aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/formats.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/formats.c')
-rw-r--r--mesalib/src/mesa/main/formats.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index f6c399ede..0cf97fa31 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -520,6 +520,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
1, 1, 4
},
{
+ MESA_FORMAT_R8G8B8A8_SRGB,
+ "MESA_FORMAT_R8G8B8A8_SRGB",
+ GL_RGBA,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 8, 8, 8,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
+ {
MESA_FORMAT_L_SRGB8,
"MESA_FORMAT_L_SRGB8",
GL_LUMINANCE,
@@ -1790,6 +1799,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
0, 0, 0, 0, 0,
1, 1, 4
},
+ {
+ MESA_FORMAT_B8G8R8X8_SRGB,
+ "MESA_FORMAT_B8G8R8X8_SRGB",
+ GL_RGB,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 8, 8, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
};
@@ -2025,6 +2043,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_R8G8B8A8_SRGB:
case MESA_FORMAT_L_SRGB8:
case MESA_FORMAT_L8A8_SRGB:
case MESA_FORMAT_SRGB_DXT1:
@@ -2035,6 +2054,7 @@ _mesa_get_format_color_encoding(mesa_format format)
case MESA_FORMAT_ETC2_SRGB8:
case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
+ case MESA_FORMAT_B8G8R8X8_SRGB:
return GL_SRGB;
default:
return GL_LINEAR;
@@ -2059,6 +2079,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_B8G8R8A8_SRGB:
format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
+ case MESA_FORMAT_R8G8B8A8_SRGB:
+ format = MESA_FORMAT_R8G8B8A8_UNORM;
+ break;
case MESA_FORMAT_L_SRGB8:
format = MESA_FORMAT_L_UNORM8;
break;
@@ -2089,6 +2112,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
format = MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
break;
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ format = MESA_FORMAT_B8G8R8X8_UNORM;
+ break;
default:
break;
}
@@ -2563,6 +2589,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
return;
case MESA_FORMAT_A8B8G8R8_SRGB:
case MESA_FORMAT_B8G8R8A8_SRGB:
+ case MESA_FORMAT_R8G8B8A8_SRGB:
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
return;
@@ -2895,6 +2922,11 @@ _mesa_format_to_type_and_comps(mesa_format format,
*comps = 2;
return;
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ *datatype = GL_UNSIGNED_BYTE;
+ *comps = 4;
+ return;
+
case MESA_FORMAT_COUNT:
assert(0);
return;
@@ -2967,6 +2999,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return GL_FALSE;
case MESA_FORMAT_R8G8B8A8_UNORM:
+ case MESA_FORMAT_R8G8B8A8_SRGB:
if (format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8_REV &&
!swapBytes)
return GL_TRUE;
@@ -3448,6 +3481,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_G16R16_SNORM:
return format == GL_RG && type == GL_SHORT && !littleEndian &&
!swapBytes;
+
+ case MESA_FORMAT_B8G8R8X8_SRGB:
+ return GL_FALSE;
}
return GL_FALSE;