summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arrayobj.h
diff options
context:
space:
mode:
authorMathias Froehlich <Mathias.Froehlich@web.de>2011-12-29 13:10:00 +0100
committerMathias Fröhlich <Mathias.Froehlich@gmx.net>2012-01-20 07:24:11 +0100
commit2a207c4bf95312b68093280b97229cc4316f5724 (patch)
treefd7fc910c9e3393ad3675d68c9391a633d390048 /src/mesa/main/arrayobj.h
parentf60e892c5017f66282080983da87f638d13917c5 (diff)
downloadexternal_mesa3d-2a207c4bf95312b68093280b97229cc4316f5724.zip
external_mesa3d-2a207c4bf95312b68093280b97229cc4316f5724.tar.gz
external_mesa3d-2a207c4bf95312b68093280b97229cc4316f5724.tar.bz2
mesa: Introduce enabled bitfield helper functions.
Depending on the installed shader type, different arrays are used from gl_array_object. Provide helper functions that compute the bitmask of these arrays that are finally enabled for a given shader type. The will be used in a followup change. Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/arrayobj.h')
-rw-r--r--src/mesa/main/arrayobj.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 0b5a013..717c791 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -29,6 +29,7 @@
#define ARRAYOBJ_H
#include "glheader.h"
+#include "mtypes.h"
struct gl_context;
@@ -64,6 +65,42 @@ extern void
_mesa_update_array_object_max_element(struct gl_context *ctx,
struct gl_array_object *arrayObj);
+/** Returns the bitmask of all enabled arrays in fixed function mode.
+ *
+ * In fixed function mode only the traditional fixed function arrays
+ * are available.
+ */
+static inline GLbitfield64
+_mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj)
+{
+ return arrayObj->_Enabled & VERT_BIT_FF_ALL;
+}
+
+/** Returns the bitmask of all enabled arrays in nv shader mode.
+ *
+ * In nv shader mode, the nv generic arrays take precedence over
+ * the legacy arrays.
+ */
+static inline GLbitfield64
+_mesa_array_object_get_enabled_nv(const struct gl_array_object *arrayObj)
+{
+ GLbitfield64 enabled = arrayObj->_Enabled;
+ return enabled & ~(VERT_BIT_FF_NVALIAS & (enabled >> VERT_ATTRIB_GENERIC0));
+}
+
+/** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
+ *
+ * In arb/glsl shader mode all the fixed function and the arb/glsl generic
+ * arrays are available. Only the first generic array takes
+ * precedence over the legacy position array.
+ */
+static inline GLbitfield64
+_mesa_array_object_get_enabled_arb(const struct gl_array_object *arrayObj)
+{
+ GLbitfield64 enabled = arrayObj->_Enabled;
+ return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0));
+}
+
/*
* API functions