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:
@@ -465,6 +465,7 @@ nir_copy_var(nir_builder *build, nir_variable *dest, nir_variable *src)
|
||||
nir_builder_instr_insert(build, ©->instr);
|
||||
}
|
||||
|
||||
/* Generic builder for system values. */
|
||||
static inline nir_ssa_def *
|
||||
nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index)
|
||||
{
|
||||
@@ -477,6 +478,20 @@ nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index)
|
||||
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"
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_load_barycentric(nir_builder *build, nir_intrinsic_op op,
|
||||
unsigned interp_mode)
|
||||
|
Reference in New Issue
Block a user