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

Discard is allowed in compute shader stage #2263

Closed
Noxime opened this issue Feb 26, 2023 · 0 comments · Fixed by #2262
Closed

Discard is allowed in compute shader stage #2263

Noxime opened this issue Feb 26, 2023 · 0 comments · Fixed by #2262
Labels
area: validation Validation of the IR kind: bug Something isn't working

Comments

@Noxime
Copy link

Noxime commented Feb 26, 2023

Description
A compute shader may include discard statements. This is not allowed by the WGSL spec.

Repro steps
Invoke a compute shader like

@compute @workgroup_size(1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
    if global_id.x == 3u {
        discard;
    }
}

Expected vs observed behavior

  • Expected: Shader is rejected
  • Vulkan: Pipeline creation succeeds but validation layers catch the invalid use of OpKill. Device is lost upon dispatch.
  • Dx12: Pipeline creation fails with an FXC error X4532

Extra materials
This can easily be reproduced by modifying the hello compute example

Platform
Windows 10, RTX 2070. Reproduced for wgpu 0.15.1 and #df54bc4

@teoxoy teoxoy transferred this issue from gfx-rs/wgpu Feb 27, 2023
@teoxoy teoxoy added kind: bug Something isn't working area: validation Validation of the IR labels Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Validation of the IR kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants