summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_intrinsics.c
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2016-01-13 18:43:14 -0500
committerRob Clark <robclark@freedesktop.org>2016-02-09 17:30:33 -0500
commit1df3ecc1b87d95130165283154a13ea5b9a498d4 (patch)
treed007d515e3d34dc94d2a821f9fe679d3c687ce23 /src/compiler/nir/nir_intrinsics.c
parent8b0f6de73d7bf5cc2b9bb189e5a3fe4d48dd1017 (diff)
downloadexternal_mesa3d-1df3ecc1b87d95130165283154a13ea5b9a498d4.zip
external_mesa3d-1df3ecc1b87d95130165283154a13ea5b9a498d4.tar.gz
external_mesa3d-1df3ecc1b87d95130165283154a13ea5b9a498d4.tar.bz2
nir: const_index helpers
Direct access to intr->const_index[n], where different slots have different meanings, is somewhat confusing. Instead, let's put some extra info in nir_intrinsic_infos[] about which slots map to what, and add some get/set helpers. The helpers validate that the field being accessed (base/writemask/etc) is applicable for the intrinsic opc, for some extra safety. And nir_print can use this to dump out decoded const_index fields. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/compiler/nir/nir_intrinsics.c')
-rw-r--r--src/compiler/nir/nir_intrinsics.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_intrinsics.c b/src/compiler/nir/nir_intrinsics.c
index a7c868c..0257b19 100644
--- a/src/compiler/nir/nir_intrinsics.c
+++ b/src/compiler/nir/nir_intrinsics.c
@@ -30,7 +30,8 @@
#define OPCODE(name) nir_intrinsic_##name
#define INTRINSIC(_name, _num_srcs, _src_components, _has_dest, \
- _dest_components, _num_variables, _num_indices, _flags) \
+ _dest_components, _num_variables, _num_indices, \
+ idx0, idx1, idx2, _flags) \
{ \
.name = #_name, \
.num_srcs = _num_srcs, \
@@ -39,9 +40,16 @@
.dest_components = _dest_components, \
.num_variables = _num_variables, \
.num_indices = _num_indices, \
+ .index_map = { \
+ [NIR_INTRINSIC_ ## idx0] = 1, \
+ [NIR_INTRINSIC_ ## idx1] = 2, \
+ [NIR_INTRINSIC_ ## idx2] = 3, \
+ }, \
.flags = _flags \
},
+#define NIR_INTRINSIC_xx 0
+
#define LAST_INTRINSIC(name)
const nir_intrinsic_info nir_intrinsic_infos[nir_num_intrinsics] = {