step095-emscripten doesn't compile with enum issue
This happens after running
emcmake cmake . -B build-web
cmake --build build-web
the error:
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:226:1: error: unknown type name 'WGPUComputePassTimestampLocation'; did you mean 'ComputePassTimestampLocation'?
226 | ENUM(ComputePassTimestampLocation)
| ^
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:104:10: note: expanded from macro 'ENUM'
104 | typedef WGPU ## Type W; /* W == WGPU Type */ \
| ^
<scratch space>:325:1: note: expanded from here
325 | WGPUComputePassTimestampLocation
| ^
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:226:6: note: 'ComputePassTimestampLocation' declared here
226 | ENUM(ComputePassTimestampLocation)
| ^
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:226:1: warning: conversion function converting 'wgpu::ComputePassTimestampLocation' to itself will never be used [-Wclass-conversion]
226 | ENUM(ComputePassTimestampLocation)
| ^
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:106:2: note: expanded from macro 'ENUM'
106 | operator W() { return m_raw; } \
| ^
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:226:1: error: field has incomplete type 'W' (aka 'wgpu::ComputePassTimestampLocation')
/home/blin/LearnWebGPU-Code/build-web/_deps/webgpu-backend-emscripten-src/include/webgpu/webgpu.hpp:108:4: note: expanded from macro 'ENUM'
108 | W m_raw; \
Versions
- Emscripten version 3.1.51
Ah, downgrading to Emscripten 3.1.45 seems to do the trick.
same issue. on linux, the last working version is 3.1.47.
ok, so apparently webgpu.h changed and made the provided webgpu.hpp incompatible.
you have to go to https://eliemichel.github.io/WebGPU-Cpp/, and paste your webgpu.h, then replace your webgpu.hpp. The new files have some changes (1. corrected spelling error and 2. removed a descriptor field). You'll have to fix your code to match the new api. I tested this on 3.1.53. In my case, I also had to give a nullptr to wgpuCreateInstance.