summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2014-01-15 02:14:06 -0500
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>2014-01-27 16:40:42 +0100
commitc75eeab60936810eb1a2641961b5ecf6f77a2abd (patch)
tree4bc38309b427c8ab938df4ab05990e0c02d2a873 /src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
parent3f264e16e29a870b4b3b605590c718c35bb1a91c (diff)
downloadexternal_mesa3d-c75eeab60936810eb1a2641961b5ecf6f77a2abd.zip
external_mesa3d-c75eeab60936810eb1a2641961b5ecf6f77a2abd.tar.gz
external_mesa3d-c75eeab60936810eb1a2641961b5ecf6f77a2abd.tar.bz2
nv50, nvc0: clear out RT on a null cbuf
This is needed since commit 9baa45f78b (st/mesa: bind NULL colorbuffers as specified by glDrawBuffers). This implementation is highly based on a larger commit by Christoph Bumiller <e0425955@student.tuwien.ac.at> in his gallium-nine branch. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_state_validate.c')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state_validate.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
index 86b9a23..bb05f03 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
@@ -1,6 +1,19 @@
#include "nv50/nv50_context.h"
-#include "os/os_time.h"
+#include "nv50/nv50_defs.xml.h"
+
+static INLINE void
+nv50_fb_set_null_rt(struct nouveau_pushbuf *push, unsigned i)
+{
+ BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(i)), 4);
+ PUSH_DATA (push, 0);
+ PUSH_DATA (push, 0);
+ PUSH_DATA (push, NV50_SURFACE_FORMAT_NONE);
+ PUSH_DATA (push, 0);
+ BEGIN_NV04(push, NV50_3D(RT_HORIZ(i)), 2);
+ PUSH_DATA (push, 64);
+ PUSH_DATA (push, 0);
+}
static void
nv50_validate_fb(struct nv50_context *nv50)
@@ -20,9 +33,18 @@ nv50_validate_fb(struct nv50_context *nv50)
PUSH_DATA (push, fb->height << 16);
for (i = 0; i < fb->nr_cbufs; ++i) {
- struct nv50_miptree *mt = nv50_miptree(fb->cbufs[i]->texture);
- struct nv50_surface *sf = nv50_surface(fb->cbufs[i]);
- struct nouveau_bo *bo = mt->base.bo;
+ struct nv50_miptree *mt;
+ struct nv50_surface *sf;
+ struct nouveau_bo *bo;
+
+ if (!fb->cbufs[i]) {
+ nv50_fb_set_null_rt(push, i);
+ continue;
+ }
+
+ mt = nv50_miptree(fb->cbufs[i]->texture);
+ sf = nv50_surface(fb->cbufs[i]);
+ bo = mt->base.bo;
array_size = MIN2(array_size, sf->depth);
if (mt->layout_3d)