From bd85ba08bc0593e3fb53003209a3d569d006a98e Mon Sep 17 00:00:00 2001 From: Fabian Bieler Date: Fri, 24 May 2013 23:26:54 +0200 Subject: [PATCH] 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 Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke --- src/glsl/linker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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]); -- 2.30.2