mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 02:20:11 +01:00
spirv: Add better error messages in vtn_value helpers
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
22980f941e
commit
296046556a
1 changed files with 15 additions and 11 deletions
|
|
@ -584,15 +584,25 @@ struct vtn_pointer *
|
|||
vtn_pointer_from_ssa(struct vtn_builder *b, nir_ssa_def *ssa,
|
||||
struct vtn_type *ptr_type);
|
||||
|
||||
static inline struct vtn_value *
|
||||
vtn_untyped_value(struct vtn_builder *b, uint32_t value_id)
|
||||
{
|
||||
vtn_fail_if(value_id >= b->value_id_bound,
|
||||
"SPIR-V id %u is out-of-bounds", value_id);
|
||||
return &b->values[value_id];
|
||||
}
|
||||
|
||||
static inline struct vtn_value *
|
||||
vtn_push_value(struct vtn_builder *b, uint32_t value_id,
|
||||
enum vtn_value_type value_type)
|
||||
{
|
||||
assert(value_id < b->value_id_bound);
|
||||
assert(b->values[value_id].value_type == vtn_value_type_invalid);
|
||||
struct vtn_value *val = vtn_untyped_value(b, value_id);
|
||||
|
||||
b->values[value_id].value_type = value_type;
|
||||
vtn_fail_if(val->value_type != vtn_value_type_invalid,
|
||||
"SPIR-V id %u has already been written by another instruction",
|
||||
value_id);
|
||||
|
||||
val->value_type = value_type;
|
||||
return &b->values[value_id];
|
||||
}
|
||||
|
||||
|
|
@ -611,19 +621,13 @@ vtn_push_ssa(struct vtn_builder *b, uint32_t value_id,
|
|||
return val;
|
||||
}
|
||||
|
||||
static inline struct vtn_value *
|
||||
vtn_untyped_value(struct vtn_builder *b, uint32_t value_id)
|
||||
{
|
||||
assert(value_id < b->value_id_bound);
|
||||
return &b->values[value_id];
|
||||
}
|
||||
|
||||
static inline struct vtn_value *
|
||||
vtn_value(struct vtn_builder *b, uint32_t value_id,
|
||||
enum vtn_value_type value_type)
|
||||
{
|
||||
struct vtn_value *val = vtn_untyped_value(b, value_id);
|
||||
assert(val->value_type == value_type);
|
||||
vtn_fail_if(val->value_type != value_type,
|
||||
"SPIR-V id %u is the wrong kind of value", value_id);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue