Skip to content

Commit 778aed9

Browse files
BrutPittocornut
authored andcommitted
Examples: GLFW+WebGPU: update to latest specs and to work on Emscripten 4.0.10+ and latest Dawn-Native, WGPU-Native. (#8381, #8567, #8191, #7435)
1 parent c5b2a84 commit 778aed9

File tree

6 files changed

+644
-259
lines changed

6 files changed

+644
-259
lines changed

docs/CHANGELOG.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ Other Changes:
9191
ImGui_ImplWGPU_GetDeviceLostReasonName(), ImGui_ImplWGPU_GetErrorTypeName(),
9292
ImGui_ImplWGPU_GetLogLevelName().
9393
- WebGPU: update to compile with Dawn and Emscripten's 4.0.10+
94-
'--use-port=emdawnwebgpu' ports. (#8381, #8898) [@brutpitt, @trbabb]
94+
'--use-port=emdawnwebgpu' ports. (#8381, #8898, #7435) [@brutpitt, @trbabb]
9595
When using Emscripten 4.0.10+, backend now defaults to IMGUI_IMPL_WEBGPU_BACKEND_DAWN
9696
instead of IMGUI_IMPL_WEBGPU_BACKEND_WGPU, if neither are specified.
9797
(note: examples application were not updated yet)
9898
- Win32: Revert 1.92.4 change of comparing dwPacketNumber, which prevents
9999
refreshing accurate gamepad info after focus-out + io.ClearInputKeys(). (#8556)
100100
- Examples:
101+
- GLFW+WebGPU: update example for latest specs, to work on Emscripten 4.0.10+,
102+
latest Dawn-Native and WGPU-Native. (#8381, #8567, #8191, #7435) [@brutpitt]
101103
- GLFW+WebGPU: removed unnecessary ImGui_ImplWGPU_InvalidateDeviceObjects() call
102104
during surface resize. (#8381)
103105

examples/example_glfw_wgpu/CMakeLists.txt

Lines changed: 174 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -6,112 +6,203 @@
66
# * build/Debug/example_glfw_wgpu[.exe]
77
# * build/example_glfw_wgpu[.exe]
88

9+
# Building for desktop (WGPU-Native) with WGPU-Native:
10+
# 1. download WGPU-Native autogenerated binary modules for your platform/compiler from: https://github.com/gfx-rs/wgpu-native/releases
11+
# 2. unzip the downloaded file in your_preferred_folder
12+
# 3. cmake -B build -DIMGUI_WGPU_DIR=your_preferred_folder ("full path" or "relative" starting from current directory)
13+
# 4. cmake --build build
14+
# The resulting binary will be found at one of the following locations:
15+
# * build/Debug/example_glfw_wgpu[.exe]
16+
# * build/example_glfw_wgpu[.exe]
17+
918
# Building for Emscripten:
1019
# 1. Install Emscripten SDK following the instructions: https://emscripten.org/docs/getting_started/downloads.html
1120
# 2. Install Ninja build system
1221
# 3. emcmake cmake -G Ninja -B build
22+
# (optional) -DIMGUI_EMSCRIPTEN_WEBGPU_FLAG="--use-port=path/to/emdawnwebgpu_package/emdawnwebgpu.port.py", see ReadMe.md
1323
# 3. cmake --build build
1424
# 4. emrun build/index.html
1525

16-
cmake_minimum_required(VERSION 3.10.2)
26+
cmake_minimum_required(VERSION 3.22) # Dawn requires CMake >= 3.22
1727
project(imgui_example_glfw_wgpu C CXX)
1828

29+
set(IMGUI_EXECUTABLE example_glfw_wgpu)
30+
1931
if(NOT CMAKE_BUILD_TYPE)
20-
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
32+
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
2133
endif()
2234

2335
set(CMAKE_CXX_STANDARD 17) # Dawn requires C++17
2436

2537
# Dear ImGui
2638
set(IMGUI_DIR ../../)
2739

28-
# Libraries
40+
set(IMGUI_EXAMPLE_SOURCE_FILES
41+
# Example code
42+
main.cpp
43+
# Dear ImGui Backend files
44+
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
45+
${IMGUI_DIR}/backends/imgui_impl_wgpu.cpp
46+
# Dear ImGui files
47+
${IMGUI_DIR}/imgui.cpp
48+
${IMGUI_DIR}/imgui_draw.cpp
49+
${IMGUI_DIR}/imgui_demo.cpp
50+
${IMGUI_DIR}/imgui_tables.cpp
51+
${IMGUI_DIR}/imgui_widgets.cpp
52+
)
53+
2954
if(EMSCRIPTEN)
30-
if(EMSCRIPTEN_VERSION VERSION_GREATER_EQUAL "3.1.57")
31-
set(IMGUI_EMSCRIPTEN_GLFW3 "--use-port=contrib.glfw3" CACHE STRING "Choose between --use-port=contrib.glfw3 and -sUSE_GLFW=3 for GLFW implementation (default to --use-port=contrib.glfw3)")
32-
else()
33-
# cannot use contrib.glfw3 prior to 3.1.57
34-
set(IMGUI_EMSCRIPTEN_GLFW3 "-sUSE_GLFW=3" CACHE STRING "Use -sUSE_GLFW=3 for GLFW implementation" FORCE)
35-
endif()
36-
set(LIBRARIES glfw)
37-
add_compile_options(-sDISABLE_EXCEPTION_CATCHING=1 -DIMGUI_DISABLE_FILE_FUNCTIONS=1 -DIMGUI_IMPL_WEBGPU_BACKEND_WGPU)
38-
else()
39-
# Dawn wgpu desktop
40-
set(DAWN_FETCH_DEPENDENCIES ON)
41-
set(IMGUI_DAWN_DIR CACHE PATH "Path to Dawn repository")
42-
if (NOT IMGUI_DAWN_DIR)
43-
message(FATAL_ERROR "Please specify the Dawn repository by setting IMGUI_DAWN_DIR")
44-
endif()
45-
46-
option(DAWN_FETCH_DEPENDENCIES "Use fetch_dawn_dependencies.py as an alternative to using depot_tools" ON)
47-
48-
# Dawn builds many things by default - disable things we don't need
49-
option(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" OFF)
50-
option(TINT_BUILD_CMD_TOOLS "Build the Tint command line tools" OFF)
51-
option(TINT_BUILD_DOCS "Build documentation" OFF)
52-
option(TINT_BUILD_TESTS "Build tests" OFF)
53-
if (NOT APPLE)
54-
option(TINT_BUILD_MSL_WRITER "Build the MSL output writer" OFF)
55-
endif()
56-
if(WIN32)
57-
option(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" OFF)
58-
option(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON)
59-
option(TINT_BUILD_GLSL_WRITER "Build the GLSL output writer" OFF)
60-
option(TINT_BUILD_GLSL_VALIDATOR "Build the GLSL output validator" OFF)
61-
option(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" OFF)
62-
option(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON)
63-
endif()
64-
65-
add_subdirectory("${IMGUI_DAWN_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/dawn" EXCLUDE_FROM_ALL)
66-
67-
set(LIBRARIES webgpu_dawn webgpu_cpp webgpu_glfw glfw)
55+
if(NOT IMGUI_EMSCRIPTEN_WEBGPU_FLAG) # if IMGUI_EMSCRIPTEN_WEBGPU_FLAG not used, set by current EMSCRIPTEN version
56+
if(EMSCRIPTEN_VERSION VERSION_GREATER_EQUAL "4.0.10")
57+
set(IMGUI_EMSCRIPTEN_WEBGPU_FLAG "--use-port=emdawnwebgpu" CACHE STRING "Choose between --use-port=emdawnwebgpu (Dawn implementation of EMSCRIPTEN) and -sUSE_WEBGPU=1 (WGPU implementation of EMSCRIPTEN, deprecated in 4.0.10): default to --use-port=emdawnwebgpu for EMSCRIPTEN >= 4.0.10")
58+
else()
59+
set(IMGUI_EMSCRIPTEN_WEBGPU_FLAG "-sUSE_WEBGPU=1" CACHE STRING "Use -sUSE_WEBGPU=1 for EMSCRIPTEN WGPU implementation")
60+
endif()
61+
else() # if IMGUI_EMSCRIPTEN_WEBGPU_FLAG used, check correct version
62+
if(EMSCRIPTEN_VERSION VERSION_LESS "4.0.10" AND "${IMGUI_EMSCRIPTEN_WEBGPU_FLAG}" MATCHES "emdawnwebgpu")
63+
# it's necessary EMSCRIPTEN >= v4.0.10 (although "--use-port=path/to/emdawnwebgpu.port.py" is supported/tested from v4.0.8)
64+
message(FATAL_ERROR "emdawnwebgpu needs EMSCRIPTEN version >= 4.0.10")
65+
endif()
66+
endif()
67+
68+
if(EMSCRIPTEN_VERSION VERSION_GREATER_EQUAL "3.1.57")
69+
set(IMGUI_EMSCRIPTEN_GLFW3 "--use-port=contrib.glfw3" CACHE STRING "Choose between --use-port=contrib.glfw3 and -sUSE_GLFW=3 for GLFW implementation (default to --use-port=contrib.glfw3)")
70+
else() # cannot use contrib.glfw3 prior to 3.1.57
71+
set(IMGUI_EMSCRIPTEN_GLFW3 "-sUSE_GLFW=3" CACHE STRING "Use -sUSE_GLFW=3 for GLFW implementation" FORCE)
72+
endif()
73+
74+
set(LIBRARIES glfw)
75+
add_compile_options(-sDISABLE_EXCEPTION_CATCHING=1 -DIMGUI_DISABLE_FILE_FUNCTIONS=1)
76+
else() # Native/Desktop build
77+
# Check DAWN/WGPU directory
78+
if(NOT IMGUI_DAWN_DIR AND NOT IMGUI_WGPU_DIR) # if it's Native/Desktop build, IMGUI_DAWN_DIR or IMGUI_WGPU_DIR must be specified
79+
message(FATAL_ERROR "Please specify the Dawn or WGPU base directory")
80+
endif()
81+
82+
if(IMGUI_DAWN_DIR AND IMGUI_WGPU_DIR) # both IMGUI_DAWN_DIR and IMGUI_WGPU_DIR cannot be set
83+
message(FATAL_ERROR "Please specify only one between Dawn / WGPU base directory")
84+
endif()
85+
86+
if(APPLE) # Add SDL2 module to get Surface, with libs and file property for MacOS build
87+
set_source_files_properties(${IMGUI_DIR}/backends/imgui_impl_wgpu.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
88+
# set(OS_LIBRARIES "-framework CoreFoundation -framework QuartzCore -framework Metal -framework MetalKit -framework Cocoa")
89+
endif()
90+
91+
if(IMGUI_DAWN_DIR) # DAWN-Native build options
92+
set(IMGUI_DAWN_DIR CACHE PATH "Path to Dawn repository")
93+
if(NOT IMGUI_DAWN_DIR)
94+
message(FATAL_ERROR "Please specify the Dawn repository by setting IMGUI_DAWN_DIR")
95+
endif()
96+
97+
option(DAWN_FETCH_DEPENDENCIES "Use fetch_dawn_dependencies.py as an alternative to using depot_tools" ON)
98+
set(DAWN_BUILD_MONOLITHIC_LIBRARY "STATIC" CACHE STRING "Build monolithic library: SHARED, STATIC, or OFF.")
99+
100+
# Dawn builds many things by default - disable things we don't need
101+
option(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" OFF)
102+
option(TINT_BUILD_CMD_TOOLS "Build the Tint command line tools" OFF)
103+
option(TINT_BUILD_DOCS "Build documentation" OFF)
104+
option(TINT_BUILD_TESTS "Build tests" OFF)
105+
if(NOT APPLE)
106+
option(TINT_BUILD_MSL_WRITER "Build the MSL output writer" OFF)
107+
endif()
108+
if(WIN32)
109+
option(DAWN_FORCE_SYSTEM_COMPONENT_LOAD "Allow system component fallback" ON)
110+
option(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" OFF)
111+
option(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON)
112+
option(TINT_BUILD_GLSL_WRITER "Build the GLSL output writer" OFF)
113+
option(TINT_BUILD_GLSL_VALIDATOR "Build the GLSL output validator" OFF)
114+
option(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" ON)
115+
option(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON)
116+
endif()
117+
# check if WAYLAND is the current Session Type and enable DAWN_USE_WAYLAND Wayland option @compile time
118+
# You can override this using: cmake -DDAWN_USE_WAYLAND=X (X = ON | OFF)
119+
if(LINUX)
120+
if($ENV{XDG_SESSION_TYPE} MATCHES wayland)
121+
option(DAWN_USE_WAYLAND "Enable support for Wayland surface" ON)
122+
endif()
123+
endif()
124+
125+
add_subdirectory("${IMGUI_DAWN_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/dawn" EXCLUDE_FROM_ALL)
126+
127+
set(LIBRARIES webgpu_dawn webgpu_glfw glfw)
128+
else() # WGPU-Native build options
129+
find_package(glfw3 CONFIG)
130+
131+
set(WGPU_NATIVE_LIB_DIR ${IMGUI_WGPU_DIR}/lib)
132+
find_library(WGPU_LIBRARY NAMES libwgpu_native.a wgpu_native.lib wgpu_native HINTS ${WGPU_NATIVE_LIB_DIR} REQUIRED)
133+
if(WIN32)
134+
set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32 Propsys RuntimeObject)
135+
elseif(UNIX AND NOT APPLE)
136+
set(OS_LIBRARIES "-lm -ldl")
137+
elseif(APPLE)
138+
set(OS_LIBRARIES "-framework CoreFoundation -framework QuartzCore -framework Metal -framework MetalKit -framework Cocoa")
139+
endif()
140+
141+
set(LIBRARIES glfw ${WGPU_LIBRARY} ${OS_LIBRARIES})
142+
endif()
68143
endif()
69144

70-
add_executable(example_glfw_wgpu
71-
main.cpp
72-
# backend files
73-
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
74-
${IMGUI_DIR}/backends/imgui_impl_wgpu.cpp
75-
# Dear ImGui files
76-
${IMGUI_DIR}/imgui.cpp
77-
${IMGUI_DIR}/imgui_draw.cpp
78-
${IMGUI_DIR}/imgui_demo.cpp
79-
${IMGUI_DIR}/imgui_tables.cpp
80-
${IMGUI_DIR}/imgui_widgets.cpp
145+
add_executable(${IMGUI_EXECUTABLE} ${IMGUI_EXAMPLE_SOURCE_FILES})
146+
147+
target_include_directories(${IMGUI_EXECUTABLE} PUBLIC
148+
${IMGUI_DIR}
149+
${IMGUI_DIR}/backends
81150
)
82-
IF(NOT EMSCRIPTEN)
83-
target_compile_definitions(example_glfw_wgpu PUBLIC
84-
"IMGUI_IMPL_WEBGPU_BACKEND_DAWN"
85-
)
151+
152+
target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_EXAMPLE_GLFW_WGPU")
153+
154+
# compiler option only for IMGUI_EXAMPLE_SOURCE_FILES
155+
if (MSVC)
156+
target_compile_options(${IMGUI_EXECUTABLE} PUBLIC /W4) # warning level 4
157+
else()
158+
target_compile_options(${IMGUI_EXECUTABLE} PUBLIC -Wall) # -Wextra -Wpedantic
86159
endif()
87-
target_include_directories(example_glfw_wgpu PUBLIC
88-
${IMGUI_DIR}
89-
${IMGUI_DIR}/backends
90-
)
91160

92-
target_link_libraries(example_glfw_wgpu PUBLIC ${LIBRARIES})
161+
# In this example IMGUI_IMPL_WEBGPU_BACKEND_DAWN / IMGUI_IMPL_WEBGPU_BACKEND_WGPU internal define is set according to:
162+
# EMSCRIPTEN: by used FLAG
163+
# --use-port=emdawnwebgpu --> IMGUI_IMPL_WEBGPU_BACKEND_DAWN defined
164+
# -sUSE_WEBGPU=1 --> IMGUI_IMPL_WEBGPU_BACKEND_WGPU defined
165+
# NATIVE: by used SDK installation directory
166+
# if IMGUI_DAWN_DIR is valid --> IMGUI_IMPL_WEBGPU_BACKEND_DAWN defined
167+
# if IMGUI_WGPU_DIR is valid --> IMGUI_IMPL_WEBGPU_BACKEND_WGPU defined
93168

94-
# Emscripten settings
95-
if(EMSCRIPTEN)
96-
if("${IMGUI_EMSCRIPTEN_GLFW3}" STREQUAL "--use-port=contrib.glfw3")
97-
target_compile_options(example_glfw_wgpu PUBLIC
98-
"${IMGUI_EMSCRIPTEN_GLFW3}"
169+
if(NOT EMSCRIPTEN) # WegGPU-Native settings
170+
# Set IMGUI_IMPL_WEBGPU_BACKEND_XXXX based on the SDK (directory) used
171+
if(IMGUI_DAWN_DIR)
172+
target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_DAWN")
173+
else()
174+
target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_WGPU")
175+
target_include_directories(${IMGUI_EXECUTABLE} PUBLIC ${IMGUI_WGPU_DIR}/include)
176+
endif()
177+
178+
target_link_libraries(${IMGUI_EXECUTABLE} INTERFACE webgpu_cpp PUBLIC ${LIBRARIES})
179+
else() # Emscripten settings
180+
set(CMAKE_EXECUTABLE_SUFFIX ".html")
181+
182+
if("${IMGUI_EMSCRIPTEN_GLFW3}" STREQUAL "--use-port=contrib.glfw3")
183+
target_compile_options(${IMGUI_EXECUTABLE} PUBLIC "${IMGUI_EMSCRIPTEN_GLFW3}")
184+
endif()
185+
message(STATUS "Using ${IMGUI_EMSCRIPTEN_GLFW3} GLFW implementation")
186+
187+
if("${IMGUI_EMSCRIPTEN_WEBGPU_FLAG}" MATCHES "emdawnwebgpu")
188+
target_compile_options(${IMGUI_EXECUTABLE} PUBLIC "${IMGUI_EMSCRIPTEN_WEBGPU_FLAG}")
189+
target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_DAWN")
190+
else()
191+
target_compile_definitions(${IMGUI_EXECUTABLE} PUBLIC "IMGUI_IMPL_WEBGPU_BACKEND_WGPU")
192+
endif()
193+
message(STATUS "Using ${IMGUI_EMSCRIPTEN_WEBGPU_FLAG} WebGPU implementation")
194+
195+
target_link_options(${IMGUI_EXECUTABLE} PRIVATE
196+
"${IMGUI_EMSCRIPTEN_WEBGPU_FLAG}"
197+
"${IMGUI_EMSCRIPTEN_GLFW3}"
198+
"-sWASM=1"
199+
"-sASYNCIFY=1"
200+
"-sALLOW_MEMORY_GROWTH=1"
201+
"-sNO_EXIT_RUNTIME=0"
202+
"-sASSERTIONS=1"
203+
"-sDISABLE_EXCEPTION_CATCHING=1"
204+
"-sNO_FILESYSTEM=1"
205+
"--shell-file=${CMAKE_CURRENT_LIST_DIR}/../libs/emscripten/shell_minimal.html"
99206
)
100-
endif()
101-
message(STATUS "Using ${IMGUI_EMSCRIPTEN_GLFW3} GLFW implementation")
102-
target_link_options(example_glfw_wgpu PRIVATE
103-
"-sUSE_WEBGPU=1"
104-
"${IMGUI_EMSCRIPTEN_GLFW3}"
105-
"-sWASM=1"
106-
"-sALLOW_MEMORY_GROWTH=1"
107-
"-sNO_EXIT_RUNTIME=0"
108-
"-sASSERTIONS=1"
109-
"-sDISABLE_EXCEPTION_CATCHING=1"
110-
"-sNO_FILESYSTEM=1"
111-
)
112-
set_target_properties(example_glfw_wgpu PROPERTIES OUTPUT_NAME "index")
113-
# copy our custom index.html to build directory
114-
add_custom_command(TARGET example_glfw_wgpu POST_BUILD
115-
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/web/index.html" $<TARGET_FILE_DIR:example_glfw_wgpu>
116-
)
207+
set_target_properties(${IMGUI_EXECUTABLE} PROPERTIES OUTPUT_NAME "index")
117208
endif()

examples/example_glfw_wgpu/Makefile.emscripten

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# This Makefile assumes you have loaded emscripten's environment.
77
# (On Windows, you may need to execute emsdk_env.bat or encmdprompt.bat ahead)
88
#
9-
# Running `make` will produce three files:
10-
# - web/index.html (current stored in the repository)
9+
# Running `make -f Makefile.emscripten` will produce three files:
10+
# - web/index.html
1111
# - web/index.js
1212
# - web/index.wasm
1313
#
@@ -16,7 +16,7 @@
1616
CC = emcc
1717
CXX = em++
1818
WEB_DIR = web
19-
EXE = $(WEB_DIR)/index.js
19+
EXE = $(WEB_DIR)/index.html
2020
IMGUI_DIR = ../..
2121
SOURCES = main.cpp
2222
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp
@@ -34,15 +34,19 @@ EMS =
3434
# ("EMS" options gets added to both CPPFLAGS and LDFLAGS, whereas some options are for linker only)
3535
# Note: For glfw, we use emscripten-glfw port (contrib.glfw3) instead of (-s USE_GLFW=3) to get a better support for High DPI displays.
3636
EMS += -s DISABLE_EXCEPTION_CATCHING=1 --use-port=contrib.glfw3
37-
LDFLAGS += -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s ASSERTIONS=1
37+
LDFLAGS += -s WASM=1
38+
LDFLAGS += -s ALLOW_MEMORY_GROWTH=1
39+
LDFLAGS += -s ASYNCIFY=1
40+
LDFLAGS += -s NO_EXIT_RUNTIME=0
41+
LDFLAGS += -s ASSERTIONS=1
3842

3943
# (1) Using legacy WebGPU implementation (Emscripten < 4.0.10)
40-
EMS += -DIMGUI_IMPL_WEBGPU_BACKEND_WGPU
41-
LDFLAGS += -s USE_WEBGPU=1
44+
#EMS += -DIMGUI_IMPL_WEBGPU_BACKEND_WGPU
45+
#LDFLAGS += -s USE_WEBGPU=1
4246

43-
# or (2) Using newer Dawn-based WebGPU port (Emscripten >= 4.0.10) (UNSUPPORTED YET)
44-
#EMS += --use-port=emdawnwebgpu
45-
#LDFLAGS += --use-port=emdawnwebgpu
47+
# or (2) Using newer Dawn-based WebGPU port (Emscripten >= 4.0.10)
48+
EMS += --use-port=emdawnwebgpu
49+
LDFLAGS += --use-port=emdawnwebgpu
4650

4751
# Build as single file (binary text encoded in .html file)
4852
#LDFLAGS += -sSINGLE_FILE
@@ -67,7 +71,7 @@ endif
6771
CPPFLAGS += -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
6872
#CPPFLAGS += -g
6973
CPPFLAGS += -Wall -Wformat -Os $(EMS)
70-
#LDFLAGS += --shell-file shell_minimal.html
74+
LDFLAGS += --shell-file ../libs/emscripten/shell_minimal.html
7175
LDFLAGS += $(EMS)
7276

7377
##---------------------------------------------------------------------

0 commit comments

Comments
 (0)