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

Author: Timothy Arceri <[email protected]>
Date:   Tue Jun 24 07:43:05 2014 +1000

glsl: dont allow gl_PerVertex to be redeclared as an array of arrays

V3: move patch after fixes to ast for AoA and add const to helper
as suggested by Ian

V2: move single dimensional array detection into a helper

Signed-off-by: Timothy Arceri <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>

---

 src/glsl/ast.h          |    6 ++++++
 src/glsl/ast_to_hir.cpp |    3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index 57d432d..e803e6d 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -336,6 +336,12 @@ public:
       array_dimensions.push_tail(&dim->link);
    }
 
+   const bool is_single_dimension()
+   {
+      return this->array_dimensions.tail_pred->prev != NULL &&
+             this->array_dimensions.tail_pred->prev->is_head_sentinel();
+   }
+
    virtual void print(void) const;
 
    /* This list contains objects of type ast_node containing the
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 7b54eaf..db617cb 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -6335,7 +6335,8 @@ ast_interface_block::hir(exec_list *instructions,
                              _mesa_shader_stage_to_string(state->stage));
          }
          if (this->instance_name == NULL ||
-             strcmp(this->instance_name, "gl_in") != 0 || 
this->array_specifier == NULL) {
+             strcmp(this->instance_name, "gl_in") != 0 || 
this->array_specifier == NULL ||
+             !this->array_specifier->is_single_dimension()) {
             _mesa_glsl_error(&loc, state,
                              "gl_PerVertex input must be redeclared as "
                              "gl_in[]");

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

Reply via email to