99 * https://github.com/gfx-rs/wgpu-native/blob/master/examples/triangle/main.c
1010 *
1111 * MIT License
12- * Copyright (c) 2022-2024 Elie Michel and the wgpu-native authors
12+ * Copyright (c) 2022-2025 Elie Michel and the wgpu-native authors
1313 *
1414 * Permission is hereby granted, free of charge, to any person obtaining a copy
1515 * of this software and associated documentation files (the "Software"), to deal
@@ -78,20 +78,15 @@ WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* windo
7878 Display * x11_display = glfwGetX11Display ();
7979 Window x11_window = glfwGetX11Window (window );
8080
81- # ifdef WEBGPU_BACKEND_DAWN
8281 WGPUSurfaceSourceXlibWindow fromXlibWindow ;
8382 fromXlibWindow .chain .sType = WGPUSType_SurfaceSourceXlibWindow ;
84- # else
85- WGPUSurfaceDescriptorFromXlibWindow fromXlibWindow ;
86- fromXlibWindow .chain .sType = WGPUSType_SurfaceDescriptorFromXlibWindow ;
87- # endif
8883 fromXlibWindow .chain .next = NULL ;
8984 fromXlibWindow .display = x11_display ;
9085 fromXlibWindow .window = x11_window ;
9186
9287 WGPUSurfaceDescriptor surfaceDescriptor ;
9388 surfaceDescriptor .nextInChain = & fromXlibWindow .chain ;
94- surfaceDescriptor .label = NULL ;
89+ surfaceDescriptor .label = NULL ; // NOTE FROM ANDRE: This used to be (WGPUStringView){ NULL, WGPU_STRLEN };
9590
9691 return wgpuInstanceCreateSurface (instance , & surfaceDescriptor );
9792 }
@@ -102,20 +97,15 @@ WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* windo
10297 struct wl_display * wayland_display = glfwGetWaylandDisplay ();
10398 struct wl_surface * wayland_surface = glfwGetWaylandWindow (window );
10499
105- # ifdef WEBGPU_BACKEND_DAWN
106100 WGPUSurfaceSourceWaylandSurface fromWaylandSurface ;
107101 fromWaylandSurface .chain .sType = WGPUSType_SurfaceSourceWaylandSurface ;
108- # else
109- WGPUSurfaceDescriptorFromWaylandSurface fromWaylandSurface ;
110- fromWaylandSurface .chain .sType = WGPUSType_SurfaceDescriptorFromWaylandSurface ;
111- # endif
112102 fromWaylandSurface .chain .next = NULL ;
113103 fromWaylandSurface .display = wayland_display ;
114104 fromWaylandSurface .surface = wayland_surface ;
115105
116106 WGPUSurfaceDescriptor surfaceDescriptor ;
117107 surfaceDescriptor .nextInChain = & fromWaylandSurface .chain ;
118- surfaceDescriptor .label = NULL ;
108+ surfaceDescriptor .label = NULL ; // NOTE FROM ANDRE: This used to be (WGPUStringView){ NULL, WGPU_STRLEN };
119109
120110 return wgpuInstanceCreateSurface (instance , & surfaceDescriptor );
121111 }
@@ -128,19 +118,14 @@ WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* windo
128118 [ns_window .contentView setWantsLayer : YES ] ;
129119 [ns_window .contentView setLayer : metal_layer ] ;
130120
131- # ifdef WEBGPU_BACKEND_DAWN
132121 WGPUSurfaceSourceMetalLayer fromMetalLayer ;
133122 fromMetalLayer .chain .sType = WGPUSType_SurfaceSourceMetalLayer ;
134- # else
135- WGPUSurfaceDescriptorFromMetalLayer fromMetalLayer ;
136- fromMetalLayer .chain .sType = WGPUSType_SurfaceDescriptorFromMetalLayer ;
137- # endif
138123 fromMetalLayer .chain .next = NULL ;
139124 fromMetalLayer .layer = metal_layer ;
140125
141126 WGPUSurfaceDescriptor surfaceDescriptor ;
142127 surfaceDescriptor .nextInChain = & fromMetalLayer .chain ;
143- surfaceDescriptor .label = NULL ;
128+ surfaceDescriptor .label = NULL ; // NOTE FROM ANDRE: This used to be (WGPUStringView){ NULL, WGPU_STRLEN };
144129
145130 return wgpuInstanceCreateSurface (instance , & surfaceDescriptor );
146131 }
@@ -151,30 +136,25 @@ WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* windo
151136 HWND hwnd = glfwGetWin32Window (window );
152137 HINSTANCE hinstance = GetModuleHandle (NULL );
153138
154- # ifdef WEBGPU_BACKEND_DAWN
155139 WGPUSurfaceSourceWindowsHWND fromWindowsHWND ;
156140 fromWindowsHWND .chain .sType = WGPUSType_SurfaceSourceWindowsHWND ;
157- # else
158- WGPUSurfaceDescriptorFromWindowsHWND fromWindowsHWND ;
159- fromWindowsHWND .chain .sType = WGPUSType_SurfaceDescriptorFromWindowsHWND ;
160- # endif
161141 fromWindowsHWND .chain .next = NULL ;
162142 fromWindowsHWND .hinstance = hinstance ;
163143 fromWindowsHWND .hwnd = hwnd ;
164144
165145 WGPUSurfaceDescriptor surfaceDescriptor ;
166146 surfaceDescriptor .nextInChain = & fromWindowsHWND .chain ;
167- surfaceDescriptor .label = NULL ;
147+ surfaceDescriptor .label = NULL ; // NOTE FROM ANDRE: This used to be (WGPUStringView){ NULL, WGPU_STRLEN };
168148
169149 return wgpuInstanceCreateSurface (instance , & surfaceDescriptor );
170150 }
171- #endif // GLFW_EXPOSE_NATIVE_X11
151+ #endif // GLFW_EXPOSE_NATIVE_WIN32
172152
173153#ifdef GLFW_EXPOSE_NATIVE_EMSCRIPTEN
174154 case GLFW_PLATFORM_EMSCRIPTEN : {
175- # ifdef WEBGPU_BACKEND_DAWN
176- WGPUSurfaceSourceCanvasHTMLSelector_Emscripten fromCanvasHTMLSelector ;
177- fromCanvasHTMLSelector .chain .sType = WGPUSType_SurfaceSourceCanvasHTMLSelector_Emscripten ;
155+ # ifdef WEBGPU_BACKEND_EMDAWNWEBGPU
156+ WGPUEmscriptenSurfaceSourceCanvasHTMLSelector fromCanvasHTMLSelector ;
157+ fromCanvasHTMLSelector .chain .sType = WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector ;
178158# else
179159 WGPUSurfaceDescriptorFromCanvasHTMLSelector fromCanvasHTMLSelector ;
180160 fromCanvasHTMLSelector .chain .sType = WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector ;
@@ -188,7 +168,7 @@ WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* windo
188168
189169 return wgpuInstanceCreateSurface (instance , & surfaceDescriptor );
190170 }
191- #endif // GLFW_EXPOSE_NATIVE_X11
171+ #endif // GLFW_EXPOSE_NATIVE_EMSCRIPTEN
192172
193173 default :
194174 // Unsupported platform
0 commit comments