zink: move dynamic state2 pipeline state to substruct in pipeline state
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 7 Mar 2022 20:09:56 +0000 (15:09 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 14 Mar 2022 04:08:29 +0000 (04:08 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15328>

src/gallium/drivers/zink/zink_draw.cpp
src/gallium/drivers/zink/zink_pipeline.c
src/gallium/drivers/zink/zink_pipeline.h
src/gallium/drivers/zink/zink_program.c

index 5c7046d..0a002fc 100644 (file)
@@ -605,9 +605,9 @@ zink_draw(struct pipe_context *pctx,
       VKCTX(CmdBindIndexBuffer)(batch->state->cmdbuf, res->obj->buffer, index_offset, index_type[index_size >> 1]);
    }
    if (DYNAMIC_STATE < ZINK_DYNAMIC_STATE2) {
-      if (ctx->gfx_pipeline_state.primitive_restart != dinfo->primitive_restart)
+      if (ctx->gfx_pipeline_state.dyn_state2.primitive_restart != dinfo->primitive_restart)
          ctx->gfx_pipeline_state.dirty = true;
-      ctx->gfx_pipeline_state.primitive_restart = dinfo->primitive_restart;
+      ctx->gfx_pipeline_state.dyn_state2.primitive_restart = dinfo->primitive_restart;
    }
 
    if (have_streamout && ctx->dirty_so_targets)
index 728b387..791a39e 100644 (file)
@@ -90,12 +90,12 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
       case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
       case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
       case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
-         if (state->primitive_restart)
+         if (state->dyn_state2.primitive_restart)
             debug_printf("restart_index set with unsupported primitive topology %u\n", primitive_topology);
          primitive_state.primitiveRestartEnable = VK_FALSE;
          break;
       default:
-         primitive_state.primitiveRestartEnable = state->primitive_restart ? VK_TRUE : VK_FALSE;
+         primitive_state.primitiveRestartEnable = state->dyn_state2.primitive_restart ? VK_TRUE : VK_FALSE;
       }
    }
 
index 80c851c..76bfcf6 100644 (file)
@@ -60,7 +60,9 @@ struct zink_gfx_pipeline_state {
       unsigned num_viewports;
    } dyn_state1;
 
-   bool primitive_restart; //dynamic state2
+   struct {
+      bool primitive_restart;
+   } dyn_state2;
 
    VkShaderModule modules[PIPE_SHADER_TYPES - 1];
    bool modules_changed;
index db6b178..6dd9f8d 100644 (file)
@@ -213,7 +213,7 @@ hash_gfx_pipeline_state(const void *key)
    const struct zink_gfx_pipeline_state *state = key;
    uint32_t hash = _mesa_hash_data(key, offsetof(struct zink_gfx_pipeline_state, hash));
    if (!state->have_EXT_extended_dynamic_state2)
-      hash = XXH32(&state->primitive_restart, 1, hash);
+      hash = XXH32(&state->dyn_state2, sizeof(state->dyn_state2), hash);
    if (state->have_EXT_extended_dynamic_state)
       return hash;
    return XXH32(&state->dyn_state1, sizeof(state->dyn_state1), hash);
@@ -245,7 +245,7 @@ equals_gfx_pipeline_state(const void *a, const void *b)
          return false;
    }
    if (!sa->have_EXT_extended_dynamic_state2) {
-      if (sa->primitive_restart != sb->primitive_restart)
+      if (sa->dyn_state2.primitive_restart != sb->dyn_state2.primitive_restart)
          return false;
    }
    return !memcmp(sa->modules, sb->modules, sizeof(sa->modules)) &&