Mesa (main): u_format: Define tests for r3g3b2 formats and fix BE swizzles for them.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 3 00:44:43 UTC 2021


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 27 16:48:20 2021 -0700

u_format: Define tests for r3g3b2 formats and fix BE swizzles for them.

These tests passed for LE, and the BE channel ordering specified obviously
didn't fit the pattern of the other BE formats (channels are listed
right-to-left in the BE columns for historical reasons).

Note that we can't write pure-integer format tests in u_format_tests.c
currently.

Acked-by: Adam Jackson <ajax at redhat.com>
Acked-by: Ilia Mirkin <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

---

 src/util/format/u_format.csv     | 4 ++--
 src/util/format/u_format_tests.c | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv
index 29e21773bdf..9090eabd45f 100644
--- a/src/util/format/u_format.csv
+++ b/src/util/format/u_format.csv
@@ -102,7 +102,7 @@ PIPE_FORMAT_R10G10B10X2_UNORM       , plain, 1, 1, 1, un10, un10, un10, x2,   xy
 PIPE_FORMAT_B10G10R10A2_UNORM       , plain, 1, 1, 1, un10, un10, un10, un2 , zyxw, rgb, un2 , un10, un10, un10, yzwx
 PIPE_FORMAT_A2R10G10B10_UNORM       , plain, 1, 1, 1, un2 , un10, un10, un10, yzwx, rgb, un10, un10, un10, un2 , zyxw
 PIPE_FORMAT_A2B10G10R10_UNORM       , plain, 1, 1, 1, un2 , un10, un10, un10, wzyx, rgb, un10, un10, un10, un2 , xyzw
-PIPE_FORMAT_R3G3B2_UNORM            , plain, 1, 1, 1, un3 , un3 , un2 ,     , xyz1, rgb, un3 , un3 , un2 ,     , zyx1
+PIPE_FORMAT_R3G3B2_UNORM            , plain, 1, 1, 1, un3 , un3 , un2 ,     , xyz1, rgb, un2 , un3 , un3 ,     , zyx1
 PIPE_FORMAT_B2G3R3_UNORM            , plain, 1, 1, 1, un2 , un3 , un3 ,     , zyx1, rgb, un3 , un3 , un2 ,     , xyz1
 
 # Luminance/Intensity/Alpha formats
@@ -513,7 +513,7 @@ PIPE_FORMAT_B10G10R10A2_UINT        , plain, 1, 1, 1, up10, up10, up10, up2, zyx
 PIPE_FORMAT_B10G10R10A2_SINT        , plain, 1, 1, 1, sp10, sp10, sp10, sp2, zyxw, rgb, sp2 , sp10, sp10, sp10, yzwx
 PIPE_FORMAT_R5G6B5_UINT             , plain, 1, 1, 1, up5 , up6 , up5 ,     , xyz1, rgb, up5 , up6 , up5 ,     , zyx1
 PIPE_FORMAT_B5G6R5_UINT             , plain, 1, 1, 1, up5 , up6 , up5 ,     , zyx1, rgb, up5 , up6 , up5 ,     , xyz1
-PIPE_FORMAT_R3G3B2_UINT             , plain, 1, 1, 1, up3 , up3 , up2 ,     , xyz1, rgb, up3 , up3 , up2 ,     , zyx1
+PIPE_FORMAT_R3G3B2_UINT             , plain, 1, 1, 1, up3 , up3 , up2 ,     , xyz1, rgb, up2 , up3 , up3 ,     , zyx1
 PIPE_FORMAT_B2G3R3_UINT             , plain, 1, 1, 1, up2 , up3 , up3 ,     , zyx1, rgb, up3 , up3 , up2 ,     , xyz1
 PIPE_FORMAT_R4G4B4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , xyzw, rgb, up4 , up4 , up4 , up4 , wzyx
 PIPE_FORMAT_B4G4R4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , zyxw, rgb, up4 , up4 , up4 , up4 , yzwx
diff --git a/src/util/format/u_format_tests.c b/src/util/format/u_format_tests.c
index 78a3926d407..167b971ce09 100644
--- a/src/util/format/u_format_tests.c
+++ b/src/util/format/u_format_tests.c
@@ -1048,7 +1048,13 @@ util_format_test_cases[] =
    /*
     * Special formats that not fit anywhere else
     */
+   {PIPE_FORMAT_R3G3B2_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x07), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R3G3B2_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x38), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R3G3B2_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xc0), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
 
+   {PIPE_FORMAT_B2G3R3_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x03), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_B2G3R3_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x1c), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B2G3R3_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xe0), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
 };
 
 



More information about the mesa-commit mailing list