mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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 (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphicsdriver"
|
"github.com/hajimehoshi/ebiten/internal/graphicsdriver"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal"
|
"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 {
|
// isMetalSupported represents whether Metal is supported.
|
||||||
return metal.Get()
|
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