|
@@ -3,11 +3,8 @@ package wgpu_glfw_glue
|
|
import "vendor:glfw"
|
|
import "vendor:glfw"
|
|
import "vendor:wgpu"
|
|
import "vendor:wgpu"
|
|
|
|
|
|
-// GLFW needs to be compiled with wayland support for this to work.
|
|
|
|
-SUPPORT_WAYLAND :: #config(WGPU_GFLW_GLUE_SUPPORT_WAYLAND, false)
|
|
|
|
-
|
|
|
|
GetSurface :: proc(instance: wgpu.Instance, window: glfw.WindowHandle) -> wgpu.Surface {
|
|
GetSurface :: proc(instance: wgpu.Instance, window: glfw.WindowHandle) -> wgpu.Surface {
|
|
- when SUPPORT_WAYLAND {
|
|
|
|
|
|
+ if glfw.GetPlatform != nil {
|
|
if glfw.GetPlatform() == glfw.PLATFORM_WAYLAND {
|
|
if glfw.GetPlatform() == glfw.PLATFORM_WAYLAND {
|
|
display := glfw.GetWaylandDisplay()
|
|
display := glfw.GetWaylandDisplay()
|
|
surface := glfw.GetWaylandWindow(window)
|
|
surface := glfw.GetWaylandWindow(window)
|
|
@@ -24,6 +21,10 @@ GetSurface :: proc(instance: wgpu.Instance, window: glfw.WindowHandle) -> wgpu.S
|
|
},
|
|
},
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if glfw.GetPlatform() != glfw.PLATFORM_X11 {
|
|
|
|
+ panic("wgpu glfw glue: unsupported platform, expected Wayland or X11")
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
display := glfw.GetX11Display()
|
|
display := glfw.GetX11Display()
|