diff options
author | Brian Paul <brianp@vmware.com> | 2014-02-08 09:51:14 -0800 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2014-02-14 08:21:44 -0700 |
commit | d0c22a6d53a9cce2d40006f3d4d7dd7e2f63aca9 (patch) | |
tree | 1f7f0648b45321bdc2134176b65b49df648a0460 /src | |
parent | c1e60a61e8ca3bdac0530ad1aeb3c751f273b73d (diff) |
svga: track which textures are rendered to
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_misc.c | 39 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_surface.c | 17 |
2 files changed, 38 insertions, 18 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c index 2c88e2a90de..1df32a13b82 100644 --- a/src/gallium/drivers/svga/svga_pipe_misc.c +++ b/src/gallium/drivers/svga/svga_pipe_misc.c @@ -25,11 +25,13 @@ #include "svga_cmd.h" +#include "util/u_framebuffer.h" #include "util/u_inlines.h" #include "svga_context.h" #include "svga_screen.h" #include "svga_surface.h" +#include "svga_resource_texture.h" static void svga_set_scissor_states( struct pipe_context *pipe, @@ -86,19 +88,25 @@ static void svga_set_framebuffer_state(struct pipe_context *pipe, dst->nr_cbufs = fb->nr_cbufs; /* check if we need to propagate any of the target surfaces */ - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i]) - if (svga_surface_needs_propagation(dst->cbufs[i])) + for (i = 0; i < dst->nr_cbufs; i++) { + struct pipe_surface *s = i < fb->nr_cbufs ? fb->cbufs[i] : NULL; + if (dst->cbufs[i] && dst->cbufs[i] != s) { + if (svga_surface_needs_propagation(dst->cbufs[i])) { propagate = TRUE; + break; + } + } } if (propagate) { /* make sure that drawing calls comes before propagation calls */ svga_hwtnl_flush_retry( svga ); - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) - if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i]) + for (i = 0; i < dst->nr_cbufs; i++) { + struct pipe_surface *s = i < fb->nr_cbufs ? fb->cbufs[i] : NULL; + if (dst->cbufs[i] && dst->cbufs[i] != s) svga_propagate_surface(svga, dst->cbufs[i]); + } } /* XXX: Actually the virtual hardware may support rendertargets with @@ -111,12 +119,16 @@ static void svga_set_framebuffer_state(struct pipe_context *pipe, } } - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - pipe_surface_reference(&dst->cbufs[i], - (i < fb->nr_cbufs) ? fb->cbufs[i] : NULL); - } - pipe_surface_reference(&dst->zsbuf, fb->zsbuf); + util_copy_framebuffer_state(dst, fb); + /* Set the rendered-to flags */ + for (i = 0; i < dst->nr_cbufs; i++) { + struct pipe_surface *s = dst->cbufs[i]; + if (s) { + struct svga_texture *t = svga_texture(s->texture); + svga_set_texture_rendered_to(t, s->u.tex.first_layer, s->u.tex.level); + } + } if (svga->curr.framebuffer.zsbuf) { @@ -140,6 +152,13 @@ static void svga_set_framebuffer_state(struct pipe_context *pipe, svga->curr.depthscale = 0.0f; break; } + + /* Set rendered-to flag */ + { + struct pipe_surface *s = dst->zsbuf; + struct svga_texture *t = svga_texture(s->texture); + svga_set_texture_rendered_to(t, s->u.tex.first_layer, s->u.tex.level); + } } else { svga->curr.depthscale = 0.0f; diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index 5fafadf6175..c538e36366c 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -158,7 +158,7 @@ svga_texture_view_surface(struct svga_context *svga, for (i = 0; i < key->numMipLevels; i++) { for (j = 0; j < key->numFaces; j++) { - if (tex->defined[j + face_pick][i + start_mip]) { + if (svga_is_texture_level_defined(tex, j + face_pick, i + start_mip)) { unsigned depth = (zslice_pick < 0 ? u_minify(tex->b.b.depth0, i + start_mip) : 1); @@ -304,18 +304,19 @@ svga_mark_surface_dirty(struct pipe_surface *surf) if (s->handle == tex->handle) { /* hmm so 3d textures always have all their slices marked ? */ if (surf->texture->target == PIPE_TEXTURE_CUBE) - tex->defined[surf->u.tex.first_layer][surf->u.tex.level] = TRUE; + svga_define_texture_level(tex, surf->u.tex.first_layer, + surf->u.tex.level); else - tex->defined[0][surf->u.tex.level] = TRUE; + svga_define_texture_level(tex, 0, surf->u.tex.level); } else { /* this will happen later in svga_propagate_surface */ } - /* Increment the view_age and texture age for this surface's slice - * so that any sampler views into the texture are re-validated too. + /* Increment the view_age and texture age for this surface's mipmap + * level so that any sampler views into the texture are re-validated too. */ - svga_age_texture_view(tex, surf->u.tex.first_layer); + svga_age_texture_view(tex, surf->u.tex.level); } } @@ -361,7 +362,7 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf) s->dirty = FALSE; ss->texture_timestamp++; - tex->view_age[surf->u.tex.level] = ++(tex->age); + svga_age_texture_view(tex, surf->u.tex.level); if (s->handle != tex->handle) { SVGA_DBG(DEBUG_VIEWS, @@ -372,7 +373,7 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf) tex->handle, 0, 0, zslice, surf->u.tex.level, face, u_minify(tex->b.b.width0, surf->u.tex.level), u_minify(tex->b.b.height0, surf->u.tex.level), 1); - tex->defined[face][surf->u.tex.level] = TRUE; + svga_define_texture_level(tex, face, surf->u.tex.level); } } |