From b9789ae45a54852bcf21dd1c653eac1ae83e725f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 13 Jun 2021 11:28:59 -0400 Subject: [PATCH] asahi: Wire in tgsi_to_nir Gets GALLIUM_HUD working. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 6155a9f..d4a13ec 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -36,6 +36,7 @@ #include "gallium/auxiliary/util/u_viewport.h" #include "gallium/auxiliary/util/u_blend.h" #include "gallium/auxiliary/tgsi/tgsi_from_mesa.h" +#include "gallium/auxiliary/nir/tgsi_to_nir.h" #include "compiler/nir/nir.h" #include "asahi/compiler/agx_compile.h" #include "agx_state.h" @@ -754,7 +755,7 @@ static bool asahi_shader_key_equal(const void *a, const void *b) } static void * -agx_create_shader_state(struct pipe_context *ctx, +agx_create_shader_state(struct pipe_context *pctx, const struct pipe_shader_state *cso) { struct agx_uncompiled_shader *so = CALLOC_STRUCT(agx_uncompiled_shader); @@ -762,9 +763,12 @@ agx_create_shader_state(struct pipe_context *ctx, if (!so) return NULL; - /* TGSI unsupported */ - assert(cso->type == PIPE_SHADER_IR_NIR); - so->nir = cso->ir.nir; + if (cso->type == PIPE_SHADER_IR_NIR) { + so->nir = cso->ir.nir; + } else { + assert(cso->type == PIPE_SHADER_IR_TGSI); + so->nir = tgsi_to_nir(cso->tokens, pctx->screen, false); + } so->variants = _mesa_hash_table_create(NULL, asahi_shader_key_hash, asahi_shader_key_equal); return so; -- 2.7.4