diff options
author | Tapani Pälli <tapani.palli@intel.com> | 2015-09-03 14:26:48 +0300 |
---|---|---|
committer | Tapani Pälli <tapani.palli@intel.com> | 2015-09-04 09:22:24 +0300 |
commit | 08e9049e3d204265d803aac5ff6bf0b4e5d82d00 (patch) | |
tree | de683f16c79111e2897f07208892a1114965fef6 | |
parent | 69678953d1740a5d27da4f9dd522f68d5a95d223 (diff) |
glsl: error out on ES 3.1 if VS or FS present but not both
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r-- | src/glsl/linker.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index fb1d955aef..4838ab4433 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -3889,10 +3889,31 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) * behavior specified in GLSL specification. */ if (!prog->SeparateShader && 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) { - linker_error(prog, "program lacks a fragment shader\n"); + /* With ES < 3.1 one needs to have always vertex + fragment shader. */ + if (ctx->Version < 31) { + if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) { + linker_error(prog, "program lacks a vertex shader\n"); + } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { + linker_error(prog, "program lacks a fragment shader\n"); + } + } else { + /* From OpenGL ES 3.1 specification (7.3 Program Objects): + * "Linking can fail for a variety of reasons as specified in the + * OpenGL ES Shading Language Specification, as well as any of the + * following reasons: + * + * ... + * + * * program contains objects to form either a vertex shader or + * fragment shader, and program is not separable, and does not + * contain objects to form both a vertex shader and fragment + * shader." + */ + if (!!prog->_LinkedShaders[MESA_SHADER_VERTEX] ^ + !!prog->_LinkedShaders[MESA_SHADER_FRAGMENT]) { + linker_error(prog, "Program needs to contain both vertex and " + "fragment shaders.\n"); + } } } |