aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/glformats.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-14 15:13:52 +0100
committermarha <marha@users.sourceforge.net>2013-01-14 15:13:52 +0100
commit2a1abdc8fe640583dac90dc316caf2d40b9ee4e2 (patch)
tree721982dda954c217323cf726bf1ff527b0477ebe /mesalib/src/mesa/main/glformats.c
parentddc05759f098f06bd93253a7bffe38640963dfb3 (diff)
downloadvcxsrv-2a1abdc8fe640583dac90dc316caf2d40b9ee4e2.tar.gz
vcxsrv-2a1abdc8fe640583dac90dc316caf2d40b9ee4e2.tar.bz2
vcxsrv-2a1abdc8fe640583dac90dc316caf2d40b9ee4e2.zip
libxtrans xwininfo libX11 libXau libXmu libXdmcp mesa mkfontscale
xkeyboard-config git update 14 jan 2013 libxtrans: ec3136232f7ce930f9ca812b6ab42a71b60af4af xwininfo: 3e60a26559221e561770710a8c4ed0b8ebc31afb libX11: 3cd974b1d4d1fa6389d3695fa9fcc0c22a51d50c libXau: 8570d287396934f26224c76d48d7f17d87380e72 libXmu: 9b253d99d5b4f3fbb681c2cb1b84f8f9acfee528 libXdmcp: ca65a92405500393f09d34388edbbf6350e6c146 mesa: e3e1ffb2520498584ef402213d0c8aa4303a46a3 mkfontscale: 1157b3039551b552b483f05f6a411e57941a87c0
Diffstat (limited to 'mesalib/src/mesa/main/glformats.c')
-rw-r--r--mesalib/src/mesa/main/glformats.c83
1 files changed, 68 insertions, 15 deletions
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index f33a0503d..ff56ffad0 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -271,7 +271,8 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type)
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT ||
- format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT)
+ format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT ||
+ format == GL_RGB)
return sizeof(GLuint);
else
return -1;
@@ -353,21 +354,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
* Test if the given format is an integer (non-normalized) format.
*/
GLboolean
-_mesa_is_enum_format_integer(GLenum format)
+_mesa_is_enum_format_unsigned_int(GLenum format)
{
switch (format) {
- /* generic integer formats */
- case GL_RED_INTEGER_EXT:
- case GL_GREEN_INTEGER_EXT:
- case GL_BLUE_INTEGER_EXT:
- case GL_ALPHA_INTEGER_EXT:
- case GL_RGB_INTEGER_EXT:
- case GL_RGBA_INTEGER_EXT:
- case GL_BGR_INTEGER_EXT:
- case GL_BGRA_INTEGER_EXT:
- case GL_LUMINANCE_INTEGER_EXT:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- case GL_RG_INTEGER:
/* specific integer formats */
case GL_RGBA32UI_EXT:
case GL_RGB32UI_EXT:
@@ -393,6 +382,34 @@ _mesa_is_enum_format_integer(GLenum format)
case GL_INTENSITY8UI_EXT:
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT:
+ case GL_RGB10_A2UI:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given format is an integer (non-normalized) format.
+ */
+GLboolean
+_mesa_is_enum_format_signed_int(GLenum format)
+{
+ switch (format) {
+ /* generic integer formats */
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ case GL_RG_INTEGER:
+ /* specific integer formats */
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
case GL_RG32I:
@@ -417,7 +434,6 @@ _mesa_is_enum_format_integer(GLenum format)
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
- case GL_RGB10_A2UI:
return GL_TRUE;
default:
return GL_FALSE;
@@ -426,6 +442,17 @@ _mesa_is_enum_format_integer(GLenum format)
/**
+ * Test if the given format is an integer (non-normalized) format.
+ */
+GLboolean
+_mesa_is_enum_format_integer(GLenum format)
+{
+ return _mesa_is_enum_format_unsigned_int(format) ||
+ _mesa_is_enum_format_signed_int(format);
+}
+
+
+/**
* Test if the given type is an integer (non-normalized) format.
*/
GLboolean
@@ -1032,6 +1059,32 @@ _mesa_base_format_has_channel(GLenum base_format, GLenum pname)
/**
+ * Returns the number of channels/components for a base format.
+ */
+GLint
+_mesa_base_format_component_count(GLenum base_format)
+{
+ switch (base_format) {
+ case GL_RED:
+ case GL_ALPHA:
+ case GL_INTENSITY:
+ case GL_DEPTH_COMPONENT:
+ return 1;
+ case GL_RG:
+ case GL_LUMINANCE_ALPHA:
+ case GL_DEPTH_STENCIL:
+ return 2;
+ case GL_RGB:
+ return 3;
+ case GL_RGBA:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+
+/**
* If format is a generic compressed format, return the corresponding
* non-compressed format. For other formats, return the format as-is.
*/