Skip to content

Conversation

@andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented Jul 14, 2025

Adds some more buffer-texture copy validation. I am declaring that this fixes #7936, although there are still problems with buffer-texture copies, see #7946 and #7947.

This PR enforces:

  • Offset for copies to/from compressed formats must be aligned to the block size
  • Offset for copies to/from depth stencil formats must be 4B aligned.
  • Temporarily enforces that all buffer-texture copies be 4B aligned, pending a fix for wgpu imposes a 4B alignment for buffer initializations but fails to respect it #7947.
  • Disallows multisampled textures for both T2B and B2T (previously only one checked for multisampled textures)

Testing
Enables a sampling of relevant CTS tests, but some of the tests still have a mix of passing and failing variants and I didn't try to exhaustively list every passing case in test.lst.

Squash or Rebase? Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@andyleiserson andyleiserson requested review from a team and crowlKats as code owners July 14, 2025 21:19
@andyleiserson andyleiserson force-pushed the buffer-texture-copy-validation branch from 505645e to 859c787 Compare July 14, 2025 21:41
@andyleiserson andyleiserson marked this pull request as draft July 14, 2025 23:58
@andyleiserson andyleiserson force-pushed the buffer-texture-copy-validation branch from fe9db5a to 26933e5 Compare July 15, 2025 17:18
@andyleiserson andyleiserson marked this pull request as ready for review July 15, 2025 17:39
@andyleiserson
Copy link
Contributor Author

andyleiserson commented Jul 22, 2025

This comment previously noted which commits belonged to this PR vs. #7935, but that no longer applies since the other PR has been merged and this one rebased.

@andyleiserson andyleiserson force-pushed the buffer-texture-copy-validation branch from 3e2c500 to 22efde3 Compare July 22, 2025 18:44
@teoxoy teoxoy merged commit 1c43ac2 into gfx-rs:trunk Jul 23, 2025
40 checks passed
@andyleiserson andyleiserson deleted the buffer-texture-copy-validation branch July 23, 2025 16:05
andyleiserson added a commit to andyleiserson/wgpu that referenced this pull request Jul 29, 2025
andyleiserson added a commit to andyleiserson/wgpu that referenced this pull request Jul 29, 2025
This fixes a regression introduced by gfx-rs#7948. However, it makes it
possible to reach a panic in initialize_buffer_memory if the copy
requires initializing a region of memory that is not 4B aligned.
andyleiserson added a commit to andyleiserson/wgpu that referenced this pull request Jul 29, 2025
This fixes a regression introduced by gfx-rs#7948. However, it makes it
possible to reach a panic in initialize_buffer_memory if the copy
requires initializing a region of memory that is not 4B aligned.
@andyleiserson andyleiserson mentioned this pull request Jul 29, 2025
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#7948. However, it makes it
possible to reach a panic in initialize_buffer_memory if the copy
requires initializing a region of memory that is not 4B aligned.
teoxoy pushed a commit that referenced this pull request Jul 30, 2025
* Restore allowance of unaligned buffer-texture copies

This fixes a regression introduced by #7948. However, it makes it
possible to reach a panic in initialize_buffer_memory if the copy
requires initializing a region of memory that is not 4B aligned.

* Fix CopyT2T of multi-layer depth/stencil textures

* Adjust test list
sharmajai pushed a commit to sharmajai/wgpu that referenced this pull request Oct 12, 2025
* Additional validation of buffer-texture copies

Fixes gfx-rs#7936, but leaves a TODO for gfx-rs#7947

* Skip tests failing on dx12

* Update comments and change unwrap_or to expect
sharmajai pushed a commit to sharmajai/wgpu that referenced this pull request Oct 12, 2025
* Restore allowance of unaligned buffer-texture copies

This fixes a regression introduced by gfx-rs#7948. However, it makes it
possible to reach a panic in initialize_buffer_memory if the copy
requires initializing a region of memory that is not 4B aligned.

* Fix CopyT2T of multi-layer depth/stencil textures

* Adjust test list
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.

Missing validation for buffer<->texture copies

2 participants