mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 10:00:14 +01:00
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>
This commit is contained in:
parent
646afc6ff7
commit
ec16a5b091
2 changed files with 12 additions and 6 deletions
|
|
@ -229,6 +229,8 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen,
|
|||
memset(svga->state.hw_draw.sampler_views, 0,
|
||||
sizeof(svga->state.hw_draw.sampler_views));
|
||||
svga->state.hw_draw.num_views = 0;
|
||||
svga->state.hw_draw.num_rendertargets = 0;
|
||||
svga->state.hw_draw.dsv = NULL;
|
||||
|
||||
/* Initialize the shader pointers */
|
||||
svga->state.hw_draw.vs = NULL;
|
||||
|
|
|
|||
|
|
@ -664,17 +664,21 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf)
|
|||
void
|
||||
svga_propagate_rendertargets(struct svga_context *svga)
|
||||
{
|
||||
const unsigned num_cbufs = svga_screen(svga->pipe.screen)->max_color_buffers;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < num_cbufs; i++) {
|
||||
if (svga->curr.framebuffer.cbufs[i]) {
|
||||
svga_propagate_surface(svga, svga->curr.framebuffer.cbufs[i]);
|
||||
/* Note that we examine the svga->state.hw_draw.framebuffer surfaces,
|
||||
* not the svga->curr.framebuffer surfaces, because it's the former
|
||||
* surfaces which may be backing surface views (the actual render targets).
|
||||
*/
|
||||
for (i = 0; i < svga->state.hw_draw.num_rendertargets; i++) {
|
||||
struct pipe_surface *s = svga->state.hw_draw.rtv[i];
|
||||
if (s) {
|
||||
svga_propagate_surface(svga, s);
|
||||
}
|
||||
}
|
||||
|
||||
if (svga->curr.framebuffer.zsbuf) {
|
||||
svga_propagate_surface(svga, svga->curr.framebuffer.zsbuf);
|
||||
if (svga->state.hw_draw.dsv) {
|
||||
svga_propagate_surface(svga, svga->state.hw_draw.dsv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue