nir: Add nir_builder support for individual system value loads.

The previous nir_load_system_value(b, nir_intrinsic_load_whatever), 0) was
rather verbose, when system values should be easy to generate.

The index is left out because only one system value had an index included
in it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt
2016-08-05 17:10:18 -07:00
parent 24728637e2
commit c35f979220
6 changed files with 34 additions and 20 deletions

View File

@@ -41,7 +41,6 @@
#define ARR(...) { __VA_ARGS__ }
INTRINSIC(load_var, 0, ARR(0), true, 0, 1, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE)
INTRINSIC(store_var, 1, ARR(0), false, 0, 1, 1, WRMASK, xx, xx, 0)
INTRINSIC(copy_var, 0, ARR(0), false, 0, 2, 0, xx, xx, xx, 0)
@@ -277,7 +276,13 @@ INTRINSIC(shared_atomic_xor, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
INTRINSIC(shared_atomic_exchange, 2, ARR(1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
INTRINSIC(shared_atomic_comp_swap, 3, ARR(1, 1, 1), true, 1, 0, 1, BASE, xx, xx, 0)
/* Used by nir_builder.h to generate loader helpers for the system values. */
#ifndef DEFINE_SYSTEM_VALUE
#define DEFINE_SYSTEM_VALUE(name)
#endif
#define SYSTEM_VALUE(name, components, num_indices, idx0, idx1, idx2) \
DEFINE_SYSTEM_VALUE(name) \
INTRINSIC(load_##name, 0, ARR(0), true, components, 0, num_indices, \
idx0, idx1, idx2, \
NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
@@ -406,5 +411,6 @@ STORE(shared, 2, 2, BASE, WRMASK, xx, 0)
LAST_INTRINSIC(store_shared)
#undef DEFINE_SYSTEM_VALUE
#undef INTRINSIC
#undef LAST_INTRINSIC