svga: fix a texture readback bug
authorBrian Paul <brianp@vmware.com>
Fri, 26 Aug 2016 22:25:39 +0000 (16:25 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 29 Aug 2016 23:46:50 +0000 (17:46 -0600)
commitec16a5b0915a4a764e077f2b6abc8723143e488d
tree354e349406394677bdeea48be72ffad4ad842b7c
parent646afc6ff75fca5a961549ffe175877f903ef5c7
svga: fix a texture readback bug

Backing views/surfaces are used to handle the case when a resource is
bound both as a render target and as a sampler source (such as when
doing auto mipmap generation).

This patch fixes a bug where mapping a resource (to do a glReadPixels)
was reading the stale data in the original surface rather than the
backing surface which was rendered to.

We need to propagate the backing resource (which we rendered to) back
to the original resource before we read from it.  The problem was the
svga_propagate_rendertargets() function was examining the wrong surface
views.

This fixes the "poc9" test described in VMware bug 1686661.
Also tested with Piglit, Cinebench, Lightsmark, etc.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/drivers/svga/svga_context.c
src/gallium/drivers/svga/svga_surface.c