[Mesa-dev] [PATCH 21/42] mesa: prepare create_samplers() helper for KHR_no_error support

Timothy Arceri tarceri at itsqueeze.com
Tue Jun 27 23:34:29 UTC 2017


On 27/06/17 21:20, Samuel Pitoiset wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/mesa/main/samplerobj.c | 37 ++++++++++++++++++++++---------------
>   1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
> index d3ed4da3932..2fbaab9a8dc 100644
> --- a/src/mesa/main/samplerobj.c
> +++ b/src/mesa/main/samplerobj.c
> @@ -154,23 +154,11 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name)
>   }
>   
>   static void
> -create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers,
> -                const char *caller)
> +create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers)
>   {
>      GLuint first;
>      GLint i;
>   
> -   if (MESA_VERBOSE & VERBOSE_API)
> -      _mesa_debug(ctx, "%s(%d)\n", caller, count);
> -
> -   if (count < 0) {
> -      _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", caller);
> -      return;
> -   }
> -
> -   if (!samplers)
> -      return;

Again please leave this here. With that 20-21:

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

> -
>      _mesa_HashLockMutex(ctx->Shared->SamplerObjects);
>   
>      first = _mesa_HashFindFreeKeyBlock(ctx->Shared->SamplerObjects, count);
> @@ -186,18 +174,37 @@ create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers,
>      _mesa_HashUnlockMutex(ctx->Shared->SamplerObjects);
>   }
>   
> +static void
> +create_samplers_err(struct gl_context *ctx, GLsizei count, GLuint *samplers,
> +                    const char *caller)
> +{
> +
> +   if (MESA_VERBOSE & VERBOSE_API)
> +      _mesa_debug(ctx, "%s(%d)\n", caller, count);
> +
> +   if (count < 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", caller);
> +      return;
> +   }
> +
> +   if (!samplers)
> +      return;
> +
> +   create_samplers(ctx, count, samplers);
> +}
> +
>   void GLAPIENTRY
>   _mesa_GenSamplers(GLsizei count, GLuint *samplers)
>   {
>      GET_CURRENT_CONTEXT(ctx);
> -   create_samplers(ctx, count, samplers, "glGenSamplers");
> +   create_samplers_err(ctx, count, samplers, "glGenSamplers");
>   }
>   
>   void GLAPIENTRY
>   _mesa_CreateSamplers(GLsizei count, GLuint *samplers)
>   {
>      GET_CURRENT_CONTEXT(ctx);
> -   create_samplers(ctx, count, samplers, "glCreateSamplers");
> +   create_samplers_err(ctx, count, samplers, "glCreateSamplers");
>   }
>   
>   
> 


More information about the mesa-dev mailing list