[Mesa-dev] [PATCH] glsl: Don't require matching centroid qualifiers

Kenneth Graunke kenneth at whitecape.org
Tue Mar 29 06:23:43 UTC 2016


On Friday, March 25, 2016 2:15:51 PM PDT Jordan Justen wrote:
> Note: This patch appears to violate older OpenGL and OpenGLES specs.
> 
> 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 deqp
> dEQP-
GLES3.functional.shaders.linkage.varying.rules.differing_interpolation_2
> test wants the newer OpenGLES 3.1 specification behavior, even for
> OpenGLES 3.0. This patch simply removes the checking in all cases.
> 
> The OpenGLES 3.0 conformance test suite doesn't appear to require the
> older ("must match") spec behavior.
> 
> For reference, here are the relavent spec citations:
> 
>   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
> Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7819
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  I previously posted a patch that strictly matched the specs:
>  https://lists.freedesktop.org/archives/mesa-dev/2016-March/110183.html
> 
>  src/compiler/glsl/link_varyings.cpp | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/
link_varyings.cpp
> index 44fc8f6..6e413ba 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -121,7 +121,16 @@ 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) {
> +
> +   /* According to the OpenGL and OpenGLES GLSL specs, the centroid 
qualifier
> +    * should match until OpenGL 4.3 and OpenGLES 3.1. The OpenGLES 3.0
> +    * conformance test suite does not verify that the qualifiers must 
match.
> +    * The deqp test suite expects the opposite (OpenGLES 3.1) behavior for
> +    * OpenGLES 3.0 drivers, so we relax the checking in all cases.
> +    */
> +   if (false /* always skip the centroid check */ &&
> +       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",
> 

This seems reasonable, and I think is faithful to Ian's recommendation:
if there's no conformance test for the old behavior, treat the newly
relaxed behavior as the right thing to do.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160328/560a204a/attachment.sig>


More information about the mesa-dev mailing list