From: Eric Anholt Date: Thu, 29 Aug 2019 20:20:45 +0000 (-0700) Subject: mesa: Stop defining a full separate format for RGBA_UINT8. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80a8021d6ce02be599b3befd2dae6506a91f174a;p=mesa.git mesa: Stop defining a full separate format for RGBA_UINT8. We have packed formats for RGBA and ABGR already, so we can just pack/unpack code. v2: Rebase on endianness macro rename Reviewed-by: Marek Olšák (v1) --- diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 77221117dce..9c65e7decc7 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -1295,10 +1295,6 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, *datatype = GL_UNSIGNED_BYTE; *comps = 3; return; - case MESA_FORMAT_RGBA_UINT8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 4; - return; case MESA_FORMAT_R_UINT16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv index bd0975a9192..6fc787cdf57 100644 --- a/src/mesa/main/formats.csv +++ b/src/mesa/main/formats.csv @@ -252,7 +252,6 @@ MESA_FORMAT_RGB_SINT8 , array , 1, 1, 1, s8 , s8 , s8 , MESA_FORMAT_RGB_SINT16 , array , 1, 1, 1, s16 , s16 , s16 , , xyz1, rgb MESA_FORMAT_RGB_SINT32 , array , 1, 1, 1, s32 , s32 , s32 , , xyz1, rgb -MESA_FORMAT_RGBA_UINT8 , array , 1, 1, 1, u8 , u8 , u8 , u8 , xyzw, rgb MESA_FORMAT_RGBA_UINT16 , array , 1, 1, 1, u16 , u16 , u16 , u16 , xyzw, rgb MESA_FORMAT_RGBA_UINT32 , array , 1, 1, 1, u32 , u32 , u32 , u32 , xyzw, rgb MESA_FORMAT_RGBA_SINT8 , array , 1, 1, 1, s8 , s8 , s8 , s8 , xyzw, rgb diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 2f0768c0828..ad645233412 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -36,6 +36,7 @@ #include #include #include +#include "util/u_endian.h" #ifdef __cplusplus extern "C" { @@ -553,7 +554,6 @@ typedef enum MESA_FORMAT_RGB_SINT16, MESA_FORMAT_RGB_SINT32, - MESA_FORMAT_RGBA_UINT8, MESA_FORMAT_RGBA_UINT16, MESA_FORMAT_RGBA_UINT32, MESA_FORMAT_RGBA_SINT8, @@ -674,6 +674,12 @@ typedef enum MESA_FORMAT_COUNT } mesa_format; +/* Packed to array format adapters */ +#if UTIL_ARCH_LITTLE_ENDIAN +#define MESA_FORMAT_RGBA_UINT8 MESA_FORMAT_R8G8B8A8_UINT +#else +#define MESA_FORMAT_RGBA_UINT8 MESA_FORMAT_A8B8G8R8_UINT +#endif extern const char * _mesa_get_format_name(mesa_format format); diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 91692f1c031..f4efb31524c 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -328,8 +328,6 @@ st_mesa_format_to_pipe_format(const struct st_context *st, return PIPE_FORMAT_R8G8_UINT; case MESA_FORMAT_RGB_UINT8: return PIPE_FORMAT_R8G8B8_UINT; - case MESA_FORMAT_RGBA_UINT8: - return PIPE_FORMAT_R8G8B8A8_UINT; case MESA_FORMAT_R_UINT16: return PIPE_FORMAT_R16_UINT; case MESA_FORMAT_RG_UINT16: @@ -421,6 +419,8 @@ st_mesa_format_to_pipe_format(const struct st_context *st, case MESA_FORMAT_R11G11B10_FLOAT: return PIPE_FORMAT_R11G11B10_FLOAT; + case MESA_FORMAT_R8G8B8A8_UINT: + return PIPE_FORMAT_RGBA8888_UINT; case MESA_FORMAT_B8G8R8A8_UINT: return PIPE_FORMAT_BGRA8888_UINT; case MESA_FORMAT_A8R8G8B8_UINT: @@ -973,8 +973,6 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_RG_UINT8; case PIPE_FORMAT_R8G8B8_UINT: return MESA_FORMAT_RGB_UINT8; - case PIPE_FORMAT_R8G8B8A8_UINT: - return MESA_FORMAT_RGBA_UINT8; case PIPE_FORMAT_R16_UINT: return MESA_FORMAT_R_UINT16; @@ -1066,6 +1064,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) 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: diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index 61c87913467..cae8268b3aa 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -250,7 +250,6 @@ texfetch_funcs[] = /* Packed signed/unsigned non-normalized integer formats */ /* Array signed/unsigned non-normalized integer formats */ - FETCH_FUNCS(RGBA_UINT8), FETCH_FUNCS(RGBA_UINT16), FETCH_FUNCS(RGBA_UINT32), FETCH_FUNCS(RGBA_SINT8), diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h index e0885da2f9c..06ff436349d 100644 --- a/src/mesa/swrast/s_texfetch_tmp.h +++ b/src/mesa/swrast/s_texfetch_tmp.h @@ -155,7 +155,6 @@ FETCH_RGBA(LA_SRGB8, GLubyte, 2) FETCH_RGBA(RGBA_SINT8, GLbyte, 4) FETCH_RGBA(RGBA_SINT16, GLshort, 4) FETCH_RGBA(RGBA_SINT32, GLint, 4) -FETCH_RGBA(RGBA_UINT8, GLubyte, 4) FETCH_RGBA(RGBA_UINT16, GLushort, 4) FETCH_RGBA(RGBA_UINT32, GLuint, 4) FETCH_RGBA(R_SNORM8, GLbyte, 1)