[Mesa-dev] EXT_tetxure_swizzle and BGRA textures : glean test enhancement

Brian Paul brianp at vmware.com
Mon May 3 10:39:25 PDT 2010


Dave Airlie wrote:
> On Sat, May 1, 2010 at 6:47 PM, Dave Airlie <airlied at gmail.com> wrote:
>> In looking at adding EXT_texture_swizzle I'm a bit confused about what
>> exactly should happen with BGRA textures, as on r300 we use the
>> texture swizzling to do BGRA, so we would have some interaction at
>> that point.
>>
>> To make sure we test for this I've made the following enhancments to
>> the glean test (in piglit tree - but I'll resubmit against glean tree
>> if correct).
>>
>> Can someone with a clue make sure this is a sane test, it passes
>> against swrast..
>>
> 
> Hmm on a second look inside mesa, it appears it never stores textures
> internally as BGRA, it always does a swizzle translate on the way in,
> so this test won't help me there, I'll have to think up something a
> bit more intricate to test this stuff.


There's often texture swizzling involved in converting the 
user-provided image (GL_RGBA vs. GL_BGRA vs. GL_ABGR_EXT, etc) to the 
actual hardware texture format (MESA_FORMAT_RGBA8888, 
MESA_FORMAT_ARGB8888_REV, etc).

BTW, people concerned with glTexImage() performance should do some 
experimentation with different source formats/types to find one that 
(hopefully) avoids swizzling and can just be memcpy'd.

For swrast, Mesa prefers the MESA_FORMAT_RGBA8888 format for slightly 
faster software rendering on some paths.  If you want to force a 
different internal format for testing with swrast, just modify the 
_mesa_choose_tex_format() function in texformat.c.  There's similar 
code for gallium in st_ChooseTextureFormat().

There's a glean test (packedPixels??) that exercises all the different 
glTexImage() format/type combinations if you're looking for something 
that will hit different texture formats.

-Brian


More information about the mesa-dev mailing list