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

Support VK_KHR_dynamic_rendering_local_read #3459

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

ShabbyX
Copy link
Contributor

@ShabbyX ShabbyX commented Oct 24, 2024

Description

VK_KHR_dynamic_rendering_local_read (DRLR) closes the gap left by VK_KHR_dynamic_rendering (DR) where input attachments couldn't be used. As the Vulkan API moves towards dynamic rendering, usage of DRLR will increase and DR will eventually replace now-legacy VkRenderPass objects.

This change adds support for DRLR to RenderDoc. At a high level, DRLR allows the render pass color attachments to be mapped to "locations". Since the rest of the API does not use these remapped locations (notably, blend and vkCmdClearAttachments use the attachment index), I opted for RenderDoc to continue referencing the attachment by its index in the UI. However, where location matters (i.e. connection to the shader), the mapping is specified in the UI:

image

Additionally, an attachment can be mapped to VK_ATTACHMENT_UNUSED, in which case writes to it are automatically disabled. In this case, RenderDoc would tag the attachment as [disabled] and automatically set the Write Mask to ____:

image

DRLR additionally includes a mapping of attachments to InputAttachmentIndex decorations in the shader. For depth/stencil, the shader is no longer required to specify this decoration at all, in which case the corresponding API (VkRenderingInputAttachmentIndexInfoKHR) would also specify nullptr for the mapping. If VK_ATTACHMENT_UNUSED is specified in the mapping, the attachment is not expected to be used as input attachment. In the code, an additional flag for depth and stencil is present to differentiate between nullptr and VK_ATTACHMENT_UNUSED, with the format being an "implicit" mapping.

Notably, RenderDoc does not actually care about input attachment indices, but rather uses set/binding information to read from input attachments (e.g. during shader debugging), so the input index mapping information only ends up being used for the html export from the pipeline tab.

Fixes #3341

@ShabbyX ShabbyX force-pushed the VK_KHR_dynamic_rendering_local_read branch from 85017c0 to 6fbacc5 Compare October 24, 2024 06:19
@ShabbyX
Copy link
Contributor Author

ShabbyX commented Oct 24, 2024

@Themaister the Pipeline State tab also has an "Export to Fossilize database" functionality. Is there something I need to manually implement for that?

@ShabbyX ShabbyX force-pushed the VK_KHR_dynamic_rendering_local_read branch 3 times, most recently from 6b0ae12 to 074b46e Compare October 25, 2024 21:07
renderdoc/driver/vulkan/extension_support.md Outdated Show resolved Hide resolved
renderdoc/api/replay/vk_pipestate.h Outdated Show resolved Hide resolved
renderdoc/driver/vulkan/vk_common.h Outdated Show resolved Hide resolved
renderdoc/driver/vulkan/vk_pixelhistory.cpp Show resolved Hide resolved
renderdoc/driver/vulkan/vk_pixelhistory.cpp Outdated Show resolved Hide resolved
renderdoc/driver/vulkan/vk_state.h Outdated Show resolved Hide resolved
renderdoc/driver/vulkan/wrappers/vk_dynamic_funcs.cpp Outdated Show resolved Hide resolved
renderdoc/driver/vulkan/wrappers/vk_dynamic_funcs.cpp Outdated Show resolved Hide resolved
@ShabbyX ShabbyX force-pushed the VK_KHR_dynamic_rendering_local_read branch 3 times, most recently from 7aa28ab to f1850d0 Compare October 28, 2024 20:28
@ShabbyX ShabbyX requested a review from baldurk October 28, 2024 21:02
@ShabbyX ShabbyX force-pushed the VK_KHR_dynamic_rendering_local_read branch from f1850d0 to c65fa37 Compare October 28, 2024 22:19
Copy link
Owner

@baldurk baldurk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now - I've left a couple of minor tweaks remaining and one explanation of the command buffer things that you were unsure of in case you want the info.

renderdoc/driver/vulkan/vk_stringise.cpp Outdated Show resolved Hide resolved
renderdoc/driver/vulkan/vk_pixelhistory.cpp Outdated Show resolved Hide resolved
renderdoc/api/replay/vk_pipestate.h Show resolved Hide resolved
renderdoc/driver/vulkan/vk_replay.cpp Show resolved Hide resolved
renderdoc/api/replay/vk_pipestate.h Outdated Show resolved Hide resolved
@ShabbyX ShabbyX force-pushed the VK_KHR_dynamic_rendering_local_read branch from c65fa37 to c4f968f Compare November 1, 2024 19:47
@ShabbyX ShabbyX requested a review from baldurk November 1, 2024 19:49
@ShabbyX ShabbyX force-pushed the VK_KHR_dynamic_rendering_local_read branch from c4f968f to 06e48e3 Compare November 4, 2024 16:28
@ShabbyX ShabbyX requested a review from baldurk November 4, 2024 16:28
@baldurk baldurk merged commit 76b6d47 into baldurk:v1.x Nov 4, 2024
16 checks passed
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.

Please consider adding support for VK_KHR_dynamic_rendering_local_read
2 participants