diff options
author | Chad Versace <[email protected]> | 2015-08-28 07:57:34 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2015-08-28 07:57:34 -0700 |
commit | aacb7bb9b6080ac6a0c9166d5a5b615c6425b821 (patch) | |
tree | 7ead7b72c5a93455d718cab5d7f49838cc072aea /src/vulkan/anv_cmd_buffer.c | |
parent | 641c25dd5505333ae4d260c6e821249c1be6da65 (diff) |
vk: Add func anv_cmd_buffer_get_depth_stencil_view()
This function removes some duplicated code from
genN_cmd_buffer_emit_depth_stencil().
Diffstat (limited to 'src/vulkan/anv_cmd_buffer.c')
-rw-r--r-- | src/vulkan/anv_cmd_buffer.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 963edcf06ca..f8a630bece5 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -783,3 +783,23 @@ VkResult anv_ResetCommandPool( return VK_SUCCESS; } + +/** + * Return NULL if the current subpass has no depthstencil attachment. + */ +const struct anv_depth_stencil_view * +anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer) +{ + const struct anv_subpass *subpass = cmd_buffer->state.subpass; + const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer; + + if (subpass->depth_stencil_attachment == VK_ATTACHMENT_UNUSED) + return NULL; + + const struct anv_attachment_view *aview = + fb->attachments[subpass->depth_stencil_attachment]; + + assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL); + + return (const struct anv_depth_stencil_view *) aview; +} |