From 9dd616f08a565050ee1057a6ccead4a0125137d2 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Thu, 11 Nov 2021 18:18:38 +0100 Subject: [PATCH] Fix strided device address regions in RT misc tests Some strided device address regions in ray tracing misc tests were being created with the wrong size, not taking into account some tests were storing several shader group handles in the binding tables. In addition, this commit also fixes several validation errors in these tests, related to bad sizes when flusing allocations and unaligned strides in strided device address regions, which needed to be rounded up. Affected tests: dEQP-VK.ray_tracing_pipeline.misc.* Components: Vulkan VK-GL-CTS issue: 3280 Change-Id: I7d20c347ff44b455547115d1a6b94c5d69a46c2c --- .../ray_tracing/vktRayTracingMiscTests.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingMiscTests.cpp b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingMiscTests.cpp index 1acef427f..db15155d6 100644 --- a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingMiscTests.cpp +++ b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingMiscTests.cpp @@ -8260,11 +8260,7 @@ de::MovePtr RayTracingMiscTestInstance::runTest(void) resultBufferDataVec.data(), resultBufferDataVec.size() ); - flushMappedMemoryRange( deviceInterface, - deviceVk, - resultBufferPtr->getAllocation().getMemory(), - resultBufferPtr->getAllocation().getOffset(), - resultBufferSize); + flushAlloc(deviceInterface, deviceVk, resultBufferPtr->getAllocation()); } } @@ -8361,18 +8357,22 @@ de::MovePtr RayTracingMiscTestInstance::runTest(void) { const auto nTraceRaysInvocationsNeeded = m_testPtr->getNTraceRayInvocationsNeeded(); + const auto handleSize = m_rayTracingPropsPtr->getShaderGroupHandleSize(); + const auto missStride = de::roundUp(handleSize + m_testPtr->getShaderRecordSize(ShaderGroups::MISS_GROUP), handleSize); + const auto hitStride = de::roundUp(handleSize + m_testPtr->getShaderRecordSize(ShaderGroups::HIT_GROUP), handleSize); + const auto callStride = de::roundUp(handleSize + m_testPtr->getShaderRecordSize(ShaderGroups::FIRST_CALLABLE_GROUP), handleSize); const auto raygenShaderBindingTableRegion = makeStridedDeviceAddressRegionKHR(getBufferDeviceAddress( deviceInterface, deviceVk, raygenShaderBindingTablePtr->get(), 0 /* offset */), - m_rayTracingPropsPtr->getShaderGroupHandleSize(), - m_rayTracingPropsPtr->getShaderGroupHandleSize() ); + handleSize, + handleSize); const auto missShaderBindingTableRegion = ((nMissGroups > 0u) ? makeStridedDeviceAddressRegionKHR(getBufferDeviceAddress( deviceInterface, deviceVk, missShaderBindingTablePtr->get(), 0 /* offset */), - m_rayTracingPropsPtr->getShaderGroupHandleSize() + m_testPtr->getShaderRecordSize(ShaderGroups::MISS_GROUP), - m_rayTracingPropsPtr->getShaderGroupHandleSize()) + missStride, + missStride * nMissGroups) : makeStridedDeviceAddressRegionKHR(DE_NULL, 0, /* stride */ 0 /* size */)); @@ -8380,8 +8380,8 @@ de::MovePtr RayTracingMiscTestInstance::runTest(void) deviceVk, hitShaderBindingTablePtr->get(), 0 /* offset */), - m_rayTracingPropsPtr->getShaderGroupHandleSize() + m_testPtr->getShaderRecordSize(ShaderGroups::HIT_GROUP), - m_rayTracingPropsPtr->getShaderGroupHandleSize() ) + hitStride, + hitStride * nHitGroups) : makeStridedDeviceAddressRegionKHR(DE_NULL, 0, /* stride */ 0 /* size */)); @@ -8390,8 +8390,8 @@ de::MovePtr RayTracingMiscTestInstance::runTest(void) deviceVk, callableShaderBindingTablePtr->get(), 0 /* offset */), - m_rayTracingPropsPtr->getShaderGroupHandleSize(), /* stride */ - (m_rayTracingPropsPtr->getShaderGroupHandleSize() + m_testPtr->getShaderRecordSize(ShaderGroups::FIRST_CALLABLE_GROUP) ) * static_cast(callableShaderCollectionNames.size() ) ) + callStride, /* stride */ + callStride * static_cast(callableShaderCollectionNames.size() ) ) : makeStridedDeviceAddressRegionKHR(DE_NULL, 0, /* stride */ 0 /* size */); -- 2.34.1