Additional validation of texture copies#7935
Merged
teoxoy merged 3 commits intogfx-rs:trunkfrom Jul 22, 2025
Merged
Conversation
* Copies must not overlap. * Copies of multisampled or depth/stencil formats must span the entire texture. * Move no-op for zero-size copies after parameter validation. Closes gfx-rs#2951 Fixes gfx-rs#7844
0b8f788 to
fa7961b
Compare
Collaborator
Sounds like we need to add more CTS tests. |
6 tasks
teoxoy
requested changes
Jul 16, 2025
fa7961b to
04cd49f
Compare
andyleiserson
added a commit
to andyleiserson/wgpu
that referenced
this pull request
Jul 29, 2025
This fixes a regression introduced by gfx-rs#7935.
6 tasks
andyleiserson
added a commit
that referenced
this pull request
Jul 29, 2025
This fixes a regression introduced by #7935.
6 tasks
andyleiserson
added a commit
to andyleiserson/wgpu
that referenced
this pull request
Jul 30, 2025
This fixes a regression introduced by gfx-rs#7935.
sharmajai
pushed a commit
to sharmajai/wgpu
that referenced
this pull request
Oct 12, 2025
* Additional validation of texture copies * Copies must not overlap. * Copies of multisampled or depth/stencil formats must span the entire texture. * Move no-op for zero-size copies after parameter validation. Closes gfx-rs#2951 Fixes gfx-rs#7844 * Fix issue with combined depth+stencil copy on dx12 * PR feedback
sharmajai
pushed a commit
to sharmajai/wgpu
that referenced
this pull request
Oct 12, 2025
This fixes a regression introduced by gfx-rs#7935.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In studying whether #2951 is still an issue, I identified some other texture validation that is missing. This adds it, and also fixes the issue where we skip parameter validation for zero-size copies.
I suspect that this may fix #7844 by rejecting an illegal operation before dx12 panics.I've also included a fix for #7844 that splits depth+stencil copies into two operations, although I'm not sure if this is the right fix -- it appears that metal does support a combined copy in copyTextureToTexture (but not in copyBufferToTexture), so maybe this should be pushed to the backends.Testing
Enables all the
copyTextureToTextureCTS tests. However, the CTS isn't complete coverage of the validation logic I added. In particular, it doesn't cover the logic that allows copies among different aspects of the same texture. I'm not sure if that even makes sense (copying between depth and stencil?), or if it's just the spec being thorough, but I would welcome a suggestion of an interesting test to add here.Squash or Rebase? Squash
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry. Maybe it's worth one overall changelog entry mentioning this, the vertex/index buffer offset change, and any other added validation that gets added.