From ac9d98b2b460e97113cfc63bfc283422c133f222 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Thu, 7 Oct 2021 17:30:10 +0200 Subject: [PATCH] tests: Verify that we can use UPDATE mode in PrebuildInfo. As expected, the flag is ignored unless we're actually building. Signed-off-by: Hans-Kristian Arntzen --- tests/d3d12_raytracing.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/d3d12_raytracing.c b/tests/d3d12_raytracing.c index 80599629..620432c7 100644 --- a/tests/d3d12_raytracing.c +++ b/tests/d3d12_raytracing.c @@ -432,6 +432,31 @@ static void create_acceleration_structure(struct raytracing_test_context *contex else rtas->scratch_update = NULL; + /* Verify how the build mode behaves here. */ + { + D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS tmp_inputs = *inputs; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO tmp_prebuild_info; + + /* We should ignore this flag when querying prebuild info. + * Deduced by: Equal sizes, no validation errors. + * Vulkan does not seem to care either, and this trips validation + * errors in neither D3D12 nor Vulkan. */ + tmp_inputs.Flags |= D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE; + ID3D12Device5_GetRaytracingAccelerationStructurePrebuildInfo(context->device5, &tmp_inputs, &tmp_prebuild_info); + ok(tmp_prebuild_info.ResultDataMaxSizeInBytes == prebuild_info.ResultDataMaxSizeInBytes, + "Size mismatch, %"PRIu64" != %"PRIu64".\n", + tmp_prebuild_info.ResultDataMaxSizeInBytes, + prebuild_info.ResultDataMaxSizeInBytes); + ok(tmp_prebuild_info.ScratchDataSizeInBytes == prebuild_info.ScratchDataSizeInBytes, + "Size mismatch, %"PRIu64" != %"PRIu64".\n", + tmp_prebuild_info.ScratchDataSizeInBytes, + prebuild_info.ScratchDataSizeInBytes); + ok(tmp_prebuild_info.UpdateScratchDataSizeInBytes == prebuild_info.UpdateScratchDataSizeInBytes, + "Size mismatch, %"PRIu64" != %"PRIu64".\n", + tmp_prebuild_info.UpdateScratchDataSizeInBytes, + prebuild_info.UpdateScratchDataSizeInBytes); + } + rtas->rtas = create_default_buffer(context->context.device, prebuild_info.ResultDataMaxSizeInBytes, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS,