Remove a workaround of buffer size computation
If we are copying a partial of rows, the buffer size doesn't need to be that large of the entire image which has "rowsPerImage" rows. There was a bug in texture copy splitter. And this workaround was introduced at https://dawn-review.googlesource.com/c/dawn/+/30741 in order to workaround that bug. D3D12 validation is actually correct. Now that we have fixed the bug at https://dawn-review.googlesource.com/c/dawn/+/52680/. The workaround is not needed. Bug: dawn:547, dawn:520 Change-Id: I92292c71dc5479fc2ba863eb9f897516bd1a96a0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53360 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
parent
2b43b45af9
commit
539fc31de3
|
@ -52,19 +52,11 @@ namespace utils {
|
||||||
}
|
}
|
||||||
layout.rowsPerImage = rowsPerImage;
|
layout.rowsPerImage = rowsPerImage;
|
||||||
|
|
||||||
layout.bytesPerImage = layout.bytesPerRow * rowsPerImage;
|
uint32_t appliedRowsPerImage = rowsPerImage > 0 ? rowsPerImage : layout.mipSize.height;
|
||||||
|
layout.bytesPerImage = layout.bytesPerRow * appliedRowsPerImage;
|
||||||
|
|
||||||
// TODO(kainino@chromium.org): Remove this intermediate variable.
|
layout.byteLength =
|
||||||
// It is currently needed because of an issue in the D3D12 copy splitter
|
RequiredBytesInCopy(layout.bytesPerRow, appliedRowsPerImage, layout.mipSize, format);
|
||||||
// (or maybe in D3D12 itself?) which requires there to be enough room in the
|
|
||||||
// buffer for the last image to have a height of `rowsPerImage` instead of
|
|
||||||
// the actual height.
|
|
||||||
wgpu::Extent3D mipSizeWithHeightWorkaround = layout.mipSize;
|
|
||||||
mipSizeWithHeightWorkaround.height =
|
|
||||||
rowsPerImage * utils::GetTextureFormatBlockHeight(format);
|
|
||||||
|
|
||||||
layout.byteLength = RequiredBytesInCopy(layout.bytesPerRow, rowsPerImage,
|
|
||||||
mipSizeWithHeightWorkaround, format);
|
|
||||||
|
|
||||||
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(format);
|
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(format);
|
||||||
layout.texelBlocksPerRow = layout.bytesPerRow / bytesPerTexel;
|
layout.texelBlocksPerRow = layout.bytesPerRow / bytesPerTexel;
|
||||||
|
|
Loading…
Reference in New Issue