Skip to content

Commit c72a685

Browse files
authored
update supporting libraries (#16)
* update glfw-webgpu * update emscripten in github actions
1 parent db13bc7 commit c72a685

File tree

4 files changed

+16
-39
lines changed

4 files changed

+16
-39
lines changed

.github/workflows/release.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
submodules: recursive
125125

126126
- name: Setup Emscripten
127-
uses: mymindstorm/setup-emsdk@v11
127+
uses: mymindstorm/setup-emsdk@v14
128128

129129
- name: Install dependencies
130130
run: |
@@ -155,10 +155,9 @@ jobs:
155155
if: github.event_name == 'release'
156156
uses: actions/upload-pages-artifact@v3
157157
with:
158-
path: './web_build'
158+
path: "./web_build"
159159

160160
- name: Deploy to GitHub Pages
161161
id: deployment
162162
if: github.event_name == 'release'
163163
uses: actions/deploy-pages@v4
164-

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"cfenv": "cpp",
9494
"regex": "cpp",
9595
"valarray": "cpp",
96-
"*.inc": "cpp"
96+
"*.inc": "cpp",
97+
"glfw3.h": "c"
9798
},
9899
"files.exclude": {
99100
"build": true,

OpenGL/vendor/glfw3webgpu/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ add_library(glfw3webgpu STATIC glfw3webgpu.c)
77
target_include_directories(glfw3webgpu PUBLIC .)
88
target_link_libraries(glfw3webgpu PUBLIC glfw webgpu)
99

10-
if (APPLE)
11-
target_compile_options(glfw3webgpu PRIVATE -x objective-c)
12-
target_link_libraries(glfw3webgpu PRIVATE "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
13-
endif ()
14-
1510
# Copy compile definitions that are PRIVATE in glfw
1611
if (GLFW_BUILD_COCOA)
1712
target_compile_definitions(glfw3webgpu PRIVATE _GLFW_COCOA)
13+
target_compile_options(glfw3webgpu PRIVATE -x objective-c)
14+
target_link_libraries(glfw3webgpu PRIVATE "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
1815
endif()
1916
if (GLFW_BUILD_WIN32)
2017
target_compile_definitions(glfw3webgpu PRIVATE _GLFW_WIN32)

OpenGL/vendor/glfw3webgpu/glfw3webgpu.c

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
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

Comments
 (0)