-
Notifications
You must be signed in to change notification settings - Fork 937
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
fix: don't depend on BG{,L} layout entry order in HAL #5421
Merged
ErichDonGubler
merged 5 commits into
gfx-rs:trunk
from
erichdongubler-mozilla:create-bgl-resource-ordering
Apr 1, 2024
Merged
fix: don't depend on BG{,L} layout entry order in HAL #5421
ErichDonGubler
merged 5 commits into
gfx-rs:trunk
from
erichdongubler-mozilla:create-bgl-resource-ordering
Apr 1, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ErichDonGubler
force-pushed
the
create-bgl-resource-ordering
branch
from
March 28, 2024 21:18
e7d2b8e
to
dea6a96
Compare
ErichDonGubler
added
area: correctness
We're behaving incorrectly
api: dx12
Issues with DX12 or DXGI
api: gles
Issues with GLES or WebGL
api: metal
Issues with Metal
type: bug
Something isn't working
labels
Mar 29, 2024
ErichDonGubler
force-pushed
the
create-bgl-resource-ordering
branch
2 times, most recently
from
March 29, 2024 14:36
0adbd36
to
a709356
Compare
ErichDonGubler
changed the title
WIP: fix: don't depend on BGL layout entry order in HAL
fix: don't depend on BG{,L} layout entry order in HAL
Mar 29, 2024
ErichDonGubler
force-pushed
the
create-bgl-resource-ordering
branch
from
March 29, 2024 15:59
44946ae
to
c0aeb31
Compare
This isn't guaranteed by `wgpu-core`; we should try to match by binding slot index instead.
This isn't guaranteed by `wgpu-core`; we should try to match by binding slot index instead.
This isn't guaranteed by `wgpu-core`; we should try to match by binding slot index instead.
ErichDonGubler
force-pushed
the
create-bgl-resource-ordering
branch
from
March 29, 2024 16:06
c0aeb31
to
38eb30e
Compare
ErichDonGubler
added
the
PR: needs back-porting
PR with a fix that needs to land on crates
label
Mar 29, 2024
ErichDonGubler
commented
Apr 1, 2024
jimblandy
approved these changes
Apr 1, 2024
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.
We need a followup bug for the quadratic behavior, but other than that, this looks fantastic. Thank you so much for writing a test.
Edit from @ErichDonGubler: Added in #5473.
cwfitzgerald
removed
the
PR: needs back-porting
PR with a fix that needs to land on crates
label
Apr 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: dx12
Issues with DX12 or DXGI
api: gles
Issues with GLES or WebGL
api: metal
Issues with Metal
area: correctness
We're behaving incorrectly
type: bug
Something isn't working
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
Description
Multiple backends for
wgpu-hal
currently make assumptions about the ordering of descriptor entries provided for bind groups and bind group layouts that are invalid. In particular, it was assumed that the element order of resource entries stored inVec
s in bind group layouts were the same for bind group resources entries stored inVec
s. This caused binding slot order to become out-of-sync when actually creating bind groups from descriptors and bind group layouts with code likedesc.entries.iter().zip(desc.layout.entries.iter())
, bypassing essential validation for, i.e., type matching in resource entries, and usage masks for buffers and textures. At best, this caused crashes because of different numbers of types of resources being used (as observed in Firefox's bug 1877461, comment 3). At worst, this caused resources of (of the same and different) types to be bound in the wrong places. We in Firefox noticed because of crashes and putting graphics drivers into invalid states. I'm sure there are other potential types of damage that are even worse. 😬Testing
The test
wgpu_test::different_bgl_order_bw_shader_and_api
has been added, which exercises the previously crashing case where more than one resource type was being used in a bind group layout. This doesn't cover cases of resources of the same type having their order mixed up, but it should be sufficient to prevent a significant regression.Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.