From 3a0af510acb0ff8415e5ab38da186bf476afeaf1 Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Tue, 12 May 2026 09:52:29 +0200 Subject: [PATCH 1/3] use same build tags as proposed for glfw in wgpuglfw --- wgpuglfw/surface_linux_wayland.go | 2 +- wgpuglfw/surface_linux_x11.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpuglfw/surface_linux_wayland.go b/wgpuglfw/surface_linux_wayland.go index 7ebdfb0..14bb240 100644 --- a/wgpuglfw/surface_linux_wayland.go +++ b/wgpuglfw/surface_linux_wayland.go @@ -1,4 +1,4 @@ -//go:build (linux || freebsd || netbsd || openbsd) && !android && !x11 && wayland +//go:build (linux || freebsd || netbsd || openbsd) && !android && ((!x11 && !wayland) || wayland) package wgpuglfw diff --git a/wgpuglfw/surface_linux_x11.go b/wgpuglfw/surface_linux_x11.go index e001de9..9138feb 100644 --- a/wgpuglfw/surface_linux_x11.go +++ b/wgpuglfw/surface_linux_x11.go @@ -1,4 +1,4 @@ -//go:build (linux || freebsd || netbsd || openbsd) && !android && x11 && !wayland +//go:build (linux || freebsd || netbsd || openbsd) && !android && ((!x11 && !wayland) || x11) package wgpuglfw From 64d494aa44091280a912c9ab63c5adc77b43494a Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Tue, 12 May 2026 09:54:55 +0200 Subject: [PATCH 2/3] fix panic message --- wgpuglfw/surface_linux_wayland.go | 2 +- wgpuglfw/surface_linux_x11.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpuglfw/surface_linux_wayland.go b/wgpuglfw/surface_linux_wayland.go index 14bb240..b8ad757 100644 --- a/wgpuglfw/surface_linux_wayland.go +++ b/wgpuglfw/surface_linux_wayland.go @@ -21,6 +21,6 @@ func GetSurfaceDescriptor(w *glfw.Window) *wgpu.SurfaceDescriptor { } default: - panic("Unsupported glfw platform. To support both x11 and wayland, build with --tags wayland,x11") + panic("Unsupported glfw platform. Build with no tags to support both x11 and wayland.") } } diff --git a/wgpuglfw/surface_linux_x11.go b/wgpuglfw/surface_linux_x11.go index 9138feb..9ec34a9 100644 --- a/wgpuglfw/surface_linux_x11.go +++ b/wgpuglfw/surface_linux_x11.go @@ -21,6 +21,6 @@ func GetSurfaceDescriptor(w *glfw.Window) *wgpu.SurfaceDescriptor { } default: - panic("Unsupported glfw platform. To support both x11 and wayland, build with --tags wayland,x11") + panic("Unsupported glfw platform. Build with no tags to support both x11 and wayland.") } } From 516b12c214bf14b8e9d7af00e720371fc435a2fb Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Tue, 12 May 2026 10:02:33 +0200 Subject: [PATCH 3/3] only support tagless build that supports either x11 or wayland --- wgpuglfw/surface_linux.go | 2 +- wgpuglfw/surface_linux_wayland.go | 26 -------------------------- wgpuglfw/surface_linux_x11.go | 26 -------------------------- 3 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 wgpuglfw/surface_linux_wayland.go delete mode 100644 wgpuglfw/surface_linux_x11.go diff --git a/wgpuglfw/surface_linux.go b/wgpuglfw/surface_linux.go index 69c9a93..f16db7a 100644 --- a/wgpuglfw/surface_linux.go +++ b/wgpuglfw/surface_linux.go @@ -1,4 +1,4 @@ -//go:build (linux || freebsd || netbsd || openbsd) && !android && ((!x11 && !wayland) || (x11 && wayland)) +//go:build (linux || freebsd || netbsd || openbsd) && !android package wgpuglfw diff --git a/wgpuglfw/surface_linux_wayland.go b/wgpuglfw/surface_linux_wayland.go deleted file mode 100644 index b8ad757..0000000 --- a/wgpuglfw/surface_linux_wayland.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build (linux || freebsd || netbsd || openbsd) && !android && ((!x11 && !wayland) || wayland) - -package wgpuglfw - -import ( - "unsafe" - - "github.com/go-gl/glfw/v3.4/glfw" - "github.com/oliverbestmann/webgpu/wgpu" -) - -func GetSurfaceDescriptor(w *glfw.Window) *wgpu.SurfaceDescriptor { - switch glfw.GetPlatform() { - - case glfw.PlatformWayland: - return &wgpu.SurfaceDescriptor{ - WaylandSurface: &wgpu.SurfaceSourceWaylandSurface{ - Display: unsafe.Pointer(glfw.GetWaylandDisplay()), - Surface: unsafe.Pointer(w.GetWaylandWindow()), - }, - } - - default: - panic("Unsupported glfw platform. Build with no tags to support both x11 and wayland.") - } -} diff --git a/wgpuglfw/surface_linux_x11.go b/wgpuglfw/surface_linux_x11.go deleted file mode 100644 index 9ec34a9..0000000 --- a/wgpuglfw/surface_linux_x11.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build (linux || freebsd || netbsd || openbsd) && !android && ((!x11 && !wayland) || x11) - -package wgpuglfw - -import ( - "unsafe" - - "github.com/go-gl/glfw/v3.4/glfw" - "github.com/oliverbestmann/webgpu/wgpu" -) - -func GetSurfaceDescriptor(w *glfw.Window) *wgpu.SurfaceDescriptor { - switch glfw.GetPlatform() { - - case glfw.PlatformX11: - return &wgpu.SurfaceDescriptor{ - XlibWindow: &wgpu.SurfaceSourceXlibWindow{ - Display: unsafe.Pointer(glfw.GetX11Display()), - Window: uint32(w.GetX11Window()), - }, - } - - default: - panic("Unsupported glfw platform. Build with no tags to support both x11 and wayland.") - } -}