diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-28 01:10:05 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-28 01:10:05 +0100 |
| commit | 6cd6fb41ed44bd37bd05e5a4abf23661605c00df (patch) | |
| tree | f3c5fb237b71bc6ad2d67dea62324b2edede51c3 /scripts/project_init.sh | |
| parent | a7bcf5e9cd6884d010b5cec0146293a0515242fc (diff) | |
refactor(gpu): Integrate WebGPU via system wgpu-native and glfw3webgpu
Replaces the complex wgpu-native submodule and manual platform-specific surface creation with a system-wide wgpu-native install (via Homebrew) and the glfw3webgpu helper library.
- Updates scripts/project_init.sh to fetch glfw3webgpu and ensure wgpu-native is installed.
- Refactors CMakeLists.txt to link against the system wgpu-native library.
- Simplifies src/platform.cc to use glfwCreateWindowWGPUSurface.
- Simplifies src/gpu/gpu.cc to use standard WebGPU headers.
- Updates FETCH_DEPS.md with new installation instructions.
- Updates PROJECT_CONTEXT.md with the new integration strategy.
Diffstat (limited to 'scripts/project_init.sh')
| -rwxr-xr-x | scripts/project_init.sh | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripts/project_init.sh b/scripts/project_init.sh index db24c8f..549e146 100755 --- a/scripts/project_init.sh +++ b/scripts/project_init.sh @@ -14,19 +14,26 @@ else echo "miniaudio.h already present." fi -# wgpu-native submodule -if [ ! -d third_party/wgpu-native ]; then - echo "Fetching wgpu-native submodule..." - git submodule update --init --recursive +# glfw3webgpu (helper for GLFW + WebGPU) +mkdir -p third_party/glfw3webgpu +if [ ! -f third_party/glfw3webgpu/glfw3webgpu.h ]; then + echo "Fetching glfw3webgpu..." + curl -L https://raw.githubusercontent.com/eliemichel/glfw3webgpu/main/glfw3webgpu.h -o third_party/glfw3webgpu/glfw3webgpu.h + curl -L https://raw.githubusercontent.com/eliemichel/glfw3webgpu/main/glfw3webgpu.c -o third_party/glfw3webgpu/glfw3webgpu.c else - echo "wgpu-native submodule already present." + echo "glfw3webgpu already present." fi -if [ ! -f third_party/wgpu-native/target/release/libwgpu_native.a ]; then - echo "Building wgpu-native static library..." - (cd third_party/wgpu-native && make lib-native) +# Check for wgpu-native (system install) +if command -v brew >/dev/null 2>&1; then + if ! brew list wgpu-native >/dev/null 2>&1; then + echo "Warning: wgpu-native not found via brew. Installing..." + brew install wgpu-native + else + echo "wgpu-native found (via brew)." + fi else - echo "wgpu-native static library already built." + echo "Warning: Homebrew not found. Ensure wgpu-native is installed manually." fi echo "Done." |
