Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workgroup_size: expected 32-bit signed integer literal error #2430

Closed
jack1232 opened this issue Aug 10, 2023 · 1 comment · Fixed by #2309
Closed

workgroup_size: expected 32-bit signed integer literal error #2430

jack1232 opened this issue Aug 10, 2023 · 1 comment · Fixed by #2309
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language

Comments

@jack1232
Copy link

jack1232 commented Aug 10, 2023

Description

The following compute shader code works in WebGPU:

const SIZE = 8;
@compute @workgroup_size(SIZE, SIZE, 1)
fn cs_main(@builtin(workgroup_id) workGroupId : vec3u, @builtin(local_invocation_id) localId: vec3u) {
    let x = localId.x + workGroupId.x * u32(SIZE);
    let y = localId.y + workGroupId.y * u32(SIZE); 
    ...
}  

But wgpu gives error:

@compute @workgroup_size(SIZE, SIZE, 1)
  │                      ^^^^ expected 32-bit signed integer literal

However, from WGSL spec:
workgroup_size: One, two or three parameters.
Each parameter must be a const-expression or an override-expression. All parameters must be the same type, either i32 or u32.

It is clear that workgroup_size can be a const expression. Why wgpu requires it to be a 32-bit signed integer literal?

Platform
Windows 11, RTX 3060

@teoxoy teoxoy transferred this issue from gfx-rs/wgpu Aug 10, 2023
@teoxoy teoxoy added kind: bug Something isn't working lang: WGSL WebGPU shading language area: front-end Input formats for conversion labels Aug 11, 2023
@teoxoy teoxoy added this to the WGSL Specification V1 milestone Aug 11, 2023
@teoxoy
Copy link
Member

teoxoy commented Aug 11, 2023

Will be fixed by #2309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants