Mesa (main): venus: check dynamic state for raster enablement

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 20 01:59:36 UTC 2022


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

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Sat Jul 16 16:20:48 2022 +0000

venus: check dynamic state for raster enablement

We should not scrub raster dedicated states when dynamic state includes
VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE.

Test:
- dEQP-VK.pipeline.extended_dynamic_state.*_raster
- dEQP-VK.api.pipeline.pipeline_invalid_pointers_unused_structs.graphics

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17582>

---

 src/virtio/vulkan/vn_pipeline.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/virtio/vulkan/vn_pipeline.c b/src/virtio/vulkan/vn_pipeline.c
index 2c2ab4a9df6..b16ec9000f6 100644
--- a/src/virtio/vulkan/vn_pipeline.c
+++ b/src/virtio/vulkan/vn_pipeline.c
@@ -277,8 +277,8 @@ vn_fix_graphics_pipeline_create_info(
       bool any_fix = false;
 
       VkShaderStageFlags stages = 0;
-      for (uint32_t i = 0; i < info->stageCount; ++i) {
-         stages |= info->pStages[i].stage;
+      for (uint32_t j = 0; j < info->stageCount; j++) {
+         stages |= info->pStages[j].stage;
       }
 
       /* Fix pTessellationState?
@@ -291,13 +291,25 @@ vn_fix_graphics_pipeline_create_info(
          any_fix = true;
       }
 
+      bool ignore_raster_dedicated_states =
+         !info->pRasterizationState ||
+         info->pRasterizationState->rasterizerDiscardEnable == VK_TRUE;
+      if (ignore_raster_dedicated_states && info->pDynamicState) {
+         for (uint32_t j = 0; j < info->pDynamicState->dynamicStateCount;
+              j++) {
+            if (info->pDynamicState->pDynamicStates[j] ==
+                VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE) {
+               ignore_raster_dedicated_states = false;
+               break;
+            }
+         }
+      }
+
       /* FIXME: Conditions for ignoring pDepthStencilState and
        * pColorBlendState miss some cases that depend on the render pass. Make
        * them agree with the VUIDs.
-       *
-       * TODO: Update conditions for VK_EXT_extended_dynamic_state2.
        */
-      if (info->pRasterizationState->rasterizerDiscardEnable == VK_TRUE &&
+      if (ignore_raster_dedicated_states &&
           (info->pViewportState || info->pMultisampleState ||
            info->pDepthStencilState || info->pColorBlendState)) {
          fix.ignore_raster_dedicated_states = true;



More information about the mesa-commit mailing list