From f2179ed4f33d66cefe0f607c048cb6d89a7e979a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 4 May 2021 22:20:39 -0400 Subject: [PATCH] asahi: Augment Gallium key with blend state Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 13 ++++++++----- src/gallium/drivers/asahi/agx_state.h | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index d8875e5c87e..4dfdf366862 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -606,7 +606,7 @@ agx_create_shader_state(struct pipe_context *ctx, static bool agx_update_shader(struct agx_context *ctx, struct agx_compiled_shader **out, - enum pipe_shader_type stage, struct agx_shader_key *key) + enum pipe_shader_type stage, struct asahi_shader_key *key) { struct agx_uncompiled_shader *so = ctx->stage[stage].shader; assert(so != NULL); @@ -626,7 +626,7 @@ agx_update_shader(struct agx_context *ctx, struct agx_compiled_shader **out, util_dynarray_init(&binary, NULL); nir_shader *nir = nir_shader_clone(NULL, so->nir); - agx_compile_shader_nir(nir, key, &binary, &compiled->info); + agx_compile_shader_nir(nir, &key->base, &binary, &compiled->info); /* TODO: emit this properly */ nir_variable_mode varying_mode = (nir->info.stage == MESA_SHADER_FRAGMENT) ? @@ -705,8 +705,11 @@ agx_update_vs(struct agx_context *ctx) key.vbuf_strides[i] = ctx->vertex_buffers[i].stride / 4; // TODO: alignment } - return agx_update_shader(ctx, &ctx->vs, PIPE_SHADER_VERTEX, - (struct agx_shader_key *) &key); + struct asahi_shader_key akey = { + .base.vs = key + }; + + return agx_update_shader(ctx, &ctx->vs, PIPE_SHADER_VERTEX, &akey); } static bool @@ -717,7 +720,7 @@ agx_update_fs(struct agx_context *ctx) }; return agx_update_shader(ctx, &ctx->fs, PIPE_SHADER_FRAGMENT, - (struct agx_shader_key *) &key); + (struct asahi_shader_key *) &key); } static void diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index 9cd84c139de..0cbabbaf2fc 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -107,6 +107,11 @@ struct agx_blend { }; }; +struct asahi_shader_key { + struct agx_shader_key base; + struct agx_blend blend; +}; + #define AGX_DIRTY_VERTEX (1 << 0) struct agx_context {