glsl: Refuse to parse uniform block declarations when UBOs aren't available.
authorEric Anholt <eric@anholt.net>
Thu, 26 Jul 2012 20:11:05 +0000 (13:11 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 7 Aug 2012 20:54:51 +0000 (13:54 -0700)
Fixes piglit
GL_ARB_uniform_buffer_object/compiler/extension-disabled-block.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/glsl_parser.yy

index 04c64f096b8f6319f7fb171385868215961948db..ee6a67288e845f41efb19279adeb5b88268a7642 100644 (file)
@@ -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");
+          }
        }
        ;