summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-09-17 14:32:33 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-09-17 14:32:33 -0600
commit1a820f52f6fa125786538c1adf2aa350e66b8c1e (patch)
tree229a922b489441efe0390b5002fa5979842fb345
parente6a120fefea44078b3a8d4292d83671e6c41357f (diff)
gallium: clean-up/fix msaa override in state tracker
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c2
-rw-r--r--src/mesa/state_tracker/st_context.c15
-rw-r--r--src/mesa/state_tracker/st_context.h6
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c11
4 files changed, 27 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index e286dc511..fc47896c2 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 534c7c12a..cca808d32 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 4314d9af5..1d1aca311 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 0f4a03fa4..ec8928f20 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 */