From 4bbaac3782ad83765698c3722a5e94cda94759fa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Aug 2019 13:58:23 -0700 Subject: [PATCH] gallium: Add some more channel orderings of packed formats. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This covers everything that MESA_FORMAT had for packed unorm. Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_format.csv | 8 +++++++ src/gallium/include/pipe/p_format.h | 8 +++++++ src/mesa/state_tracker/st_format.c | 32 +++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index 4bfc2a07fda..2f67e7e80ea 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -73,17 +73,25 @@ PIPE_FORMAT_A8B8G8R8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wz PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, 1, x8 , un8 , un8 , un8 , wzy1, rgb # PIPE_FORMAT_R8G8B8A8_UNORM is below PIPE_FORMAT_R8G8B8X8_UNORM , plain, 1, 1, 1, un8 , un8 , un8 , x8 , xyz1, rgb +PIPE_FORMAT_R5G5B5A1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , un1 , xyzw, rgb, un1 , un5 , un5 , un5 , wzyx PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb, x1 , un5 , un5 , un5 , yzw1 PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb, un1 , un5 , un5 , un5 , yzwx PIPE_FORMAT_X1B5G5R5_UNORM , plain, 1, 1, 1, x1 , un5 , un5 , un5 , wzy1, rgb, un5 , un5 , un5 , x1 , xyz1 +PIPE_FORMAT_A1R5G5B5_UNORM , plain, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb, un5 , un5 , un5 , un1 , zyxw PIPE_FORMAT_A1B5G5R5_UNORM , plain, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb, un5 , un5 , un5 , un1 , xyzw +PIPE_FORMAT_R4G4B4A4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , xyzw, rgb, un4 , un4 , un4 , un4 , wzyx PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb, un4 , un4 , un4 , un4 , yzwx PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb, x4 , un4 , un4 , un4 , yzw1 +PIPE_FORMAT_A4R4G4B4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb, un4 , un4 , un4 , un4 , zyxw PIPE_FORMAT_A4B4G4R4_UNORM , plain, 1, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb, un4 , un4 , un4 , un4 , xyzw +PIPE_FORMAT_R5G6B5_UNORM , plain, 1, 1, 1, un5 , un6 , un5 , , xyz1, rgb, un5 , un6 , un5 , , zyx1 PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, 1, un5 , un6 , un5 , , zyx1, rgb, un5 , un6 , un5 , , xyz1 PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, 1, un10, un10, un10, un2 , xyzw, rgb, un2 , un10, un10, un10, wzyx PIPE_FORMAT_R10G10B10X2_UNORM , plain, 1, 1, 1, un10, un10, un10, x2, xyz1, rgb, x2 , un10, un10, un10, wzy1 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_B2G3R3_UNORM , plain, 1, 1, 1, un2 , un3 , un3 , , zyx1, rgb, un3 , un3 , un2 , , xyz1 # Luminance/Intensity/Alpha formats diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 1c116c0ef3c..f1524352d9e 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -45,7 +45,9 @@ enum pipe_format { PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_X8R8G8B8_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM, + PIPE_FORMAT_R4G4B4A4_UNORM, PIPE_FORMAT_B4G4R4A4_UNORM, + PIPE_FORMAT_R5G6B5_UNORM, PIPE_FORMAT_B5G6R5_UNORM, PIPE_FORMAT_R10G10B10A2_UNORM, PIPE_FORMAT_L8_UNORM, /**< ubyte luminance */ @@ -177,6 +179,8 @@ enum pipe_format { PIPE_FORMAT_R10G10B10X2_USCALED, PIPE_FORMAT_R10G10B10X2_SNORM, PIPE_FORMAT_L4A4_UNORM, + PIPE_FORMAT_A2R10G10B10_UNORM, + PIPE_FORMAT_A2B10G10R10_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM, PIPE_FORMAT_R10SG10SB10SA2U_NORM, PIPE_FORMAT_R8G8Bx_SNORM, @@ -188,6 +192,7 @@ enum pipe_format { PIPE_FORMAT_S8X24_UINT, PIPE_FORMAT_X32_S8X24_UINT, + PIPE_FORMAT_R3G3B2_UNORM, PIPE_FORMAT_B2G3R3_UNORM, PIPE_FORMAT_L16A16_UNORM, PIPE_FORMAT_A16_UNORM, @@ -412,8 +417,11 @@ enum pipe_format { PIPE_FORMAT_P016, PIPE_FORMAT_R10G10B10X2_UNORM, + PIPE_FORMAT_A1R5G5B5_UNORM, PIPE_FORMAT_A1B5G5R5_UNORM, PIPE_FORMAT_X1B5G5R5_UNORM, + PIPE_FORMAT_R5G5B5A1_UNORM, + PIPE_FORMAT_A4R4G4B4_UNORM, PIPE_FORMAT_A4B4G4R4_UNORM, PIPE_FORMAT_R8_SRGB, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index dd3e1b28804..e60ac10ac4f 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -91,12 +91,24 @@ st_mesa_format_to_pipe_format(const struct st_context *st, return PIPE_FORMAT_B5G5R5A1_UNORM; case MESA_FORMAT_A1B5G5R5_UNORM: return PIPE_FORMAT_A1B5G5R5_UNORM; + case MESA_FORMAT_A1R5G5B5_UNORM: + return PIPE_FORMAT_A1R5G5B5_UNORM; + case MESA_FORMAT_R5G5B5A1_UNORM: + return PIPE_FORMAT_R5G5B5A1_UNORM; + case MESA_FORMAT_R4G4B4A4_UNORM: + return PIPE_FORMAT_R4G4B4A4_UNORM; case MESA_FORMAT_B4G4R4A4_UNORM: return PIPE_FORMAT_B4G4R4A4_UNORM; case MESA_FORMAT_A4B4G4R4_UNORM: return PIPE_FORMAT_A4B4G4R4_UNORM; + case MESA_FORMAT_A4R4G4B4_UNORM: + return PIPE_FORMAT_A4R4G4B4_UNORM; + case MESA_FORMAT_R5G6B5_UNORM: + return PIPE_FORMAT_R5G6B5_UNORM; case MESA_FORMAT_B5G6R5_UNORM: return PIPE_FORMAT_B5G6R5_UNORM; + case MESA_FORMAT_R3G3B2_UNORM: + return PIPE_FORMAT_R3G3B2_UNORM; case MESA_FORMAT_B2G3R3_UNORM: return PIPE_FORMAT_B2G3R3_UNORM; case MESA_FORMAT_B10G10R10A2_UNORM: @@ -105,6 +117,10 @@ st_mesa_format_to_pipe_format(const struct st_context *st, return PIPE_FORMAT_R10G10B10A2_UNORM; case MESA_FORMAT_R10G10B10X2_UNORM: return PIPE_FORMAT_R10G10B10X2_UNORM; + case MESA_FORMAT_A2B10G10R10_UNORM: + return PIPE_FORMAT_A2B10G10R10_UNORM; + case MESA_FORMAT_A2R10G10B10_UNORM: + return PIPE_FORMAT_A2R10G10B10_UNORM; case MESA_FORMAT_L4A4_UNORM: return PIPE_FORMAT_L4A4_UNORM; case MESA_FORMAT_A_UNORM8: @@ -682,12 +698,24 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_B5G5R5A1_UNORM; case PIPE_FORMAT_A1B5G5R5_UNORM: return MESA_FORMAT_A1B5G5R5_UNORM; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return MESA_FORMAT_A1R5G5B5_UNORM; + case PIPE_FORMAT_R5G5B5A1_UNORM: + return MESA_FORMAT_R5G5B5A1_UNORM; + case PIPE_FORMAT_R4G4B4A4_UNORM: + return MESA_FORMAT_R4G4B4A4_UNORM; case PIPE_FORMAT_B4G4R4A4_UNORM: return MESA_FORMAT_B4G4R4A4_UNORM; case PIPE_FORMAT_A4B4G4R4_UNORM: return MESA_FORMAT_A4B4G4R4_UNORM; + case PIPE_FORMAT_A4R4G4B4_UNORM: + return MESA_FORMAT_A4R4G4B4_UNORM; + case PIPE_FORMAT_R5G6B5_UNORM: + return MESA_FORMAT_R5G6B5_UNORM; case PIPE_FORMAT_B5G6R5_UNORM: return MESA_FORMAT_B5G6R5_UNORM; + case PIPE_FORMAT_R3G3B2_UNORM: + return MESA_FORMAT_R3G3B2_UNORM; case PIPE_FORMAT_B2G3R3_UNORM: return MESA_FORMAT_B2G3R3_UNORM; case PIPE_FORMAT_B10G10R10A2_UNORM: @@ -696,6 +724,10 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_R10G10B10A2_UNORM; case PIPE_FORMAT_R10G10B10X2_UNORM: return MESA_FORMAT_R10G10B10X2_UNORM; + case PIPE_FORMAT_A2R10G10B10_UNORM: + return MESA_FORMAT_A2R10G10B10_UNORM; + case PIPE_FORMAT_A2B10G10R10_UNORM: + return MESA_FORMAT_A2B10G10R10_UNORM; case PIPE_FORMAT_L4A4_UNORM: return MESA_FORMAT_L4A4_UNORM; case PIPE_FORMAT_L8A8_UNORM: -- 2.30.2