[Mesa-dev] [PATCH] getteximage: Return correct error value when texure object is not found
Eduardo Lima Mitev
elima at igalia.com
Wed Feb 15 18:40:13 UTC 2017
On 02/15/2017 01:56 PM, Nicolai Hähnle wrote:
> On 15.02.2017 12:14, Eduardo Lima Mitev wrote:
>> glGetTextureSubImage() and glGetCompressedTextureSubImage() are currently
>> returning INVALID_OPERATION error when the passed texture argument
>> does not
>> correspond to an existing texture object. However, the error should be
>> INVALID_VALUE instead. 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.
>>
>> The INVALID_OPERATION error is coming from the call to
>> _mesa_lookup_texture_err(). This patch uses _mesa_lookup_texture()
>> instead
>> and emits the correct error in the caller instead.
>>
>> Fixes: GL45-CTS.get_texture_sub_image.errors_test
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
Just merged the patch. Thanks, Nicolai!
I forgot to comment that there is a piglit regression with this patch,
but it is an error in the test. I have submitted a fix for it too:
https://lists.freedesktop.org/archives/piglit/2017-February/021804.html
Eduardo
>> ---
>> src/mesa/main/texgetimage.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
>> index b0ced1eac0f..c0c50b0518b 100644
>> --- a/src/mesa/main/texgetimage.c
>> +++ b/src/mesa/main/texgetimage.c
>> @@ -1459,9 +1459,10 @@ _mesa_GetTextureSubImage(GLuint texture, GLint
>> level,
>> GET_CURRENT_CONTEXT(ctx);
>> static const char *caller = "glGetTextureSubImage";
>> struct gl_texture_object *texObj =
>> - _mesa_lookup_texture_err(ctx, texture, caller);
>> + _mesa_lookup_texture(ctx, texture);
>>
>> if (!texObj) {
>> + _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", caller);
>> return;
>> }
>>
>> @@ -1775,8 +1776,9 @@ _mesa_GetCompressedTextureSubImage(GLuint
>> texture, GLint level,
>> static const char *caller = "glGetCompressedTextureImage";
>> struct gl_texture_object *texObj;
>>
>> - texObj = _mesa_lookup_texture_err(ctx, texture, caller);
>> + texObj = _mesa_lookup_texture(ctx, texture);
>> if (!texObj) {
>> + _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", caller);
>> return;
>> }
>>
>>
>
>
More information about the mesa-dev
mailing list