This patch enables the correct detection of PIPE_FORMAT_R10G10B10A2_UINT
and PIPE_FORMAT_B10G10R10A2_UINT formats in r600g in big-endian mode.

Because the swapping doesn't happen on component boundaries for these
formats, the GPU H/W needs to be configured differently for LE/BE.
Therefore, we need to use a different color format for BE - 
V_0280A0_COLOR_10_10_10_2

This enables support for ARB_texture_rgb10_a2ui, which otherwise is not
detected as supported.

Tested using piglit texwrap with GL_ARB_texture_rgb10_a2ui.

v2:

- Used the correct color format for R10G10B10A2 on
  BE (V_0280A0_COLOR_10_10_10_2) to configure the GPU

- Added detection of this color format in endian swap function

- removed blank line

Signed-off-by: Oded Gabbay <oded.gab...@gmail.com>
Cc: "11.1 11.2" <mesa-sta...@lists.freedesktop.org>
---
 src/gallium/drivers/r600/r600_state_common.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index aa3a085..53cf972 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2464,6 +2464,14 @@ uint32_t r600_translate_texformat(struct pipe_screen 
*screen,
                                result = FMT_2_10_10_10;
                                goto out_word4;
                        }
+                       if (R600_BIG_ENDIAN &&
+                           desc->channel[0].size == 2 &&
+                           desc->channel[1].size == 10 &&
+                           desc->channel[2].size == 10 &&
+                           desc->channel[3].size == 10) {
+                               result = FMT_10_10_10_2;
+                               goto out_word4;
+                       }
                        goto out_unknown;
                }
                goto out_unknown;
@@ -2685,6 +2693,8 @@ uint32_t r600_translate_colorformat(enum chip_class chip, 
enum pipe_format forma
                        return V_0280A0_COLOR_1_5_5_5;
                } else if (HAS_SIZE(10,10,10,2)) {
                        return V_0280A0_COLOR_2_10_10_10;
+               } else if (R600_BIG_ENDIAN && HAS_SIZE(2,10,10,10)) {
+                       return V_0280A0_COLOR_10_10_10_2;
                }
                break;
        }
@@ -2717,6 +2727,7 @@ uint32_t r600_colorformat_endian_swap(uint32_t 
colorformat)
                         */
                        return ENDIAN_NONE;
 
+               case V_0280A0_COLOR_10_10_10_2:
                case V_0280A0_COLOR_2_10_10_10:
                case V_0280A0_COLOR_8_24:
                case V_0280A0_COLOR_24_8:
-- 
2.5.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to