You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(webgpu): automatic bind-group reflection for compute shaders (#8821)
* feat(webgpu): automatic bind-group reflection for compute shaders
WebGPU compute shaders can now use the same simplified WGSL syntax as
vertex/fragment shaders. The engine reflects resources from the shader source
and builds the bind group automatically, so a hand-written computeBindGroupFormat
is no longer required.
- Reflect loose uniforms (into a generated uniform buffer), textures + samplers,
storage buffers, and storage textures declared with simplified syntax.
- computeBindGroupFormat / computeUniformBufferFormats are now optional. Reflected
resources go in their own bind group (group 1 when a caller format is supplied,
otherwise group 0); explicitly-bound resources are left untouched.
- Generalize compute pipeline / bind-group execution to support multiple bind groups.
- Fix storage-buffer reflection regex to accept read_write.
- Convert edge-detect and particles examples to the simplified syntax.
- Add unit tests for the compute reflection paths.
Fixes#7689
* fix(webgpu): avoid GPUComputePipeline type in generated d.ts
The @returns {GPUComputePipeline} JSDoc emitted an explicit return type into
the .d.ts, which fails the standalone type check (no WebGPU lib types in scope).
* refactor(webgpu): address compute reflection review comments
- gpuFormatToPixelFormat: use last-wins so the canonical PIXELFORMAT (e.g. RGBA8
for 'rgba8unorm') is chosen, avoiding a needless bind group layout / pipeline
cache split (the key uses the numeric PIXELFORMAT).
- Assert computeUniformBufferFormats requires a computeBindGroupFormat, instead of
silently dropping the uniform buffers.
- STORAGE_BUFFER_REGEX: drop the invalid 'write' token (storage buffers only support
read / read_write in WGSL).
- Sync runCompute and buildResourceFormats JSDoc to mention storage textures.
---------
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
0 commit comments