Don't use depth offset in TextureCopySplitter

Remove usage of the depth offset in TextureCopySplitter. Because there
is no slice pitch alignment requirement, it is simpler to express the
subresource footprint with just width and height. Fixes incorrect copies
when using WriteTexture on a texture with 64 or less width.

Bug: dawn:573
Change-Id: I51cb73b522a443b8b42d9ba290c69541211be4bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39200
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
This commit is contained in:
Brandon Jones
2021-03-12 17:58:47 +00:00
committed by Commit Bot service account
parent a57308e60b
commit c53ea046a6
4 changed files with 81 additions and 22 deletions

View File

@@ -141,8 +141,9 @@ namespace {
uint32_t absoluteTexelOffset =
copySplit.offset / textureSpec.texelBlockSizeInBytes * texelsPerBlock +
copy.bufferOffset.x / textureSpec.blockWidth * texelsPerBlock +
copy.bufferOffset.y / textureSpec.blockHeight * bytesPerRowInTexels +
copy.bufferOffset.z * slicePitchInTexels;
copy.bufferOffset.y / textureSpec.blockHeight * bytesPerRowInTexels;
ASSERT_EQ(copy.bufferOffset.z, 0u);
ASSERT(absoluteTexelOffset >=
bufferSpec.offset / textureSpec.texelBlockSizeInBytes * texelsPerBlock);
@@ -203,6 +204,7 @@ namespace {
// Define base texture sizes and offsets to test with: some aligned, some unaligned
constexpr TextureSpec kBaseTextureSpecs[] = {
{0, 0, 0, 1, 1, 1, 4},
{0, 0, 0, 64, 1, 1, 4},
{31, 16, 0, 1, 1, 1, 4},
{64, 16, 0, 1, 1, 1, 4},
{64, 16, 8, 1, 1, 1, 4},
@@ -237,7 +239,7 @@ namespace {
// Define base buffer sizes to work with: some offsets aligned, some unaligned. bytesPerRow is
// the minimum required
std::array<BufferSpec, 13> BaseBufferSpecs(const TextureSpec& textureSpec) {
std::array<BufferSpec, 14> BaseBufferSpecs(const TextureSpec& textureSpec) {
uint32_t bytesPerRow = Align(textureSpec.texelBlockSizeInBytes * textureSpec.width,
kTextureBytesPerRowAlignment);
@@ -266,6 +268,8 @@ namespace {
textureSpec.height},
BufferSpec{alignNonPow2(257, textureSpec.texelBlockSizeInBytes), bytesPerRow,
textureSpec.height},
BufferSpec{alignNonPow2(384, textureSpec.texelBlockSizeInBytes), bytesPerRow,
textureSpec.height},
BufferSpec{alignNonPow2(511, textureSpec.texelBlockSizeInBytes), bytesPerRow,
textureSpec.height},
BufferSpec{alignNonPow2(513, textureSpec.texelBlockSizeInBytes), bytesPerRow,