pvr: Correctly read dynamic state setup during blend constant setup
authorMatt Coster <matt.coster@imgtec.com>
Fri, 9 Jun 2023 15:53:59 +0000 (16:53 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 23 Jun 2023 15:38:43 +0000 (15:38 +0000)
Somewhat counterintuitively, dynamic_state.set contains the bits that
have been loaded from static state, i.e. those that are _not_ dynamic.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23590>

src/imagination/vulkan/pvr_pipeline.c

index f26500f..ae26b9b 100644 (file)
@@ -1611,17 +1611,15 @@ static bool pvr_blend_factor_requires_consts(VkBlendFactor factor)
 static bool pvr_graphics_pipeline_requires_dynamic_blend_consts(
    const struct pvr_graphics_pipeline *gfx_pipeline)
 {
-   const bool has_dynamic_blend_consts =
-      BITSET_TEST(gfx_pipeline->dynamic_state.set,
-                  MESA_VK_DYNAMIC_CB_BLEND_CONSTANTS);
+   const struct vk_dynamic_graphics_state *const state =
+      &gfx_pipeline->dynamic_state;
 
-   if (!has_dynamic_blend_consts)
+   if (BITSET_TEST(state->set, MESA_VK_DYNAMIC_CB_BLEND_CONSTANTS))
       return false;
 
-   for (uint32_t i = 0; i < gfx_pipeline->dynamic_state.cb.attachment_count;
-        i++) {
+   for (uint32_t i = 0; i < state->cb.attachment_count; i++) {
       const struct vk_color_blend_attachment_state *attachment =
-         &gfx_pipeline->dynamic_state.cb.attachments[i];
+         &state->cb.attachments[i];
 
       const bool has_color_write =
          attachment->write_mask &