[Mesa-dev] [PATCH v2] getteximage: fix returned error value when texture object is not found

Juan A. Suarez Romero jasuarez at igalia.com
Thu Jun 22 16:19:30 UTC 2017


On Thu, 2017-06-22 at 18:13 +0200, Juan A. Suarez Romero wrote:
> On Thu, 2017-06-22 at 17:48 +0200, Samuel Pitoiset wrote:
> > 
> > On 06/22/2017 05:46 PM, Juan A. Suarez Romero wrote:
> > >  From OpenGL 4.5 spec PDF, section '8.11. Texture Queries', page 236:
> > >    "An INVALID_VALUE error is generated if texture is not the name of
> > >     an existing texture object."
> > > 
> > > Same wording applies to the compressed version.
> > > 
> > > But turns out this is a spec bug, and Khronos is fixing it for the next
> > > revisions.
> > > 
> > > The proposal is to return INVALID_OPERATION in these cases.
> > > 
> > > v2: Use _mesa_lookup_texture_err (Samuel Pitoiset)
> > > 
> > > Fixes: GL45-CTS.get_texture_sub_image.errors_test
> > > Fixes: 633c959fa (getteximage: Return correct error value when texure
> > > object is not found)
> > > 
> > > Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
> > > ---
> > >   src/mesa/main/texgetimage.c | 6 ++----
> > >   1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> > > index 658b0e5..4937d89 100644
> > > --- a/src/mesa/main/texgetimage.c
> > > +++ b/src/mesa/main/texgetimage.c
> > > @@ -1461,10 +1461,9 @@ _mesa_GetTextureSubImage(GLuint texture, GLint level,
> > >      struct gl_texture_object *texObj = NULL;
> > >   
> > >      if (texture > 0)
> > > -      texObj = _mesa_lookup_texture(ctx, texture);
> > > +      texObj = _mesa_lookup_texture_err(ctx, texture, caller);
> > 
> > _mesa_lookup_texture_err() already handles the case where texture > 0, 
> > you can get rid of that check (same below). Thanks.
> > 
> 
> Thanks! Didn't know.
> 
> 


I'm realizing that easiest way is just to revert 633c959fa.

> 	J.A.
> 
> > >   
> > >      if (!texObj) {
> > > -      _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", caller);
> > >         return;
> > >      }
> > >   
> > > @@ -1779,10 +1778,9 @@ _mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
> > >      struct gl_texture_object *texObj = NULL;
> > >   
> > >      if (texture > 0)
> > > -      texObj = _mesa_lookup_texture(ctx, texture);
> > > +      texObj = _mesa_lookup_texture_err(ctx, texture, caller);
> > >   
> > >      if (!texObj) {
> > > -      _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", caller);
> > >         return;
> > >      }
> > >   
> > > 
> > 
> > 
> 
> _______________________________________________
> 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