[Mesa-dev] [PATCH 3/4] mesa/st: add BPTC formats, expose ARB_texture_compression_bptc

Ilia Mirkin imirkin at alum.mit.edu
Thu Aug 7 15:27:03 PDT 2014


Yeah, I noticed those later on. The latest patch is at

https://github.com/imirkin/mesa/commit/1a2f6dc41dae3df8d332ce4675e072ee0d9f37c7

Or did you have something else in mind?

On Thu, Aug 7, 2014 at 6:23 PM, Marek Olšák <maraeo at gmail.com> wrote:
> See st_GetTexImage and search for BPTC. There is a TODO comment which
> says what to do. All formats except for SRGBA must be added there.
>
> Marek
>
> On Wed, Jul 23, 2014 at 3:11 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>
>> This trivially depends on Neil's patches which add the mesa/core bits.
>>
>>  src/mesa/state_tracker/st_extensions.c |  6 ++++++
>>  src/mesa/state_tracker/st_format.c     | 36 ++++++++++++++++++++++++++++++++++
>>  2 files changed, 42 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
>> index aa59fbf..7297ffb 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -491,6 +491,12 @@ void st_init_extensions(struct st_context *st)
>>            PIPE_FORMAT_DXT3_RGBA,
>>            PIPE_FORMAT_DXT5_RGBA } },
>>
>> +      { { o(ARB_texture_compression_bptc) },
>> +        { PIPE_FORMAT_BPTC_RGBA_UNORM,
>> +          PIPE_FORMAT_BPTC_SRGBA_UNORM,
>> +          PIPE_FORMAT_BPTC_RGB_FLOAT,
>> +          PIPE_FORMAT_BPTC_RGB_UFLOAT } },
>> +
>>        { { o(EXT_texture_shared_exponent) },
>>          { PIPE_FORMAT_R9G9B9E5_FLOAT } },
>>
>> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
>> index 409079b..4ce5d43 100644
>> --- a/src/mesa/state_tracker/st_format.c
>> +++ b/src/mesa/state_tracker/st_format.c
>> @@ -326,6 +326,15 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat)
>>     case MESA_FORMAT_ETC1_RGB8:
>>        return PIPE_FORMAT_ETC1_RGB8;
>>
>> +   case MESA_FORMAT_BPTC_RGBA_UNORM:
>> +      return PIPE_FORMAT_BPTC_RGBA_UNORM;
>> +   case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM:
>> +      return PIPE_FORMAT_BPTC_SRGBA_UNORM;
>> +   case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:
>> +      return PIPE_FORMAT_BPTC_RGB_FLOAT;
>> +   case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT:
>> +      return PIPE_FORMAT_BPTC_RGB_UFLOAT;
>> +
>>     /* signed normalized formats */
>>     case MESA_FORMAT_R_SNORM8:
>>        return PIPE_FORMAT_R8_SNORM;
>> @@ -685,6 +694,15 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
>>     case PIPE_FORMAT_ETC1_RGB8:
>>        return MESA_FORMAT_ETC1_RGB8;
>>
>> +   case PIPE_FORMAT_BPTC_RGBA_UNORM:
>> +      return MESA_FORMAT_BPTC_RGBA_UNORM;
>> +   case PIPE_FORMAT_BPTC_SRGBA_UNORM:
>> +      return MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM;
>> +   case PIPE_FORMAT_BPTC_RGB_FLOAT:
>> +      return MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT;
>> +   case PIPE_FORMAT_BPTC_RGB_UFLOAT:
>> +      return MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT;
>> +
>>     /* signed normalized formats */
>>     case PIPE_FORMAT_R8_SNORM:
>>        return MESA_FORMAT_R_SNORM8;
>> @@ -1238,6 +1256,24 @@ static const struct format_mapping format_map[] = {
>>        { PIPE_FORMAT_ETC1_RGB8, 0 }
>>     },
>>
>> +   /* BPTC */
>> +   {
>> +      { GL_COMPRESSED_RGBA_BPTC_UNORM, 0 },
>> +      { PIPE_FORMAT_BPTC_RGBA_UNORM, 0 },
>> +   },
>> +   {
>> +      { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, 0 },
>> +      { PIPE_FORMAT_BPTC_SRGBA_UNORM, 0 },
>> +   },
>> +   {
>> +      { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, 0 },
>> +      { PIPE_FORMAT_BPTC_RGB_FLOAT, 0 },
>> +   },
>> +   {
>> +      { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, 0 },
>> +      { PIPE_FORMAT_BPTC_RGB_UFLOAT, 0 },
>> +   },
>> +
>>     /* signed/unsigned integer formats.
>>      */
>>     {
>> --
>> 1.8.5.5
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list