summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.c
diff options
context:
space:
mode:
authorRichard Sandiford <[email protected]>2014-07-22 11:02:10 +0100
committerDave Airlie <[email protected]>2014-09-17 13:19:45 +1000
commitbe6ef203aafd52fce532c8dae47be75f1d5252a0 (patch)
tree2d2bc7ca2801beb9dafd00b1982ce23fcca62baf /src/mesa/main/formats.c
parentdf14091c5857dc398521aaa9ff43bbbaee2d6116 (diff)
mesa: Add MESA_FORMAT_{A8R8G8B8, X8R8G8B8, X8B8G8R8}_SRGB (v2)
This means that each 8888 SRGB format has a reversed counterpart, which is necessary for handling big-endian mesa<->gallium mappings. v2: fix missing i965 additions. (Jason) fix 127->255 max alpha for SRGB formats. (Jason) v1: Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Richard Sandiford <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r--src/mesa/main/formats.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 8fd36a08209..58c32e23b30 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -357,6 +357,7 @@ _mesa_get_format_color_encoding(mesa_format format)
case MESA_FORMAT_BGR_SRGB8:
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_A8R8G8B8_SRGB:
case MESA_FORMAT_R8G8B8A8_SRGB:
case MESA_FORMAT_L_SRGB8:
case MESA_FORMAT_L8A8_SRGB:
@@ -420,6 +421,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_B8G8R8A8_SRGB:
format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
+ case MESA_FORMAT_A8R8G8B8_SRGB:
+ format = MESA_FORMAT_A8R8G8B8_UNORM;
+ break;
case MESA_FORMAT_R8G8B8A8_SRGB:
format = MESA_FORMAT_R8G8B8A8_UNORM;
break;
@@ -447,6 +451,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_R8G8B8X8_SRGB:
format = MESA_FORMAT_R8G8B8X8_UNORM;
break;
+ case MESA_FORMAT_X8B8G8R8_SRGB:
+ format = MESA_FORMAT_X8B8G8R8_UNORM;
+ break;
case MESA_FORMAT_ETC2_SRGB8:
format = MESA_FORMAT_ETC2_RGB8;
break;
@@ -462,6 +469,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_B8G8R8X8_SRGB:
format = MESA_FORMAT_B8G8R8X8_UNORM;
break;
+ case MESA_FORMAT_X8R8G8B8_SRGB:
+ format = MESA_FORMAT_X8R8G8B8_UNORM;
+ break;
default:
break;
}
@@ -966,6 +976,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_A8R8G8B8_SRGB:
case MESA_FORMAT_R8G8B8A8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
@@ -1241,6 +1252,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_R8G8B8X8_SRGB:
+ case MESA_FORMAT_X8B8G8R8_SRGB:
case MESA_FORMAT_RGBX_UINT8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
@@ -1305,6 +1317,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_B8G8R8X8_SRGB:
+ case MESA_FORMAT_X8R8G8B8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
return;
@@ -1420,6 +1433,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return GL_FALSE;
case MESA_FORMAT_A8R8G8B8_UNORM:
+ case MESA_FORMAT_A8R8G8B8_SRGB:
if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8 && !swapBytes)
return GL_TRUE;
@@ -1849,6 +1863,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_B5G5R5X1_UNORM:
case MESA_FORMAT_R8G8B8X8_SNORM:
case MESA_FORMAT_R8G8B8X8_SRGB:
+ case MESA_FORMAT_X8B8G8R8_SRGB:
case MESA_FORMAT_RGBX_UINT8:
case MESA_FORMAT_RGBX_SINT8:
case MESA_FORMAT_B10G10R10X2_UNORM:
@@ -1875,6 +1890,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
!swapBytes;
case MESA_FORMAT_B8G8R8X8_SRGB:
+ case MESA_FORMAT_X8R8G8B8_SRGB:
return GL_FALSE;
}