mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
Revert "internal/graphicsdriver/metal: refactoring"
This reverts commit 1c57393393
.
Reason: nothing is rendered on iOS.
Closes #2022
This commit is contained in:
parent
7744013b05
commit
a74e7b1578
@ -349,10 +349,14 @@ const (
|
|||||||
// isMetalAvailable reports whether Metal is available or not.
|
// isMetalAvailable reports whether Metal is available or not.
|
||||||
//
|
//
|
||||||
// On old mac devices like iMac 2011, Metal is not supported (#779).
|
// On old mac devices like iMac 2011, Metal is not supported (#779).
|
||||||
//
|
var isMetalAvailable bool
|
||||||
// initializeView calls mtl.CreateSystemDefualtDevice, which works only when Metal is available.
|
|
||||||
// If there is a better way, this should be adopted.
|
func init() {
|
||||||
var isMetalAvailable = theGraphics.initializeView() == nil
|
// Initialize isMetalAvailable on the main thread.
|
||||||
|
// TODO: Is there a better way to check whether Metal is available or not?
|
||||||
|
// It seems OK to call MTLCreateSystemDefaultDevice multiple times, so this should be fine.
|
||||||
|
_, isMetalAvailable = mtl.CreateSystemDefaultDevice()
|
||||||
|
}
|
||||||
|
|
||||||
var theGraphics Graphics
|
var theGraphics Graphics
|
||||||
|
|
||||||
@ -595,10 +599,6 @@ func operationToBlendFactor(c graphicsdriver.Operation) mtl.BlendFactor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) initializeView() error {
|
|
||||||
return g.view.initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Graphics) Initialize() error {
|
func (g *Graphics) Initialize() error {
|
||||||
// Creating *State objects are expensive and reuse them whenever possible.
|
// Creating *State objects are expensive and reuse them whenever possible.
|
||||||
// See https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
|
// See https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
|
||||||
@ -615,6 +615,9 @@ func (g *Graphics) Initialize() error {
|
|||||||
g.dsss = map[stencilMode]mtl.DepthStencilState{}
|
g.dsss = map[stencilMode]mtl.DepthStencilState{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := g.view.initialize(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if g.transparent {
|
if g.transparent {
|
||||||
g.view.ml.SetOpaque(false)
|
g.view.ml.SetOpaque(false)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user