[Mesa-dev] [PATCH 15/23] main: add binary support to ProgramBinary

Tapani Pälli tapani.palli at intel.com
Fri Dec 8 05:33:58 UTC 2017


13,14,15

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 11/29/2017 03:24 AM, Timothy Arceri wrote:
> From: Jordan Justen <jordan.l.justen at intel.com>
> 
> V2: call generic mesa_program_binary() helper rather than driver
>      function directly to allow greater code sharing.
> 
> Signed-off-by: Timothy Arceri <tarceri at itsqueeze.com>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com> (v1)
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com> (v1)
> ---
>   src/mesa/main/shaderapi.c | 36 +++++++++++++++++++-----------------
>   1 file changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index b728b320ac4..51031e12ec9 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -2214,47 +2214,49 @@ void GLAPIENTRY
>   _mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
>                       const GLvoid *binary, GLsizei length)
>   {
>      struct gl_shader_program *shProg;
>      GET_CURRENT_CONTEXT(ctx);
>   
>      shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary");
>      if (!shProg)
>         return;
>   
> -   (void) binaryFormat;
> -   (void) binary;
> -
>      /* Section 2.3.1 (Errors) of the OpenGL 4.5 spec says:
>       *
>       *     "If a negative number is provided where an argument of type sizei or
>       *     sizeiptr is specified, an INVALID_VALUE error is generated."
>       */
>      if (length < 0) {
>         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramBinary(length < 0)");
>         return;
>      }
>   
> -   /* The ARB_get_program_binary spec says:
> -    *
> -    *     "<binaryFormat> and <binary> must be those returned by a previous
> -    *     call to GetProgramBinary, and <length> must be the length of the
> -    *     program binary as returned by GetProgramBinary or GetProgramiv with
> -    *     <pname> PROGRAM_BINARY_LENGTH. Loading the program binary will fail,
> -    *     setting the LINK_STATUS of <program> to FALSE, if these conditions
> -    *     are not met."
> -    *
> -    * Since any value of binaryFormat passed "is not one of those specified as
> -    * allowable for [this] command, an INVALID_ENUM error is generated."
> -    */
> -   shProg->data->LinkStatus = linking_failure;
> -   _mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary");
> +   if (ctx->Const.NumProgramBinaryFormats == 0 ||
> +       binaryFormat != GL_PROGRAM_BINARY_FORMAT_MESA) {
> +      /* The ARB_get_program_binary spec says:
> +       *
> +       *     "<binaryFormat> and <binary> must be those returned by a previous
> +       *     call to GetProgramBinary, and <length> must be the length of the
> +       *     program binary as returned by GetProgramBinary or GetProgramiv with
> +       *     <pname> PROGRAM_BINARY_LENGTH. Loading the program binary will fail,
> +       *     setting the LINK_STATUS of <program> to FALSE, if these conditions
> +       *     are not met."
> +       *
> +       * Since any value of binaryFormat passed "is not one of those specified as
> +       * allowable for [this] command, an INVALID_ENUM error is generated."
> +       */
> +      shProg->data->LinkStatus = linking_failure;
> +      _mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary");
> +   } else {
> +      _mesa_program_binary(ctx, shProg, binaryFormat, binary, length);
> +   }
>   }
>   
>   
>   static ALWAYS_INLINE void
>   program_parameteri(struct gl_context *ctx, struct gl_shader_program *shProg,
>                      GLuint pname, GLint value, bool no_error)
>   {
>      switch (pname) {
>      case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
>         /* This enum isn't part of the OES extension for OpenGL ES 2.0, but it
> 


More information about the mesa-dev mailing list