[Mesa-dev] [PATCH 2/5] mesa: Make compile_shader() take a gl_shader, not a GLuint.

Timothy Arceri timothy.arceri at collabora.com
Wed Mar 16 11:08:00 UTC 2016


Patches 2-4 are

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

I'll take a better look at the other two in the next few days unless
someone beats me to it.

On Wed, 2016-03-16 at 00:12 -0700, Kenneth Graunke wrote:
> In half the callers, we already have a pointer, and don't need
> to look it up again.  This will also help with upcoming meta work.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/main/shaderapi.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index cdf15b4..43c4188 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -960,11 +960,8 @@ shader_source(struct gl_shader *sh, const GLchar
> *source)
>   * Compile a shader.
>   */
>  static void
> -compile_shader(struct gl_context *ctx, GLuint shaderObj)
> +compile_shader(struct gl_context *ctx, struct gl_shader *sh)
>  {
> -   struct gl_shader *sh;
> -
> -   sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader");
>     if (!sh)
>        return;
>  
> @@ -1270,7 +1267,8 @@ _mesa_CompileShader(GLuint shaderObj)
>     GET_CURRENT_CONTEXT(ctx);
>     if (MESA_VERBOSE & VERBOSE_API)
>        _mesa_debug(ctx, "glCompileShader %u\n", shaderObj);
> -   compile_shader(ctx, shaderObj);
> +   compile_shader(ctx,
> +                  _mesa_lookup_shader_err(ctx, shaderObj,
> "glCompileShader"));
>  }
>  
>  
> @@ -2154,18 +2152,17 @@ _mesa_CreateShaderProgramv(GLenum type,
> GLsizei count,
>     }
>  
>     if (shader) {
> -      _mesa_ShaderSource(shader, count, strings, NULL);
> +      struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
>  
> -      compile_shader(ctx, shader);
> +      _mesa_ShaderSource(shader, count, strings, NULL);
> +      compile_shader(ctx, sh);
>  
>        program = create_shader_program(ctx);
>        if (program) {
>  	 struct gl_shader_program *shProg;
> -	 struct gl_shader *sh;
>  	 GLint compiled = GL_FALSE;
>  
>  	 shProg = _mesa_lookup_shader_program(ctx, program);
> -	 sh = _mesa_lookup_shader(ctx, shader);
>  
>  	 shProg->SeparateShader = GL_TRUE;
>  


More information about the mesa-dev mailing list