summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nvc0
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-01-15 02:14:06 -0500
committerMaarten Lankhorst <[email protected]>2014-01-27 16:40:42 +0100
commitc75eeab60936810eb1a2641961b5ecf6f77a2abd (patch)
tree4bc38309b427c8ab938df4ab05990e0c02d2a873 /src/gallium/drivers/nouveau/nvc0
parent3f264e16e29a870b4b3b605590c718c35bb1a91c (diff)
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 <[email protected]> in his gallium-nine branch. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 0ba4bad154a..dd71c6587a6 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -2,6 +2,7 @@
#include "util/u_math.h"
#include "nvc0/nvc0_context.h"
+#include "nv50/nv50_defs.xml.h"
#if 0
static void
@@ -54,6 +55,18 @@ nvc0_validate_zcull(struct nvc0_context *nvc0)
}
#endif
+static INLINE void
+nvc0_fb_set_null_rt(struct nouveau_pushbuf *push, unsigned i)
+{
+ BEGIN_NVC0(push, NVC0_3D(RT_ADDRESS_HIGH(i)), 6);
+ PUSH_DATA (push, 0);
+ PUSH_DATA (push, 0);
+ PUSH_DATA (push, 64);
+ PUSH_DATA (push, 0);
+ PUSH_DATA (push, NV50_SURFACE_FORMAT_NONE);
+ PUSH_DATA (push, 0);
+}
+
static void
nvc0_validate_fb(struct nvc0_context *nvc0)
{
@@ -72,9 +85,18 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
PUSH_DATA (push, fb->height << 16);
for (i = 0; i < fb->nr_cbufs; ++i) {
- struct nv50_surface *sf = nv50_surface(fb->cbufs[i]);
- struct nv04_resource *res = nv04_resource(sf->base.texture);
- struct nouveau_bo *bo = res->bo;
+ struct nv50_surface *sf;
+ struct nv04_resource *res;
+ struct nouveau_bo *bo;
+
+ if (!fb->cbufs[i]) {
+ nvc0_fb_set_null_rt(push, i);
+ continue;
+ }
+
+ sf = nv50_surface(fb->cbufs[i]);
+ res = nv04_resource(sf->base.texture);
+ bo = res->bo;
BEGIN_NVC0(push, NVC0_3D(RT_ADDRESS_HIGH(i)), 9);
PUSH_DATAh(push, res->address + sf->offset);