Module: Mesa
Branch: staging/22.3
Commit: 965833d45888fb63cf61a0873df6ecebc824865f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=965833d45888fb63cf61a0873df6ecebc824865f

Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Jan 19 15:35:17 2023 -0500

zink: don't use ds3 blend states without color attachments

this is illegal and causes validation errors

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20799>
(cherry picked from commit 5d44318566613cea529858a6487f9ce625cd37d9)

---

 .pick_status.json                        |  2 +-
 src/gallium/drivers/zink/zink_pipeline.c | 16 ++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0aaa6f1e324..2923ae8fb51 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -274,7 +274,7 @@
         "description": "zink: don't use ds3 blend states without color 
attachments",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/zink/zink_pipeline.c 
b/src/gallium/drivers/zink/zink_pipeline.c
index 68e27f1e690..12869a7ccc6 100644
--- a/src/gallium/drivers/zink/zink_pipeline.c
+++ b/src/gallium/drivers/zink/zink_pipeline.c
@@ -256,9 +256,11 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
             dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT;
             if (screen->info.feats.features.alphaToOne)
                dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT;
-            dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT;
-            dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT;
-            dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT;
+            if (state->rendering_info.colorAttachmentCount) {
+               dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT;
+               dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT;
+               dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT;
+            }
          }
       }
    }
@@ -472,9 +474,11 @@ zink_create_gfx_pipeline_output(struct zink_screen 
*screen, struct zink_gfx_pipe
          dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT;
          if (screen->info.feats.features.alphaToOne)
             dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT;
-         dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT;
-         dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT;
-         dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT;
+         if (state->rendering_info.colorAttachmentCount) {
+            dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT;
+            dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT;
+            dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT;
+         }
       }
    } else {
       if (state->blend_state) {

Reply via email to