summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/gfx-test-util.h
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.h
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.h')
-rw-r--r--tools/gfx-unit-test/gfx-test-util.h23
1 files changed, 4 insertions, 19 deletions
diff --git a/tools/gfx-unit-test/gfx-test-util.h b/tools/gfx-unit-test/gfx-test-util.h
index 04c602359..3be47bc82 100644
--- a/tools/gfx-unit-test/gfx-test-util.h
+++ b/tools/gfx-unit-test/gfx-test-util.h
@@ -30,7 +30,8 @@ namespace gfx_test
void compareComputeResult(
gfx::IDevice* device,
gfx::IBufferResource* buffer,
- uint8_t* expectedResult,
+ size_t offset,
+ const void* expectedResult,
size_t expectedBufferSize);
/// Reads back the content of `buffer` and compares it against `expectedResult`.
@@ -38,7 +39,7 @@ namespace gfx_test
gfx::IDevice* device,
gfx::ITextureResource* texture,
gfx::ResourceState state,
- float* expectedResult,
+ void* expectedResult,
size_t expectedResultRowPitch,
size_t rowCount);
@@ -65,24 +66,8 @@ namespace gfx_test
expectedBuffer.setCount(bufferSize);
memcpy(expectedBuffer.getBuffer(), expectedResult.begin(), bufferSize);
if (std::is_same<T, float>::value) return compareComputeResultFuzzy(device, buffer, (float*)expectedBuffer.getBuffer(), bufferSize);
- return compareComputeResult(device, buffer, expectedBuffer.getBuffer(), bufferSize);
+ return compareComputeResult(device, buffer, 0, expectedBuffer.getBuffer(), bufferSize);
}
-
-// TODO: Implement compareComputeResultFuzzy() and keep or just directly use compareComputeResult() above and add a second overload for uint/int?
-// template<typename T, Slang::Index count>
-// void compareComputeResult(
-// gfx::IDevice* device,
-// gfx::ITextureResource* texture,
-// gfx::ResourceState state,
-// Slang::Array<T, count> expectedResult)
-// {
-// Slang::List<uint8_t> expectedBuffer;
-// size_t bufferSize = sizeof(T) * count;
-// expectedBuffer.setCount(bufferSize);
-// memcpy(expectedBuffer.getBuffer(), expectedResult.begin(), bufferSize);
-// if (std::is_same<T, float>::value) return compareComputeResultFuzzy(device, buffer, (float*)expectedBuffer.getBuffer(), bufferSize);
-// return compareComputeResult(device, texture, state, expectedBuffer.getBuffer(), bufferSize);
-// }
Slang::ComPtr<gfx::IDevice> createTestingDevice(UnitTestContext* context, Slang::RenderApiFlag::Enum api);