summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/copy-texture-tests.cpp
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2022-03-08 12:47:32 -0800
committerGitHub <noreply@github.com>2022-03-08 15:47:32 -0500
commit771f29435d664f7344bc5596056146af5d64d352 (patch)
tree035fba1641088d75381e9a7140dab2d6f21223f9 /tools/gfx-unit-test/copy-texture-tests.cpp
parent2a80bcfa96089967b299eea0454d9debe52fa0f6 (diff)
Expose API-specific row alignment values (#2151)
* Added function to IDevice that retrieves the row alignment for the particular API; Added rowDstStride argument to copyTextureToBuffer and changed D3D12 footprint row pitch to check that the user-supplied stride is correctly aligned before assigning to the footprint's row pitch * Changed alignment from Uint to size_t Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
Diffstat (limited to 'tools/gfx-unit-test/copy-texture-tests.cpp')
-rw-r--r--tools/gfx-unit-test/copy-texture-tests.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/gfx-unit-test/copy-texture-tests.cpp b/tools/gfx-unit-test/copy-texture-tests.cpp
index 069d20f02..dec71541f 100644
--- a/tools/gfx-unit-test/copy-texture-tests.cpp
+++ b/tools/gfx-unit-test/copy-texture-tests.cpp
@@ -77,7 +77,8 @@ namespace gfx_test
FormatInfo formatInfo;
gfxGetFormatInfo(format, &formatInfo);
- UInt alignment = 256; // D3D requires rows to be aligned to a multiple of 256 bytes.
+ size_t alignment;
+ device->getTextureRowAlignment(&alignment);
alignedRowPitch = (dstTextureInfo.extent.width * formatInfo.blockSizeInBytes + alignment - 1) & ~(alignment - 1);
IBufferResource::Desc bufferDesc = {};
bufferDesc.sizeInBytes = dstTextureInfo.extent.height * alignedRowPitch;
@@ -120,7 +121,7 @@ namespace gfx_test
encoder->textureSubresourceBarrier(srcTexture, srcSubresource, ResourceState::UnorderedAccess, ResourceState::CopySource);
encoder->copyTexture(dstTexture, ResourceState::CopyDestination, dstSubresource, dstOffset, srcTexture, ResourceState::CopySource, srcSubresource, srcOffset, extent);
encoder->textureSubresourceBarrier(dstTexture, dstSubresource, ResourceState::CopyDestination, ResourceState::CopySource);
- encoder->copyTextureToBuffer(resultsBuffer, 0, textureSize, dstTexture, ResourceState::CopySource, dstSubresource, dstOffset, extent);
+ encoder->copyTextureToBuffer(resultsBuffer, 0, textureSize, alignedRowPitch, dstTexture, ResourceState::CopySource, dstSubresource, dstOffset, extent);
encoder->endEncoding();
commandBuffer->close();
queue->executeCommandBuffer(commandBuffer);