[virglrenderer-devel] [PATCH 4/4] blit: fix blitting to red-alpha texture

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jun 14 15:30:56 UTC 2016


Hi

On Tue, Jun 14, 2016 at 8:18 AM, Dave Airlie <airlied at gmail.com> wrote:
> On 14 June 2016 at 16:11, Dave Airlie <airlied at gmail.com> wrote:
>> On 11 June 2016 at 03:25,  <marcandre.lureau at redhat.com> wrote:
>>> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>>>
>>> glBlitFramebuffer() doesn't take swizzling into account, so use
>>> blit_gl() fallback in this case with a alpha->red swizzle.
>>>
>>> This fixes text rendering with Qt
>>> QGLTextureGlyphCache::resizeTextureData(), as can be reproduced with
>>> stellarium or qt5/examples/widgets/graphicsview/chip/chip.
>>
>> I like the GLX workarounds, so I'll take those, as apitrace is a pita
>> with epoxy. I've
>> hacked it locally a few times but it's always messy.
>>
>> However I don't think this fix is fully correct,
>>
>> What we are doing here is if the destination is ALPHA we are taking the ALPHA
>> channel from the source into RED, we should be adjusting the shader I
>> think in this
>> case to write the alpha not the red.
>>
>> If the source was ALPHA we should be using the swizzle. Granted there might
>> not be a difference in the end result.
>>
>> https://cgit.freedesktop.org/~airlied/virglrenderer/commit/?h=fix-red-blit&id=b50aaa0396256e68e784ae57eac4c408701719e3
>> was my alternate patch that does the same thing as yours without
>> redoing all the swizzle code.
>>
>> However I think we need to look at changing the shader when the dst is
>> emulated alpha.
>
> https://cgit.freedesktop.org/~airlied/virglrenderer/commit/?h=fix-red-blit-shader&id=20916f13f66e10705a8220e78daac3862fb8db5d
>
> seems to work for me.

That is fine to me too, I also had a similar approach initially.

I haven't encountered the issue yet, but do you think it should also
handle the swizzle/emulated-alpha on the source (perhaps an associated
sampler view is guaranteed to be set before the blit)

-- 
Marc-André Lureau


More information about the virglrenderer-devel mailing list