aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo/vbo_context.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/vbo/vbo_context.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/vbo/vbo_context.h')
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h
index c896f1196..1ff6ec000 100644
--- a/mesalib/src/mesa/vbo/vbo_context.h
+++ b/mesalib/src/mesa/vbo/vbo_context.h
@@ -147,4 +147,47 @@ vbo_draw_method(struct vbo_context *vbo, enum draw_method method)
}
}
+/**
+ * Return if format is integer. The immediate mode commands only emit floats
+ * for non-integer types, thus everything else is integer.
+ */
+static inline GLboolean
+vbo_attrtype_to_integer_flag(GLenum format)
+{
+ switch (format) {
+ case GL_FLOAT:
+ return GL_FALSE;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ return GL_TRUE;
+ default:
+ ASSERT(0);
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Return default component values for the given format.
+ * The return type is an array of floats, because that's how we declare
+ * the vertex storage despite the fact we sometimes store integers in there.
+ */
+static inline const GLfloat *
+vbo_get_default_vals_as_float(GLenum format)
+{
+ static const GLfloat default_float[4] = { 0, 0, 0, 1 };
+ static const GLint default_int[4] = { 0, 0, 0, 1 };
+
+ switch (format) {
+ case GL_FLOAT:
+ return default_float;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ return (const GLfloat*)default_int;
+ default:
+ ASSERT(0);
+ return NULL;
+ }
+}
+
#endif