[Mesa-dev] [PATCH 1/2] glsl: Don't require matching centroid qualifiers for newer GLSL

Jordan Justen jordan.l.justen at intel.com
Wed Mar 16 19:57:26 UTC 2016


The OpenGLES GLSL 3.1 and OpenGL GLSL 4.3 specifications both remove
the requirement for the output and input centroid qualifiers to match.

The OpenGL 4.2 spec says: "the last active shader stage output
variables and fragment shader input variables of the same name must
match in type and qualification (other than out matching to in)"

The OpenGL 4.3 spec says: "interpolation qualification (e.g., flat)
and auxiliary qualification (e.g. centroid) may differ."

The OpenGLES GLSL 3.00.4 specification says: "The output of the vertex
shader and the input of the fragment shader form an interface. For
this interface, vertex shader output variables and fragment shader
input variables of the same name must match in type and qualification
(other than precision and out matching to in)."

The OpenGLES GLSL 3.10 Specification says: "interpolation
qualification (e.g., flat) and auxiliary qualification (e.g. centroid)
may differ"

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92743
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/compiler/glsl/link_varyings.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 34eb848..9d7177d 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -121,7 +121,10 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
 
    /* Check that all of the qualifiers match between stages.
     */
-   if (input->data.centroid != output->data.centroid) {
+
+   /* Centroid must match until OpenGL 4.3 and OpenGLES 3.1 */
+   if (prog->Version < (prog->IsES ? 310 : 430) &&
+       input->data.centroid != output->data.centroid) {
       linker_error(prog,
                    "%s shader output `%s' %s centroid qualifier, "
                    "but %s shader input %s centroid qualifier\n",
-- 
2.7.0



More information about the mesa-dev mailing list