gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.4k stars 908 forks source link

WGSL back end can't translate GLSL `gl_WorkgroupSize` or SPIR-V `WorkgroupSize` builtin #4418

Open jimblandy opened 1 year ago

jimblandy commented 1 year ago

As of gfx-rs/naga#2147, the WGSL back end will fail to generate code for modules that use naga::BuiltIn::WorkGroupSize, corresponding to GLSL gl_WorkgroupSize and the SPIR-V WorkgroupSize builtin.

It might make sense to remove Builtin::WorkGroupSize from Naga altogether:

It might be possible to have the GLSL and SPIR-V front ends just replace uses of gl_WorkgroupSize and WorkgroupSize builtins with the given constants.

If we do keep naga::BuiltIn::WorkGroupSize, then we ought to generate code for it, probably by simply grabbing the value of EntryPoint::workgroup_size.

jimblandy commented 1 year ago

Oh, and per https://github.com/gpuweb/gpuweb/issues/1590:

"workgroup_size" builtin is not supported on some Apple platforms