mesa: Make FEATURE_EXT_transform_feedback more modular.
authorChia-I Wu <olv@lunarg.com>
Tue, 11 May 2010 05:20:40 +0000 (13:20 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 12 May 2010 04:12:56 +0000 (12:12 +0800)
This allows transformfeedback.h and st_cb_xformfb.h to be included and
used without knowing if FEATURE_EXT_transform_feedback is enabled.  Fix
build of ES overlay.

src/mesa/main/api_exec.c
src/mesa/main/transformfeedback.c
src/mesa/main/transformfeedback.h
src/mesa/state_tracker/st_cb_xformfb.c
src/mesa/state_tracker/st_cb_xformfb.h
src/mesa/state_tracker/st_context.c

index f838561..8fa8887 100644 (file)
@@ -523,15 +523,7 @@ _mesa_create_exec_table(void)
    SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
 
    /* 352. GL_EXT_transform_feedback */
-#if _HAVE_FULL_GL
-   SET_BeginTransformFeedbackEXT(exec, _mesa_BeginTransformFeedback);
-   SET_EndTransformFeedbackEXT(exec, _mesa_EndTransformFeedback);
-   SET_BindBufferRangeEXT(exec, _mesa_BindBufferRange);
-   SET_BindBufferBaseEXT(exec, _mesa_BindBufferBase);
-   SET_BindBufferOffsetEXT(exec, _mesa_BindBufferOffsetEXT);
-   SET_TransformFeedbackVaryingsEXT(exec, _mesa_TransformFeedbackVaryings);
-   SET_GetTransformFeedbackVaryingEXT(exec, _mesa_GetTransformFeedbackVarying);
-#endif
+   _mesa_init_transform_feedback_dispatch(exec);
 
    /* 364. GL_EXT_provoking_vertex */
    SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
index 06a1281..cd3dd9b 100644 (file)
 #include "context.h"
 #include "hash.h"
 #include "transformfeedback.h"
+#include "main/dispatch.h"
 
 #include "shader/prog_parameter.h"
 #include "shader/shader_api.h"
 
 
+#if FEATURE_EXT_transform_feedback
+
+
 /**
  * Do reference counting of transform feedback buffers.
  */
@@ -281,6 +285,18 @@ _mesa_init_transform_feedback_functions(struct dd_function_table *driver)
 }
 
 
+void
+_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp)
+{
+   SET_BeginTransformFeedbackEXT(disp, _mesa_BeginTransformFeedback);
+   SET_EndTransformFeedbackEXT(disp, _mesa_EndTransformFeedback);
+   SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
+   SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
+   SET_BindBufferOffsetEXT(disp, _mesa_BindBufferOffsetEXT);
+   SET_TransformFeedbackVaryingsEXT(disp, _mesa_TransformFeedbackVaryings);
+   SET_GetTransformFeedbackVaryingEXT(disp, _mesa_GetTransformFeedbackVarying);
+}
+
 
 /**
  ** Begin API functions
@@ -879,3 +895,6 @@ GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED
 GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE
 GL_TRANSFORM_FEEDBACK_BINDING
 */
+
+
+#endif /* FEATURE_EXT_transform_feedback */
index 99f75ee..b806488 100644 (file)
 #ifndef TRANSFORM_FEEDBACK_H
 #define TRANSFORM_FEEDBACK_H
 
-#include "glheader.h"
+#include "main/mtypes.h"
 
 
+#if FEATURE_EXT_transform_feedback
+
 extern GLboolean
 _mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode);
 
@@ -44,6 +46,9 @@ _mesa_free_transform_feedback(GLcontext *ctx);
 extern void
 _mesa_init_transform_feedback_functions(struct dd_function_table *driver);
 
+extern void
+_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp);
+
 
 /*** GL_EXT_transform_feedback ***/
 
@@ -98,5 +103,40 @@ _mesa_ResumeTransformFeedback(void);
 extern void GLAPIENTRY
 _mesa_DrawTransformFeedback(GLenum mode, GLuint name);
 
+#else /* FEATURE_EXT_transform_feedback */
+
+static INLINE GLboolean
+_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode)
+{
+   return GL_TRUE;
+}
+
+static INLINE GLboolean
+_mesa_validate_transform_feedback_buffers(GLcontext *ctx)
+{
+   return GL_TRUE;
+}
+
+static INLINE void
+_mesa_init_transform_feedback(GLcontext *ctx)
+{
+}
+
+static INLINE void
+_mesa_free_transform_feedback(GLcontext *ctx)
+{
+}
+
+static INLINE void
+_mesa_init_transform_feedback_functions(struct dd_function_table *driver)
+{
+}
+
+static INLINE void
+_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_EXT_transform_feedback */
 
 #endif /* TRANSFORM_FEEDBACK_H */
index fb48b57..749e88e 100644 (file)
@@ -40,6 +40,8 @@
 #include "st_cb_xformfb.h"
 
 
+#if FEATURE_EXT_transform_feedback
+
 #if 0
 static struct gl_transform_feedback_object *
 st_new_transform_feedback(GLcontext *ctx, GLuint name)
@@ -127,3 +129,5 @@ st_init_xformfb_functions(struct dd_function_table *functions)
    functions->ResumeTransformFeedback = st_resume_transform_feedback;
    functions->DrawTransformFeedback = st_draw_transform_feedback;
 }
+
+#endif /* FEATURE_EXT_transform_feedback */
index d6c354e..50efcb9 100644 (file)
 #define ST_CB_XFORMFB_H
 
 
+#if FEATURE_EXT_transform_feedback
+
 extern void
 st_init_xformfb_functions(struct dd_function_table *functions);
 
+#else
+
+static INLINE void
+st_init_xformfb_functions(struct dd_function_table *functions)
+{
+}
+
+#endif /* FEATURE_EXT_transform_feedback */
 
 #endif /* ST_CB_XFORMFB_H */
index 9340614..806f877 100644 (file)
@@ -54,9 +54,7 @@
 #include "st_cb_queryobj.h"
 #include "st_cb_readpixels.h"
 #include "st_cb_texture.h"
-#if FEATURE_EXT_transform_feedback
 #include "st_cb_xformfb.h"
-#endif
 #include "st_cb_flush.h"
 #include "st_cb_strings.h"
 #include "st_atom.h"
@@ -338,9 +336,7 @@ void st_init_driver_functions(struct dd_function_table *functions)
    st_init_flush_functions(functions);
    st_init_string_functions(functions);
 
-#if FEATURE_EXT_transform_feedback
    st_init_xformfb_functions(functions);
-#endif
 
    functions->UpdateState = st_invalidate_state;
 }