[Mesa-dev] [PATCH 1/5] meta: Use the _mesa_meta_compile_and_link_program helper more places.

Pohjolainen, Topi topi.pohjolainen at intel.com
Wed Mar 16 12:55:59 UTC 2016


On Wed, Mar 16, 2016 at 12:12:58AM -0700, Kenneth Graunke wrote:
> Less boilerplate.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/common/meta.c                  | 34 ++++---------------------
>  src/mesa/drivers/dri/i965/brw_meta_fast_clear.c | 14 +++-------
>  2 files changed, 8 insertions(+), 40 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index b05dfc7..bdcf316 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -1537,21 +1537,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
>     if (clear->ShaderProg != 0)
>        return;
>  
> -   vs = _mesa_CreateShader(GL_VERTEX_SHADER);
> -   _mesa_ShaderSource(vs, 1, &vs_source, NULL);
> -   _mesa_CompileShader(vs);
> -
> -   fs = _mesa_CreateShader(GL_FRAGMENT_SHADER);
> -   _mesa_ShaderSource(fs, 1, &fs_source, NULL);
> -   _mesa_CompileShader(fs);
> -
> -   clear->ShaderProg = _mesa_CreateProgram();
> -   _mesa_AttachShader(clear->ShaderProg, fs);
> -   _mesa_DeleteShader(fs);
> -   _mesa_AttachShader(clear->ShaderProg, vs);
> -   _mesa_DeleteShader(vs);
> -   _mesa_ObjectLabel(GL_PROGRAM, clear->ShaderProg, -1, "meta clear");
> -   _mesa_LinkProgram(clear->ShaderProg);
> +   _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source, "meta clear",
> +                                       &clear->ShaderProg);

While it takes care of all the above it also calls:

   _mesa_BindAttribLocation(*program, 0, "position");
   _mesa_BindAttribLocation(*program, 1, "texcoords");

But then I realized you replaced these in your previous patches with
explicit locations. This is:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>


More information about the mesa-dev mailing list