[Mesa-dev] [PATCH] glsl: Fix condition to generate shader link error

Ian Romanick idr at freedesktop.org
Tue Feb 18 10:37:12 PST 2014


On 12/19/2013 03:12 PM, Anuj Phogat wrote:
> GL_ARB_ES2_compatibility don't say anything about shader linking
> when one of the shaders (vertex or fragment shader) is absent.
> So, the extention shouldn't change the behavior specified in
> GLSL specification.

If you add the above text to the comment in the code,

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

Otherwise, someone will eventually come along and "fix" the code back to
its original form. :)

> Tested the behavior on proprietary linux drivers of NVIDIA and AMD.
> Both of them allow linking a version 100 shader program in OpenGL
> context, when one of the shaders is absent.
> 
> Makes following Khronos CTS tests to pass:
> successfulcompilevert_linkprogram.test
> successfulcompilefrag_linkprogram.test
> 
> Cc: mesa-stable at lists.freedesktop.org
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/glsl/linker.cpp | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index a6133ea..f84d364 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -2382,11 +2382,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
>        goto done;
>  
>     /* OpenGL ES requires that a vertex shader and a fragment shader both be
> -    * present in a linked program.  By checking prog->IsES, we also
> -    * catch the GL_ARB_ES2_compatibility case.
> +    * present in a linked program.
>      */
> -   if (!prog->InternalSeparateShader &&
> -       (ctx->API == API_OPENGLES2 || prog->IsES)) {
> +   if (!prog->InternalSeparateShader && ctx->API == API_OPENGLES2) {
>        if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
>  	 linker_error(prog, "program lacks a vertex shader\n");
>        } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) {



More information about the mesa-dev mailing list