KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.33k stars 648 forks source link

Fix (non) alignment of shader group handles as returned in calls to `vkGetRayTracing*ShaderGroupHandles*` #964

Open arno-lunarg opened 8 months ago

arno-lunarg commented 8 months ago

It will soon be clarified in the spec that the shader group handles returned in a call to the vkGetRayTracing*ShaderGroupHandles* functions are tightly packed/not aligned. Corresponding Gitlab merge request: https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/6490

I think the only thing that needs to be changed in the ray tracing samples are sbt_size computation, it should use handle_size instead of handle_size_aligned, and the following memory copies that compute offsets using handle_size_aligned.

https://github.com/KhronosGroup/Vulkan-Samples/blob/8ba37b44a693d165c2ab8b9cfdcf1c8774efd407/samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp#L471 https://github.com/KhronosGroup/Vulkan-Samples/blob/8ba37b44a693d165c2ab8b9cfdcf1c8774efd407/samples/extensions/ray_tracing_reflection/ray_tracing_reflection.cpp#L583 https://github.com/KhronosGroup/Vulkan-Samples/blob/8ba37b44a693d165c2ab8b9cfdcf1c8774efd407/samples/extensions/ray_tracing_extended/ray_tracing_extended.cpp#L852