-
Notifications
You must be signed in to change notification settings - Fork 89
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
Test default layout bindgroups #3374
Test default layout bindgroups #3374
Conversation
src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts
Outdated
Show resolved
Hide resolved
src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts
Outdated
Show resolved
Hide resolved
src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts
Outdated
Show resolved
Hide resolved
src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts
Outdated
Show resolved
Hide resolved
* Test empty bindgroup layouts on the same default layout pipeline are not compatible. In other words if | ||
you only define group(2) then group(0)'s empty layout and group(1)'s empty layout should be incompatible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec rules as written only require it to come from the same pipeline, not the same slot:
https://gpuweb.github.io/gpuweb/#bind-group-compatibility
This is a little odd, but probably fine as I don't think it's much of a footgun?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case we need to test that 2 bind groups that appear the same, are the same? In other words
@group(0) @binding(0) var s1: sampler;
@group(0) @binding(1) var t1: texture_2d<f32>;
@group(1) @binding(0) var s2: sampler;
@group(1) @binding(1) var t2: texture_2d<f32>;
If we use layout: 'auto'
on this then a bindGroup made with pipeline.getBindGroupLayout(0)
should work bound to bind group 1.
I don't think there is a test for that and it would be easy for browsers to disagree on this without a test?
It does make me wonder why they aren't just compatible in general. The rules are spelled out for what gets generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, we would definitely need to test that. Unless we want to make a breaking change in the spec and make it stricter.
The exclusivePipeline thing was added as a way to prevent footguns because auto layouts are sensitive to static uses in WGSL which are fairly subtle and easy to change (like by commenting out a function call, it removes from the BGL some binding that was used by that function's call tree). But I do wonder if it's really needed. Maybe with some good error messages there would be no footgun, like, "bindgroup created with auto BGL from pipeline 'X' but is used with pipeline 'Y' which has an incompatible auto BGL. Note that auto BGLs do not include declared bindings which are not reachable from the entrypoint of the pipeline".
Jasper and Brandon both had more opinions about this. We definitely picked the current behavior knowing it was a more "safe for 1.0" decision that we didn't necessarily have to keep forever.
src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts
Outdated
Show resolved
Hide resolved
src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts
Outdated
Show resolved
Hide resolved
According to the current WebGPU spec, a bind group created with a bind group layout that itself is from a default layout pipeline (a pipeline created with `layout: 'auto'` is incompatible with any other bind group created with a different bind group layout, even if they'd appear to match by their resource types and binding locations. Further, no excpetion is made for empty bind groups.
…group_compat.spec.ts Co-authored-by: Kai Ninomiya <[email protected]>
…group_compat.spec.ts Co-authored-by: Kai Ninomiya <[email protected]>
…group_compat.spec.ts Co-authored-by: Kai Ninomiya <[email protected]>
9794bf9
to
4d39a49
Compare
It's probably a good idea to decide what we want to happen here and fix it ASAP because as it is, Chrome will allow bind groups made with different
layout: 'auto'
pipelines to work with each other but the spec seems to say that's disallowed. It's easy to imagine lots of WebGPU pages are already breaking this rule.I also suspect the spec would like to say that all empty bind group layouts are compatible but I don't see that in the spec currently so it's tested that they are not compatible in this PR.
Requirements for PR author:
.unimplemented()
./** documented */
and new helper files are found inhelper_index.txt
.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.