[Mesa-dev] [PATCH 2/2] glsl: Don't require matching interpolation qualifiers for newer GLSL
Tapani Pälli
tapani.palli at intel.com
Thu Mar 17 11:17:55 UTC 2016
On 03/16/2016 09:57 PM, Jordan Justen wrote:
> The OpenGLES GLSL 3.1 and OpenGL GLSL 4.3 specifications both remove
> the requirement for the output and input interpolation qualifiers to
> match.
>
> Note: I'm changing desktop OpenGL to allow the interpolation to
> differ, starting with 4.3, whereas the code previously used 4.4. (This
> was first added in 32a220f1f60980de50ecefb3b9ab1f754ade8c83.)
>
> 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."
I used 4.40 there because it's 'Changes' list includes following text:
"Remove old contradictory text requiring interpolation qualifiers to
match cross stage; they must only match within a stage."
(see Khronos bug #10990)
but if 4.30 spec already has similar changes done then this is correct.
> 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"
>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Tapani Pälli <tapani.palli at intel.com>
> ---
> src/compiler/glsl/link_varyings.cpp | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
> index 9d7177d..0938cf1 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -172,17 +172,9 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
> return;
> }
>
> - /* GLSL >= 4.40 removes text requiring interpolation qualifiers
> - * to match cross stage, they must only match within the same stage.
> - *
> - * From page 84 (page 90 of the PDF) of the GLSL 4.40 spec:
> - *
> - * "It is a link-time error if, within the same stage, the interpolation
> - * qualifiers of variables of the same name do not match.
> - *
> - */
> - if (input->data.interpolation != output->data.interpolation &&
> - prog->Version < 440) {
> + /* Interpolation must match until OpenGL 4.3 and OpenGLES 3.1 */
> + if (prog->Version < (prog->IsES ? 310 : 430) &&
> + input->data.interpolation != output->data.interpolation) {
> linker_error(prog,
> "%s shader output `%s' specifies %s "
> "interpolation qualifier, "
>
More information about the mesa-dev
mailing list