Skip to content

ShaderStages::all() causes validation error when used in WebGPU #7708

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

Open
Wumpf opened this issue May 21, 2025 · 7 comments
Open

ShaderStages::all() causes validation error when used in WebGPU #7708

Wumpf opened this issue May 21, 2025 · 7 comments
Labels
area: api Issues related to API surface area: validation Issues related to validation, diagnostics, and error handling backend: webgpu Issues with direct interface with WebGPU type: bug Something isn't working

Comments

@Wumpf
Copy link
Member

Wumpf commented May 21, 2025

Since ShaderStages::all now also includes Taks & Mesh shaders, it causes a validation error when used in a WebGPU environment.
As those were introduced only in wgpu 25, this is effectively a regression since it means that code that worked fine in 24 now breaks on 25 when run on the web!

Need to find a way to make all only mean supported shader stages. Which isn't entirely straight forward 🤔

@Wumpf Wumpf added type: bug Something isn't working area: api Issues related to API surface backend: webgpu Issues with direct interface with WebGPU labels May 21, 2025
@Wumpf
Copy link
Member Author

Wumpf commented May 21, 2025

Actually, this also hints at a missing validation in wgpu-core!

@Wumpf Wumpf added the area: validation Issues related to validation, diagnostics, and error handling label May 21, 2025
@SupaMaggie70Incorporated
Copy link
Contributor

What exactly is the validation issue and what could cause it? I can’t test WebGPU myself. Which part of validation is failing and what validation do you think is missing in wgpu-core?

Also, I’m surprised this went uncaught for so long.

@Wumpf
Copy link
Member Author

Wumpf commented May 21, 2025

chrome gives you Wgpu validation error 18446744073709551615: Value 31 is invalid for WGPUShaderStage.
wgpu-core is not validating unsupported (or from pov of WebGPU) invalid shader stages, thus causing unexpected discrepancy here.

Debatable whether wgpu's webgpu impl should just strip down the additional shader stages or whether this is practically just a user error (+ missing validation on wgpu-core)

@cwfitzgerald
Copy link
Member

I think the fundamental question is: are you allowed to mention a stage that cannot be used in a visibility bitmask. Currently I think our answer has been yes. We allow you to mention compute when compute isn't supported by the device. I'm not sure if WebGPU has had to make this decision yet (afaik WebGPU compat still supports compute), so we probably should just make a decision and roll with it. I think I'm of the opinion that it shouldn't be a validation error.

@SupaMaggie70Incorporated
Copy link
Contributor

SupaMaggie70Incorporated commented May 21, 2025

I would propose that the binding/attachment stages that aren’t in the pipeline itself(for graphics, mesh, or compute) should just be dropped at pipeline creation time. This would probably save us from issues like these without removing important existing validation.

To specify further, if the pipeline creation is passed say a mesh shader stage for a compute pipeline, it should simply be ignored.

@Wumpf
Copy link
Member Author

Wumpf commented May 21, 2025

@SupaMaggie70Incorporated I think you're missunderstanding: wgpu-core does not do any validation on this today. But Chrome does for WebGPU (on this path there's no wgpu-core involved) which is what causing the problem in the first place

@SupaMaggie70Incorporated
Copy link
Contributor

@Wumpf You’re right, I made a mistake in typing. I edited my comment to hopefully clarify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface area: validation Issues related to validation, diagnostics, and error handling backend: webgpu Issues with direct interface with WebGPU type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants