zink: move dynamic state2 pipeline state to substruct in pipeline state

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15328>
This commit is contained in:
Mike Blumenkrantz 2022-03-07 15:09:56 -05:00 committed by Marge Bot
parent d1f12b1924
commit ae4bdea73e
4 changed files with 9 additions and 7 deletions

View 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)

View 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;
}
}

View 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;

View 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)) &&