[Mesa-dev] [PATCH 4/6] mesa: Add a new texture format GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
Anuj Phogat
anuj.phogat at gmail.com
Tue Oct 30 08:24:09 PDT 2012
On Tue, Oct 30, 2012 at 7:22 AM, Brian Paul <brianp at vmware.com> wrote:
> 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
>
I was compiling swrast and i965 drivers. Didn't get any compile time assertion.
I'm not sure if i have the required code for compile time assertion in my etc2
branch. I took my branch at commit 299acac. Issues with etc2 decoding on
swrast are now fixed on my etc2-v12.1 branch. Found few bugs in my
*fetch_texel functions during this process.
Ian, if we have a run time assertion, do we still need unit tests to be run by
'make check'?
More information about the mesa-dev
mailing list