[Mesa-stable] [PATCH V2 03/10] mesa: Add error condition for integer formats in glGetTexImage()

Anuj Phogat anuj.phogat at gmail.com
Tue Mar 25 15:40:49 PDT 2014


On Tue, Mar 25, 2014 at 3:33 PM, Brian Paul <brianp at vmware.com> wrote:
> On 03/25/2014 04:02 PM, Anuj Phogat wrote:
>>
>> OpenGL 4.0 spec, page 306 suggests an INVALID_OPERATION in glGetTexImage
>> if :
>>     "format is one of the integer formats in table 3.3 and the internal
>>      format of the texture image is not integer, or format is not one of
>>      the integer formats in table 3.3 and the internal format is integer."
>>
>> V2: Use helper function _mesa_is_format_integer()
>>
>> Cc: <mesa-stable at lists.freedesktop.org>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> ---
>>   src/mesa/main/texgetimage.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
>> index 488b678..2747540 100644
>> --- a/src/mesa/main/texgetimage.c
>> +++ b/src/mesa/main/texgetimage.c
>> @@ -823,7 +823,7 @@ getteximage_error_check(struct gl_context *ctx, GLenum
>> target, GLint level,
>>      }
>>
>>      baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
>> -
>> +
>>      /* Make sure the requested image format is compatible with the
>>       * texture's format.
>>       */
>> @@ -858,6 +858,11 @@ getteximage_error_check(struct gl_context *ctx,
>> GLenum target, GLint level,
>>         _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format
>> mismatch)");
>>         return GL_TRUE;
>>      }
>> +   else if (_mesa_is_enum_format_integer(format) !=
>> +            _mesa_is_enum_format_integer(texImage->TexFormat)) {
>
>
> I think you're calling the wrong "is integer" function there.
>
Yes. copy-paste error :(

>
>
>> +      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format
>> mismatch)");
>> +      return GL_TRUE;
>> +   }
>>
>>      if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack,
>> texImage->Width,
>>                                     texImage->Height, texImage->Depth,
>>
>
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable


More information about the mesa-stable mailing list