[Mesa-dev] [PATCH] getteximage: avoid to lookup textures with id 0

Mark Janes mark.a.janes at intel.com
Mon Mar 6 20:26:04 UTC 2017


Does this work on AMD hardware?  It regresses every Intel GPU.

https://bugs.freedesktop.org/show_bug.cgi?id=100088

Samuel Pitoiset <samuel.pitoiset at gmail.com> writes:

> This fixes the following assertion when the key is 0.
>
> main/hash.c:181: _mesa_HashLookup_unlocked: Assertion `key' failed.
>
> Fixes: 633c959fae ("getteximage: Return correct error value when texure object is not found")
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/mesa/main/texgetimage.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> index c0c50b0518..37fda3dc9c 100644
> --- a/src/mesa/main/texgetimage.c
> +++ b/src/mesa/main/texgetimage.c
> @@ -1458,7 +1458,9 @@ _mesa_GetTextureSubImage(GLuint texture, GLint level,
>  {
>     GET_CURRENT_CONTEXT(ctx);
>     static const char *caller = "glGetTextureSubImage";
> -   struct gl_texture_object *texObj =
> +   struct gl_texture_object *texObj = NULL;
> +
> +   if (texture > 0)
>        _mesa_lookup_texture(ctx, texture);
>  
>     if (!texObj) {
> @@ -1774,9 +1776,11 @@ _mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
>  {
>     GET_CURRENT_CONTEXT(ctx);
>     static const char *caller = "glGetCompressedTextureImage";
> -   struct gl_texture_object *texObj;
> +   struct gl_texture_object *texObj = NULL;
> +
> +   if (texture > 0)
> +      texObj = _mesa_lookup_texture(ctx, texture);
>  
> -   texObj = _mesa_lookup_texture(ctx, texture);
>     if (!texObj) {
>        _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", caller);
>        return;
> -- 
> 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