aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/macros.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-07 07:53:41 +0100
committermarha <marha@users.sourceforge.net>2012-11-07 07:53:41 +0100
commit1738a6973deb03f33a71c9527594727cb8bb64b4 (patch)
tree813603d381b5536ef7a1e2ffd3a137c4bc0623f7 /mesalib/src/mesa/main/macros.h
parent1cc98f5a48924d750fbef7ea6b05a1ba49c28589 (diff)
downloadvcxsrv-1738a6973deb03f33a71c9527594727cb8bb64b4.tar.gz
vcxsrv-1738a6973deb03f33a71c9527594727cb8bb64b4.tar.bz2
vcxsrv-1738a6973deb03f33a71c9527594727cb8bb64b4.zip
xserver mesa xkbcomp git update 7 nov 2012
xserver: 011f8458805e443ac9130865d2840a929a00cabf xkbcomp: bd1103ef3cfef9cfed645566f944a69e7ca568b4 mesa: f42518962a08ce927e4ddd233d19d2661e135834
Diffstat (limited to 'mesalib/src/mesa/main/macros.h')
-rw-r--r--mesalib/src/mesa/main/macros.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index 7b7fd1b6d..14a5d5fe1 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -171,6 +171,20 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
#endif
+static inline GLfloat INT_AS_FLT(GLint i)
+{
+ fi_type tmp;
+ tmp.i = i;
+ return tmp.f;
+}
+
+static inline GLfloat UINT_AS_FLT(GLuint u)
+{
+ fi_type tmp;
+ tmp.u = u;
+ return tmp.f;
+}
+
/*@}*/
@@ -573,6 +587,31 @@ do { \
/*@}*/
+/** Copy \p sz elements into a homegeneous (4-element) vector, giving
+ * default values to the remaining components.
+ * The default values are chosen based on \p type.
+ */
+static inline void
+COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4],
+ GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ ASSIGN_4V(dst, 0, 0, 0, 1);
+ break;
+ case GL_INT:
+ ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
+ INT_AS_FLT(0), INT_AS_FLT(1));
+ break;
+ case GL_UNSIGNED_INT:
+ ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
+ UINT_AS_FLT(0), UINT_AS_FLT(1));
+ break;
+ default:
+ ASSERT(0);
+ }
+ COPY_SZ_4V(dst, sz, src);
+}
/** \name Linear interpolation functions */
/*@{*/