Mesa (master): glsl: Check that 'centroid in' does not occur in vertex shader

Chad Versace chadversary at kemper.freedesktop.org
Mon Jan 17 18:21:19 UTC 2011


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

Author: Chad Versace <chad.versace at intel.com>
Date:   Tue Jan 11 18:24:17 2011 -0800

glsl: Check that 'centroid in' does not occur in vertex shader

The check is performed only in GLSL versions >= 1.30.

>From section 4.3.4 of the GLSL 1.30 spec:
   "It is an error to use centroid in in a vertex shader."

Fixes Piglit test
spec/glsl-1.30/compiler/storage-qualifiers/vs-centroid-in-01.vert

---

 src/glsl/ast_to_hir.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index e5a21fd..51bc8ec 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2338,6 +2338,19 @@ ast_declarator_list::hir(exec_list *instructions,
       }
 
 
+      /* From section 4.3.4 of the GLSL 1.30 spec:
+       *    "It is an error to use centroid in in a vertex shader."
+       */
+      if (state->language_version >= 130
+          && this->type->qualifier.flags.q.centroid
+          && this->type->qualifier.flags.q.in
+          && state->target == vertex_shader) {
+
+         _mesa_glsl_error(&loc, state,
+                          "'centroid in' cannot be used in a vertex shader");
+      }
+
+
       /* Process the initializer and add its instructions to a temporary
        * list.  This list will be added to the instruction stream (below) after
        * the declaration is added.  This is done because in some cases (such as




More information about the mesa-commit mailing list