Skip to content
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

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

pixelcluster
Copy link
Contributor

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
Copy link
Owner

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));
Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Owner

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.

renderdoc/driver/vulkan/wrappers/vk_shader_funcs.cpp Outdated Show resolved Hide resolved
@pixelcluster pixelcluster force-pushed the rt-pipeline-replay-fix branch from 22dd0f9 to 27fc6ee Compare December 10, 2024 14:26
This is required for RT pipelines when capture/replay handles are used,
both during capture and replay.
@pixelcluster pixelcluster force-pushed the rt-pipeline-replay-fix branch from 27fc6ee to 3b9b5ad Compare December 10, 2024 14:56
@baldurk baldurk merged commit eab7751 into baldurk:v1.x Dec 10, 2024
16 checks passed
@pixelcluster pixelcluster deleted the rt-pipeline-replay-fix branch December 10, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants