glsl: Fix condition to generate shader link error

GL_ARB_ES2_compatibility doesn't say anything about shader linking
when one of the shaders (vertex or fragment shader) is absent. So,
the extension shouldn't change the behavior specified in GLSL
specification.

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@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Anuj Phogat 2013-12-19 14:17:19 -08:00
parent 6bd2472a8b
commit 03597cf802

View file

@ -2441,11 +2441,12 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done; goto done;
/* OpenGL ES requires that a vertex shader and a fragment shader both be /* OpenGL ES requires that a vertex shader and a fragment shader both be
* present in a linked program. By checking prog->IsES, we also * present in a linked program. GL_ARB_ES2_compatibility doesn't say
* catch the GL_ARB_ES2_compatibility case. * anything about shader linking when one of the shaders (vertex or
* fragment shader) is absent. So, the extension shouldn't change the
* behavior specified in GLSL specification.
*/ */
if (!prog->InternalSeparateShader && if (!prog->InternalSeparateShader && ctx->API == API_OPENGLES2) {
(ctx->API == API_OPENGLES2 || prog->IsES)) {
if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) { if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
linker_error(prog, "program lacks a vertex shader\n"); linker_error(prog, "program lacks a vertex shader\n");
} else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) {