From 22f694c008a65d63bb405046f78fd41716c6fa78 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 3 Aug 2023 14:04:24 -0400 Subject: [PATCH] agx: Implement nir_intrinsic_load_coefficients_agx Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 83d830b..a33ece7 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -345,6 +345,22 @@ agx_format_for_pipe(enum pipe_format format) } static void +agx_emit_load_coefficients(agx_builder *b, agx_index dest, + nir_intrinsic_instr *instr) +{ + enum glsl_interp_mode mode = nir_intrinsic_interp_mode(instr); + bool smooth = (mode != INTERP_MODE_FLAT); + bool perspective = smooth && (mode != INTERP_MODE_NOPERSPECTIVE); + + agx_index cf = agx_get_cf(b->shader, smooth, perspective, + nir_intrinsic_io_semantics(instr).location, + nir_intrinsic_component(instr), 1); + + agx_ldcf_to(b, dest, cf, 1); + agx_emit_cached_split(b, dest, 3); +} + +static void agx_emit_load_vary_flat(agx_builder *b, agx_index dest, nir_intrinsic_instr *instr) { @@ -953,6 +969,11 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr) agx_emit_load_vary_flat(b, dst, instr); return NULL; + case nir_intrinsic_load_coefficients_agx: + assert(stage == MESA_SHADER_FRAGMENT); + agx_emit_load_coefficients(b, dst, instr); + return NULL; + case nir_intrinsic_load_agx: case nir_intrinsic_load_constant_agx: agx_emit_load(b, dst, instr); -- 2.7.4