diff --git a/internal/ui/graphics_ios.go b/internal/ui/graphics_ios.go index d59b8bfdc..0790de038 100644 --- a/internal/ui/graphics_ios.go +++ b/internal/ui/graphics_ios.go @@ -12,22 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build ((ios && arm) || (ios && arm64)) && !ebitengl && !ebitencbackend -// +build ios,arm ios,arm64 -// +build !ebitengl -// +build !ebitencbackend +//go:build ios && !ebitengl && !ebitencbackend +// +build ios,!ebitengl,!ebitencbackend package ui import ( "fmt" + "runtime" "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver" "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal" "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/metal/mtl" + "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl" ) func Graphics() graphicsdriver.Graphics { + if runtime.GOARCH == "386" || runtime.GOARCH == "amd64" { + return opengl.Get() + } + if _, err := mtl.CreateSystemDefaultDevice(); err != nil { panic(fmt.Sprintf("mobile: mtl.CreateSystemDefaultDevice failed on iOS: %v", err)) } diff --git a/internal/ui/graphics_opengl.go b/internal/ui/graphics_opengl.go index aef1b21df..5ae629dcf 100644 --- a/internal/ui/graphics_opengl.go +++ b/internal/ui/graphics_opengl.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !darwin || (ios && 386) || (ios && amd64) || ebitengl -// +build !darwin ios,386 ios,amd64 ebitengl +//go:build !darwin || ebitengl +// +build !darwin ebitengl package ui