spirv: Add a vtn_constant_value helper
[mesa.git] / src / compiler / spirv / vtn_private.h
index 3e49df4dac8769fff1094ae0a50fe00d1e7bf7ee..817f78ce42db967feabd9ca9b3c39f4982f850f7 100644 (file)
@@ -639,6 +639,12 @@ bool
 vtn_set_instruction_result_type(struct vtn_builder *b, SpvOp opcode,
                                 const uint32_t *w, unsigned count);
 
+static inline nir_constant *
+vtn_constant_value(struct vtn_builder *b, uint32_t value_id)
+{
+   return vtn_value(b, value_id, vtn_value_type_constant)->constant;
+}
+
 struct vtn_ssa_value *vtn_ssa_value(struct vtn_builder *b, uint32_t value_id);
 
 struct vtn_ssa_value *vtn_create_ssa_value(struct vtn_builder *b,