[Mesa-dev] [PATCH 3/3] st/mesa: implement ARB_copy_image

Marek Olšák maraeo at gmail.com
Tue Oct 27 02:41:41 PDT 2015

On Tue, Oct 27, 2015 at 10:33 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On 26.10.2015 02:25, Marek Olšák wrote:
>> +/**
>> + * Handle complex format conversions using 2 blits with a temporary texture
>> + * in between, e.g. blitting from B10G10R10A2 to G16R16.
>> + *
>> + * This example is implemented this way:
>> + * 1) First, blit from B10G10R10A2 to R10G10B10A2, which is canonical, so it
>> + *    can be reinterpreted as a different canonical format of the same bpp,
>> + *    such as R16G16. This blit only swaps R and B 10-bit components.
>> + * 2) Finnaly, blit the result, which is R10G10B10A2, as R16G16 to G16R16.
>> + *    This blit only swaps R and G 16-bit components.
> In this example, some of the G10 bits will be covered by R16 and some of
> them by G16, so step 2) will tear the G10 bits apart and shuffle them
> around, won't it? Is that really what's supposed to happen in that case?
> Maybe I'm misunderstanding the example.

Yes, that's correct. ARB_copy_image is memcpy-like. RGB10A2 -> R16G16
must be memcpy. BGRA channel ordering doesn't exist in OpenGL. The
code only deals with GR and BGRA swizzling in gallium and reorders
those to standard RGBA, so that the memcpy can be executed.


More information about the mesa-dev mailing list