[Mesa-dev] [PATCH 40/42] mesa: add KHR_no_error support for glBindAttribLocation()

Timothy Arceri tarceri at itsqueeze.com
Wed Jun 28 01:41:28 UTC 2017



On 27/06/17 21:20, Samuel Pitoiset wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/mapi/glapi/gen/gl_API.xml  |  2 +-
>   src/mesa/main/shader_query.cpp | 11 +++++++++++
>   src/mesa/main/shaderapi.h      |  3 +++
>   3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index d2810952501..64078c44166 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -5301,7 +5301,7 @@
>           <glx ignore="true"/>
>       </function>
>   
> -    <function name="BindAttribLocation" es2="2.0">
> +    <function name="BindAttribLocation" es2="2.0" no_error="true">
>           <param name="program" type="GLuint"/>
>           <param name="index" type="GLuint"/>
>           <param name="name" type="const GLchar *"/>
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index 98441075551..117120c7568 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -79,6 +79,17 @@ bind_attrib_location(struct gl_shader_program *const shProg, GLuint index,
>   }
>   
>   void GLAPIENTRY
> +_mesa_BindAttribLocation_no_error(GLuint program, GLuint index,
> +                                  const GLchar *name)
> +{
> +   GET_CURRENT_CONTEXT(ctx);

Unfortunately we must add:

    if (!name)
       return;

Because it's not an error to pass NULL;

With that 38-40 are:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>


> +
> +   struct gl_shader_program *const shProg =
> +      _mesa_lookup_shader_program(ctx, program);
> +   bind_attrib_location(shProg, index, name);
> +}
> +
> +void GLAPIENTRY
>   _mesa_BindAttribLocation(GLuint program, GLuint index,
>                            const GLchar *name)
>   {
> diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
> index ccc38d9f75e..b2229f7ced6 100644
> --- a/src/mesa/main/shaderapi.h
> +++ b/src/mesa/main/shaderapi.h
> @@ -143,6 +143,9 @@ extern void GLAPIENTRY
>   _mesa_ValidateProgram(GLuint);
>   
>   
> +void GLAPIENTRY
> +_mesa_BindAttribLocation_no_error(GLuint program, GLuint, const GLchar *);
> +
>   extern void GLAPIENTRY
>   _mesa_BindAttribLocation(GLuint program, GLuint, const GLchar *);
>   
> 


More information about the mesa-dev mailing list