summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorFabian Bieler <[email protected]>2013-05-24 23:26:54 +0200
committerPaul Berry <[email protected]>2013-08-01 20:23:21 -0700
commitbd85ba08bc0593e3fb53003209a3d569d006a98e (patch)
tree55750aabfa0c74087e837cad8123331b0e018e19 /src/glsl/linker.cpp
parent8cdbe8394e01964a362649d0aa69ce7d48124373 (diff)
glsl/linker: Fail to link geometry shader without vertex shader.
From section 2.15 (Geometry Shaders) the OpenGL 3.2 spec: A program object that includes a geometry shader must also include a vertex shader; otherwise a link error will occur. Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 4e77a9618c0..381440efd59 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1690,6 +1690,14 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
prog->Version = max_version;
prog->IsES = is_es_prog;
+ /* Geometry shaders have to be linked with vertex shaders.
+ */
+ if (num_geom_shaders > 0 && num_vert_shaders == 0) {
+ linker_error(prog, "Geometry shader must be linked with "
+ "vertex shader\n");
+ goto done;
+ }
+
for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
if (prog->_LinkedShaders[i] != NULL)
ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);