Mesa (master): radeonsi: assert the CB format is valid (v2)

Alex Deucher agd5f at kemper.freedesktop.org
Thu Nov 15 17:12:35 UTC 2012


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

Author: Alex Deucher <alexander.deucher at amd.com>
Date:   Thu Nov 15 09:34:13 2012 -0500

radeonsi: assert the CB format is valid (v2)

Assert the the CB format is valid and default to
the INVALID hw format rather than ~0U when the format
doesn't match for non-debug builds.

v2: use INVALID hw format rather than ~0U

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

---

 src/gallium/drivers/radeonsi/si_state.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index fbc636d..31a55a2 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -831,7 +831,7 @@ static uint32_t si_translate_colorformat(enum pipe_format format)
 	case PIPE_FORMAT_R4A4_UNORM:
 	case PIPE_FORMAT_A4R4_UNORM:
 	default:
-		return ~0U; /* Unsupported. */
+		return V_028C70_COLOR_INVALID; /* Unsupported. */
 	}
 }
 
@@ -1432,7 +1432,7 @@ static bool si_is_vertex_format_supported(struct pipe_screen *screen, enum pipe_
 
 static bool si_is_colorbuffer_format_supported(enum pipe_format format)
 {
-	return si_translate_colorformat(format) != ~0U &&
+	return si_translate_colorformat(format) != V_028C70_COLOR_INVALID &&
 		si_translate_colorswap(format) != ~0U;
 }
 
@@ -1606,6 +1606,7 @@ static void si_cb(struct r600_context *rctx, struct si_pm4_state *pm4,
 	}
 
 	format = si_translate_colorformat(surf->base.format);
+	assert(format != V_028C70_COLOR_INVALID);
 	swap = si_translate_colorswap(surf->base.format);
 	if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
 		endian = V_028C70_ENDIAN_NONE;




More information about the mesa-commit mailing list