summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-01-12 04:45:22 -0500
committerMaarten Lankhorst <[email protected]>2014-01-27 16:40:43 +0100
commite3247355cc1a02f5fb39f18782ff26412d450826 (patch)
tree2e875eea1048e306aa751fdbede46967f474619f /src/gallium/drivers/nouveau
parentd98b85b50713c12e1970da08220f124b26feaab0 (diff)
nv50: don't forget to also clear additional layers
Fixes most of the tests/spec/gl-3.2/layered-rendering/* piglits. Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_surface.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
index f50345f4034..a22436b7e54 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
@@ -395,7 +395,7 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct pipe_framebuffer_state *fb = &nv50->framebuffer;
- unsigned i;
+ unsigned i, j, k;
uint32_t mode = 0;
/* don't need NEW_BLEND, COLOR_MASK doesn't affect CLEAR_BUFFERS */
@@ -427,14 +427,36 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
}
if (mode) {
- BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
- PUSH_DATA (push, mode);
+ int zs_layers = 0, color0_layers = 0;
+ if (fb->cbufs[0] && (mode & 0x3c))
+ color0_layers = fb->cbufs[0]->u.tex.last_layer -
+ fb->cbufs[0]->u.tex.first_layer + 1;
+ if (fb->zsbuf && (mode & ~0x3c))
+ zs_layers = fb->zsbuf->u.tex.last_layer -
+ fb->zsbuf->u.tex.first_layer + 1;
+
+ for (j = 0; j < MIN2(zs_layers, color0_layers); j++) {
+ BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
+ PUSH_DATA(push, mode | (j << NV50_3D_CLEAR_BUFFERS_LAYER__SHIFT));
+ }
+ for (k = j; k < zs_layers; k++) {
+ BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
+ PUSH_DATA(push, (mode & ~0x3c) | (k << NV50_3D_CLEAR_BUFFERS_LAYER__SHIFT));
+ }
+ for (k = j; k < color0_layers; k++) {
+ BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
+ PUSH_DATA(push, (mode & 0x3c) | (k << NV50_3D_CLEAR_BUFFERS_LAYER__SHIFT));
+ }
}
for (i = 1; i < fb->nr_cbufs; i++) {
- if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
+ struct pipe_surface *sf = fb->cbufs[i];
+ if (!sf || !(buffers & (PIPE_CLEAR_COLOR0 << i)))
+ continue;
+ for (j = 0; j <= sf->u.tex.last_layer - sf->u.tex.first_layer; j++) {
BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
- PUSH_DATA (push, (i << 6) | 0x3c);
+ PUSH_DATA (push, (i << 6) | 0x3c |
+ (j << NV50_3D_CLEAR_BUFFERS_LAYER__SHIFT));
}
}
}