nir: Add load_coefficients_agx intrinsic
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 3 Aug 2023 17:33:54 +0000 (13:33 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Aug 2023 09:50:11 +0000 (09:50 +0000)
For lowering interpolation.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24498>

src/compiler/nir/nir_intrinsics.py
src/compiler/nir/nir_print.c

index 980cb61..47c9662 100644 (file)
@@ -1655,6 +1655,15 @@ store("tlb_sample_color_v3d", [1], [BASE, COMPONENT, SRC_TYPE], [])
 # the target framebuffer
 intrinsic("load_fb_layers_v3d", dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER])
 
+# Load the coefficient register corresponding to a given fragment shader input.
+# Coefficient registers are vec3s that are dotted with <x, y, 1> to interpolate
+# the input, where x and y are relative to the 32x32 supertile.
+intrinsic("load_coefficients_agx",
+          bit_sizes = [32],
+          dest_comp = 3,
+          indices=[COMPONENT, IO_SEMANTICS, INTERP_MODE],
+          flags=[CAN_ELIMINATE, CAN_REORDER])
+
 # Load/store a pixel in local memory. This operation is formatted, with
 # conversion between the specified format and the implied register format of the
 # source/destination (for store/loads respectively). This mostly matters for
index a50da9e..1fb5e49 100644 (file)
@@ -1200,6 +1200,7 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
          case nir_intrinsic_load_interpolated_input:
          case nir_intrinsic_load_per_vertex_input:
          case nir_intrinsic_load_input_vertex:
+         case nir_intrinsic_load_coefficients_agx:
             mode = nir_var_shader_in;
             break;