[Mesa-dev] [PATCH 04/11] mesa: Add stub implementations of glGetProgramBinary and glProgramBinary

Eric Anholt eric at anholt.net
Thu Dec 20 17:05:38 PST 2012


Ian Romanick <idr at freedesktop.org> writes:

> From: Ian Romanick <ian.d.romanick at intel.com>

It looks to me like we really do have to support getting a
binary with this extension/gles3:

"Any program binary retrieved using GetProgramBinary and submitted us-
ing ProgramBinary under the same configuration must be successful. Any
programs loaded successfully by ProgramBinary must be run properly with
any legal GL state vector."

where I read configuration as "hardware and driver version"  I don't see
any of the text I would expect if they're letting length == 0 mean
"sorry, can't save this one".

> ---
>  src/mesa/main/shaderapi.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
>  src/mesa/main/shaderapi.h |  8 ++++++++
>  2 files changed, 58 insertions(+)
>
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index 19fa6fc..550018e 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -1500,6 +1500,56 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
>  
>  #endif /* FEATURE_ES2 */
>  
> +void GLAPIENTRY
> +_mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
> +                       GLenum *binaryFormat, GLvoid *binary)
> +{
> +   struct gl_shader_program *shProg;
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   ASSERT_OUTSIDE_BEGIN_END(ctx);
> +
> +   shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramBinary");
> +   if (!shProg)
> +      return;
> +
> +   if (!shProg->LinkStatus) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +		  "glGetProgramBinary(program %u not linked)",

tabs, probably from a copy and paste.

> +                  shProg->Name);
> +      return;
> +   }
> +
> +   if (bufSize < 0){
> +      _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramBinary(bufSize < 0)");
> +      return;
> +   }
> +
> +   *length = 0;

"If <length> is NULL, then no length is returned."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121220/2e74fa9f/attachment.pgp>


More information about the mesa-dev mailing list