D3D12: Fix crash in the workaround for T2T copy issue on Intel GPUs
This patch fixes a bug in the computation of temporary buffer size in the implementation of the workaround for the T2T copy issue on Intel GPUs. With this tests all the T2T operation tests in WebGPU CTS will be able to pass on Intel Gen9 and Gen9.5 GPUs. BUG=chromium:1161355 TEST=dawn_end2end_tests Change-Id: Ic4fb0c0056cf7b01720e47cc91c37a9f293cd194 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44840 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
3209df5a9c
commit
0008432827
|
@ -230,11 +230,15 @@ namespace dawn_native { namespace d3d12 {
|
|||
uint32_t bytesPerRow =
|
||||
Align(blockInfo.byteSize * widthInBlocks, kTextureBytesPerRowAlignment);
|
||||
uint32_t rowsPerImage = heightInBlocks;
|
||||
uint64_t tempBufferSize = bytesPerRow * (widthInBlocks * heightInBlocks - 1) +
|
||||
Align(blockInfo.byteSize * widthInBlocks, 4);
|
||||
|
||||
// The size of temporary buffer isn't needed to be a multiple of 4 because we don't
|
||||
// need to set mappedAtCreation to be true.
|
||||
auto tempBufferSize =
|
||||
ComputeRequiredBytesInCopy(blockInfo, copySize, bytesPerRow, rowsPerImage);
|
||||
|
||||
BufferDescriptor tempBufferDescriptor;
|
||||
tempBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
tempBufferDescriptor.size = tempBufferSize;
|
||||
tempBufferDescriptor.size = tempBufferSize.AcquireSuccess();
|
||||
Device* device = ToBackend(srcCopy.texture->GetDevice());
|
||||
Ref<Buffer> tempBuffer =
|
||||
AcquireRef(ToBackend(device->CreateBuffer(&tempBufferDescriptor)));
|
||||
|
|
|
@ -1628,13 +1628,17 @@ TEST_P(CopyTests_T2T, CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes) {
|
|||
ASSERT_LE(kSrcSize, kTextureBytesPerRowAlignment);
|
||||
ASSERT_LE(kDstSize, kTextureBytesPerRowAlignment);
|
||||
|
||||
// The copyDepth to test:
|
||||
// 1u (non-array texture), 3u (copyDepth < copyWidth), 5u (copyDepth > copyWidth)
|
||||
constexpr std::array<uint32_t, 3> kTestTextureDepth = {1u, 3u, 5u};
|
||||
|
||||
for (wgpu::TextureFormat format : kFormats) {
|
||||
if (HasToggleEnabled("disable_snorm_read") &&
|
||||
(format == wgpu::TextureFormat::RG8Snorm || format == wgpu::TextureFormat::R8Snorm)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32_t textureDepth = 1; textureDepth < 3; ++textureDepth) {
|
||||
for (uint32_t textureDepth : kTestTextureDepth) {
|
||||
const wgpu::Extent3D kUploadSize = {4u, 4u, textureDepth};
|
||||
|
||||
for (uint32_t srcLevel = 0; srcLevel < kSrcLevelCount; ++srcLevel) {
|
||||
|
|
Loading…
Reference in New Issue