From 50e0091a9d70f9e6383ad322d4df7576bd7c38f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathias=20Fr=C3=B6hlich?= Date: Thu, 22 Dec 2011 20:12:20 +0100 Subject: [PATCH] mesa: Convert RENDERINPUTS* macros to GLbitfield64. Signed-off-by: Mathias Froehlich Reviewed-by: Brian Paul --- 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 7068d5aff4d..107371e5299 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 36b10435441..3b7d4468055 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) /** -- 2.30.2