summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/vk-command-encoder.cpp
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2022-06-21 13:14:18 -0700
committerGitHub <noreply@github.com>2022-06-21 13:14:18 -0700
commitea3800e115d4ad1ce06ec07689152616f47a0e3d (patch)
tree16bc7af0da281af5aae7da382abf782c1edc202a /tools/gfx/vulkan/vk-command-encoder.cpp
parent92dfec2320421113498ae7b5b72e78bd8b5b09a8 (diff)
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)
Diffstat (limited to 'tools/gfx/vulkan/vk-command-encoder.cpp')
-rw-r--r--tools/gfx/vulkan/vk-command-encoder.cpp5
1 files changed, 3 insertions, 2 deletions
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<ResourceCommandEncoder*>(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;