summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-03-04 12:18:52 +0800
committerChia-I Wu <[email protected]>2014-03-06 10:59:25 +0800
commit5a27491a760c64e885110605ff0e5c8021382864 (patch)
treee342b91433cf8e2396727a166c11d29b621c270f /src/mesa/main/formats.c
parent48a9094b69db621c4b8a432adc63d6f4439ab3d1 (diff)
mesa: add MESA_FORMAT_B8G8R8X8_SRGB
The format is needed to represent an RGB-only winsys framebuffer that is sRGB-capable. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r--src/mesa/main/formats.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index f6c399ede58..e0b774e3a44 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1790,6 +1790,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
+ },
};
@@ -2035,6 +2044,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;
@@ -2089,6 +2099,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;
}
@@ -2895,6 +2908,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;
@@ -3448,6 +3466,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;