internal/ui: simplify build tags

This commit is contained in:
Hajime Hoshi 2022-02-11 20:47:14 +09:00
parent f839b52abb
commit 76848f48e6
2 changed files with 10 additions and 6 deletions

View File

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

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build !darwin || (ios && 386) || (ios && amd64) || ebitengl //go:build !darwin || ebitengl
// +build !darwin ios,386 ios,amd64 ebitengl // +build !darwin ebitengl
package ui package ui