summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_builder.h
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-03-15 18:42:44 -0400
committerRob Clark <[email protected]>2018-03-27 08:36:37 -0400
commit76dfed8ae2d5c6c509eb2661389be3c6a25077df (patch)
treee811d58f7f277c7844c3421eab1203e7d55607a2 /src/compiler/nir/nir_builder.h
parentcc3a88e81dbceb12b79eb4ebe7a4ce5ba97fc291 (diff)
nir: mako all the intrinsics
I threatened to do this a long time ago.. I probably *should* have done it a long time ago when there where many fewer intrinsics. But the system of macro/#include magic for dealing with intrinsics is a bit annoying, and python has the nice property of optional fxn params, making it possible to define new intrinsics while ignoring parameters that are not applicable (and naming optional params). And not having to specify various array lengths explicitly is nice too. I think the end result makes it easier to add new intrinsics. v2: couple small fixes found with a test program to compare the old and new tables v3: misc comments, don't rely on capture=true for meson.build, get rid of system_values table to avoid return value of intrinsic() and *mostly* remove side-effects, add autotools build support v4: scons build Signed-off-by: Rob Clark <[email protected]> Acked-by: Dylan Baker <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_builder.h')
-rw-r--r--src/compiler/nir/nir_builder.h27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 36e0ae3ac63..8f7ddf1483c 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -610,32 +610,7 @@ nir_copy_var(nir_builder *build, nir_variable *dest, nir_variable *src)
nir_builder_instr_insert(build, &copy->instr);
}
-/* Generic builder for system values. */
-static inline nir_ssa_def *
-nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index)
-{
- nir_intrinsic_instr *load = nir_intrinsic_instr_create(build->shader, op);
- load->num_components = nir_intrinsic_infos[op].dest_components;
- load->const_index[0] = index;
- nir_ssa_dest_init(&load->instr, &load->dest,
- nir_intrinsic_infos[op].dest_components, 32, NULL);
- nir_builder_instr_insert(build, &load->instr);
- return &load->dest.ssa;
-}
-
-/* Generate custom builders for system values. */
-#define INTRINSIC(name, num_srcs, src_components, has_dest, dest_components, \
- num_variables, num_indices, idx0, idx1, idx2, flags)
-#define LAST_INTRINSIC(name)
-
-#define DEFINE_SYSTEM_VALUE(name) \
- static inline nir_ssa_def * \
- nir_load_##name(nir_builder *build) \
- { \
- return nir_load_system_value(build, nir_intrinsic_load_##name, 0); \
- }
-
-#include "nir_intrinsics.h"
+#include "nir_builder_opcodes.h"
static inline nir_ssa_def *
nir_load_barycentric(nir_builder *build, nir_intrinsic_op op,