main: return 0 length when the queried program object's not linked
authorXiong, James <james.xiong@intel.com>
Fri, 27 Apr 2018 01:39:57 +0000 (18:39 -0700)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 9 May 2018 23:34:19 +0000 (09:34 +1000)
Signed-off-by: Xiong, James <james.xiong@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/shaderapi.c

index 44b18af49275ca9abb6e89fa82095406d3286b00..caa42541cad648b70343f6852dd9e8a2350e3498 100644 (file)
@@ -837,7 +837,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       *params = shProg->BinaryRetreivableHint;
       return;
    case GL_PROGRAM_BINARY_LENGTH:
-      if (ctx->Const.NumProgramBinaryFormats == 0) {
+      if (ctx->Const.NumProgramBinaryFormats == 0 || !shProg->data->LinkStatus) {
          *params = 0;
       } else {
          _mesa_get_program_binary_length(ctx, shProg, params);