[Mesa-dev] [PATCH] mesa: enable ASTC/ETC1 compressed textures

Tapani Pälli tapani.palli at intel.com
Mon Jan 22 06:41:48 UTC 2018



On 01/19/2018 12:44 PM, Juan A. Suarez Romero wrote:
> Anyone could take a look at this patch?
> 

Can you pinpoint where the mentioned tests are located, which suite?

> Thanks in advance!
> 
> 
> 	J.A.
> 
> On Thu, 2018-01-11 at 16:35 +0100, Juan A. Suarez Romero wrote:
>> Enable these kind of texture when proper extensions are available.
>>
>> Fixes KHR-GLES2.texture_3d.* with these textures.
>> ---
>>   src/mesa/main/teximage.c | 26 +++++++++++++++++++-------
>>   1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index e5f8bb0718f..a9940de88b1 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -1487,6 +1487,9 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
>>         break;
>>      case GL_TEXTURE_3D:
>>         switch (layout) {
>> +      case MESA_FORMAT_LAYOUT_ETC1:
>> +         target_can_be_compresed = ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
>> +         break;
>>         case MESA_FORMAT_LAYOUT_ETC2:
>>            /* See ETC2/EAC comment in case GL_TEXTURE_CUBE_MAP_ARRAY. */
>>            if (_mesa_is_gles3(ctx))
>> @@ -4648,10 +4651,12 @@ out:
>>    */
>>   static GLboolean
>>   compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
>> -                                   GLint dims, GLenum format, bool dsa,
>> +                                   GLint dims, GLenum intFormat, bool dsa,
>>                                      const char *caller)
>>   {
>>      GLboolean targetOK;
>> +   mesa_format format;
>> +   enum mesa_format_layout layout;
>>   
>>      if (dsa && target == GL_TEXTURE_RECTANGLE) {
>>         _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid target %s)", caller,
>> @@ -4712,21 +4717,28 @@ compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
>>             * which is (at this time) only bptc. Otherwise we'd say s3tc (and
>>             * more) are valid here, which they are not, but of course not
>>             * mentioned by core spec.
>> +          *
>> +          * We add also other formats supported due extensions.
>>             */
>> -         switch (format) {
>> +         format = _mesa_glenum_to_compressed_format(intFormat);
>> +         layout = _mesa_get_format_layout(format);
>> +         switch (layout) {
>>            /* These are the only 3D compression formats supported at this time */
>> -         case GL_COMPRESSED_RGBA_BPTC_UNORM:
>> -         case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
>> -         case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
>> -         case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
>> +         case MESA_FORMAT_LAYOUT_BPTC:
>>               /* valid format */
>>               break;
>> +         case MESA_FORMAT_LAYOUT_ASTC:
>> +            targetOK = ctx->Extensions.KHR_texture_compression_astc_ldr;
>> +            break;
>> +         case MESA_FORMAT_LAYOUT_ETC1:
>> +            targetOK = ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
>> +            break;
>>            default:
>>               /* invalid format */
>>               _mesa_error(ctx, GL_INVALID_OPERATION,
>>                           "%s(invalid target %s for format %s)", caller,
>>                           _mesa_enum_to_string(target),
>> -                        _mesa_enum_to_string(format));
>> +                        _mesa_enum_to_string(intFormat));
>>               return GL_TRUE;
>>            }
>>            break;
> _______________________________________________
> 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