From: Eric Anholt Date: Mon, 19 Aug 2019 21:33:51 +0000 (-0700) Subject: gallium: Add equivalents of packed MESA_FORMAT_*UINT formats. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b28eb044cdc1b9bbf4a830b36476f047b660b7ad;p=mesa.git gallium: Add equivalents of packed MESA_FORMAT_*UINT formats. These are the last formats that MESA_FORMAT had and PIPE_FORMAT didn't. The .csv entries channel sizes and swizzles all came from the corresponding UNORM format. Reviewed-by: Marek Olšák --- diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index 02f20cf1cb2..65e596546f8 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -451,7 +451,24 @@ PIPE_FORMAT_I32_SINT , plain, 1, 1, 1, sp32, , , , xxxx, rgb PIPE_FORMAT_L32_SINT , plain, 1, 1, 1, sp32, , , , xxx1, rgb PIPE_FORMAT_L32A32_SINT , plain, 1, 1, 1, sp32, sp32, , , xxxy, rgb +PIPE_FORMAT_B8G8R8A8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , up8 , zyxw, rgb +PIPE_FORMAT_A8R8G8B8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , up8 , yzwx, rgb +PIPE_FORMAT_A8B8G8R8_UINT , plain, 1, 1, 1, up8 , up8 , up8 , up8 , wzyx, rgb +PIPE_FORMAT_A2R10G10B10_UINT , plain, 1, 1, 1, up2 , up10, up10, up10, yzwx, rgb, up10, up10, up10, up2 , zyxw +PIPE_FORMAT_A2B10G10R10_UINT , plain, 1, 1, 1, up2 , up10, up10, up10, wzyx, rgb, up10, up10, up10, up2 , xyzw PIPE_FORMAT_B10G10R10A2_UINT , plain, 1, 1, 1, up10, up10, up10, up2, zyxw, rgb, up2 , up10, up10, up10, 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_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 +PIPE_FORMAT_A4R4G4B4_UINT , plain, 1, 1, 1, up4 , up4 , up4 , up4 , yzwx, rgb, up4 , up4 , up4 , up4 , zyxw +PIPE_FORMAT_A4B4G4R4_UINT , plain, 1, 1, 1, up4 , up4 , up4 , up4 , wzyx, rgb, up4 , up4 , up4 , up4 , xyzw +PIPE_FORMAT_A1R5G5B5_UINT , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , zyxw +PIPE_FORMAT_A1B5G5R5_UINT , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , xyzw +PIPE_FORMAT_R5G5B5A1_UINT , plain, 1, 1, 1, up5 , up5 , up5 , up1 , xyzw, rgb, up5 , up5 , up5 , up1 , wzyx +PIPE_FORMAT_B5G5R5A1_UINT , plain, 1, 1, 1, up5 , up5 , up5 , up1 , zyxw, rgb, up1 , up5 , up5 , up5 , yzwx PIPE_FORMAT_R8G8B8X8_SNORM , plain, 1, 1, 1, sn8, sn8, sn8, x8, xyz1, rgb PIPE_FORMAT_R8G8B8X8_SRGB , plain, 1, 1, 1, un8, un8, un8, x8, xyz1, srgb diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index fa104e1d66c..76f98683b5c 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -300,7 +300,24 @@ enum pipe_format { PIPE_FORMAT_L32_SINT, PIPE_FORMAT_L32A32_SINT, + PIPE_FORMAT_B8G8R8A8_UINT, + PIPE_FORMAT_A8R8G8B8_UINT, + PIPE_FORMAT_A8B8G8R8_UINT, + PIPE_FORMAT_A2R10G10B10_UINT, + PIPE_FORMAT_A2B10G10R10_UINT, PIPE_FORMAT_B10G10R10A2_UINT, + PIPE_FORMAT_R5G6B5_UINT, + PIPE_FORMAT_B5G6R5_UINT, + PIPE_FORMAT_R5G5B5A1_UINT, + PIPE_FORMAT_B5G5R5A1_UINT, + PIPE_FORMAT_A1R5G5B5_UINT, + PIPE_FORMAT_A1B5G5R5_UINT, + PIPE_FORMAT_R4G4B4A4_UINT, + PIPE_FORMAT_B4G4R4A4_UINT, + PIPE_FORMAT_A4R4G4B4_UINT, + PIPE_FORMAT_A4B4G4R4_UINT, + PIPE_FORMAT_R3G3B2_UINT, + PIPE_FORMAT_B2G3R3_UINT, PIPE_FORMAT_ETC1_RGB8, @@ -464,6 +481,10 @@ enum pipe_format { #define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB #define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB #define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB +#define PIPE_FORMAT_RGBA8888_UINT PIPE_FORMAT_R8G8B8A8_UINT +#define PIPE_FORMAT_BGRA8888_UINT PIPE_FORMAT_B8G8R8A8_UINT +#define PIPE_FORMAT_ARGB8888_UINT PIPE_FORMAT_A8R8G8B8_UINT +#define PIPE_FORMAT_ABGR8888_UINT PIPE_FORMAT_A8B8G8R8_UINT #define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_R8G8_UNORM #define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_G8R8_UNORM #define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_R8G8_SNORM @@ -493,6 +514,10 @@ enum pipe_format { #define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB #define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB #define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB +#define PIPE_FORMAT_RGBA8888_UINT PIPE_FORMAT_A8B8G8R8_UINT +#define PIPE_FORMAT_BGRA8888_UINT PIPE_FORMAT_A8R8G8B8_UINT +#define PIPE_FORMAT_ARGB8888_UINT PIPE_FORMAT_B8G8R8A8_UINT +#define PIPE_FORMAT_ABGR8888_UINT PIPE_FORMAT_R8G8B8A8_UINT #define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_G8R8_UNORM #define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_R8G8_UNORM #define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_G8R8_SNORM diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 1d6b439681c..91692f1c031 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -420,10 +420,45 @@ st_mesa_format_to_pipe_format(const struct st_context *st, return PIPE_FORMAT_R9G9B9E5_FLOAT; case MESA_FORMAT_R11G11B10_FLOAT: return PIPE_FORMAT_R11G11B10_FLOAT; + + case MESA_FORMAT_B8G8R8A8_UINT: + return PIPE_FORMAT_BGRA8888_UINT; + case MESA_FORMAT_A8R8G8B8_UINT: + return PIPE_FORMAT_ARGB8888_UINT; + case MESA_FORMAT_A8B8G8R8_UINT: + return PIPE_FORMAT_ABGR8888_UINT; case MESA_FORMAT_B10G10R10A2_UINT: return PIPE_FORMAT_B10G10R10A2_UINT; case MESA_FORMAT_R10G10B10A2_UINT: return PIPE_FORMAT_R10G10B10A2_UINT; + case MESA_FORMAT_A2B10G10R10_UINT: + return PIPE_FORMAT_A2B10G10R10_UINT; + case MESA_FORMAT_A2R10G10B10_UINT: + return PIPE_FORMAT_A2R10G10B10_UINT; + case MESA_FORMAT_R4G4B4A4_UINT: + return PIPE_FORMAT_R4G4B4A4_UINT; + case MESA_FORMAT_B4G4R4A4_UINT: + return PIPE_FORMAT_B4G4R4A4_UINT; + case MESA_FORMAT_A4B4G4R4_UINT: + return PIPE_FORMAT_A4B4G4R4_UINT; + case MESA_FORMAT_A4R4G4B4_UINT: + return PIPE_FORMAT_A4R4G4B4_UINT; + case MESA_FORMAT_R5G6B5_UINT: + return PIPE_FORMAT_R5G6B5_UINT; + case MESA_FORMAT_B5G6R5_UINT: + return PIPE_FORMAT_B5G6R5_UINT; + case MESA_FORMAT_B5G5R5A1_UINT: + return PIPE_FORMAT_B5G5R5A1_UINT; + case MESA_FORMAT_R5G5B5A1_UINT: + return PIPE_FORMAT_R5G5B5A1_UINT; + case MESA_FORMAT_A1B5G5R5_UINT: + return PIPE_FORMAT_A1B5G5R5_UINT; + case MESA_FORMAT_A1R5G5B5_UINT: + return PIPE_FORMAT_A1R5G5B5_UINT; + case MESA_FORMAT_R3G3B2_UINT: + return PIPE_FORMAT_R3G3B2_UINT; + case MESA_FORMAT_B2G3R3_UINT: + return PIPE_FORMAT_B2G3R3_UINT; case MESA_FORMAT_B4G4R4X4_UNORM: return PIPE_FORMAT_B4G4R4X4_UNORM; @@ -1031,10 +1066,44 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_R11G11B10_FLOAT: return MESA_FORMAT_R11G11B10_FLOAT; + case PIPE_FORMAT_BGRA8888_UINT: + return MESA_FORMAT_B8G8R8A8_UINT; + case PIPE_FORMAT_ARGB8888_UINT: + return MESA_FORMAT_A8R8G8B8_UINT; + case PIPE_FORMAT_ABGR8888_UINT: + return MESA_FORMAT_A8B8G8R8_UINT; case PIPE_FORMAT_B10G10R10A2_UINT: return MESA_FORMAT_B10G10R10A2_UINT; case PIPE_FORMAT_R10G10B10A2_UINT: return MESA_FORMAT_R10G10B10A2_UINT; + case PIPE_FORMAT_A2R10G10B10_UINT: + return MESA_FORMAT_A2R10G10B10_UINT; + case PIPE_FORMAT_A2B10G10R10_UINT: + return MESA_FORMAT_A2B10G10R10_UINT; + case PIPE_FORMAT_R5G5B5A1_UINT: + return MESA_FORMAT_R5G5B5A1_UINT; + case PIPE_FORMAT_B5G5R5A1_UINT: + return MESA_FORMAT_B5G5R5A1_UINT; + case PIPE_FORMAT_A1R5G5B5_UINT: + return MESA_FORMAT_A1R5G5B5_UINT; + case PIPE_FORMAT_A1B5G5R5_UINT: + return MESA_FORMAT_A1B5G5R5_UINT; + case PIPE_FORMAT_R4G4B4A4_UINT: + return MESA_FORMAT_R4G4B4A4_UINT; + case PIPE_FORMAT_B4G4R4A4_UINT: + return MESA_FORMAT_B4G4R4A4_UINT; + case PIPE_FORMAT_A4B4G4R4_UINT: + return MESA_FORMAT_A4B4G4R4_UINT; + case PIPE_FORMAT_A4R4G4B4_UINT: + return MESA_FORMAT_A4R4G4B4_UINT; + case PIPE_FORMAT_R5G6B5_UINT: + return MESA_FORMAT_R5G6B5_UINT; + case PIPE_FORMAT_B5G6R5_UINT: + return MESA_FORMAT_B5G6R5_UINT; + case PIPE_FORMAT_R3G3B2_UINT: + return MESA_FORMAT_R3G3B2_UINT; + case PIPE_FORMAT_B2G3R3_UINT: + return MESA_FORMAT_B2G3R3_UINT; case PIPE_FORMAT_B4G4R4X4_UNORM: return MESA_FORMAT_B4G4R4X4_UNORM;