From ea3800e115d4ad1ce06ec07689152616f47a0e3d Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Tue, 21 Jun 2022 13:14:18 -0700 Subject: Added a second set of shaders to the ray tracing test and added another test that uses these shaders; Fixed a bug in Vulkan's RayTracingCommandEncoder::dispatchRays() where the supplied raygen shader index wasn't being used (#2290) --- tools/gfx/vulkan/vk-command-encoder.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools/gfx/vulkan/vk-command-encoder.cpp') diff --git a/tools/gfx/vulkan/vk-command-encoder.cpp b/tools/gfx/vulkan/vk-command-encoder.cpp index 00915e0c4..33cd567c7 100644 --- a/tools/gfx/vulkan/vk-command-encoder.cpp +++ b/tools/gfx/vulkan/vk-command-encoder.cpp @@ -1460,14 +1460,15 @@ void RayTracingCommandEncoder::dispatchRays( m_currentPipeline, m_commandBuffer->m_transientHeap, static_cast(this)); + auto shaderTableAddr = shaderTableBuffer->getDeviceAddress(); VkStridedDeviceAddressRegionKHR raygenSBT; - raygenSBT.deviceAddress = shaderTableBuffer->getDeviceAddress(); raygenSBT.stride = VulkanUtil::calcAligned(alignedHandleSize, rtProps.shaderGroupBaseAlignment); + raygenSBT.deviceAddress = shaderTableAddr + raygenShaderIndex * raygenSBT.stride; raygenSBT.size = raygenSBT.stride; VkStridedDeviceAddressRegionKHR missSBT; - missSBT.deviceAddress = raygenSBT.deviceAddress + raygenSBT.size; + missSBT.deviceAddress = shaderTableAddr + shaderTableImpl->m_raygenTableSize; missSBT.stride = alignedHandleSize; missSBT.size = shaderTableImpl->m_missTableSize; -- cgit v1.2.3