From c52bc900765f5b7d093c4e3234e3de2e1739598e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Thu, 19 Mar 2026 18:33:47 +0100 Subject: [PATCH] r300: fix BE 32-bit CBZB clear values CBZB clears use ZB_DEPTHCLEARVALUE for the clear color. On big-endian hosts the 32-bit payload needs little-endian byte order. Fixes fast_color_clear/all-colors on RV350. Part-of: --- src/gallium/drivers/r300/r300_blit.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index c52181a345a..118d1e52736 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -10,6 +10,7 @@ #include "util/format/u_format.h" #include "util/half_float.h" +#include "util/u_math.h" #include "util/u_pack_color.h" #include "util/u_surface.h" @@ -110,10 +111,14 @@ static uint32_t r300_depth_clear_cb_value(enum pipe_format format, union util_color uc; util_pack_color(rgba, format, &uc); - if (util_format_get_blocksizebits(format) == 32) - return uc.ui[0]; - else - return uc.us | (uc.us << 16); + if (util_format_get_blocksizebits(format) == 32) { + /* CBZB clears reuse ZB_DEPTHCLEARVALUE, which expects the 32-bit + * payload in little-endian byte order. + */ + return util_cpu_to_le32(uc.ui[0]); + } + + return uc.us | (uc.us << 16); } static bool r300_cbzb_clear_allowed(struct r300_context *r300,