Skip to content

Don't include detailed shader compilation info in validation error - #10033

Open
beicause wants to merge 7 commits into
gfx-rs:trunkfrom
beicause:shader-error-no-compilation-info
Open

Don't include detailed shader compilation info in validation error#10033
beicause wants to merge 7 commits into
gfx-rs:trunkfrom
beicause:shader-error-no-compilation-info

Conversation

@beicause

@beicause beicause commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Connections

Description

Don't include detailed shader compilation info in validation error

See https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule :

NOTE:
User agents should not include detailed compiler error messages or shader text in the message text of validation errors arising here: these details are accessible via getCompilationInfo(). User agents should surface human-readable, formatted error details to developers for easier debugging (for example as a warning in the browser developer console, expandable to show full shader source).

As shader compilation errors should be rare in production applications, user agents could choose to surface them to developers regardless of error handling (GPU error scopes or uncapturederror event handlers), e.g. as an expandable warning. If not, they should provide and document another way for developers to access human-readable error details, for example by adding a checkbox to show errors unconditionally, or by showing human-readable details when logging a GPUCompilationInfo object to the console.

Testing
Added an unit test in wgpu-core/src/pipeline.rs

Squash or Rebase?
Squash

Checklist

  • I self-reviewed and fully understand this PR.
  • WebGPU implementations built with wgpu may be affected behaviorally.
  • Validation and feature gates are in place to confine behavioral changes.
  • Tests demonstrate the validation and altered logic works.
  • CHANGELOG.md entries for the user-facing effects of this change are present.
  • The PR is minimal, and doesn't make sense to land as multiple PRs.
  • Commits are logically scoped and individually reviewable.
  • The PR description has enough context to understand the motivation and solution implemented.

@beicause
beicause force-pushed the shader-error-no-compilation-info branch from 32b4d38 to 2e5f1e2 Compare August 9, 2026 12:17
@kpreid

kpreid commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

In wgpu, there is no such thing as “the developer console”. While this specified behavior should be available in wgpu-core for the sake of implementing WebGPU to spec, I don’t think it should be the behavior that wgpu exposes to Rust users.

Perhaps a good compromise would be that the compilation error appears as the source() of the validation error. This means that normal Rust error printers can include the details automatically, but that a short message is also available.

@beicause

Copy link
Copy Markdown
Contributor Author

I left ShaderError in source(), though this requires special handling to skip it when recursively format error descriptions in wgpu and deno_webgpu.

@andyleiserson andyleiserson self-assigned this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants