glsl: Fix segfault when lhs is error_type in TCS
authorTimothy Arceri <timothy.arceri@collabora.com>
Wed, 9 Mar 2016 05:58:29 +0000 (16:58 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 31 Mar 2016 01:49:42 +0000 (12:49 +1100)
It seems expected that both lhs and rhs could be of type error_type
in this code however the TCS case wasn't expecting it.

Fixes segfault in an enhanced layouts GL CTS test.

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/ast_to_hir.cpp

index fcc542ab5e0218425b636069c1ae343c2e240124..0c686b27229be1f2e154a851a50ac9ca4d7d85d9 100644 (file)
@@ -819,7 +819,7 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
     * if the expression indicating the vertex number is not the identifier
     * `gl_InvocationID`.
     */
-   if (state->stage == MESA_SHADER_TESS_CTRL) {
+   if (state->stage == MESA_SHADER_TESS_CTRL && !lhs->type->is_error()) {
       ir_variable *var = lhs->variable_referenced();
       if (var->data.mode == ir_var_shader_out && !var->data.patch) {
          ir_rvalue *index = find_innermost_array_index(lhs);