aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2015-09-03 14:20:46 +0300
committerTapani Pälli <[email protected]>2015-09-04 09:01:00 +0300
commit69678953d1740a5d27da4f9dd522f68d5a95d223 (patch)
tree3fada7aca296c6bc4f535e73813914bf9473e754 /src/glsl/linker.cpp
parent4323e78d3f6d935cb75fc20375e6730613d41119 (diff)
glsl: error on linking if no shaders are attached to program
This applies to OpenGL Core >= 4.5 and OpenGL ES >= 3.1. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 59e3e9c38a6..fb1d955aef5 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -3466,6 +3466,25 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
prog->Version = max_version;
prog->IsES = is_es_prog;
+ /* From OpenGL 4.5 Core specification (7.3 Program Objects):
+ * "Linking can fail for a variety of reasons as specified in the OpenGL
+ * Shading Language Specification, as well as any of the following
+ * reasons:
+ *
+ * * No shader objects are attached to program.
+ *
+ * ..."
+ *
+ * Same rule applies for OpenGL ES >= 3.1.
+ */
+
+ if (prog->NumShaders == 0 &&
+ ((ctx->API == API_OPENGL_CORE && ctx->Version >= 45) ||
+ (ctx->API == API_OPENGLES2 && ctx->Version >= 31))) {
+ linker_error(prog, "No shader objects are attached to program.\n");
+ goto done;
+ }
+
/* Some shaders have to be linked with some other shaders present.
*/
if (num_shaders[MESA_SHADER_GEOMETRY] > 0 &&