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

Author: Chad Versace <[email protected]>
Date:   Mon May 23 16:53:24 2022 -0700

venus/pipeline: Fix ignore rule for pColorBlendState

The ignore logic was too eager. We must inspect the subpass.

Signed-off-by: Chad Versace <[email protected]>
Reviewed-by: Yiwei Zhang <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16681>

---

 src/virtio/vulkan/vn_pipeline.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/virtio/vulkan/vn_pipeline.c b/src/virtio/vulkan/vn_pipeline.c
index 38f118ffd7c..1a6ff68bde2 100644
--- a/src/virtio/vulkan/vn_pipeline.c
+++ b/src/virtio/vulkan/vn_pipeline.c
@@ -252,11 +252,7 @@ struct vn_graphics_pipeline_create_info_fix {
    bool ignore_viewport_state;
    bool ignore_multisample_state;
    bool ignore_depth_stencil_state;
-
-   /* Ignore the following:
-    *    pColorBlendState
-    */
-   bool ignore_raster_dedicated_states;
+   bool ignore_color_blend_state;
 };
 
 /** Temporary storage for fixes in vkCreateGraphicsPipelines. */
@@ -379,7 +375,7 @@ vn_fix_graphics_pipeline_create_info(
           info->pRasterizationState->rasterizerDiscardEnable == VK_FALSE);
 
       /* VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT */
-      const bool UNUSED has_fragment_shader_state = has_raster_state;
+      const bool has_fragment_shader_state = has_raster_state;
 
       /* VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT */
       const bool has_fragment_output_state = has_raster_state;
@@ -425,13 +421,17 @@ vn_fix_graphics_pipeline_create_info(
          }
       }
 
-      /* FIXME: Conditions for ignoring
-       * pColorBlendState miss some cases that depend on the render pass. Make
-       * them agree with the VUIDs.
+      /* Ignore pColorBlendState?
+       *    VUID-VkGraphicsPipelineCreateInfo-renderPass-06044
        */
-      if (!has_raster_state && info->pColorBlendState) {
-         fix.ignore_raster_dedicated_states = true;
-         any_fix = true;
+      if (info->pColorBlendState) {
+         const bool has_static_attachment =
+            subpass && subpass->has_color_attachment;
+
+         if (!has_fragment_output_state || !has_static_attachment) {
+            fix.ignore_color_blend_state = true;
+            any_fix = true;
+         }
       }
 
       if (!any_fix)
@@ -459,9 +459,8 @@ vn_fix_graphics_pipeline_create_info(
       if (fix.ignore_depth_stencil_state)
          fixes->create_infos[i].pDepthStencilState = NULL;
 
-      if (fix.ignore_raster_dedicated_states) {
+      if (fix.ignore_color_blend_state)
          fixes->create_infos[i].pColorBlendState = NULL;
-      }
    }
 
    if (!fixes)

Reply via email to