From: Fabian Bieler Date: Fri, 24 May 2013 21:26:54 +0000 (+0200) Subject: glsl/linker: Fail to link geometry shader without vertex shader. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd85ba08bc0593e3fb53003209a3d569d006a98e;p=mesa.git 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 --- 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]);