[Mesa-stable] [PATCH 3/3] mesa: Allow GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL combinations in glTexImage{123}D()

Anuj Phogat anuj.phogat at gmail.com
Tue Mar 4 10:54:13 PST 2014


On Tue, Mar 4, 2014 at 7:28 AM, Brian Paul <brianp at vmware.com> wrote:
> On 03/03/2014 07:48 PM, Anuj Phogat wrote:
>>
>>  From OpenGL 3.3 spec, page 141:
>>     "Textures with a base internal format of DEPTH_COMPONENT or
>> DEPTH_STENCIL
>>      require either depth component data or depth/stencil component data.
>>      Textures with other base internal formats require RGBA component
>> data.
>>      The error INVALID_OPERATION is generated if one of the base internal
>>      format and format is DEPTH_COMPONENT or DEPTH_STENCIL, and the other
>>      is neither of these values."
>>
>> Fixes Khronos OpenGL CTS test failure: proxy_textures_invalid_size
>>
>> Cc: <mesa-stable at lists.freedesktop.org>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> ---
>>   src/mesa/main/teximage.c | 13 +++++++++++--
>>   1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index 1cd6ade..1192b45 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -2039,6 +2039,8 @@ texture_error_check( struct gl_context *ctx,
>>                        GLint depth, GLint border )
>>   {
>>      GLboolean colorFormat;
>> +   GLboolean is_format_depth_or_depthstencil;
>> +   GLboolean is_internalFormat_depth_or_depthstencil;
>>      GLenum err;
>>
>>      /* Even though there are no color-index textures, we still have to
>> support
>> @@ -2129,11 +2131,18 @@ texture_error_check( struct gl_context *ctx,
>>      }
>>
>>      /* make sure internal format and format basically agree */
>> +   is_internalFormat_depth_or_depthstencil =
>> +      _mesa_is_depth_format(internalFormat) ||
>> +      _mesa_is_depthstencil_format(internalFormat);
>> +
>> +   is_format_depth_or_depthstencil =
>> +      _mesa_is_depth_format(format) ||
>> +      _mesa_is_depthstencil_format(format);
>> +
>>      colorFormat = _mesa_is_color_format(format);
>>      if ((_mesa_is_color_format(internalFormat) && !colorFormat &&
>> !indexFormat) ||
>> -       (_mesa_is_depth_format(internalFormat) !=
>> _mesa_is_depth_format(format)) ||
>> +       (is_internalFormat_depth_or_depthstencil !=
>> is_format_depth_or_depthstencil) ||
>>          (_mesa_is_ycbcr_format(internalFormat) !=
>> _mesa_is_ycbcr_format(format)) ||
>> -       (_mesa_is_depthstencil_format(internalFormat) !=
>> _mesa_is_depthstencil_format(format)) ||
>>          (_mesa_is_dudv_format(internalFormat) !=
>> _mesa_is_dudv_format(format))) {
>>         _mesa_error(ctx, GL_INVALID_OPERATION,
>>                     "glTexImage%dD(incompatible internalFormat = %s,
>> format = %s)",
>>
>
> LGTM.  Do we have any piglit tests that actually check this?
I don' think so. No changes in full piglit run with this patch. I'll send
out a patch to add this check in tests/texturing/teximage-errors.c.

>
> For the series, Reviewed-by: Brian Paul <brianp at vmware.com>
>
> -Brian
>
> _______________________________________________
> 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