[Mesa-dev] [PATCH 1/2] glsl: error on linking if no shaders are attached to program
Ilia Mirkin
imirkin at alum.mit.edu
Thu Sep 3 11:49:14 PDT 2015
On Thu, Sep 3, 2015 at 7:58 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> This applies to OpenGL Core >= 4.5 and OpenGL ES >= 3.1.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
> src/glsl/linker.cpp | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 01554bc..bc76af6 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -3467,6 +3467,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 (((ctx->API == API_OPENGL_CORE && ctx->Version >= 45) ||
> + (ctx->API == API_OPENGLES2 && ctx->Version >= 31)) &&
Seems like the indent is off by 1 here -- the parens should line up so
that the ctx's line up too.
I double-checked that GL4.4 doesn't have this restriction, so this is
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> + prog->NumShaders == 0) {
I would personally stick this check in first so that the if can bail
faster (as this will never be true), but... your call.
> + 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 &&
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list