<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 11, 2017 at 10:05 AM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 12/07/2017 08:12 AM, Jason Ekstrand wrote:<br>
> ---<br>
>  src/compiler/spirv/spirv_to_<wbr>nir.c | 14 +++++++++++---<br>
>  1 file changed, 11 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
> index 11c8c2a..4b93b11 100644<br>
> --- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
> +++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
> @@ -934,7 +934,11 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,<br>
>        struct vtn_type *base = vtn_value(b, w[2], vtn_value_type_type)->type;<br>
>        unsigned elems = w[3];<br>
><br>
> -      vtn_assert(glsl_type_is_<wbr>scalar(base->type));<br>
> +      vtn_fail_if(base->base_type != vtn_base_type_scalar,<br>
> +                  "Base type for OpTypeVector must be a scalar");<br>
> +      vtn_fail_if(elems < 2 || elems > 4,<br>
> +                  "Invalid component count for OpTypeVector");<br>
> +<br>
>        val->type->base_type = vtn_base_type_vector;<br>
>        val->type->type = glsl_vector_type(glsl_get_<wbr>base_type(base->type), elems);<br>
>        val->type->length = elems;<br>
> @@ -947,12 +951,16 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,<br>
>        struct vtn_type *base = vtn_value(b, w[2], vtn_value_type_type)->type;<br>
>        unsigned columns = w[3];<br>
><br>
> -      vtn_assert(glsl_type_is_<wbr>vector(base->type));<br>
> +      vtn_fail_if(columns < 2 || columns > 4,<br>
> +                  "Invalid column count for OpTypeMatrix");<br>
> +<br>
<br>
</div></div>I think we should still check glsl_type_is_vector here.  The<br>
glsl_type_is_error check below will catch that case, but we'll give a<br>
better error message with the explicit check here.<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>Sure.  I'll add something and send a v2.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
>        val->type->base_type = vtn_base_type_matrix;<br>
>        val->type->type = glsl_matrix_type(glsl_get_<wbr>base_type(base->type),<br>
>                                           glsl_get_vector_elements(base-<wbr>>type),<br>
>                                           columns);<br>
> -      vtn_assert(!glsl_type_is_<wbr>error(val->type->type));<br>
> +      vtn_fail_if(glsl_type_is_<wbr>error(val->type->type),<br>
> +                  "Unsupported base type for OpTypeMatrix");<br>
> +      assert(!glsl_type_is_error(<wbr>val->type->type));<br>
>        val->type->length = columns;<br>
>        val->type->array_element = base;<br>
>        val->type->row_major = false;<br>
><br>
<br>
</div></div></blockquote></div><br></div></div>