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

Author: Jason Ekstrand <[email protected]>
Date:   Wed Jul 20 13:58:44 2022 -0500

vulkan: Fix pipeline libraries with dynamic-only VI or FSR state

When we initialize the graphics pipeline state, we skip VI and FSR state
if they're 100% dynamic.  We need to do this if the current set of
dynamic things contains VI/FSR or if the set of dynamic state already in
the vk_graphics_pipeline_state has them dynamic.  Look state->dynamic
after we've merged instead of just looking at the dynamic set from the
VkGraphicsPipelineCreateInfo we were passed.

Also, when we validate, we need to assume that VI and FSR exist or else
we'll assert if dynamic VI or FSR are set.

Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696>

---

 src/vulkan/runtime/vk_graphics_state.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/vulkan/runtime/vk_graphics_state.c 
b/src/vulkan/runtime/vk_graphics_state.c
index 8c0af803ba8..857cd206fad 100644
--- a/src/vulkan/runtime/vk_graphics_state.c
+++ b/src/vulkan/runtime/vk_graphics_state.c
@@ -979,21 +979,30 @@ vk_dynamic_graphics_state_init_rp(struct 
vk_dynamic_graphics_state *dst,
    f(MESA_VK_GRAPHICS_STATE_RENDER_PASS_BIT,             \
      vk_render_pass_state, rp);
 
-static void
-vk_graphics_pipeline_state_validate(const struct vk_graphics_pipeline_state 
*state)
+static enum mesa_vk_graphics_state_groups
+vk_graphics_pipeline_state_groups(const struct vk_graphics_pipeline_state 
*state)
 {
-#ifndef NDEBUG
    /* For now, we just validate dynamic state */
-   enum mesa_vk_graphics_state_groups has = 0;
+   enum mesa_vk_graphics_state_groups groups = 0;
 
 #define FILL_HAS(STATE, type, s) \
-   if (state->s != NULL) has |= STATE
+   if (state->s != NULL) groups |= STATE
 
    FOREACH_STATE_GROUP(FILL_HAS)
 
 #undef FILL_HAS
 
-   validate_dynamic_state_groups(state->dynamic, has);
+   return groups | fully_dynamic_state_groups(state->dynamic);
+}
+
+static void
+vk_graphics_pipeline_state_validate(const struct vk_graphics_pipeline_state 
*state)
+{
+#ifndef NDEBUG
+   /* For now, we just validate dynamic state */
+   enum mesa_vk_graphics_state_groups groups =
+      vk_graphics_pipeline_state_groups(state);
+   validate_dynamic_state_groups(state->dynamic, groups);
 #endif
 }
 
@@ -1224,7 +1233,7 @@ vk_graphics_pipeline_state_fill(const struct vk_device 
*device,
     * this after we've filtered dynamic state because we still want them to
     * show up in the dynamic state but don't want the actual state.
     */
-   needs &= ~fully_dynamic_state_groups(dynamic);
+   needs &= ~fully_dynamic_state_groups(state->dynamic);
 
    /* If we don't need to set up any new states, bail early */
    if (needs == 0)

Reply via email to