#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,
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
}
}
- 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)
{
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;
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);
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);
}
}
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,
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);
}
}