summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-06-27 00:39:27 +0200
committerMarek Olšák <[email protected]>2010-06-27 15:13:13 +0200
commit639a7daa85ccc016965a51e46298fd6fdf1ceec6 (patch)
tree44b0700507f17d10c04d3cffa2da43754f385c36 /src
parent408a88612791fd5feae841db24a5e1e1bf4ffd1b (diff)
r300g: reference surfaces in set_framebuffer_state
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_state.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 09e694f041a..567774c8be9 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -659,6 +659,24 @@ static void r300_print_fb_surf_info(struct pipe_surface *surf, unsigned index,
tex->last_level, util_format_short_name(tex->format));
}
+static void copy_framebuffer_state(struct pipe_framebuffer_state *dst,
+ const struct pipe_framebuffer_state *src)
+{
+ unsigned i;
+
+ for (i = 0; i < src->nr_cbufs; i++) {
+ pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
+ }
+ for (; i < dst->nr_cbufs; i++) {
+ pipe_surface_reference(&dst->cbufs[i], NULL);
+ }
+ pipe_surface_reference(&dst->zsbuf, src->zsbuf);
+
+ dst->nr_cbufs = src->nr_cbufs;
+ dst->width = src->width;
+ dst->height = src->height;
+}
+
static void
r300_set_framebuffer_state(struct pipe_context* pipe,
const struct pipe_framebuffer_state* state)
@@ -703,7 +721,7 @@ static void
/* The tiling flags are dependent on the surface miplevel, unfortunately. */
r300_fb_set_tiling_flags(r300, r300->fb_state.state, state);
- memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));
+ copy_framebuffer_state(r300->fb_state.state, state);
r300->fb_state.size =
7 +