[Mesa-dev] [WIP 11/13] glsl: parser changes for GL_ARB_explicit_uniform_location
Tapani Pälli
tapani.palli at intel.com
Thu Mar 27 23:45:34 PDT 2014
Patch adds a preprocessor define for the extension and stores
explicit location data for uniforms during AST->HIR conversion.
It also sets layout token to be available when having the
extension in place.
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
src/glsl/ast_to_hir.cpp | 13 +++++++++++++
src/glsl/glcpp/glcpp-parse.y | 3 +++
src/glsl/glsl_lexer.ll | 1 +
3 files changed, 17 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8f6e901..3bfad02 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2123,6 +2123,19 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
{
bool fail = false;
+ /* Checks for GL_ARB_explicit_uniform_location. */
+ if (qual->flags.q.uniform) {
+
+ if (qual->index < 0) {
+ _mesa_glsl_error(loc, state,
+ "explicit location < 0 for uniform %s", var->name);
+ } else {
+ var->data.explicit_location = true;
+ var->data.location = qual->location;
+ }
+ return;
+ }
+
/* Between GL_ARB_explicit_attrib_location an
* GL_ARB_separate_shader_objects, the inputs and outputs of any shader
* stage can be assigned explicit locations. The checking here associates
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index f28d853..6d42138 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2087,6 +2087,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
if (extensions->ARB_explicit_attrib_location)
add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
+ if (extensions->ARB_explicit_uniform_location)
+ add_builtin_define(parser, "GL_ARB_explicit_uniform_location", 1);
+
if (extensions->ARB_shader_texture_lod)
add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1);
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 7602351..83f0b6d 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -393,6 +393,7 @@ layout {
|| yyextra->AMD_conservative_depth_enable
|| yyextra->ARB_conservative_depth_enable
|| yyextra->ARB_explicit_attrib_location_enable
+ || yyextra->ARB_explicit_uniform_location_enable
|| yyextra->has_separate_shader_objects()
|| yyextra->ARB_uniform_buffer_object_enable
|| yyextra->ARB_fragment_coord_conventions_enable
--
1.8.3.1
More information about the mesa-dev
mailing list