[Mesa-dev] [PATCH 1/5] mesa: Add X1B5G5R5 along with A1B5G5R5.
Eric Anholt
eric at anholt.net
Tue May 2 19:33:03 UTC 2017
For supporting RGB5 in hardware with A in the low bit (vc4), we need this
format as well.
---
src/mesa/main/formats.c | 2 ++
src/mesa/main/formats.csv | 1 +
src/mesa/main/formats.h | 1 +
src/mesa/main/texformat.c | 1 +
src/mesa/swrast/s_texfetch.c | 1 +
5 files changed, 6 insertions(+)
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 9d9830f8bf45..537afa511016 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -992,6 +992,7 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format,
case MESA_FORMAT_A1B5G5R5_UNORM:
case MESA_FORMAT_A1B5G5R5_UINT:
+ case MESA_FORMAT_X1B5G5R5_UNORM:
*datatype = GL_UNSIGNED_SHORT_5_5_5_1;
*comps = 4;
return;
@@ -2116,6 +2117,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_B4G4R4X4_UNORM:
case MESA_FORMAT_B5G5R5X1_UNORM:
+ case MESA_FORMAT_X1B5G5R5_UNORM:
case MESA_FORMAT_R8G8B8X8_SNORM:
case MESA_FORMAT_R8G8B8X8_SRGB:
case MESA_FORMAT_X8B8G8R8_SRGB:
diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv
index 285921ed4457..ce53f8f05619 100644
--- a/src/mesa/main/formats.csv
+++ b/src/mesa/main/formats.csv
@@ -68,6 +68,7 @@ MESA_FORMAT_B4G4R4A4_UNORM , packed, 1, 1, 1, un4 , un4 , un4 , u
MESA_FORMAT_B4G4R4X4_UNORM , packed, 1, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb
MESA_FORMAT_A4R4G4B4_UNORM , packed, 1, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb
MESA_FORMAT_A1B5G5R5_UNORM , packed, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
+MESA_FORMAT_X1B5G5R5_UNORM , packed, 1, 1, 1, x1 , un5 , un5 , un5 , wzy1, rgb
MESA_FORMAT_B5G5R5A1_UNORM , packed, 1, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
MESA_FORMAT_B5G5R5X1_UNORM , packed, 1, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb
MESA_FORMAT_A1R5G5B5_UNORM , packed, 1, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index b88466f03685..7a7ebfd13252 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -350,6 +350,7 @@ typedef enum
MESA_FORMAT_B4G4R4X4_UNORM, /* xxxx RRRR GGGG BBBB */
MESA_FORMAT_A4R4G4B4_UNORM, /* BBBB GGGG RRRR AAAA */
MESA_FORMAT_A1B5G5R5_UNORM, /* RRRR RGGG GGBB BBBA */
+ MESA_FORMAT_X1B5G5R5_UNORM, /* BBBB BGGG GGRR RRRX */
MESA_FORMAT_B5G5R5A1_UNORM, /* ARRR RRGG GGGB BBBB */
MESA_FORMAT_B5G5R5X1_UNORM, /* xRRR RRGG GGGB BBBB */
MESA_FORMAT_A1R5G5B5_UNORM, /* BBBB BGGG GGRR RRRA */
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index baa3988f0a08..7430deeb2f54 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -88,6 +88,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
break;
case GL_RGB5_A1:
RETURN_IF_SUPPORTED(MESA_FORMAT_B5G5R5A1_UNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A1B5G5R5_UNORM);
break;
case GL_RGBA2:
RETURN_IF_SUPPORTED(MESA_FORMAT_A4R4G4B4_UNORM); /* just to test another format*/
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index 4353ea0e4710..e2c3c085b575 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -159,6 +159,7 @@ texfetch_funcs[] =
FETCH_NULL(B4G4R4X4_UNORM),
FETCH_FUNCS(A4R4G4B4_UNORM),
FETCH_FUNCS(A1B5G5R5_UNORM),
+ FETCH_NULL(X1B5G5R5_UNORM),
FETCH_FUNCS(B5G5R5A1_UNORM),
FETCH_NULL(B5G5R5X1_UNORM),
FETCH_FUNCS(A1R5G5B5_UNORM),
--
2.11.0
More information about the mesa-dev
mailing list