diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-12-07 17:24:42 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-12-07 17:24:42 -0700 |
commit | c885775cae8feabe5431ba7867fac99332f5ee8e (patch) | |
tree | b866a831db8fe2bc51475592cb86d55a934767f5 /src | |
parent | 40e9c57d318c1d4a1e75fe0c88374182050d7f48 (diff) |
New vbo_set_draw_func() to keep vbo context opaque to state tracker and tnl module.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_cb_feedback.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 6 | ||||
-rw-r--r-- | src/mesa/tnl/t_context.c | 3 | ||||
-rw-r--r-- | src/mesa/vbo/vbo.h | 3 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 12 |
5 files changed, 22 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index a9fd2579a2..ea775b9452 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -43,7 +43,6 @@ #include "main/macros.h" #include "vbo/vbo.h" -#include "vbo/vbo_context.h" #include "st_context.h" #include "st_atom.h" @@ -281,26 +280,25 @@ static void st_RenderMode(GLcontext *ctx, GLenum newMode ) { struct st_context *st = ctx->st; - struct vbo_context *vbo = (struct vbo_context *) ctx->swtnl_im; struct draw_context *draw = st->draw; if (newMode == GL_RENDER) { /* restore normal VBO draw function */ - vbo->draw_prims = st_draw_vbo; + vbo_set_draw_func(ctx, st_draw_vbo); } else if (newMode == GL_SELECT) { if (!st->selection_stage) st->selection_stage = draw_glselect_stage(ctx, draw); draw_set_rasterize_stage(draw, st->selection_stage); /* Plug in new vbo draw function */ - vbo->draw_prims = st_feedback_draw_vbo; + vbo_set_draw_func(ctx, st_feedback_draw_vbo); } else { if (!st->feedback_stage) st->feedback_stage = draw_glfeedback_stage(ctx, draw); draw_set_rasterize_stage(draw, st->feedback_stage); /* Plug in new vbo draw function */ - vbo->draw_prims = st_feedback_draw_vbo; + vbo_set_draw_func(ctx, st_feedback_draw_vbo); /* need to generate/use a vertex program that emits pos/color/tex */ st->dirty.st |= ST_NEW_VERTEX_PROGRAM; } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index b4c0d0cdd6..32dcd73c46 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -34,7 +34,6 @@ #include "main/image.h" #include "vbo/vbo.h" -#include "vbo/vbo_context.h" #include "st_atom.h" #include "st_cache.h" @@ -519,14 +518,11 @@ st_feedback_draw_vbo(GLcontext *ctx, void st_init_draw( struct st_context *st ) { GLcontext *ctx = st->ctx; - struct vbo_context *vbo = (struct vbo_context *) ctx->swtnl_im; /* actually, not used here, but elsewhere */ create_default_attribs_buffer(st); - assert(vbo); - assert(vbo->draw_prims); - vbo->draw_prims = st_draw_vbo; + vbo_set_draw_func(ctx, st_draw_vbo); } diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index b87452d2eb..0ace5c2d6f 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -78,6 +78,9 @@ _tnl_CreateContext( GLcontext *ctx ) tnl->nr_blocks = 0; + /* plug in the VBO drawing function */ + vbo_set_draw_func(ctx, _tnl_draw_prims); + return GL_TRUE; } diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 4c51b44cda..79d33d09c1 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -117,4 +117,7 @@ void vbo_rebase_prims( GLcontext *ctx, void vbo_use_buffer_objects(GLcontext *ctx); +void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func); + + #endif diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index ad4556c500..60d0b76ab6 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -31,6 +31,7 @@ #include "vbo.h" #include "vbo_context.h" +#if 0 /* Reach out and grab this to use as the default: */ extern void _tnl_draw_prims( GLcontext *ctx, @@ -40,6 +41,7 @@ extern void _tnl_draw_prims( GLcontext *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index ); +#endif @@ -214,7 +216,9 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) /* By default: */ +#if 0 /* dead - see vbo_set_draw_func() */ vbo->draw_prims = _tnl_draw_prims; +#endif /* Hook our functions into exec and compile dispatch tables. These * will pretty much be permanently installed, which means that the @@ -245,3 +249,11 @@ void _vbo_DestroyContext( GLcontext *ctx ) FREE(vbo_context(ctx)); ctx->swtnl_im = NULL; } + + +void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func) +{ + struct vbo_context *vbo = vbo_context(ctx); + vbo->draw_prims = func; +} + |