-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set RT pipeline capture/replay flags and features #3499
Conversation
Required for using capture/replay shader handles.
@@ -89,6 +89,23 @@ static RDResult DeferredPipelineCompile(VkDevice device, | |||
VkRayTracingPipelineCreateInfoKHR *unwrapped = | |||
UnwrapStructAndChain(CaptureState::LoadingReplaying, mem, &createInfo); | |||
|
|||
// Patch in capture/replay creation flags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this the same way as we handle capture/replay bits for BDA: Patch it into the serialised form during capture rather than doing it independently on replay.
// deferred operations are currently not wrapped | ||
SERIALISE_TIME_CALL(ret = ObjDisp(device)->CreateRayTracingPipelinesKHR( | ||
Unwrap(device), VK_NULL_HANDLE, Unwrap(pipelineCache), createInfoCount, | ||
UnwrapInfos(m_State, pCreateInfos, createInfoCount), NULL, pPipelines)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically below here where we already have modifiedCreateInfo
you'd want to apply a similar kind of patching to add the necessary flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started on this, but it's actually a bit more complicated than the existing modifiedCreateInfo
patching. We need to patch any VkPipelineCreateFlags2CreateInfoKHR
if it exists, which by extension means we need to patch the entire pNext
chain (or at least, all elements of it up until VkPipelineCreateFlags2CreateInfoKHR
). I'm not sure how to go about that properly?
For what it's worth, it seems like the current code is buggy in that regard since the derivative pipeline check also only considers the flags from the pipeline create info itself, not of any potential VkPipelineCreateFlags2CreateInfoKHR
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You actually make a very good point about the derivative check. It made me go to check - that flags2 struct is added in KHR_maintenance5 which RenderDoc does not currently support, the existing code was copied from pre-existing handling on normal pipelines.
So none of this handling is needed yet, and the code is not currently buggy (just lacking support). The new code you've added is fine to sttay as it's illegal for any application to do pass the struct in anyway, and it will be correct for the future.
Unfortunately the next-chain pattern in general is extremely annoying when it comes to patching... I have helpers for copying a whole chain to patch it but it gets messy quickly.
22dd0f9
to
27fc6ee
Compare
This is required for RT pipelines when capture/replay handles are used, both during capture and replay.
27fc6ee
to
3b9b5ad
Compare
Without this, capture/replaying RT pipelines hangs or crashes on RADV.
Adding
VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR
is required for capture by https://registry.khronos.org/vulkan/specs/latest/man/html/vkGetRayTracingCaptureReplayShaderGroupHandlesKHR.html#VUID-vkGetRayTracingCaptureReplayShaderGroupHandlesKHR-pipeline-03607 and for replay by https://registry.khronos.org/vulkan/specs/latest/man/html/VkRayTracingPipelineCreateInfoKHR.html#VUID-VkRayTracingPipelineCreateInfoKHR-rayTracingPipelineShaderGroupHandleCaptureReplay-03599.https://registry.khronos.org/vulkan/specs/latest/man/html/VkRayTracingPipelineCreateInfoKHR.html#VUID-VkRayTracingPipelineCreateInfoKHR-flags-03598 mandates that
rayTracingPipelineShaderGroupHandleCaptureReplay
is enabled.Set the flags and enable the device features accordingly.