From 9d2c8df3ebb7770e9486f6e14aa9bf38bd792d7a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Sep 2019 14:33:18 -0700 Subject: [PATCH] mesa/st: Make st_pipe_format_to_mesa_format an effective no-op. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit All callers other than the unit test just wanted to convert back from a known-mesa-equivalent format, which is now a no-op. v2: Fix assertion failure in iris GL startup with BGR565 by continuing to return MESA_FORMAT_NONE for non-Mesa formats. Reviewed-by: Marek Olšák (v1) --- src/mesa/state_tracker/st_format.c | 572 +---------------------- src/mesa/state_tracker/tests/st_format.c | 19 - 2 files changed, 3 insertions(+), 588 deletions(-) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 84bee15d44b..f0096a2cc48 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -123,576 +123,10 @@ st_mesa_format_to_pipe_format(const struct st_context *st, mesa_format st_pipe_format_to_mesa_format(enum pipe_format format) { - switch (format) { - case PIPE_FORMAT_ABGR8888_UNORM: - return MESA_FORMAT_A8B8G8R8_UNORM; - case PIPE_FORMAT_RGBA8888_UNORM: - return MESA_FORMAT_R8G8B8A8_UNORM; - case PIPE_FORMAT_R8G8B8_UNORM: - return MESA_FORMAT_RGB_UNORM8; - case PIPE_FORMAT_BGRA8888_UNORM: - return MESA_FORMAT_B8G8R8A8_UNORM; - case PIPE_FORMAT_ARGB8888_UNORM: - return MESA_FORMAT_A8R8G8B8_UNORM; - case PIPE_FORMAT_XBGR8888_UNORM: - return MESA_FORMAT_X8B8G8R8_UNORM; - case PIPE_FORMAT_RGBX8888_UNORM: - return MESA_FORMAT_R8G8B8X8_UNORM; - case PIPE_FORMAT_BGRX8888_UNORM: - return MESA_FORMAT_B8G8R8X8_UNORM; - case PIPE_FORMAT_XRGB8888_UNORM: - return MESA_FORMAT_X8R8G8B8_UNORM; - case PIPE_FORMAT_B5G5R5A1_UNORM: - 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: - return MESA_FORMAT_B10G10R10A2_UNORM; - case PIPE_FORMAT_R10G10B10A2_UNORM: - 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: - return MESA_FORMAT_LA_UNORM8; - case PIPE_FORMAT_L16A16_UNORM: - return MESA_FORMAT_LA_UNORM16; - case PIPE_FORMAT_A8_UNORM: - return MESA_FORMAT_A_UNORM8; - case PIPE_FORMAT_A16_UNORM: - return MESA_FORMAT_A_UNORM16; - case PIPE_FORMAT_L8_UNORM: - return MESA_FORMAT_L_UNORM8; - case PIPE_FORMAT_L16_UNORM: - return MESA_FORMAT_L_UNORM16; - case PIPE_FORMAT_I8_UNORM: - return MESA_FORMAT_I_UNORM8; - case PIPE_FORMAT_I16_UNORM: - return MESA_FORMAT_I_UNORM16; - case PIPE_FORMAT_S8_UINT: - return MESA_FORMAT_S_UINT8; - - case PIPE_FORMAT_R16G16B16A16_UNORM: - return MESA_FORMAT_RGBA_UNORM16; - - case PIPE_FORMAT_Z16_UNORM: - return MESA_FORMAT_Z_UNORM16; - case PIPE_FORMAT_Z32_UNORM: - return MESA_FORMAT_Z_UNORM32; - case PIPE_FORMAT_S8_UINT_Z24_UNORM: - return MESA_FORMAT_S8_UINT_Z24_UNORM; - case PIPE_FORMAT_X8Z24_UNORM: - return MESA_FORMAT_X8_UINT_Z24_UNORM; - case PIPE_FORMAT_Z24X8_UNORM: - return MESA_FORMAT_Z24_UNORM_X8_UINT; - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - return MESA_FORMAT_Z24_UNORM_S8_UINT; - case PIPE_FORMAT_Z32_FLOAT: - return MESA_FORMAT_Z_FLOAT32; - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - return MESA_FORMAT_Z32_FLOAT_S8X24_UINT; - - case PIPE_FORMAT_UYVY: - return MESA_FORMAT_YCBCR; - case PIPE_FORMAT_YUYV: - return MESA_FORMAT_YCBCR_REV; - - case PIPE_FORMAT_DXT1_RGB: - return MESA_FORMAT_RGB_DXT1; - case PIPE_FORMAT_DXT1_RGBA: - return MESA_FORMAT_RGBA_DXT1; - case PIPE_FORMAT_DXT3_RGBA: - return MESA_FORMAT_RGBA_DXT3; - case PIPE_FORMAT_DXT5_RGBA: - return MESA_FORMAT_RGBA_DXT5; - case PIPE_FORMAT_DXT1_SRGB: - return MESA_FORMAT_SRGB_DXT1; - case PIPE_FORMAT_DXT1_SRGBA: - return MESA_FORMAT_SRGBA_DXT1; - case PIPE_FORMAT_DXT3_SRGBA: - return MESA_FORMAT_SRGBA_DXT3; - case PIPE_FORMAT_DXT5_SRGBA: - return MESA_FORMAT_SRGBA_DXT5; - case PIPE_FORMAT_L8_SRGB: - return MESA_FORMAT_L_SRGB8; - case PIPE_FORMAT_L8A8_SRGB: - return MESA_FORMAT_LA_SRGB8; - case PIPE_FORMAT_R8_SRGB: - return MESA_FORMAT_R_SRGB8; - case PIPE_FORMAT_R8G8B8_SRGB: - return MESA_FORMAT_BGR_SRGB8; - case PIPE_FORMAT_ABGR8888_SRGB: - return MESA_FORMAT_A8B8G8R8_SRGB; - case PIPE_FORMAT_RGBA8888_SRGB: - return MESA_FORMAT_R8G8B8A8_SRGB; - case PIPE_FORMAT_BGRA8888_SRGB: - return MESA_FORMAT_B8G8R8A8_SRGB; - case PIPE_FORMAT_ARGB8888_SRGB: - return MESA_FORMAT_A8R8G8B8_SRGB; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - return MESA_FORMAT_RGBA_FLOAT32; - case PIPE_FORMAT_R16G16B16A16_FLOAT: - return MESA_FORMAT_RGBA_FLOAT16; - case PIPE_FORMAT_R32G32B32_FLOAT: - return MESA_FORMAT_RGB_FLOAT32; - case PIPE_FORMAT_R16G16B16_FLOAT: - return MESA_FORMAT_RGB_FLOAT16; - case PIPE_FORMAT_L32A32_FLOAT: - return MESA_FORMAT_LA_FLOAT32; - case PIPE_FORMAT_L16A16_FLOAT: - return MESA_FORMAT_LA_FLOAT16; - case PIPE_FORMAT_L32_FLOAT: - return MESA_FORMAT_L_FLOAT32; - case PIPE_FORMAT_L16_FLOAT: - return MESA_FORMAT_L_FLOAT16; - case PIPE_FORMAT_A32_FLOAT: - return MESA_FORMAT_A_FLOAT32; - case PIPE_FORMAT_A16_FLOAT: - return MESA_FORMAT_A_FLOAT16; - case PIPE_FORMAT_I32_FLOAT: - return MESA_FORMAT_I_FLOAT32; - case PIPE_FORMAT_I16_FLOAT: - return MESA_FORMAT_I_FLOAT16; - case PIPE_FORMAT_R32_FLOAT: - return MESA_FORMAT_R_FLOAT32; - case PIPE_FORMAT_R16_FLOAT: - return MESA_FORMAT_R_FLOAT16; - case PIPE_FORMAT_R32G32_FLOAT: - return MESA_FORMAT_RG_FLOAT32; - case PIPE_FORMAT_R16G16_FLOAT: - return MESA_FORMAT_RG_FLOAT16; - - case PIPE_FORMAT_R8_UNORM: - return MESA_FORMAT_R_UNORM8; - case PIPE_FORMAT_R16_UNORM: - return MESA_FORMAT_R_UNORM16; - case PIPE_FORMAT_R8G8_UNORM: - return MESA_FORMAT_RG_UNORM8; - case PIPE_FORMAT_R16G16_UNORM: - return MESA_FORMAT_RG_UNORM16; - case PIPE_FORMAT_B8G8R8_UNORM: - return MESA_FORMAT_BGR_UNORM8; - - case PIPE_FORMAT_A8_UINT: - return MESA_FORMAT_A_UINT8; - case PIPE_FORMAT_A16_UINT: - return MESA_FORMAT_A_UINT16; - case PIPE_FORMAT_A32_UINT: - return MESA_FORMAT_A_UINT32; - case PIPE_FORMAT_A8_SINT: - return MESA_FORMAT_A_SINT8; - case PIPE_FORMAT_A16_SINT: - return MESA_FORMAT_A_SINT16; - case PIPE_FORMAT_A32_SINT: - return MESA_FORMAT_A_SINT32; - - case PIPE_FORMAT_I8_UINT: - return MESA_FORMAT_I_UINT8; - case PIPE_FORMAT_I16_UINT: - return MESA_FORMAT_I_UINT16; - case PIPE_FORMAT_I32_UINT: - return MESA_FORMAT_I_UINT32; - case PIPE_FORMAT_I8_SINT: - return MESA_FORMAT_I_SINT8; - case PIPE_FORMAT_I16_SINT: - return MESA_FORMAT_I_SINT16; - case PIPE_FORMAT_I32_SINT: - return MESA_FORMAT_I_SINT32; - - case PIPE_FORMAT_L8_UINT: - return MESA_FORMAT_L_UINT8; - case PIPE_FORMAT_L16_UINT: - return MESA_FORMAT_L_UINT16; - case PIPE_FORMAT_L32_UINT: - return MESA_FORMAT_L_UINT32; - case PIPE_FORMAT_L8_SINT: - return MESA_FORMAT_L_SINT8; - case PIPE_FORMAT_L16_SINT: - return MESA_FORMAT_L_SINT16; - case PIPE_FORMAT_L32_SINT: - return MESA_FORMAT_L_SINT32; - - case PIPE_FORMAT_L8A8_UINT: - return MESA_FORMAT_LA_UINT8; - case PIPE_FORMAT_L16A16_UINT: - return MESA_FORMAT_LA_UINT16; - case PIPE_FORMAT_L32A32_UINT: - return MESA_FORMAT_LA_UINT32; - case PIPE_FORMAT_L8A8_SINT: - return MESA_FORMAT_LA_SINT8; - case PIPE_FORMAT_L16A16_SINT: - return MESA_FORMAT_LA_SINT16; - case PIPE_FORMAT_L32A32_SINT: - return MESA_FORMAT_LA_SINT32; - - case PIPE_FORMAT_R8_SINT: - return MESA_FORMAT_R_SINT8; - case PIPE_FORMAT_R8G8_SINT: - return MESA_FORMAT_RG_SINT8; - case PIPE_FORMAT_R8G8B8_SINT: - return MESA_FORMAT_RGB_SINT8; - case PIPE_FORMAT_R8G8B8A8_SINT: - return MESA_FORMAT_RGBA_SINT8; - - case PIPE_FORMAT_R16_SINT: - return MESA_FORMAT_R_SINT16; - case PIPE_FORMAT_R16G16_SINT: - return MESA_FORMAT_RG_SINT16; - case PIPE_FORMAT_R16G16B16_SINT: - return MESA_FORMAT_RGB_SINT16; - case PIPE_FORMAT_R16G16B16A16_SINT: - return MESA_FORMAT_RGBA_SINT16; - - case PIPE_FORMAT_R32_SINT: - return MESA_FORMAT_R_SINT32; - case PIPE_FORMAT_R32G32_SINT: - return MESA_FORMAT_RG_SINT32; - case PIPE_FORMAT_R32G32B32_SINT: - return MESA_FORMAT_RGB_SINT32; - case PIPE_FORMAT_R32G32B32A32_SINT: - return MESA_FORMAT_RGBA_SINT32; - - /* unsigned int formats */ - case PIPE_FORMAT_R8_UINT: - return MESA_FORMAT_R_UINT8; - case PIPE_FORMAT_R8G8_UINT: - return MESA_FORMAT_RG_UINT8; - case PIPE_FORMAT_R8G8B8_UINT: - return MESA_FORMAT_RGB_UINT8; - - case PIPE_FORMAT_R16_UINT: - return MESA_FORMAT_R_UINT16; - case PIPE_FORMAT_R16G16_UINT: - return MESA_FORMAT_RG_UINT16; - case PIPE_FORMAT_R16G16B16_UINT: - return MESA_FORMAT_RGB_UINT16; - case PIPE_FORMAT_R16G16B16A16_UINT: - return MESA_FORMAT_RGBA_UINT16; - - case PIPE_FORMAT_R32_UINT: - return MESA_FORMAT_R_UINT32; - case PIPE_FORMAT_R32G32_UINT: - return MESA_FORMAT_RG_UINT32; - case PIPE_FORMAT_R32G32B32_UINT: - return MESA_FORMAT_RGB_UINT32; - case PIPE_FORMAT_R32G32B32A32_UINT: - return MESA_FORMAT_RGBA_UINT32; - - case PIPE_FORMAT_RGTC1_UNORM: - return MESA_FORMAT_R_RGTC1_UNORM; - case PIPE_FORMAT_RGTC1_SNORM: - return MESA_FORMAT_R_RGTC1_SNORM; - case PIPE_FORMAT_RGTC2_UNORM: - return MESA_FORMAT_RG_RGTC2_UNORM; - case PIPE_FORMAT_RGTC2_SNORM: - return MESA_FORMAT_RG_RGTC2_SNORM; - - case PIPE_FORMAT_LATC1_UNORM: - return MESA_FORMAT_L_LATC1_UNORM; - case PIPE_FORMAT_LATC1_SNORM: - return MESA_FORMAT_L_LATC1_SNORM; - case PIPE_FORMAT_LATC2_UNORM: - return MESA_FORMAT_LA_LATC2_UNORM; - case PIPE_FORMAT_LATC2_SNORM: - return MESA_FORMAT_LA_LATC2_SNORM; - - case PIPE_FORMAT_ETC1_RGB8: - return MESA_FORMAT_ETC1_RGB8; - - case PIPE_FORMAT_BPTC_RGBA_UNORM: - return MESA_FORMAT_BPTC_RGBA_UNORM; - case PIPE_FORMAT_BPTC_SRGBA: - return MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM; - case PIPE_FORMAT_BPTC_RGB_FLOAT: - return MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT; - case PIPE_FORMAT_BPTC_RGB_UFLOAT: - return MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT; - - /* signed normalized formats */ - case PIPE_FORMAT_R8_SNORM: - return MESA_FORMAT_R_SNORM8; - case PIPE_FORMAT_R8G8_SNORM: - return MESA_FORMAT_RG_SNORM8; - case PIPE_FORMAT_RGBA8888_SNORM: - return MESA_FORMAT_R8G8B8A8_SNORM; - case PIPE_FORMAT_ABGR8888_SNORM: - return MESA_FORMAT_A8B8G8R8_SNORM; - - case PIPE_FORMAT_A8_SNORM: - return MESA_FORMAT_A_SNORM8; - case PIPE_FORMAT_L8_SNORM: - return MESA_FORMAT_L_SNORM8; - case PIPE_FORMAT_L8A8_SNORM: - return MESA_FORMAT_LA_SNORM8; - case PIPE_FORMAT_I8_SNORM: - return MESA_FORMAT_I_SNORM8; - - case PIPE_FORMAT_R16_SNORM: - return MESA_FORMAT_R_SNORM16; - case PIPE_FORMAT_R16G16_SNORM: - return MESA_FORMAT_RG_SNORM16; - case PIPE_FORMAT_R16G16B16_SNORM: - return MESA_FORMAT_RGB_SNORM16; - case PIPE_FORMAT_R16G16B16A16_SNORM: - return MESA_FORMAT_RGBA_SNORM16; - - case PIPE_FORMAT_A16_SNORM: - return MESA_FORMAT_A_SNORM16; - case PIPE_FORMAT_L16_SNORM: - return MESA_FORMAT_L_SNORM16; - case PIPE_FORMAT_L16A16_SNORM: - return MESA_FORMAT_LA_SNORM16; - case PIPE_FORMAT_I16_SNORM: - return MESA_FORMAT_I_SNORM16; - - case PIPE_FORMAT_R9G9B9E5_FLOAT: - return MESA_FORMAT_R9G9B9E5_FLOAT; - case PIPE_FORMAT_R11G11B10_FLOAT: - return MESA_FORMAT_R11G11B10_FLOAT; - - case PIPE_FORMAT_RGBA8888_UINT: - return MESA_FORMAT_R8G8B8A8_UINT; - 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; - case PIPE_FORMAT_B5G5R5X1_UNORM: - return MESA_FORMAT_B5G5R5X1_UNORM; - case PIPE_FORMAT_X1B5G5R5_UNORM: - return MESA_FORMAT_X1B5G5R5_UNORM; - case PIPE_FORMAT_RGBX8888_SNORM: - return MESA_FORMAT_R8G8B8X8_SNORM; - case PIPE_FORMAT_XBGR8888_SNORM: - return MESA_FORMAT_X8B8G8R8_SNORM; - case PIPE_FORMAT_RGBX8888_SRGB: - return MESA_FORMAT_R8G8B8X8_SRGB; - case PIPE_FORMAT_XBGR8888_SRGB: - return MESA_FORMAT_X8B8G8R8_SRGB; - case PIPE_FORMAT_R8G8B8X8_UINT: - return MESA_FORMAT_RGBX_UINT8; - case PIPE_FORMAT_R8G8B8X8_SINT: - return MESA_FORMAT_RGBX_SINT8; - case PIPE_FORMAT_B10G10R10X2_UNORM: - return MESA_FORMAT_B10G10R10X2_UNORM; - case PIPE_FORMAT_R16G16B16X16_UNORM: - return MESA_FORMAT_RGBX_UNORM16; - case PIPE_FORMAT_R16G16B16X16_SNORM: - return MESA_FORMAT_RGBX_SNORM16; - case PIPE_FORMAT_R16G16B16X16_FLOAT: - return MESA_FORMAT_RGBX_FLOAT16; - case PIPE_FORMAT_R16G16B16X16_UINT: - return MESA_FORMAT_RGBX_UINT16; - case PIPE_FORMAT_R16G16B16X16_SINT: - return MESA_FORMAT_RGBX_SINT16; - case PIPE_FORMAT_R32G32B32X32_FLOAT: - return MESA_FORMAT_RGBX_FLOAT32; - case PIPE_FORMAT_R32G32B32X32_UINT: - return MESA_FORMAT_RGBX_UINT32; - case PIPE_FORMAT_R32G32B32X32_SINT: - return MESA_FORMAT_RGBX_SINT32; - - case PIPE_FORMAT_BGRX8888_SRGB: - return MESA_FORMAT_B8G8R8X8_SRGB; - case PIPE_FORMAT_XRGB8888_SRGB: - return MESA_FORMAT_X8R8G8B8_SRGB; - - case PIPE_FORMAT_ETC2_RGB8: - return MESA_FORMAT_ETC2_RGB8; - case PIPE_FORMAT_ETC2_SRGB8: - return MESA_FORMAT_ETC2_SRGB8; - case PIPE_FORMAT_ETC2_RGB8A1: - return MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1; - case PIPE_FORMAT_ETC2_SRGB8A1: - return MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1; - case PIPE_FORMAT_ETC2_RGBA8: - return MESA_FORMAT_ETC2_RGBA8_EAC; - case PIPE_FORMAT_ETC2_SRGBA8: - return MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC; - case PIPE_FORMAT_ETC2_R11_UNORM: - return MESA_FORMAT_ETC2_R11_EAC; - case PIPE_FORMAT_ETC2_R11_SNORM: - return MESA_FORMAT_ETC2_SIGNED_R11_EAC; - case PIPE_FORMAT_ETC2_RG11_UNORM: - return MESA_FORMAT_ETC2_RG11_EAC; - case PIPE_FORMAT_ETC2_RG11_SNORM: - return MESA_FORMAT_ETC2_SIGNED_RG11_EAC; - - case PIPE_FORMAT_ASTC_4x4: - return MESA_FORMAT_RGBA_ASTC_4x4; - case PIPE_FORMAT_ASTC_5x4: - return MESA_FORMAT_RGBA_ASTC_5x4; - case PIPE_FORMAT_ASTC_5x5: - return MESA_FORMAT_RGBA_ASTC_5x5; - case PIPE_FORMAT_ASTC_6x5: - return MESA_FORMAT_RGBA_ASTC_6x5; - case PIPE_FORMAT_ASTC_6x6: - return MESA_FORMAT_RGBA_ASTC_6x6; - case PIPE_FORMAT_ASTC_8x5: - return MESA_FORMAT_RGBA_ASTC_8x5; - case PIPE_FORMAT_ASTC_8x6: - return MESA_FORMAT_RGBA_ASTC_8x6; - case PIPE_FORMAT_ASTC_8x8: - return MESA_FORMAT_RGBA_ASTC_8x8; - case PIPE_FORMAT_ASTC_10x5: - return MESA_FORMAT_RGBA_ASTC_10x5; - case PIPE_FORMAT_ASTC_10x6: - return MESA_FORMAT_RGBA_ASTC_10x6; - case PIPE_FORMAT_ASTC_10x8: - return MESA_FORMAT_RGBA_ASTC_10x8; - case PIPE_FORMAT_ASTC_10x10: - return MESA_FORMAT_RGBA_ASTC_10x10; - case PIPE_FORMAT_ASTC_12x10: - return MESA_FORMAT_RGBA_ASTC_12x10; - case PIPE_FORMAT_ASTC_12x12: - return MESA_FORMAT_RGBA_ASTC_12x12; - - case PIPE_FORMAT_ASTC_4x4_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4; - case PIPE_FORMAT_ASTC_5x4_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4; - case PIPE_FORMAT_ASTC_5x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5; - case PIPE_FORMAT_ASTC_6x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5; - case PIPE_FORMAT_ASTC_6x6_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6; - case PIPE_FORMAT_ASTC_8x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5; - case PIPE_FORMAT_ASTC_8x6_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6; - case PIPE_FORMAT_ASTC_8x8_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8; - case PIPE_FORMAT_ASTC_10x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5; - case PIPE_FORMAT_ASTC_10x6_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6; - case PIPE_FORMAT_ASTC_10x8_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8; - case PIPE_FORMAT_ASTC_10x10_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10; - case PIPE_FORMAT_ASTC_12x10_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10; - case PIPE_FORMAT_ASTC_12x12_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12; - - case PIPE_FORMAT_ASTC_3x3x3: - return MESA_FORMAT_RGBA_ASTC_3x3x3; - case PIPE_FORMAT_ASTC_4x3x3: - return MESA_FORMAT_RGBA_ASTC_4x3x3; - case PIPE_FORMAT_ASTC_4x4x3: - return MESA_FORMAT_RGBA_ASTC_4x4x3; - case PIPE_FORMAT_ASTC_4x4x4: - return MESA_FORMAT_RGBA_ASTC_4x4x4; - case PIPE_FORMAT_ASTC_5x4x4: - return MESA_FORMAT_RGBA_ASTC_5x4x4; - case PIPE_FORMAT_ASTC_5x5x4: - return MESA_FORMAT_RGBA_ASTC_5x5x4; - case PIPE_FORMAT_ASTC_5x5x5: - return MESA_FORMAT_RGBA_ASTC_5x5x5; - case PIPE_FORMAT_ASTC_6x5x5: - return MESA_FORMAT_RGBA_ASTC_6x5x5; - case PIPE_FORMAT_ASTC_6x6x5: - return MESA_FORMAT_RGBA_ASTC_6x6x5; - case PIPE_FORMAT_ASTC_6x6x6: - return MESA_FORMAT_RGBA_ASTC_6x6x6; - case PIPE_FORMAT_ASTC_3x3x3_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_3x3x3; - case PIPE_FORMAT_ASTC_4x3x3_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x3x3; - case PIPE_FORMAT_ASTC_4x4x3_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x3; - case PIPE_FORMAT_ASTC_4x4x4_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x4; - case PIPE_FORMAT_ASTC_5x4x4_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4x4; - case PIPE_FORMAT_ASTC_5x5x4_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x4; - case PIPE_FORMAT_ASTC_5x5x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x5; - case PIPE_FORMAT_ASTC_6x5x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5x5; - case PIPE_FORMAT_ASTC_6x6x5_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x5; - case PIPE_FORMAT_ASTC_6x6x6_SRGB: - return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x6; - - case PIPE_FORMAT_ATC_RGB: - return MESA_FORMAT_ATC_RGB; - case PIPE_FORMAT_ATC_RGBA_EXPLICIT: - return MESA_FORMAT_ATC_RGBA_EXPLICIT; - case PIPE_FORMAT_ATC_RGBA_INTERPOLATED: - return MESA_FORMAT_ATC_RGBA_INTERPOLATED; - - case PIPE_FORMAT_FXT1_RGB: - return MESA_FORMAT_RGB_FXT1; - case PIPE_FORMAT_FXT1_RGBA: - return MESA_FORMAT_RGBA_FXT1; - - default: + mesa_format mf = format; + if (!_mesa_get_format_name(mf)) return MESA_FORMAT_NONE; - } + return mf; } /** diff --git a/src/mesa/state_tracker/tests/st_format.c b/src/mesa/state_tracker/tests/st_format.c index 837b43b1f82..26725f84176 100644 --- a/src/mesa/state_tracker/tests/st_format.c +++ b/src/mesa/state_tracker/tests/st_format.c @@ -82,16 +82,7 @@ int main(int argc, char **argv) _mesa_get_format_name(mf)); return 1; } - } - } - - /* Test all Gallium formats */ - for (i = 1; i < PIPE_FORMAT_COUNT; i++) { - mesa_format mf = st_pipe_format_to_mesa_format(i); - if (st_compressed_format_fallback(st, mf)) - continue; - if (mf != MESA_FORMAT_NONE) { const struct util_format_description *desc = util_format_description(i); /* Make sure that gallium and Mesa agree on whether the format is an @@ -114,16 +105,6 @@ int main(int argc, char **argv) return 1; } } - - enum pipe_format pf = - st_mesa_format_to_pipe_format(st, mf); - if (pf != i) { - fprintf(stderr, "Round-tripping %s -> %s -> %s failed\n", - util_format_short_name(i), - _mesa_get_format_name(mf), - util_format_short_name(pf)); - return 1; - } } } -- 2.30.2