zink: move drawid_broken to unhashed pipeline state
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 24 Jun 2021 19:10:49 +0000 (15:10 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Sep 2021 13:03:08 +0000 (13:03 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12660>

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

index bdf8cd5..21c2e65 100644 (file)
@@ -265,8 +265,6 @@ struct zink_context {
    VkSampleLocationEXT vk_sample_locations[PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE * PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE];
    uint8_t sample_locations[2 * 4 * 8 * 16];
 
-   bool drawid_broken;
-
    struct pipe_stencil_ref stencil_ref;
 
    union {
index b454e21..7554f3c 100644 (file)
@@ -445,13 +445,13 @@ zink_draw_vbo(struct pipe_context *pctx,
    uint8_t vertices_per_patch = ctx->gfx_pipeline_state.patch_vertices ? ctx->gfx_pipeline_state.patch_vertices - 1 : 0;
    if (ctx->gfx_pipeline_state.vertices_per_patch != vertices_per_patch)
       ctx->gfx_pipeline_state.dirty = true;
-   bool drawid_broken = ctx->drawid_broken;
-   ctx->drawid_broken = false;
+   bool drawid_broken = ctx->gfx_pipeline_state.drawid_broken;
+   ctx->gfx_pipeline_state.drawid_broken = false;
    if (reads_drawid && (!dindirect || !dindirect->buffer))
-      ctx->drawid_broken = (drawid_offset != 0 ||
+      ctx->gfx_pipeline_state.drawid_broken = (drawid_offset != 0 ||
                            (!HAS_MULTIDRAW && num_draws > 1) ||
                            (HAS_MULTIDRAW && num_draws > 1 && !dinfo->increment_draw_id));
-   if (drawid_broken != ctx->drawid_broken)
+   if (drawid_broken != ctx->gfx_pipeline_state.drawid_broken)
       ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_VERTEX);
    ctx->gfx_pipeline_state.vertices_per_patch = vertices_per_patch;
    if (mode_changed) {
@@ -718,7 +718,7 @@ zink_draw_vbo(struct pipe_context *pctx,
                          offsetof(struct zink_gfx_push_constant, default_inner_level), sizeof(float) * 6,
                          &ctx->tess_levels[0]);
 
-   bool needs_drawid = reads_drawid && ctx->drawid_broken;
+   bool needs_drawid = reads_drawid && ctx->gfx_pipeline_state.drawid_broken;
    work_count += num_draws;
    if (index_size > 0) {
       if (dindirect && dindirect->buffer) {
index 664e671..d4239b0 100644 (file)
@@ -77,6 +77,7 @@ struct zink_gfx_pipeline_state {
    uint8_t has_points; //either gs outputs points or prim type is points
    uint8_t coord_replace_bits;
    bool coord_replace_yinvert;
+   bool drawid_broken;
    struct zink_blend_state *blend_state;
    struct zink_render_pass *render_pass;
    VkPipeline pipeline;
index fbddcd9..253180f 100644 (file)
@@ -115,7 +115,7 @@ shader_key_vs_gen(struct zink_context *ctx, struct zink_shader *zs,
    switch (zs->nir->info.stage) {
    case MESA_SHADER_VERTEX:
       vs_key->last_vertex_stage = !shaders[PIPE_SHADER_TESS_EVAL] && !shaders[PIPE_SHADER_GEOMETRY];
-      vs_key->push_drawid = ctx->drawid_broken;
+      vs_key->push_drawid = ctx->gfx_pipeline_state.drawid_broken;
       break;
    case MESA_SHADER_TESS_EVAL:
       vs_key->last_vertex_stage = !shaders[PIPE_SHADER_GEOMETRY];