Module: Mesa
Branch: main
Commit: 227300345ed38377190b0eaf08694d5c42ee7e60
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=227300345ed38377190b0eaf08694d5c42ee7e60

Author: Chia-I Wu <olva...@gmail.com>
Date:   Wed Nov  1 17:53:44 2023 -0700

radv: stop using vk_render_pass_state::render_pass

vk_render_pass_state::pipeline_flags is derived from
vk_get_pipeline_rendering_flags and has the info we need.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10074
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26000>

---

 src/amd/vulkan/radv_pipeline_graphics.c | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline_graphics.c 
b/src/amd/vulkan/radv_pipeline_graphics.c
index 72ed9697f13..433f21ad466 100644
--- a/src/amd/vulkan/radv_pipeline_graphics.c
+++ b/src/amd/vulkan/radv_pipeline_graphics.c
@@ -296,16 +296,11 @@ static bool
 radv_pipeline_uses_vrs_attachment(const struct radv_graphics_pipeline 
*pipeline,
                                   const struct vk_graphics_pipeline_state 
*state)
 {
-   VK_FROM_HANDLE(vk_render_pass, render_pass, state->rp->render_pass);
+   VkPipelineCreateFlags2KHR create_flags = pipeline->base.create_flags;
+   if (state->rp)
+      create_flags |= state->rp->pipeline_flags;
 
-   if (render_pass) {
-      uint32_t subpass_idx = state->rp->subpass;
-      struct vk_subpass *subpass = &render_pass->subpasses[subpass_idx];
-
-      return !!subpass->fragment_shading_rate_attachment;
-   }
-
-   return (pipeline->base.create_flags & 
VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR) != 0;
+   return (create_flags & 
VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR) != 0;
 }
 
 static void
@@ -824,21 +819,11 @@ static bool
 radv_pipeline_uses_ds_feedback_loop(const struct radv_graphics_pipeline 
*pipeline,
                                     const struct vk_graphics_pipeline_state 
*state)
 {
-   VK_FROM_HANDLE(vk_render_pass, render_pass, state->rp->render_pass);
-
-   if (render_pass) {
-      uint32_t subpass_idx = state->rp->subpass;
-      struct vk_subpass *subpass = &render_pass->subpasses[subpass_idx];
-      struct vk_subpass_attachment *ds_att = subpass->depth_stencil_attachment;
-
-      for (uint32_t i = 0; i < subpass->input_count; i++) {
-         if (ds_att && ds_att->attachment == 
subpass->input_attachments[i].attachment) {
-            return true;
-         }
-      }
-   }
+   VkPipelineCreateFlags2KHR create_flags = pipeline->base.create_flags;
+   if (state->rp)
+      create_flags |= state->rp->pipeline_flags;
 
-   return (pipeline->base.create_flags & 
VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT) != 0;
+   return (create_flags & 
VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT) != 0;
 }
 
 static void

Reply via email to