[Mesa-dev] [PATCH 2/5] mesa: add api to write subroutine indicies to the program storage.

Andres Gomez agomez at igalia.com
Thu Aug 11 13:56:02 UTC 2016


On Tue, 2016-06-07 at 15:25 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This writes the subroutine indicies to the program storage for
> a stage. This API is intended to be used by drivers to update
> the uniform storage before uploading to the hw.
> 
> This isn't the most thread safe effort, but it will be significantly
> more multi-context safe.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/main/shaderapi.c | 10 ++++++++++
>  src/mesa/main/shaderapi.h |  3 +++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index 818a88d..07c581f 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -2816,6 +2816,16 @@ _mesa_shader_write_subroutine_index(struct gl_context *ctx,
>     } while(i < sh->NumSubroutineUniformRemapTable);
>  }
>  
> +void
> +_mesa_shader_write_subroutine_indicies(struct gl_context *ctx,
> +                                       gl_shader_stage stage)
> +{
> +   if (ctx->_Shader->CurrentProgram[stage] &&
> +       ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage])
> +      _mesa_shader_write_subroutine_index(ctx,
> +                                         ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage]);

Last line, not properly indented.

> +}
> +
>  static void
>  _mesa_shader_init_subroutine_defaults(struct gl_context *ctx,
>                                        struct gl_shader *sh)
> diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
> index b3de5fa..968cf97 100644
> --- a/src/mesa/main/shaderapi.h
> +++ b/src/mesa/main/shaderapi.h
> @@ -69,6 +69,9 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg);
>  extern size_t
>  _mesa_longest_attribute_name_length(struct gl_shader_program *shProg);
>  
> +extern void
> +_mesa_shader_write_subroutine_indicies(struct gl_context *ctx,
> +                                       gl_shader_stage stage);
>  extern void GLAPIENTRY
>  _mesa_AttachObjectARB(GLhandleARB, GLhandleARB);
>  

Other than the small nitpick, this is:

Reviewed-by: Andres Gomez <agomez at igalia.com>

-- 

Br,

Andres


More information about the mesa-dev mailing list