[Mesa-dev] [PATCH 1/9] nir: Add a new intrinsic 'image_deref_load_param_ir3'

Eduardo Lima Mitev elima at igalia.com
Wed Feb 13 21:29:48 UTC 2019


This is a freedreno specific intrinsic intended to be injected by a
'ir3_nir_lower_sampler_io' pass that will be introduced later in this
series, and consumed by ir3_compiler_nir.

The intrinsic will load-in SSA values for various image constants
(from image_dims), namely the format's bytes-per-pixel, y-stride and
z-stride; for which the backend compiler will emit the corresponding
uniforms.

The single source src0 is the image deref.

const_index[0] is the index into image_dims' register file for
a given image: 0 for bpp, 1 for y-stride and 2 for z-stride.
---
 src/compiler/nir/nir_intrinsics.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py
index 90d347f7331..f79a8cebc54 100644
--- a/src/compiler/nir/nir_intrinsics.py
+++ b/src/compiler/nir/nir_intrinsics.py
@@ -644,3 +644,18 @@ store("shared", 2, [BASE, WRMASK, ALIGN_MUL, ALIGN_OFFSET])
 # src[] = { value, address }.
 # const_index[] = { write_mask, align_mul, align_offset }
 store("global", 2, [WRMASK, ACCESS, ALIGN_MUL, ALIGN_OFFSET])
+
+
+# IR3-specifc query for loading image parameters at shader compile-time
+# (bytes-per-pixel, y-stride and z-stride), that will be emitted as
+# uniforms during shader run-time.
+#
+# src0 is the image deref. const-index[0] represents the specific
+# parameter being loaded (in ir3 compiler context, it is the offset
+# into image_dims register file): 0 for BPP, 1 for y-stride and 2 for
+# z-stride.
+#
+# @FIXME: Should this be merged with 'image_deref_load_param_intel'?
+# Both seem semantically similar.
+intrinsic("image_deref_load_param_ir3", src_comp=[1], dest_comp=0,
+          indices=[BASE], flags=[CAN_ELIMINATE, CAN_REORDER])
-- 
2.20.1



More information about the mesa-dev mailing list