From b84e3f570f4b5aba1dd96760e090ae976d0e1cba Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Wed, 15 Dec 2010 16:32:47 -0800 Subject: glsl: Allow redeclaration of gl_Color and its variants in GLSL 1.30 Allow redeclaration of the following built-in variables with an interpolation qualifier in language versions >= 1.30: * gl_FrontColor * gl_BackColor * gl_FrontSecondaryColor * gl_BackSecondaryColor * gl_Color * gl_SecondaryColor See section 4.3.7 of the GLSL 1.30 spec. --- src/glsl/ast_to_hir.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/glsl/ast_to_hir.cpp') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 2baeffc067..6770eed343 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2344,6 +2344,27 @@ ast_declarator_list::hir(exec_list *instructions, */ earlier->origin_upper_left = var->origin_upper_left; earlier->pixel_center_integer = var->pixel_center_integer; + + /* According to section 4.3.7 of the GLSL 1.30 spec, + * the following built-in varaibles can be redeclared with an + * interpolation qualifier: + * * gl_FrontColor + * * gl_BackColor + * * gl_FrontSecondaryColor + * * gl_BackSecondaryColor + * * gl_Color + * * gl_SecondaryColor + */ + } else if (state->language_version >= 130 + && (strcmp(var->name, "gl_FrontColor") == 0 + || strcmp(var->name, "gl_BackColor") == 0 + || strcmp(var->name, "gl_FrontSecondaryColor") == 0 + || strcmp(var->name, "gl_BackSecondaryColor") == 0 + || strcmp(var->name, "gl_Color") == 0 + || strcmp(var->name, "gl_SecondaryColor") == 0) + && earlier->type == var->type + && earlier->mode == var->mode) { + earlier->interpolation = var->interpolation; } else { YYLTYPE loc = this->get_location(); _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier); -- cgit v1.2.3