[Mesa-dev] [PATCH 6/9] r600g: add support for subsampled rgb formats

Christian König deathsimple at vodafone.de
Wed Mar 7 06:10:10 PST 2012


v2: r600 formats are msb first!

Signed-off-by: Christian König <deathsimple at vodafone.de>
---
 src/gallium/drivers/r600/r600_texture.c |   32 ++----------------------------
 1 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 4aff04a..ce66117 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -1136,44 +1136,18 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen,
 	}
 
 	if (desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
-		const unsigned char *swizzle;
-		const unsigned char swizzle_zyx[] = {
-			UTIL_FORMAT_SWIZZLE_Z,
-			UTIL_FORMAT_SWIZZLE_Y,
-			UTIL_FORMAT_SWIZZLE_X,
-			UTIL_FORMAT_SWIZZLE_1,
-		};
-		const unsigned char swizzle_yzx[] = {
-			UTIL_FORMAT_SWIZZLE_Y,
-			UTIL_FORMAT_SWIZZLE_Z,
-			UTIL_FORMAT_SWIZZLE_X,
-			UTIL_FORMAT_SWIZZLE_1,
-		};
-
 		switch (format) {
 		case PIPE_FORMAT_R8G8_B8G8_UNORM:
-			swizzle = swizzle_zyx;
+		case PIPE_FORMAT_G8R8_B8R8_UNORM:
 			result = FMT_GB_GR;
-			break;
+			goto out_word4;
 		case PIPE_FORMAT_G8R8_G8B8_UNORM:
-			swizzle = swizzle_zyx;
-			result = FMT_BG_RG;
-			break;
 		case PIPE_FORMAT_R8G8_R8B8_UNORM:
-			swizzle = swizzle_yzx;
 			result = FMT_BG_RG;
-			break;
-		case PIPE_FORMAT_G8R8_B8R8_UNORM:
-			swizzle = swizzle_yzx;
-			result = FMT_GB_GR;
-			break;
+			goto out_word4;
 		default:
 			goto out_unknown;
 		}
-		word4 &= C_038010_DST_SEL_X & C_038010_DST_SEL_Y &
-			 C_038010_DST_SEL_Z & C_038010_DST_SEL_W;
-		word4 |= r600_get_swizzle_combined(swizzle, swizzle_view);
-		goto out_word4;
 	}
 
 	if (format == PIPE_FORMAT_R9G9B9E5_FLOAT) {
-- 
1.7.5.4



More information about the mesa-dev mailing list