summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2014-06-17 23:28:56 -0400
committerCarl Worth <cworth@cworth.org>2014-06-23 15:00:14 -0700
commit3568cf8128a28f8c860fa2a4c5bbf75c2e090c7e (patch)
tree6ac17eab21fa362a1bef8e7f3b5d5f5c12410e14 /src/gallium/drivers/nouveau
parentaca2d98c35b795bd7124527bd320e0d10adcf658 (diff)
nv30: hack to avoid errors on unexpected color/zeta combinations
This is just a hack, it should be possible to create a temporary zeta surface and render to that instead. However that's more complicated and this avoids the render being entirely broken and errors being reported by the card. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "10.2" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 25182e249e50b0fce41d975ae2b3c9cbdb8d0ef3)
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_state.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state.c b/src/gallium/drivers/nouveau/nv30/nv30_state.c
index 64be1b78f79..708ba34c1e5 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_state.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_state.c
@@ -23,6 +23,7 @@
*
*/
+#include "util/u_format.h"
#include "util/u_helpers.h"
#include "util/u_inlines.h"
@@ -360,6 +361,22 @@ nv30_set_framebuffer_state(struct pipe_context *pipe,
nv30->framebuffer = *fb;
nv30->dirty |= NV30_NEW_FRAMEBUFFER;
+
+ /* Hardware can't handle different swizzled-ness or different blocksizes
+ * for zs and cbufs. If both are supplied and something doesn't match,
+ * blank out the zs for now so that at least *some* rendering can occur.
+ */
+ if (fb->nr_cbufs > 0 && fb->zsbuf) {
+ struct nv30_miptree *color_mt = nv30_miptree(fb->cbufs[0]->texture);
+ struct nv30_miptree *zeta_mt = nv30_miptree(fb->zsbuf->texture);
+
+ if (color_mt->swizzled != zeta_mt->swizzled ||
+ (util_format_get_blocksize(fb->zsbuf->format) > 2) !=
+ (util_format_get_blocksize(fb->cbufs[0]->format) > 2)) {
+ nv30->framebuffer.zsbuf = NULL;
+ debug_printf("Mismatched color and zeta formats, ignoring zeta.\n");
+ }
+ }
}
static void