[Mesa-dev] [PATCH] Linking fails when not writing gl_Position.

Kenneth Graunke kenneth at whitecape.org
Mon Sep 8 09:18:49 PDT 2014


On Monday, September 08, 2014 11:10:42 AM Tapani Pälli wrote:
> From: Kalyan Kondapally <kalyan.kondapally at intel.com>
> 
> According to GLSL-ES Spec(i.e. 1.0, 3.0), gl_Position value is undefined
> after the vertex processing stage if we don't write gl_Position. However,
> GLSL 1.10 Spec mentions that writing to gl_Position is mandatory. In case
> of GLSL-ES, it's not an error and atleast the linking should pass.
> Currently, Mesa throws an linker error in case we dont write to gl_position
> and Version is less then 140(GLSL) and 300(GLSL-ES). This patch changes
> it so that we don't report an error in case of GLSL-ES.
> 
> Signed-off-by: Kalyan Kondapally <kalyan.kondapally at intel.com>
> Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83380
> ---
>  src/glsl/linker.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 57be493..e9cf550 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -559,10 +559,10 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
>      *      vertex processing has occurred. Its value is undefined if
>      *      the vertex shader executable does not write gl_Position."
>      *
> -    * GLSL ES 3.00 is similar to GLSL 1.40--failing to write to gl_Position is
> -    * not an error.
> +    * All GLSL ES Versions are similar to GLSL 1.40--failing to write to
> +    * gl_Position is not an error.
>      */
> -   if (prog->Version < (prog->IsES ? 300 : 140)) {
> +   if (!prog->IsES && prog->Version < 140) {
>        find_assignment_visitor find("gl_Position");
>        find.run(shader->ir);
>        if (!find.variable_found()) {
> 

Good find, Kalyan!  GLSL ES 1.0 does indeed say that they "should" write gl_Position, but it's undefined if they don't, whereas GLSL <= 1.30 says they "must" write gl_Position.

Thanks for sending this to the list, Tapani.  Would you mind committing it?

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: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140908/d9fa9f54/attachment.sig>


More information about the mesa-dev mailing list