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

wgpu-core: Inform user about possible fix #5298

Conversation

hackaugusto
Copy link
Contributor

@hackaugusto hackaugusto commented Feb 24, 2024

Connections

None

Description

I'm inexperienced with the API, and wrote a test using Limits::downlevel_webgl2_defaults(). The only reason I realized the validation error for the number of bindings was not a hardware capability issue is because I had gone over an working example on https://webgpufundamentals.org/.

Adding a bit more of context to the error message should help new users realize this is a configuration issue instead of hardware/support and guide them to a possible fix.

This changes the error from:

wgpu error: Validation Error

Caused by:
    In Device::create_bind_group_layout
    Too many bindings of type StorageBuffers in Stage ShaderStages(VERTEX | FRAGMENT), limit is 0, count was 1

To:

wgpu error: Validation Error

Caused by:
    In Device::create_bind_group_layout
    Too many bindings of type StorageBuffers in Stage ShaderStages(VERTEX | FRAGMENT), limit is 0, count was 1. Check the required limit max_storage_buffers_per_shader_stage used on request_device

Testing

With cargo xtask test

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@hackaugusto hackaugusto requested a review from a team as a code owner February 24, 2024 16:31
wgpu-core/src/binding_model.rs Outdated Show resolved Hide resolved
wgpu-core/src/binding_model.rs Outdated Show resolved Hide resolved
@cwfitzgerald
Copy link
Member

Love the change, just a few small issues!

@hackaugusto hackaugusto force-pushed the hacka-add-recommended-fix-to-error-message branch from bba376c to 6c9dcbc Compare February 25, 2024 12:01
@hackaugusto
Copy link
Contributor Author

Updated the error message and implementation, after changes it looks like this:

wgpu error: Validation Error

Caused by:
    In Device::create_bind_group_layout
    Too many bindings of type StorageBuffers in Stage ShaderStages(VERTEX | FRAGMENT), limit is 0, count was 1. Check the limit `max_storage_buffers_per_shader_stage` passed to `Adapter::request_device`

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@cwfitzgerald cwfitzgerald merged commit a315925 into gfx-rs:trunk Feb 25, 2024
27 checks passed
@hackaugusto hackaugusto deleted the hacka-add-recommended-fix-to-error-message branch February 25, 2024 20:23
@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Feb 29, 2024
cwfitzgerald pushed a commit to cwfitzgerald/wgpu that referenced this pull request Feb 29, 2024
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Mar 1, 2024
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.

2 participants