From 2a1abdc8fe640583dac90dc316caf2d40b9ee4e2 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 14 Jan 2013 15:13:52 +0100 Subject: 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 --- mesalib/src/mesa/main/glformats.c | 83 ++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 15 deletions(-) (limited to 'mesalib/src/mesa/main/glformats.c') 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; @@ -425,6 +441,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. */ @@ -1031,6 +1058,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. -- cgit v1.2.3