glsl: dont crash when attempting to assign a value to a builtin define
authorTimothy Arceri <timothy.arceri@collabora.com>
Mon, 30 May 2016 02:16:39 +0000 (12:16 +1000)
committerTimothy Arceri <timothy.arceri@collabora.com>
Mon, 30 May 2016 02:47:58 +0000 (12:47 +1000)
For example GL_ARB_enhanced_layouts = 3;

Fixes:
GL44-CTS.enhanced_layouts.glsl_contant_immutablity

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

index ccacd266bb4f7d99811842b9877753a3b85a9c8d..400d3c4e90857dfb285e792f2322e80d43392463 100644 (file)
@@ -822,7 +822,7 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
     */
    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) {
+      if (var && var->data.mode == ir_var_shader_out && !var->data.patch) {
          ir_rvalue *index = find_innermost_array_index(lhs);
          ir_variable *index_var = index ? index->variable_referenced() : NULL;
          if (!index_var || strcmp(index_var->name, "gl_InvocationID") != 0) {