[Mesa-dev] [PATCH 2/5] gallium: Add support for 5551 with the 1-bit field in the low bit.
Eric Anholt
eric at anholt.net
Tue May 2 19:33:04 UTC 2017
---
Do I have the swizzles right here? It's a bit complicated because I
have a reswizzle in vc4, so I may have just massaged things to work
out in my case. I tried a lot of combinations trying to specify BE
swizzles in a way that wouldn't assertion fail in the python script,
with no luck.
src/gallium/auxiliary/util/u_format.csv | 2 ++
src/gallium/include/pipe/p_format.h | 3 +++
src/mesa/state_tracker/st_format.c | 16 +++++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index cef530aae7c3..e4e3f8705456 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -74,6 +74,8 @@ PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, r
PIPE_FORMAT_R8G8B8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , x8 , xyz1, rgb
PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb, x1 , un5 , un5 , un5 , yzw1
PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb, un1 , un5 , un5 , un5 , yzwx
+PIPE_FORMAT_X1B5G5R5_UNORM , plain, 1, 1, x1 , un5 , un5 , un5 , wzy1, rgb
+PIPE_FORMAT_A1B5G5R5_UNORM , plain, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb
PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb, un4 , un4 , un4 , un4 , yzwx
PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb, x4 , un4 , un4 , un4 , yzw1
PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb, un5 , un6 , un5 , , xyz1
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index e4e09d8b4353..515ce62e2973 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -391,6 +391,9 @@ enum pipe_format {
PIPE_FORMAT_P016 = 307,
+ PIPE_FORMAT_A1B5G5R5_UNORM = 308,
+ PIPE_FORMAT_X1B5G5R5_UNORM = 309,
+
PIPE_FORMAT_COUNT
};
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 012f1a40151f..25162fbb9e5c 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -79,6 +79,8 @@ st_mesa_format_to_pipe_format(const struct st_context *st, mesa_format mesaForma
return PIPE_FORMAT_XRGB8888_UNORM;
case MESA_FORMAT_B5G5R5A1_UNORM:
return PIPE_FORMAT_B5G5R5A1_UNORM;
+ case MESA_FORMAT_A1B5G5R5_UNORM:
+ return PIPE_FORMAT_A1B5G5R5_UNORM;
case MESA_FORMAT_B4G4R4A4_UNORM:
return PIPE_FORMAT_B4G4R4A4_UNORM;
case MESA_FORMAT_B5G6R5_UNORM:
@@ -407,6 +409,8 @@ st_mesa_format_to_pipe_format(const struct st_context *st, mesa_format mesaForma
return PIPE_FORMAT_B4G4R4X4_UNORM;
case MESA_FORMAT_B5G5R5X1_UNORM:
return PIPE_FORMAT_B5G5R5X1_UNORM;
+ case MESA_FORMAT_X1B5G5R5_UNORM:
+ return PIPE_FORMAT_X1B5G5R5_UNORM;
case MESA_FORMAT_R8G8B8X8_SNORM:
return PIPE_FORMAT_RGBX8888_SNORM;
case MESA_FORMAT_X8B8G8R8_SNORM:
@@ -556,6 +560,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
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_B4G4R4A4_UNORM:
return MESA_FORMAT_B4G4R4A4_UNORM;
case PIPE_FORMAT_B5G6R5_UNORM:
@@ -886,6 +892,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
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:
@@ -1058,7 +1066,7 @@ test_format_conversion(struct st_context *st)
struct format_mapping
{
GLenum glFormats[18]; /**< list of GLenum formats, 0-terminated */
- enum pipe_format pipeFormats[13]; /**< list of pipe formats, 0-terminated */
+ enum pipe_format pipeFormats[14]; /**< list of pipe formats, 0-terminated */
};
@@ -1145,7 +1153,8 @@ static const struct format_mapping format_map[] = {
},
{
{ GL_RGB5_A1, 0 },
- { PIPE_FORMAT_B5G5R5A1_UNORM, DEFAULT_RGBA_FORMATS }
+ { PIPE_FORMAT_B5G5R5A1_UNORM, PIPE_FORMAT_A1B5G5R5_UNORM,
+ DEFAULT_RGBA_FORMATS }
},
{
{ GL_R3_G3_B2, 0 },
@@ -1159,7 +1168,8 @@ static const struct format_mapping format_map[] = {
},
{
{ GL_RGB5 },
- { PIPE_FORMAT_B5G5R5X1_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM,
+ { PIPE_FORMAT_B5G5R5X1_UNORM, PIPE_FORMAT_X1B5G5R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM, PIPE_FORMAT_A1B5G5R5_UNORM,
DEFAULT_RGB_FORMATS }
},
{
--
2.11.0
More information about the mesa-dev
mailing list