summaryrefslogtreecommitdiff
path: root/src/compiler/nir/nir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir.c')
-rw-r--r--src/compiler/nir/nir.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index afd4d1a723..58f7649e7f 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1375,19 +1375,25 @@ nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void *state)
}
nir_const_value *
-nir_src_as_const_value(nir_src src)
+nir_ssa_def_as_const_value(nir_ssa_def *def)
{
- if (!src.is_ssa)
- return NULL;
-
- if (src.ssa->parent_instr->type != nir_instr_type_load_const)
- return NULL;
+ if (def->parent_instr->type != nir_instr_type_load_const)
+ return false;
- nir_load_const_instr *load = nir_instr_as_load_const(src.ssa->parent_instr);
+ nir_load_const_instr *load = nir_instr_as_load_const(def->parent_instr);
return &load->value;
}
+nir_const_value *
+nir_src_as_const_value(nir_src src)
+{
+ if (!src.is_ssa)
+ return NULL;
+
+ return nir_ssa_def_as_const_value(src.ssa);
+}
+
/**
* Returns true if the source is known to be dynamically uniform. Otherwise it
* returns false which means it may or may not be dynamically uniform but it