summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-07 18:20:10 +0800
committerBrian Paul <brianp@vmware.com>2009-09-30 08:31:55 -0600
commit2b36db496d34c60a3f987fa88d52bf5684713240 (patch)
tree81ff6b06ceda9744b7959a907be75bac616067a0 /src/mesa
parenta833ff0f53da6e365d917bb0081d909a809b6ec1 (diff)
mesa/main: Make FEATURE_attrib_stack follow feature conventions.
As shown in mfeatures.h, this allows users of attrib.h to work without knowing if the feature is available.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/api_exec.c11
-rw-r--r--src/mesa/main/attrib.c17
-rw-r--r--src/mesa/main/attrib.h38
-rw-r--r--src/mesa/main/context.c6
4 files changed, 47 insertions, 25 deletions
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 9ffac7905a..b363d4340e 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -39,9 +39,7 @@
#if FEATURE_ATI_fragment_shader
#include "shader/atifragshader.h"
#endif
-#if FEATURE_attrib_stack
#include "attrib.h"
-#endif
#include "blend.h"
#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
@@ -283,12 +281,9 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_PolygonMode(exec, _mesa_PolygonMode);
SET_PolygonOffset(exec, _mesa_PolygonOffset);
SET_PolygonStipple(exec, _mesa_PolygonStipple);
-#if FEATURE_attrib_stack
- SET_PopAttrib(exec, _mesa_PopAttrib);
- SET_PushAttrib(exec, _mesa_PushAttrib);
- SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
- SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
-#endif
+
+ _mesa_init_attrib_dispatch(exec);
+
#if FEATURE_drawpix
SET_RasterPos2f(exec, _mesa_RasterPos2f);
SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 0fb8fa3bba..246c5521b7 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -57,6 +57,7 @@
#include "varray.h"
#include "viewport.h"
#include "mtypes.h"
+#include "glapi/dispatch.h"
/**
@@ -174,6 +175,9 @@ struct texture_state
};
+#if FEATURE_attrib_stack
+
+
/**
* Allocate new attribute node of given type/kind. Attach payload data.
* Insert it into the linked list named by 'head'.
@@ -1464,6 +1468,19 @@ _mesa_PopClientAttrib(void)
}
+void
+_mesa_init_attrib_dispatch(struct _glapi_table *disp)
+{
+ SET_PopAttrib(disp, _mesa_PopAttrib);
+ SET_PushAttrib(disp, _mesa_PushAttrib);
+ SET_PopClientAttrib(disp, _mesa_PopClientAttrib);
+ SET_PushClientAttrib(disp, _mesa_PushClientAttrib);
+}
+
+
+#endif /* FEATURE_attrib_stack */
+
+
/**
* Free any attribute state data that might be attached to the context.
*/
diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h
index 2cf8fe6934..6b48a17663 100644
--- a/src/mesa/main/attrib.h
+++ b/src/mesa/main/attrib.h
@@ -26,10 +26,10 @@
#define ATTRIB_H
-#include "mtypes.h"
+#include "main/mtypes.h"
-#if _HAVE_FULL_GL
+#if FEATURE_attrib_stack
extern void GLAPIENTRY
_mesa_PushAttrib( GLbitfield mask );
@@ -43,18 +43,34 @@ _mesa_PushClientAttrib( GLbitfield mask );
extern void GLAPIENTRY
_mesa_PopClientAttrib( void );
+extern void
+_mesa_init_attrib_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_attrib_stack */
+
+static INLINE void
+_mesa_PushClientAttrib( GLbitfield mask )
+{
+ ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_PopClientAttrib( void )
+{
+ ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_init_attrib_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_attrib_stack */
+
extern void
_mesa_init_attrib( GLcontext *ctx );
extern void
_mesa_free_attrib_data( GLcontext *ctx );
-#else
-
-/** No-op */
-#define _mesa_init_attrib( c ) ((void)0)
-#define _mesa_free_attrib_data( c ) ((void)0)
-
-#endif
-
-#endif
+#endif /* ATTRIB_H */
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index df194c3edb..53a21ba4f5 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -82,9 +82,7 @@
#include "accum.h"
#include "api_exec.h"
#include "arrayobj.h"
-#if FEATURE_attrib_stack
#include "attrib.h"
-#endif
#include "blend.h"
#include "buffers.h"
#include "bufferobj.h"
@@ -675,9 +673,7 @@ init_attrib_groups(GLcontext *ctx)
/* Attribute Groups */
_mesa_init_accum( ctx );
-#if FEATURE_attrib_stack
_mesa_init_attrib( ctx );
-#endif
_mesa_init_buffer_objects( ctx );
_mesa_init_color( ctx );
_mesa_init_colortables( ctx );
@@ -997,9 +993,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
-#if FEATURE_attrib_stack
_mesa_free_attrib_data(ctx);
-#endif
_mesa_free_lighting_data( ctx );
#if FEATURE_evaluators
_mesa_free_eval_data( ctx );