From 9bfbbb6e9e360f66215ecf2ee64af620cb6e2931 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 25 Mar 2022 19:43:32 +0900 Subject: [PATCH] internal/ui: add graphicsDriverGetter.getDirectX() Updates #1007 --- internal/ui/graphics.go | 6 ++++++ internal/ui/ui_android.go | 4 ++++ internal/ui/ui_cbackend.go | 4 ++++ internal/ui/ui_glfw_darwin.go | 4 ++++ internal/ui/ui_glfw_unix.go | 4 ++++ internal/ui/ui_glfw_windows.go | 4 ++++ internal/ui/ui_ios.go | 4 ++++ internal/ui/ui_js.go | 4 ++++ 8 files changed, 34 insertions(+) diff --git a/internal/ui/graphics.go b/internal/ui/graphics.go index 2ea50dddb..839f52b6a 100644 --- a/internal/ui/graphics.go +++ b/internal/ui/graphics.go @@ -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 diff --git a/internal/ui/ui_android.go b/internal/ui/ui_android.go index 88ef6264e..f855474c4 100644 --- a/internal/ui/ui_android.go +++ b/internal/ui/ui_android.go @@ -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 } diff --git a/internal/ui/ui_cbackend.go b/internal/ui/ui_cbackend.go index af7eefa3f..8dbe3c784 100644 --- a/internal/ui/ui_cbackend.go +++ b/internal/ui/ui_cbackend.go @@ -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 } diff --git a/internal/ui/ui_glfw_darwin.go b/internal/ui/ui_glfw_darwin.go index 18f4b322b..11e40bbc5 100644 --- a/internal/ui/ui_glfw_darwin.go +++ b/internal/ui/ui_glfw_darwin.go @@ -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 diff --git a/internal/ui/ui_glfw_unix.go b/internal/ui/ui_glfw_unix.go index 701b18b97..ba915f010 100644 --- a/internal/ui/ui_glfw_unix.go +++ b/internal/ui/ui_glfw_unix.go @@ -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 } diff --git a/internal/ui/ui_glfw_windows.go b/internal/ui/ui_glfw_windows.go index 5e71d871d..8d0743e94 100644 --- a/internal/ui/ui_glfw_windows.go +++ b/internal/ui/ui_glfw_windows.go @@ -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 } diff --git a/internal/ui/ui_ios.go b/internal/ui/ui_ios.go index c0a4c9eed..adf1d560e 100644 --- a/internal/ui/ui_ios.go +++ b/internal/ui/ui_ios.go @@ -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. diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index 01a700c6b..33d0734c7 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -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 }