diff options
author | marha <marha@users.sourceforge.net> | 2012-12-17 11:51:13 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-12-17 11:51:13 +0100 |
commit | 840c8745518b92303d40f6834e9c616587242231 (patch) | |
tree | 097a30453fb59b6a88708c3f576e824e8f237c52 /mesalib/src/mesa/main/glformats.c | |
parent | b395c3c85251d4e8761704d8e3a3c9f9fa5b45cc (diff) | |
download | vcxsrv-840c8745518b92303d40f6834e9c616587242231.tar.gz vcxsrv-840c8745518b92303d40f6834e9c616587242231.tar.bz2 vcxsrv-840c8745518b92303d40f6834e9c616587242231.zip |
libXft pixman mesa git update 17 dec 2012
libXft: 835cd2a6cb4aa8f89e6e7dead66483643a6e7ee8
pixman: 526dc06e5694172abf979c03a5cf530207fe2d27
mesa: 1358f3a905448f6fb546aba951e317f743a83c76
Diffstat (limited to 'mesalib/src/mesa/main/glformats.c')
-rw-r--r-- | mesalib/src/mesa/main/glformats.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index fefa9c441..f33a0503d 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -308,6 +308,48 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type) /** + * Get the number of bytes for a vertex attrib with the given number of + * components and type. + * + * \param comps number of components. + * \param type data type. + * + * \return bytes per attribute, or -1 if a bad comps/type combination was given. + */ +GLint +_mesa_bytes_per_vertex_attrib(GLint comps, GLenum type) +{ + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + return comps * sizeof(GLubyte); + case GL_SHORT: + case GL_UNSIGNED_SHORT: + return comps * sizeof(GLshort); + case GL_INT: + case GL_UNSIGNED_INT: + return comps * sizeof(GLint); + case GL_FLOAT: + return comps * sizeof(GLfloat); + case GL_HALF_FLOAT_ARB: + return comps * sizeof(GLhalfARB); + case GL_DOUBLE: + return comps * sizeof(GLdouble); + case GL_FIXED: + return comps * sizeof(GLfixed); + case GL_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_2_10_10_10_REV: + if (comps == 4) + return sizeof(GLuint); + else + return -1; + default: + return -1; + } +} + + +/** * Test if the given format is an integer (non-normalized) format. */ GLboolean |