Mesa (master): mesa: Convert RENDERINPUTS* macros to GLbitfield64.
Mathias Fröhlich
frohlich at kemper.freedesktop.org
Wed Dec 28 10:07:00 UTC 2011
Module: Mesa
Branch: master
Commit: 50e0091a9d70f9e6383ad322d4df7576bd7c38f7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=50e0091a9d70f9e6383ad322d4df7576bd7c38f7
Author: Mathias Fröhlich <Mathias.Froehlich at web.de>
Date: Thu Dec 22 20:12:20 2011 +0100
mesa: Convert RENDERINPUTS* macros to GLbitfield64.
Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
Reviewed-by: Brian Paul <brianp at vmare.com>
---
src/mesa/main/mtypes.h | 6 ++++++
src/mesa/tnl/t_context.h | 26 ++++++++++++++------------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7068d5a..107371e 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -56,6 +56,12 @@ typedef GLuint64 GLbitfield64;
/** Set a single bit */
#define BITFIELD64_BIT(b) ((GLbitfield64)1 << (b))
+/** Set all bits up to excluding bit b */
+#define BITFIELD64_MASK(b) \
+ ((b) == 64 ? (~(GLbitfield64)0) : BITFIELD64_BIT(b) - 1)
+/** Set count bits starting from bit b */
+#define BITFIELD64_RANGE(b, count) \
+ (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
/**
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 36b1043..3b7d446 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -50,7 +50,7 @@
#define _T_CONTEXT_H
#include "main/glheader.h"
-#include "main/bitset.h"
+#include "main/imports.h"
#include "main/mtypes.h"
#include "math/m_vector.h"
@@ -162,6 +162,9 @@ enum {
#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC0 */
#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES /* GENERIC11 */
+/* Number of available texture attributes */
+#define _TNL_NUM_TEX 8
+
/* Number of available generic attributes */
#define _TNL_NUM_GENERIC 16
@@ -480,17 +483,16 @@ struct tnl_device_driver
};
-#define DECLARE_RENDERINPUTS(name) BITSET64_DECLARE(name, _TNL_ATTRIB_MAX)
-#define RENDERINPUTS_COPY BITSET64_COPY
-#define RENDERINPUTS_EQUAL BITSET64_EQUAL
-#define RENDERINPUTS_ZERO BITSET64_ZERO
-#define RENDERINPUTS_ONES BITSET64_ONES
-#define RENDERINPUTS_TEST BITSET64_TEST
-#define RENDERINPUTS_SET BITSET64_SET
-#define RENDERINPUTS_CLEAR BITSET64_CLEAR
-#define RENDERINPUTS_TEST_RANGE BITSET64_TEST_RANGE
-#define RENDERINPUTS_SET_RANGE BITSET64_SET_RANGE
-#define RENDERINPUTS_CLEAR_RANGE BITSET64_CLEAR_RANGE
+#define DECLARE_RENDERINPUTS(name) GLbitfield64 name
+#define RENDERINPUTS_COPY(x, y) do { (x) = (y); } while (0)
+#define RENDERINPUTS_EQUAL(x, y) ((x) == (y))
+#define RENDERINPUTS_ZERO(x) do { (x) = 0; } while (0)
+#define RENDERINPUTS_ONES(x) do { (x) = ~(GLbitfield64)0; } while (0)
+#define RENDERINPUTS_TEST(x, b) (((x) & BITFIELD64_BIT(b)) != 0)
+#define RENDERINPUTS_SET(x, b) ((x) |= BITFIELD64_BIT(b))
+#define RENDERINPUTS_CLEAR(x, b) ((x) &= ~BITFIELD64_BIT(b))
+#define RENDERINPUTS_TEST_RANGE(x, b, e) \
+ (((x) & BITFIELD64_RANGE((b), (e) - (b) + 1)) != 0)
/**
More information about the mesa-commit
mailing list