summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/gfx-test-util.cpp
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2022-01-19 16:34:58 -0800
committerGitHub <noreply@github.com>2022-01-19 16:34:58 -0800
commit11d248293f1b56a790faadead1e3d94de81f29a2 (patch)
treead28b0106fcaf98321447e10660435b1f00f7385 /tools/gfx-unit-test/gfx-test-util.cpp
parentb40cd149c2038b0a429e46d60ddee5610e08b0ba (diff)
Vulkan implementations for copyTexture, copyTextureToBuffer, and textureSubresourceBarrier (#2080)
* Added preliminary implementations for Vulkan's copyTexture, copyTextureToBuffer, and textureSubresourceBarrier * Simple copyTexture test working * Expanded test to use textureSubresourceBarrier() to change resource states before copying out to a buffer; Changed copyTextureToBuffer() to assert that only a single mip level is being copied; Test passes on Vulkan only * Fixed an incorrect loop condition in D3D12's textureSubresourceBarrier and changed the size of the results buffer to pre-account for padding; Test runs in D3D12 but does not pass * D3D12 test working, compareComputeResult for buffers now takes an offset into the results * Refactored texture copying tests * Second test written but does not copy correctly * Fixed texture creation in D3D12 to take into account the subresource index when copying texture data so it actually copies all slices instead of just the ones in the first array layer; Second test working on both D3D12 and Vulkan * Added a note for future tests to be added for texture copying; Fixed build errors in CUDA Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tools/gfx-unit-test/gfx-test-util.cpp')
-rw-r--r--tools/gfx-unit-test/gfx-test-util.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp
index 7514f22cf..c95c3d0e5 100644
--- a/tools/gfx-unit-test/gfx-test-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-util.cpp
@@ -117,7 +117,7 @@ namespace gfx_test
gfx::IDevice* device,
gfx::ITextureResource* texture,
gfx::ResourceState state,
- float* expectedResult,
+ void* expectedResult,
size_t expectedResultRowPitch,
size_t rowCount)
{
@@ -139,15 +139,16 @@ namespace gfx_test
}
}
- void compareComputeResult(gfx::IDevice* device, gfx::IBufferResource* buffer, uint8_t* expectedResult, size_t expectedBufferSize)
+ void compareComputeResult(gfx::IDevice* device, gfx::IBufferResource* buffer, size_t offset, const void* expectedResult, size_t expectedBufferSize)
{
// Read back the results.
ComPtr<ISlangBlob> resultBlob;
GFX_CHECK_CALL_ABORT(device->readBufferResource(
- buffer, 0, expectedBufferSize, resultBlob.writeRef()));
+ buffer, offset, expectedBufferSize, resultBlob.writeRef()));
SLANG_CHECK(resultBlob->getBufferSize() == expectedBufferSize);
+ auto result = (float*)resultBlob->getBufferPointer();
// Compare results.
- SLANG_CHECK(memcmp(resultBlob->getBufferPointer(), expectedResult, expectedBufferSize) == 0);
+ SLANG_CHECK(memcmp(resultBlob->getBufferPointer(), (uint8_t*)expectedResult, expectedBufferSize) == 0);
}
void compareComputeResultFuzzy(const float* result, float* expectedResult, size_t expectedBufferSize)