Mesa (master): nouveau: nv30: refuse binding a colour buffer with a zeta buffer with different bits, till the backend can tell Mesa not to do that.

Patrice Mandin pmandin at kemper.freedesktop.org
Thu Oct 15 19:59:01 UTC 2009


Module: Mesa
Branch: master
Commit: 13580aa3d142b17f936e517daf949ae228f9f14e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=13580aa3d142b17f936e517daf949ae228f9f14e

Author: Patrice Mandin <patmandin at gmail.com>
Date:   Thu Oct 15 21:58:44 2009 +0200

nouveau: nv30: refuse binding a colour buffer with a zeta buffer with different bits, till the backend can tell Mesa not to do that.

---

 src/gallium/drivers/nv30/nv30_state_fb.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index 2729dce..9b0266f 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -15,6 +15,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 	unsigned w = fb->width;
 	unsigned h = fb->height;
 	struct nv30_miptree *nv30mt;
+	int colour_bits = 32, zeta_bits = 32;
 
 	rt_enable = 0;
 	for (i = 0; i < fb->nr_cbufs; i++) {
@@ -54,6 +55,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 		break;
 	case PIPE_FORMAT_R5G6B5_UNORM:
 		rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
+		colour_bits = 16;
 		break;
 	default:
 		assert(0);
@@ -62,6 +64,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 	switch (zeta_format) {
 	case PIPE_FORMAT_Z16_UNORM:
 		rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
+		zeta_bits = 16;
 		break;
 	case PIPE_FORMAT_Z24S8_UNORM:
 	case PIPE_FORMAT_Z24X8_UNORM:
@@ -72,6 +75,10 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 		assert(0);
 	}
 
+	if (colour_bits != zeta_bits) {
+		return FALSE;
+	}
+
 	if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) {
 		uint32_t pitch = rt[0]->pitch;
 		if (zeta) {




More information about the mesa-commit mailing list