mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
graphicscommand: Use Opengl instead on early MacOSX platform which does not support Metal (#779)
This commit is contained in:
parent
6783aaae56
commit
0419aec617
@ -20,8 +20,23 @@ package graphicscommand
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/internal/graphicsdriver"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/mtl"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphicsdriver/opengl"
|
||||
)
|
||||
|
||||
func Driver() graphicsdriver.GraphicsDriver {
|
||||
return metal.Get()
|
||||
// isMetalSupported represents whether Metal is supported.
|
||||
var isMetalSupported = true
|
||||
|
||||
func init() {
|
||||
if _, err := mtl.CreateSystemDefaultDevice(); err != nil {
|
||||
isMetalSupported = false
|
||||
}
|
||||
}
|
||||
|
||||
func Driver() graphicsdriver.GraphicsDriver {
|
||||
if isMetalSupported {
|
||||
return metal.Get()
|
||||
} else {
|
||||
return opengl.Get()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user