[Mesa-dev] [PATCH 2/2] mesa: Add fall-back formats for unsupported snorm formats

Marek Olšák maraeo at gmail.com
Sun Apr 3 06:06:36 PDT 2011


On Sun, Apr 3, 2011 at 5:52 AM, Kenneth Graunke <kenneth at whitecape.org>wrote:

> On 04/02/2011 07:18 PM, Ian Romanick wrote:
>
>> From: Ian Romanick<ian.d.romanick at intel.com>
>>
>> This is always the way the real hardware and desktop OpenGL.  Some
>>
>
> Err...what?
>
>
>  hardware can't do some formats natively.  The alpha-only, luminance,
>> and intensity formats are usually the most problematic.  Some sized
>> formats can also be problematic.  This patch provides fall-back
>> formats for those that are not natively supported.
>>
>> At some point it would be interesting to try providing
>> device-independent conversions using EXT_texture_swizzle.  The drivers
>> that support EXT_texture_swizzle could, for example, see
>> GL_LUMINANCE16_SNORM as MESA_FORMAT_SIGNED_R16 with a { r, r, r, 1 }
>> swizzle.  Care would need to be taken to prevent issues with using
>> those textures for FBO rendering.
>>
>> This is the rest of the fix for glean's pixelFormats test on i965.
>>
>> Cc: Marek Ol ák<maraeo at gmail.com>
>>
>
> 's' please!  ^^^
>
>
>  ---
>>  src/mesa/main/texformat.c |   26 +++++++++++++++++++++++---
>>  1 files changed, 23 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
>> index 8b7b4ff..da90745 100644
>> --- a/src/mesa/main/texformat.c
>> +++ b/src/mesa/main/texformat.c
>> @@ -402,7 +402,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint
>> internalFormat,
>>           case GL_RGB_SNORM:
>>           case GL_RGB8_SNORM:
>>            RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
>> -           break;
>> +           /* FALLTHROUGH */
>>           case GL_RGBA_SNORM:
>>           case GL_RGBA8_SNORM:
>>            RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
>> @@ -411,18 +411,27 @@ _mesa_choose_tex_format( struct gl_context *ctx,
>> GLint internalFormat,
>>           case GL_ALPHA_SNORM:
>>           case GL_ALPHA8_SNORM:
>>              RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8);
>> +           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
>> +           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
>>
>
> I'm probably being dense here, but if RGBA8888 works as a fallback,
> couldn't R8 work as well?


A8 is 000A, R8 is R001. If you don't have swizzling, you cannot replace A8
with R8. LA8 and RGBA8 are the only possible fallback formats there. BTW
Gallium overrides the ChooseTextureFormat hook, so this patch has no effect
on Gallium drivers.

Other than that, it looks good to me.

Reviewed-by: Marek Olšák <maraeo at gmail.com>

Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110403/0825a5fa/attachment.htm>


More information about the mesa-dev mailing list