Mesa (master): glsl: Check that integer vertex outputs are qualified with flat

Chad Versace chadversary at kemper.freedesktop.org
Tue Jan 4 18:51:27 UTC 2011


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

Author: Chad Versace <chad.versace at intel.com>
Date:   Thu Dec 16 11:06:19 2010 -0800

glsl: Check that integer vertex outputs are qualified with flat

Perform this check in ast_declarator_list::hir().

>From section 4.3.6 of the GLSL 1.30 spec:
   "If a vertex output is a signed or unsigned integer or integer
   vector, then it must be qualified with the interpolation
   qualifier
   flat."

---

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

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 6770eed..67202df 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2158,6 +2158,25 @@ ast_declarator_list::hir(exec_list *instructions,
 	 }
       }
 
+      /* Integer vertex outputs must be qualified with 'flat'.
+       *
+       * From section 4.3.6 of the GLSL 1.30 spec:
+       *    "If a vertex output is a signed or unsigned integer or integer
+       *    vector, then it must be qualified with the interpolation qualifier
+       *    flat."
+       */
+      if (state->language_version >= 130
+          && state->target == vertex_shader
+          && state->current_function == NULL
+          && var->type->is_integer()
+          && var->mode == ir_var_out
+          && var->interpolation != ir_var_flat) {
+
+         _mesa_glsl_error(&loc, state, "If a vertex output is an integer, "
+                          "then it must be qualified with 'flat'");
+      }
+
+
       /* 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