Skip to content

Conversation

@greggman
Copy link
Contributor

@greggman greggman commented Jul 9, 2025

In particular test that for copyBufferToTexture, and copyTextureToBuffer

  • bytesPerRow must be a multiple of 256

  • offset must be a multiple of bytesPerBlock

  • the last row does not need to be a multiple of 256

    In other words, If the copy size is 4x2 of a r8unorm texture that's 4 bytes per row. To get from row 0 to row 1 in the buffer, bytesPerRow must be a multiple of 256. But, the size requirement for the buffer is only 256 + 4, not 256 * 2

  • origin.x must be a multiple of blockWidth

  • origin.y must be a multiple of blockHeight

  • copySize.width must be a multiple of blockWidth

  • copySize.height must be a multiple of blockHeight

@greggman greggman requested a review from toji July 9, 2025 23:01
@greggman greggman force-pushed the copy-t2b-b2t-alignment branch from 51a094a to c760cd1 Compare July 9, 2025 23:02
Copy link
Member

@toji toji left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

In particular test that for copyBufferToTexture, and copyTextureToBuffer

* bytesPerRow must be a multiple of 256
* offset must be a multiple of bytesPerBlock
* the last row does not need to be a multiple of 256
  In other words, If the copy size is 4x2 of a r8unorm texture that's 4 bytes per row.
  To get from row 0 to row 1 in the buffer, bytesPerRow must be a multiple of 256.
  But, the size requirement for the buffer is only 256 + 4, not 256 * 2
* origin.x must be a multiple of blockWidth
* origin.y must be a multiple of blockHeight
* copySize.width must be a multiple of blockWidth
* copySize.height must be a multiple of blockHeight
@greggman greggman force-pushed the copy-t2b-b2t-alignment branch from c760cd1 to 6c9228a Compare July 10, 2025 20:41
@greggman greggman merged commit eba794d into gpuweb:main Jul 10, 2025
1 check passed
@greggman greggman deleted the copy-t2b-b2t-alignment branch July 10, 2025 21:18
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