Mesa (main): r300: Throw a compile error instead of an assert in r300 swizzle rewrites.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 9 03:30:07 UTC 2022


Module: Mesa
Branch: main
Commit: bd24f418c3cda345b9ac753977ad034e5c9cff28
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd24f418c3cda345b9ac753977ad034e5c9cff28

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Feb  8 10:36:30 2022 -0800

r300: Throw a compile error instead of an assert in r300 swizzle rewrites.

I hit this on shader-db, but I really just want to get stats for unrelated
changes.

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14938>

---

 src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c
index a16f4715c70..2cc624f8982 100644
--- a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c
+++ b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c
@@ -376,7 +376,10 @@ static unsigned try_rewrite_constant(struct radeon_compiler *c,
 			continue;
 		}
 
-		assert(new_swz <= RC_SWIZZLE_W);
+		if (new_swz > RC_SWIZZLE_W) {
+			rc_error(c, "Bad swizzle in try_rewrite_constant()");
+			new_swz = RC_SWIZZLE_X;
+		}
 
 		switch (old_swz) {
 		case RC_SWIZZLE_ZERO:



More information about the mesa-commit mailing list