zink: hash blend state pointers on creation

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12660>
This commit is contained in:
Mike Blumenkrantz 2021-06-17 16:05:00 -04:00 committed by Marge Bot
parent 9ab4bfcb53
commit 75ed571921
3 changed files with 6 additions and 1 deletions

View File

@ -46,7 +46,7 @@ struct zink_gfx_pipeline_state {
VkSampleMask sample_mask;
unsigned rp_state;
struct zink_blend_state *blend_state;
uint32_t blend_id;
/* Pre-hashed value for table lookup, invalid when zero.
* Members after this point are not included in pipeline state hash key */
@ -74,6 +74,7 @@ struct zink_gfx_pipeline_state {
bool sample_locations_enabled;
bool have_EXT_extended_dynamic_state;
bool have_EXT_extended_dynamic_state2;
struct zink_blend_state *blend_state;
struct zink_render_pass *render_pass;
VkPipeline pipeline;
uint8_t patch_vertices;

View File

@ -251,6 +251,7 @@ zink_create_blend_state(struct pipe_context *pctx,
struct zink_blend_state *cso = CALLOC_STRUCT(zink_blend_state);
if (!cso)
return NULL;
cso->hash = _mesa_hash_pointer(cso);
if (blend_state->logicop_enable) {
cso->logicop_enable = VK_TRUE;
@ -313,9 +314,11 @@ zink_bind_blend_state(struct pipe_context *pctx, void *cso)
{
struct zink_context *ctx = zink_context(pctx);
struct zink_gfx_pipeline_state* state = &zink_context(pctx)->gfx_pipeline_state;
struct zink_blend_state *blend = cso;
if (state->blend_state != cso) {
state->blend_state = cso;
state->blend_id = blend ? blend->hash : 0;
state->dirty = true;
ctx->blend_state_changed = true;
}

View File

@ -79,6 +79,7 @@ struct zink_rasterizer_state {
};
struct zink_blend_state {
uint32_t hash;
VkPipelineColorBlendAttachmentState attachments[PIPE_MAX_COLOR_BUFS];
VkBool32 logicop_enable;