summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2009-12-08 21:53:19 +0100
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-12-09 13:38:11 -0800
commit6de7ac73bf027b9ace6f5f0c8063cbf724d95cee (patch)
treed4c5a8b9a9a64595e6d837c85c4d68a506a22b10
parent87b822e024797ef2fdb51ec9364f21eeb4d07161 (diff)
r300g: always disable unused colorbuffers
-rw-r--r--src/gallium/drivers/r300/r300_emit.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 55bc2b3528a..f784e1fa8e5 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -331,7 +331,13 @@ void r300_emit_fb_state(struct r300_context* r300,
int i;
CS_LOCALS(r300);
- BEGIN_CS((10 * fb->nr_cbufs) + (fb->zsbuf ? 10 : 0) + 4);
+ /* Shouldn't fail unless there is a bug in the state tracker. */
+ assert(fb->nr_cbufs <= 4);
+
+ BEGIN_CS((10 * fb->nr_cbufs) + (2 * (4 - fb->nr_cbufs)) +
+ (fb->zsbuf ? 10 : 0) + 4);
+
+ /* Flush and free renderbuffer caches. */
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS |
R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
@@ -339,6 +345,7 @@ void r300_emit_fb_state(struct r300_context* r300,
R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
+ /* Set up colorbuffers. */
for (i = 0; i < fb->nr_cbufs; i++) {
surf = fb->cbufs[i];
tex = (struct r300_texture*)surf->texture;
@@ -356,6 +363,12 @@ void r300_emit_fb_state(struct r300_context* r300,
r300_translate_out_fmt(surf->format));
}
+ /* Disable unused colorbuffers. */
+ for (; i < 4; i++) {
+ OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), R300_US_OUT_FMT_UNUSED);
+ }
+
+ /* Set up a zbuffer. */
if (fb->zsbuf) {
surf = fb->zsbuf;
tex = (struct r300_texture*)surf->texture;