From 753635f733c5548ac8e662e792f65d41b454052a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 16 Sep 2008 08:51:28 -0600 Subject: gallium: move _vbo_DestroyContext() call Call it before freeing core Mesa state to avoid references to freed buffer objects. --- src/mesa/state_tracker/st_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/state_tracker/st_context.c') diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 08d4db7f7f..534c7c12ac 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -188,8 +188,6 @@ static void st_destroy_context_priv( struct st_context *st ) st_destroy_drawtex(st); #endif - _vbo_DestroyContext(st->ctx); - for (i = 0; i < Elements(st->state.sampler_texture); i++) { pipe_texture_reference(&st->state.sampler_texture[i], NULL); } @@ -223,6 +221,8 @@ void st_destroy_context( struct st_context *st ) _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); + _vbo_DestroyContext(st->ctx); + _mesa_free_context_data(ctx); st_destroy_context_priv(st); -- cgit v1.2.3 From 1a820f52f6fa125786538c1adf2aa350e66b8c1e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Sep 2008 14:32:33 -0600 Subject: gallium: clean-up/fix msaa override in state tracker --- src/mesa/state_tracker/st_atom_rasterizer.c | 2 +- src/mesa/state_tracker/st_context.c | 15 +++++++++++++++ src/mesa/state_tracker/st_context.h | 6 ++++++ src/mesa/state_tracker/st_framebuffer.c | 11 +++++------ 4 files changed, 27 insertions(+), 7 deletions(-) (limited to 'src/mesa/state_tracker/st_context.c') diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index e286dc5116..fc47896c24 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -254,7 +254,7 @@ static void update_raster_state( struct st_context *st ) raster->line_stipple_factor = ctx->Line.StippleFactor - 1; /* _NEW_MULTISAMPLE */ - if (ctx->Multisample._Enabled) + if (ctx->Multisample._Enabled || st->force_msaa) raster->multisample = 1; /* _NEW_SCISSOR */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 534c7c12ac..cca808d328 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -88,6 +88,19 @@ void st_invalidate_state(GLcontext * ctx, GLuint new_state) } +/** + * Check for multisample env var override. + */ +int +st_get_msaa(void) +{ + const char *msaa = _mesa_getenv("__GL_FSAA_MODE"); + if (msaa) + return atoi(msaa); + return 0; +} + + static struct st_context * st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) { @@ -141,6 +154,8 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) st->pixel_xfer.cache = _mesa_new_program_cache(); + st->force_msaa = st_get_msaa(); + /* GL limits and extensions */ st_init_limits(st); st_init_extensions(st); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 4314d9af5c..1d1aca3111 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -181,6 +181,8 @@ struct st_context struct blit_state *blit; struct cso_context *cso_context; + + int force_msaa; }; @@ -238,4 +240,8 @@ st_fb_orientation(const struct gl_framebuffer *fb) } +extern int +st_get_msaa(void); + + #endif diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 0f4a03fa48..ec8928f200 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -51,13 +51,12 @@ st_create_framebuffer( const __GLcontextModes *visual, { struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); if (stfb) { - int samples = 0; - const char *msaa_override = _mesa_getenv("__GL_FSAA_MODE"); + int samples = st_get_msaa(); + + if (visual->sampleBuffers) + samples = visual->samples; + _mesa_initialize_framebuffer(&stfb->Base, visual); - if (visual->sampleBuffers) samples = visual->samples; - if (msaa_override) { - samples = _mesa_atoi(msaa_override); - } { /* fake frontbuffer */ -- cgit v1.2.3