[Mesa-dev] [PATCH 03/42] mesa: add KHR_no_error support for glAttachShader() and glAttachObjectARB()
Timothy Arceri
tarceri at itsqueeze.com
Tue Jun 27 23:08:08 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 | 4 ++--
> src/mesa/main/shaderapi.c | 28 ++++++++++++++++++++++++++++
> src/mesa/main/shaderapi.h | 7 ++++++-
> 3 files changed, 36 insertions(+), 3 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index d878a04ea09..94589464c5c 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -5295,7 +5295,7 @@
> <glx ignore="true"/>
> </function>
>
> - <function name="AttachShader" es2="2.0">
> + <function name="AttachShader" es2="2.0" no_error="true">
> <param name="program" type="GLuint"/>
> <param name="shader" type="GLuint"/>
> <glx ignore="true"/>
> @@ -7709,7 +7709,7 @@
> <glx ignore="true"/>
> </function>
>
> - <function name="AttachObjectARB">
> + <function name="AttachObjectARB" no_error="true">
> <param name="containerObj" type="GLhandleARB"/>
> <param name="obj" type="GLhandleARB"/>
> <glx ignore="true"/>
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index 457a18e4175..7318833e9b8 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -311,6 +311,19 @@ attach_shader_err(struct gl_context *ctx, GLuint program, GLuint shader,
> }
>
>
> +static void
> +attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
> +{
I think I would rather this be:
attach_shader_no_error() and
add_shader() -> attach_shader()
What do you think? It might even make sense to make:
attach_shader_no_error() -> lookup_and_attach_shader_no_error()
attach_shader_err() -> lookup_and_attach_shader_err()
If you agree 1-3:
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
> + struct gl_shader_program *shProg;
> + struct gl_shader *sh;
> +
> + shProg = _mesa_lookup_shader_program(ctx, program);
> + sh = _mesa_lookup_shader(ctx, shader);
> +
> + add_shader(ctx, shProg, sh);
> +}
> +
> +
> static GLuint
> create_shader(struct gl_context *ctx, GLenum type)
> {
> @@ -1334,6 +1347,13 @@ validate_program(struct gl_context *ctx, GLuint program)
> }
>
>
> +void GLAPIENTRY
> +_mesa_AttachObjectARB_no_error(GLhandleARB program, GLhandleARB shader)
> +{
> + GET_CURRENT_CONTEXT(ctx);
> + attach_shader(ctx, program, shader);
> +}
> +
>
> void GLAPIENTRY
> _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
> @@ -1344,6 +1364,14 @@ _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
>
>
> void GLAPIENTRY
> +_mesa_AttachShader_no_error(GLuint program, GLuint shader)
> +{
> + GET_CURRENT_CONTEXT(ctx);
> + attach_shader(ctx, program, shader);
> +}
> +
> +
> +void GLAPIENTRY
> _mesa_AttachShader(GLuint program, GLuint shader)
> {
> GET_CURRENT_CONTEXT(ctx);
> diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
> index 0a28185177d..3f6c0ff0cba 100644
> --- a/src/mesa/main/shaderapi.h
> +++ b/src/mesa/main/shaderapi.h
> @@ -73,6 +73,10 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg);
> extern void
> _mesa_shader_write_subroutine_indices(struct gl_context *ctx,
> gl_shader_stage stage);
> +
> +void GLAPIENTRY
> +_mesa_AttachObjectARB_no_error(GLhandleARB, GLhandleARB);
> +
> extern void GLAPIENTRY
> _mesa_AttachObjectARB(GLhandleARB, GLhandleARB);
>
> @@ -154,7 +158,8 @@ _mesa_GetActiveAttrib(GLuint, GLuint, GLsizei, GLsizei *, GLint *,
> extern GLint GLAPIENTRY
> _mesa_GetAttribLocation(GLuint, const GLchar *);
>
> -
> +void GLAPIENTRY
> +_mesa_AttachShader_no_error(GLuint program, GLuint shader);
>
> extern void GLAPIENTRY
> _mesa_AttachShader(GLuint program, GLuint shader);
>
More information about the mesa-dev
mailing list