From 803262a5f55ca5b94a09dfe8f35e64a579778209 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Jul 2012 13:11:05 -0700 Subject: [PATCH] glsl: Refuse to parse uniform block declarations when UBOs aren't available. Fixes piglit GL_ARB_uniform_buffer_object/compiler/extension-disabled-block.frag Reviewed-by: Kenneth Graunke --- src/glsl/glsl_parser.yy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 04c64f096b8..ee6a67288e8 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1929,6 +1929,16 @@ uniform_block: void *ctx = state; $$ = new(ctx) ast_uniform_block(*state->default_uniform_qualifier, $2, $4); + + if (!state->ARB_uniform_buffer_object_enable) { + _mesa_glsl_error(& @1, state, + "#version 140 / GL_ARB_uniform_buffer_object " + "required for defining uniform blocks\n"); + } else if (state->ARB_uniform_buffer_object_warn) { + _mesa_glsl_warning(& @1, state, + "#version 140 / GL_ARB_uniform_buffer_object " + "required for defining uniform blocks\n"); + } } | layout_qualifier UNIFORM NEW_IDENTIFIER '{' member_list '}' ';' { @@ -1939,6 +1949,16 @@ uniform_block: YYERROR; } $$ = new(ctx) ast_uniform_block(qual, $3, $5); + + if (!state->ARB_uniform_buffer_object_enable) { + _mesa_glsl_error(& @1, state, + "#version 140 / GL_ARB_uniform_buffer_object " + "required for defining uniform blocks\n"); + } else if (state->ARB_uniform_buffer_object_warn) { + _mesa_glsl_warning(& @1, state, + "#version 140 / GL_ARB_uniform_buffer_object " + "required for defining uniform blocks\n"); + } } ; -- 2.30.2