Module: Mesa
Branch: master
Commit: c33be485c58dace2a691042703f50cc6defe960d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c33be485c58dace2a691042703f50cc6defe960d

Author: Paul Berry <[email protected]>
Date:   Tue Dec 18 14:49:34 2012 -0800

glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

This patch adds logic to allow the ast_to_hir function
apply_type_qualifier_to_variable() to tell whether it is acting on a
variable declaration or a function parameter.  This will allow it to
correctly interpret the meaning of "out" and "in" keywords (which have
different meanings in those two contexts).

Reviewed-by: Kenneth Graunke <[email protected]>

---

 src/glsl/ast_to_hir.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 94b63f6..a14fe7d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
                                 ir_variable *var,
                                 struct _mesa_glsl_parse_state *state,
                                 YYLTYPE *loc,
-                                bool ubo_qualifiers_valid)
+                                bool ubo_qualifiers_valid,
+                                 bool is_parameter)
 {
    if (qual->flags.q.invariant) {
       if (var->used) {
@@ -2626,7 +2627,7 @@ ast_declarator_list::hir(exec_list *instructions,
       }
 
       apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
-                                      & loc, this->ubo_qualifiers_valid);
+                                      & loc, this->ubo_qualifiers_valid, 
false);
 
       if (this->type->qualifier.flags.q.invariant) {
         if ((state->target == vertex_shader) && !(var->mode == ir_var_out ||
@@ -3065,7 +3066,7 @@ ast_parameter_declarator::hir(exec_list *instructions,
     * for function parameters the default mode is 'in'.
     */
    apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc,
-                                   false);
+                                   false, true);
 
    /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
     *

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to