diff options
author | Jason Ekstrand <[email protected]> | 2017-12-12 09:44:59 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-01-08 14:57:44 -0800 |
commit | 819adfdfb4601eed9c1642f23efa0c8077213a35 (patch) | |
tree | 1245ee2487bf3c36300b484438e1f2e73d373741 | |
parent | 71ea4dded503cb68d40a144451bafaa80248c32b (diff) |
spirv: Rework asserts in var_decoration_cb
Now that higher levels are enforcing decoration sanity, we don't need
the vtn_asserts here. This function *should* be safe but we still want
a few well-placed regular asserts in case something goes awry.
Reviewed-by: Lionel Landwerlin <[email protected]>
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 2a413a4caeb..d69b0562ed6 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1465,11 +1465,11 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, } if (val->value_type == vtn_value_type_pointer) { - vtn_assert(val->pointer->var == void_var); - vtn_assert(val->pointer->chain == NULL); - vtn_assert(member == -1); + assert(val->pointer->var == void_var); + assert(val->pointer->chain == NULL); + assert(member == -1); } else { - vtn_assert(val->value_type == vtn_value_type_type); + assert(val->value_type == vtn_value_type_type); } /* Location is odd. If applied to a split structure, we have to walk the @@ -1501,7 +1501,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, vtn_var->var->data.location = location; } else { /* This handles the structure member case */ - vtn_assert(vtn_var->members); + assert(vtn_var->members); unsigned length = glsl_get_length(glsl_without_array(vtn_var->type->type)); for (unsigned i = 0; i < length; i++) { @@ -1514,11 +1514,12 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, return; } else { if (vtn_var->var) { - vtn_assert(member <= 0); + assert(member == -1); apply_var_decoration(b, vtn_var->var, dec); } else if (vtn_var->members) { if (member >= 0) { - vtn_assert(vtn_var->members); + /* Member decorations must come from a type */ + assert(val->value_type == vtn_value_type_type); apply_var_decoration(b, vtn_var->members[member], dec); } else { unsigned length = |