summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/nir/nir_builder.h')
-rw-r--r--src/glsl/nir/nir_builder.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
index b909f483579..332bb0246df 100644
--- a/src/glsl/nir/nir_builder.h
+++ b/src/glsl/nir/nir_builder.h
@@ -322,4 +322,16 @@ nir_store_var(nir_builder *build, nir_variable *var, nir_ssa_def *value)
nir_builder_instr_insert(build, &store->instr);
}
+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, NULL);
+ nir_builder_instr_insert(build, &load->instr);
+ return &load->dest.ssa;
+}
+
#endif /* NIR_BUILDER_H */