Skip to content

Commit

Permalink
Upgrade STypes for newest Dawn
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Sep 24, 2024
1 parent e84ae83 commit 7adcb12
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ FetchContent_Declare(
)
FetchContent_Declare(
webgpu
GIT_REPOSITORY https://github.com/eliemichel/WebGPU-binaries.git
GIT_TAG main
GIT_REPOSITORY https://github.com/eliemichel/WebGPU-distribution.git
GIT_TAG 7ed61fb96d972a4c61ccc79af1139eba2a0ce4c4 # fetch
)
FetchContent_MakeAvailable(glfw-light webgpu)

Expand Down
20 changes: 20 additions & 0 deletions glfw3webgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window) {

WGPUSurfaceDescriptorFromXlibWindow fromXlibWindow;
fromXlibWindow.chain.next = NULL;
# ifdef WEBGPU_BACKEND_DAWN
fromXlibWindow.chain.sType = WGPUSType_SurfaceSourceXlibWindow;
# else
fromXlibWindow.chain.sType = WGPUSType_SurfaceDescriptorFromXlibWindow;
# endif
fromXlibWindow.display = x11_display;
fromXlibWindow.window = x11_window;

Expand All @@ -91,7 +95,11 @@ WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window) {

WGPUSurfaceDescriptorFromWaylandSurface fromWaylandSurface;
fromWaylandSurface.chain.next = NULL;
# ifdef WEBGPU_BACKEND_DAWN
fromWaylandSurface.chain.sType = WGPUSType_SurfaceSourceWaylandSurface;
# else
fromWaylandSurface.chain.sType = WGPUSType_SurfaceDescriptorFromWaylandSurface;
# endif
fromWaylandSurface.display = wayland_display;
fromWaylandSurface.surface = wayland_surface;

Expand All @@ -112,7 +120,11 @@ WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window) {

WGPUSurfaceDescriptorFromMetalLayer fromMetalLayer;
fromMetalLayer.chain.next = NULL;
# ifdef WEBGPU_BACKEND_DAWN
fromMetalLayer.chain.sType = WGPUSType_SurfaceSourceMetalLayer;
# else
fromMetalLayer.chain.sType = WGPUSType_SurfaceDescriptorFromMetalLayer;
# endif
fromMetalLayer.layer = metal_layer;

WGPUSurfaceDescriptor surfaceDescriptor;
Expand All @@ -130,7 +142,11 @@ WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window) {

WGPUSurfaceDescriptorFromWindowsHWND fromWindowsHWND;
fromWindowsHWND.chain.next = NULL;
# ifdef WEBGPU_BACKEND_DAWN
fromWindowsHWND.chain.sType = WGPUSType_SurfaceSourceWindowsHWND;
# else
fromWindowsHWND.chain.sType = WGPUSType_SurfaceDescriptorFromWindowsHWND;
# endif
fromWindowsHWND.hinstance = hinstance;
fromWindowsHWND.hwnd = hwnd;

Expand All @@ -146,7 +162,11 @@ WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window) {
case GLFW_PLATFORM_EMSCRIPTEN: {
WGPUSurfaceDescriptorFromCanvasHTMLSelector fromCanvasHTMLSelector;
fromCanvasHTMLSelector.chain.next = NULL;
# ifdef WEBGPU_BACKEND_DAWN
fromCanvasHTMLSelector.chain.sType = WGPUSType_SurfaceSourceCanvasHTMLSelector_Emscripten;
# else
fromCanvasHTMLSelector.chain.sType = WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector;
# endif
fromCanvasHTMLSelector.selector = "canvas";

WGPUSurfaceDescriptor surfaceDescriptor;
Expand Down

0 comments on commit 7adcb12

Please sign in to comment.