@@ -206,6 +206,7 @@ set(SDL_STATIC_AVAILABLE ON)
206206# All these *_DEFAULT vars will default to ON if not specified,
207207# so you only need to override them if they need to be disabled.
208208if (EMSCRIPTEN)
209+
209210 # Set up default values for the currently supported set of subsystems:
210211 # Emscripten/Javascript does not have assembly support, a dynamic library
211212 # loading architecture, or low-level CPU inspection.
@@ -365,8 +366,10 @@ dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SD
365366dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE} " OFF )
366367dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF )
367368dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS} ;SDL_CPU_ARM32" OFF )
369+ dep_option(SDL_WEBGPU "Enable WebGPU support" ON "SDL_RENDER;${EMSCRIPTEN} " OFF )
368370dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF )
369371dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF )
372+ dep_option(SDL_RENDER_WEBGPU "Enable the WebGPU render driver" ON "SDL_RENDER;SDL_WEBGPU" OFF )
370373dep_option(SDL_METAL "Enable Metal support" ON "APPLE" OFF )
371374set_option(SDL_OPENVR "Use OpenVR video driver" OFF )
372375dep_option(SDL_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS} "SDL_VIDEO" OFF )
@@ -1535,14 +1538,19 @@ elseif(EMSCRIPTEN)
15351538 set (SDL_VIDEO_DRIVER_EMSCRIPTEN 1)
15361539 sdl_glob_sources("${SDL3_SOURCE_DIR} /src/video/emscripten/*.c" )
15371540 set (HAVE_SDL_VIDEO TRUE )
1538-
1539- #enable gles
1540- if (SDL_OPENGLES)
1541- set (SDL_VIDEO_OPENGL_EGL 1)
1542- set (HAVE_OPENGLES TRUE )
1543- set (SDL_VIDEO_OPENGL_ES2 1)
1544- set (SDL_VIDEO_RENDER_OGL_ES2 1)
1541+ if (SDL_GPU)
1542+ set (SDL_WEBGPU ON )
1543+ set (SDL_RENDER_WEBGPU ON )
1544+ set (HAVE_WEBGPU TRUE )
1545+ set (HAVE_RENDER_WEBGPU TRUE )
15451546 endif ()
1547+ # #enable gles
1548+ # if(SDL_OPENGLES)
1549+ # set(SDL_VIDEO_OPENGL_EGL 1)
1550+ # set(HAVE_OPENGLES TRUE)
1551+ # set(SDL_VIDEO_OPENGL_ES2 1)
1552+ # set(SDL_VIDEO_RENDER_OGL_ES2 1)
1553+ # endif()
15461554 endif ()
15471555
15481556 CheckPTHREAD()
@@ -3017,6 +3025,11 @@ if(SDL_GPU)
30173025 set (SDL_GPU_VULKAN 1)
30183026 set (HAVE_SDL_GPU TRUE )
30193027 endif ()
3028+ if (SDL_RENDER_WEBGPU AND EMSCRIPTEN)
3029+ sdl_glob_sources("${SDL3_SOURCE_DIR} /src/gpu/webgpu/*.c" )
3030+ set (SDL_GPU_WEBGPU 1)
3031+ set (HAVE_SDL_GPU TRUE )
3032+ endif ()
30203033 if (SDL_RENDER_GPU)
30213034 set (SDL_VIDEO_RENDER_GPU 1)
30223035 set (HAVE_RENDER_GPU TRUE )
0 commit comments