st/mesa: Make FEATURE_feedback and FEATURE_rastpos more modular.
authorChia-I Wu <olv@lunarg.com>
Wed, 31 Mar 2010 04:01:16 +0000 (12:01 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 12 May 2010 04:12:57 +0000 (12:12 +0800)
Make st_cb_feedback.h FEATURE_feedback aware and st_cb_rastpos.h
FEATURE_rastpos aware.  Move creation of selection/feedback draw context
to st_init_draw.

src/mesa/state_tracker/st_cb_feedback.c
src/mesa/state_tracker/st_cb_feedback.h
src/mesa/state_tracker/st_cb_rasterpos.c
src/mesa/state_tracker/st_cb_rasterpos.h
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_draw.c

index c85d3da84a294e4e98ea4b9342089f43de86e59a..e57730b5ecdc632000973bf27447fd3e99529c11 100644 (file)
@@ -54,6 +54,8 @@
 #include "draw/draw_pipe.h"
 
 
+#if FEATURE_feedback
+
 /**
  * This is actually used for both feedback and selection.
  */
@@ -302,3 +304,5 @@ void st_init_feedback_functions(struct dd_function_table *functions)
 {
    functions->RenderMode = st_RenderMode;
 }
+
+#endif /* FEATURE_feedback */
index 2559ba3817bc819ca6109a328055a379eb0494c2..706d84960f7bd75d7789d7319b495fea8ac716ab 100644 (file)
 #define ST_CB_FEEDBACK_H
 
 
+#include "main/mtypes.h"
+
+#if FEATURE_feedback
+
 extern void
 st_init_feedback_functions(struct dd_function_table *functions);
 
+#else
+
+static INLINE void
+st_init_feedback_functions(struct dd_function_table *functions)
+{
+}
+
+#endif /* FEATURE_feedback */
 
 #endif /* ST_CB_FEEDBACK_H */
index 843f3200278d3f79a9bdc76d669451c6e69ac5dd..7b2eb8012de405b04f154ab63daffe8c5c4b8c7c 100644 (file)
@@ -50,6 +50,7 @@
 #include "vbo/vbo.h"
 
 
+#if FEATURE_rastpos
 
 /**
  * Our special drawing pipeline stage (replaces rasterization).
@@ -267,3 +268,5 @@ void st_init_rasterpos_functions(struct dd_function_table *functions)
 {
    functions->RasterPos = st_RasterPos;
 }
+
+#endif /* FEATURE_rastpos */
index 2b992e1405ec99b1285a1f2bb01600a101e2500d..d2ed7297f152d2074364d6e0d86a56dc434a7624 100644 (file)
 #ifndef ST_CB_RASTERPOS_H
 #define ST_CB_RASTERPOS_H
 
+
+#include "main/mtypes.h"
+
+#if FEATURE_rastpos
+
 extern void st_init_rasterpos_functions(struct dd_function_table *functions);
 
-#endif
+#else
+
+static INLINE void
+st_init_rasterpos_functions(struct dd_function_table *functions)
+{
+}
+
+#endif /* FEATURE_rastpos */
+
+#endif /* ST_CB_RASTERPOS_H */
index bab54811b4e0663cb349d6c4acabd55f08c53174..5c9462a399bcbe6a5ef2f9d1f99d88a08b69b162 100644 (file)
@@ -45,9 +45,7 @@
 #endif
 #include "st_cb_eglimage.h"
 #include "st_cb_fbo.h"
-#if FEATURE_feedback
 #include "st_cb_feedback.h"
-#endif
 #include "st_cb_program.h"
 #include "st_cb_queryobj.h"
 #include "st_cb_readpixels.h"
@@ -64,7 +62,6 @@
 #include "util/u_inlines.h"
 #include "util/u_rect.h"
 #include "util/u_surface.h"
-#include "draw/draw_context.h"
 #include "cso_cache/cso_context.h"
 
 
@@ -128,18 +125,6 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
    /* state tracker needs the VBO module */
    _vbo_CreateContext(ctx);
 
-#if FEATURE_feedback || FEATURE_rastpos
-   st->draw = draw_create(pipe); /* for selection/feedback */
-
-   /* Disable draw options that might convert points/lines to tris, etc.
-    * as that would foul-up feedback/selection mode.
-    */
-   draw_wide_line_threshold(st->draw, 1000.0f);
-   draw_wide_point_threshold(st->draw, 1000.0f);
-   draw_enable_line_stipple(st->draw, FALSE);
-   draw_enable_point_sprites(st->draw, FALSE);
-#endif
-
    st->dirty.mesa = ~0;
    st->dirty.st = ~0;
 
@@ -224,9 +209,6 @@ static void st_destroy_context_priv( struct st_context *st )
 {
    uint i;
 
-#if FEATURE_feedback || FEATURE_rastpos
-   draw_destroy(st->draw);
-#endif
    st_destroy_atoms( st );
    st_destroy_draw( st );
    st_destroy_generate_mipmap(st);
@@ -315,9 +297,7 @@ void st_init_driver_functions(struct dd_function_table *functions)
    st_init_eglimage_functions(functions);
 
    st_init_fbo_functions(functions);
-#if FEATURE_feedback
    st_init_feedback_functions(functions);
-#endif
    st_init_program_functions(functions);
 #if FEATURE_queryobj
    st_init_query_functions(functions);
index 4137596bd404eb209fd8e0067cf7ff7a6bdd944c..eb2e5b2bbf77334112082961517bf658edcd14b0 100644 (file)
@@ -57,6 +57,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
+#include "draw/draw_context.h"
 #include "cso_cache/cso_context.h"
 
 
@@ -741,11 +742,26 @@ void st_init_draw( struct st_context *st )
    GLcontext *ctx = st->ctx;
 
    vbo_set_draw_func(ctx, st_draw_vbo);
+
+#if FEATURE_feedback || FEATURE_rastpos
+   st->draw = draw_create(st->pipe); /* for selection/feedback */
+
+   /* Disable draw options that might convert points/lines to tris, etc.
+    * as that would foul-up feedback/selection mode.
+    */
+   draw_wide_line_threshold(st->draw, 1000.0f);
+   draw_wide_point_threshold(st->draw, 1000.0f);
+   draw_enable_line_stipple(st->draw, FALSE);
+   draw_enable_point_sprites(st->draw, FALSE);
+#endif
 }
 
 
 void st_destroy_draw( struct st_context *st )
 {
+#if FEATURE_feedback || FEATURE_rastpos
+   draw_destroy(st->draw);
+#endif
 }