diff options
author | Oded Gabbay <[email protected]> | 2016-02-23 16:33:45 +0200 |
---|---|---|
committer | Oded Gabbay <[email protected]> | 2016-02-23 20:55:40 +0200 |
commit | 4b7e219e616f64281a83c88319dc7c386809b9ec (patch) | |
tree | dec7f69a79b624ab1017070352c71f8a9e6c92c4 | |
parent | 1807806add36327ba1e713c49554b61b2855d5f9 (diff) |
gallium/radeon: Correctly translate colorswaps for big endian
The current code in r600_translate_colorswap uses the swizzle information
to determine which colorswap to use.
This works for BE & LE when the nr_channels is <4, but when nr_channels==4
(e.g. PIPE_FORMAT_A8R8G8B8_UNORM), this method can not be used for both BE
and LE, because the swizzle info is the same for both of them.
As a result, r600g doesn't support 24bit color formats, only 16bit, which
forces the user to choose 16bit color in X server.
This patch fixes this bug by separating the checks for LE and BE and
adapting the swizzle conditions in the BE part of the checks.
Tested on an Evergreen GPU (Cedar GL FirePro 2270) running inside POWER7
Big-Endian Machine.
Signed-off-by: Oded Gabbay <[email protected]>
CC: "11.2" "11.1" <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index af206e43860..1df0c300e85 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1293,6 +1293,7 @@ unsigned r600_translate_colorswap(enum pipe_format format) break; case 4: /* check the middle channels, the 1st and 4th channel can be NONE */ +#ifdef PIPE_ARCH_LITTLE_ENDIAN if (HAS_SWIZZLE(1,Y) && HAS_SWIZZLE(2,Z)) return V_0280A0_SWAP_STD; /* XYZW */ else if (HAS_SWIZZLE(1,Z) && HAS_SWIZZLE(2,Y)) @@ -1301,6 +1302,16 @@ unsigned r600_translate_colorswap(enum pipe_format format) return V_0280A0_SWAP_ALT; /* ZYXW */ else if (HAS_SWIZZLE(1,X) && HAS_SWIZZLE(2,Y)) return V_0280A0_SWAP_ALT_REV; /* WXYZ */ +#else + if (HAS_SWIZZLE(1,W) && HAS_SWIZZLE(2,X)) + return V_0280A0_SWAP_STD; /* ZWXY */ + else if (HAS_SWIZZLE(1,X) && HAS_SWIZZLE(2,W)) + return V_0280A0_SWAP_STD_REV; /* YXWZ */ + else if (HAS_SWIZZLE(1,W) && HAS_SWIZZLE(2,Z)) + return V_0280A0_SWAP_ALT; /* XWZY */ + else if (HAS_SWIZZLE(1,Z) && HAS_SWIZZLE(2,W)) + return V_0280A0_SWAP_ALT_REV; /* YZWX */ +#endif break; } return ~0U; |