[Mesa-dev] [PATCH 4/6] mesa: Add a new texture format GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2

Brian Paul brianp at vmware.com
Tue Oct 30 07:22:09 PDT 2012


On 10/29/2012 07:37 PM, Ian Romanick wrote:
> On 10/25/2012 03:17 PM, Brian Paul wrote:
>> On 10/24/2012 02:22 PM, Anuj Phogat wrote:
>>>
>>> Signed-off-by: Anuj Phogat<anuj.phogat at gmail.com>
>>> ---
>>> src/mesa/main/format_unpack.c | 9 +++++++++
>>> src/mesa/main/formats.c | 13 +++++++++++++
>>> src/mesa/main/formats.h | 1 +
>>> src/mesa/main/glformats.c | 2 ++
>>> src/mesa/main/texcompress.c | 9 +++++++++
>>> src/mesa/main/texformat.c | 3 +++
>>> src/mesa/main/teximage.c | 1 +
>>> src/mesa/main/texstore.c | 2 ++
>>> 8 files changed, 40 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/src/mesa/main/format_unpack.c
>>> b/src/mesa/main/format_unpack.c
>>> index 1a8f113..d31d2fa 100644
>>> --- a/src/mesa/main/format_unpack.c
>>> +++ b/src/mesa/main/format_unpack.c
>>> @@ -1392,6 +1392,13 @@ unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1(const void
>>> *src, GLfloat dst[][4],
>>> }
>>>
>>> static void
>>> +unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1(const void *src, GLfloat
>>> dst[][4],
>>> + GLuint n)
>>> +{
>>> + /* XXX to do */
>>> +}
>>> +
>>> +static void
>>> unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n)
>>> {
>>> const GLbyte *s = ((const GLbyte *) src);
>>> @@ -1650,6 +1657,8 @@ get_unpack_rgba_function(gl_format format)
>>> table[MESA_FORMAT_ETC2_SIGNED_RG11_EAC] =
>>> unpack_ETC2_SIGNED_RG11_EAC;
>>> table[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1] =
>>> unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
>>> + table[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1] =
>>> + unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1;
>>> table[MESA_FORMAT_SIGNED_A8] = unpack_SIGNED_A8;
>>> table[MESA_FORMAT_SIGNED_L8] = unpack_SIGNED_L8;
>>> table[MESA_FORMAT_SIGNED_AL88] = unpack_SIGNED_AL88;
>>> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
>>> index cba51ee..8aa4f28 100644
>>> --- a/src/mesa/main/formats.c
>>> +++ b/src/mesa/main/formats.c
>>> @@ -1488,6 +1488,16 @@ static struct gl_format_info
>>> format_info[MESA_FORMAT_COUNT] =
>>> 4, 4, 8 /* 8 bytes per 4x4 block */
>>> },
>>>
>>> + {
>>> + MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1,
>>> + "MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1",
>>> + GL_RGBA,
>>> + GL_UNSIGNED_NORMALIZED,
>>> + 8, 8, 8, 1,
>>> + 0, 0, 0, 0, 0,
>>> + 4, 4, 8 /* 8 bytes per 4x4 block */
>>> + },
>>> +
>>
>> Anytime we add a new format to the format_info[] array we have to
>> add/update the corresponding entry in texfetch_funcs[] array in
>> swrast/s_texfetch.c
>>
>> There's a runtime assertion that'll detect missing entries, but only if
>> you run swrast.

I misspoke.  There's a compile-time static assertion.  Perhaps you're 
not compiling swrast, Anuj.

-Brian



More information about the mesa-dev mailing list