internal/ui: add graphicsDriverGetter.getDirectX()

Updates #1007
This commit is contained in:
Hajime Hoshi 2022-03-25 19:43:32 +09:00
parent 08783542eb
commit 9bfbbb6e9e
8 changed files with 34 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import (
type graphicsDriverGetter interface {
getAuto() graphicsdriver.Graphics
getOpenGL() graphicsdriver.Graphics
getDirectX() graphicsdriver.Graphics
getMetal() graphicsdriver.Graphics
}
@ -41,6 +42,11 @@ func chooseGraphicsDriver(getter graphicsDriverGetter) (graphicsdriver.Graphics,
return g, nil
}
return nil, fmt.Errorf("ui: %s=%s is specified but OpenGL is not available", envName, env)
case "directx":
if g := getter.getDirectX(); g != nil {
return g, nil
}
return nil, fmt.Errorf("ui: %s=%s is specified but DirectX is not available.", envName, env)
case "metal":
if g := getter.getMetal(); g != nil {
return g, nil

View File

@ -34,6 +34,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
return nil
}

View File

@ -38,6 +38,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
return nil
}

View File

@ -248,6 +248,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
if m := metal.Get(); m != nil {
return m

View File

@ -44,6 +44,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
return nil
}

View File

@ -42,6 +42,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
return nil
}

View File

@ -41,6 +41,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (g *graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
// When gomobile-build is used, GL functions must be called via
// gl.Context so that they are called on the appropriate thread.

View File

@ -38,6 +38,10 @@ func (*graphicsDriverGetterImpl) getOpenGL() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getDirectX() graphicsdriver.Graphics {
return nil
}
func (*graphicsDriverGetterImpl) getMetal() graphicsdriver.Graphics {
return nil
}