[Mesa-dev] [PATCH] mesa/main: remove useless check in _mesa_IsSampler()

Marek Olšák maraeo at gmail.com
Mon Mar 6 16:51:00 UTC 2017


I'd prefer _mesa_lookup...(...) != NULL, but either way:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Wed, Mar 1, 2017 at 10:53 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> _mesa_lookup_samplerobj() returns NULL if sampler is 0.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/mesa/main/samplerobj.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
> index 8a0835a23d..a86e1d62d8 100644
> --- a/src/mesa/main/samplerobj.c
> +++ b/src/mesa/main/samplerobj.c
> @@ -270,17 +270,11 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
>  GLboolean GLAPIENTRY
>  _mesa_IsSampler(GLuint sampler)
>  {
> -   struct gl_sampler_object *sampObj;
>     GET_CURRENT_CONTEXT(ctx);
>
>     ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
>
> -   if (sampler == 0)
> -      return GL_FALSE;
> -
> -   sampObj = _mesa_lookup_samplerobj(ctx, sampler);
> -
> -   return sampObj != NULL;
> +   return !!_mesa_lookup_samplerobj(ctx, sampler);
>  }
>
>  void
> --
> 2.12.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list