mesa: when blitting between formats clear any unused components
mesa: when blitting between formats clear any unused components
If the state tracker chooses to implement one format with a more
general one (e.g. GL_ALPHA implemented with GL_RGBA) we end up
in a situation where some components should be ignored. Readpix
handles this correctly, but blit does not, which means that if
we blit between different formats we can end up writing garbage
into some components.
This shows up in the piglit test ext_framebuffer_multisample
blit-mismatched-formats, where a GL_ALPHA framebuffer is created,
it is blitted to a GL_RGBA framebuffer, and then that is read
back and checked. A number of platforms are currently failing
that test.
Work around this by adding an explicit swizzle to the pipe_blit_info
struct, which can re-arrange elements and/or put 0 or 1 into
appropriate channels, and use this to set the appropriate values into
unused channels via the sampler view.
Signed-off-by: Eric R. Smith <eric.smith@collabora.com>
Edited by Eric Smith