summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@tungstengraphics.com>2008-07-02 20:08:27 +0200
committerRoland Scheidegger <sroland@tungstengraphics.com>2008-07-02 20:22:08 +0200
commit489fc4d10a57538de59a89e19ce752e4b7253d22 (patch)
treeacd00293c4e71f1e49da222dc840b4bbb2086f93 /src/mesa
parentcc31eecbcb90dabacabac3e6be7c01cfe3a7a2a6 (diff)
mesa: fix issues around multisample enable
multisample enable is enabled by default, however gl mandates multisample rendering rules only apply if there's also a multisampled buffer.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c2
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/multisample.c2
-rw-r--r--src/mesa/main/state.c17
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c2
-rw-r--r--src/mesa/swrast/s_points.c2
6 files changed, 22 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index eee1e803a0..c809679e6c 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -359,7 +359,7 @@ static int r300Fallback(GLcontext * ctx)
if (!r300->disable_lowimpact_fallback) {
FALLBACK_IF(ctx->Polygon.StippleFlag);
- FALLBACK_IF(ctx->Multisample.Enabled);
+ FALLBACK_IF(ctx->Multisample._Enabled);
FALLBACK_IF(ctx->Line.StippleFlag);
FALLBACK_IF(ctx->Line.SmoothFlag);
FALLBACK_IF(ctx->Point.SmoothFlag);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0a065541e1..00e7d5d395 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -961,6 +961,7 @@ struct gl_list_extensions
struct gl_multisample_attrib
{
GLboolean Enabled;
+ GLboolean _Enabled; /**< true if Enabled and multisample buffer */
GLboolean SampleAlphaToCoverage;
GLboolean SampleAlphaToOne;
GLboolean SampleCoverage;
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index e138087436..b9cfad9216 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -57,7 +57,7 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
void
_mesa_init_multisample(GLcontext *ctx)
{
- ctx->Multisample.Enabled = GL_FALSE;
+ ctx->Multisample.Enabled = GL_TRUE;
ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
ctx->Multisample.SampleAlphaToOne = GL_FALSE;
ctx->Multisample.SampleCoverage = GL_FALSE;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 315253d90a..344af91e17 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -289,6 +289,20 @@ update_viewport_matrix(GLcontext *ctx)
/**
+ * Update derived multisample state.
+ */
+static void
+update_multisample(GLcontext *ctx)
+{
+ ctx->Multisample._Enabled = GL_FALSE;
+ if (ctx->DrawBuffer) {
+ if (ctx->DrawBuffer->Visual.sampleBuffers)
+ ctx->Multisample._Enabled = GL_TRUE;
+ }
+}
+
+
+/**
* Update derived color/blend/logicop state.
*/
static void
@@ -425,6 +439,9 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
update_viewport_matrix(ctx);
+ if (new_state & _NEW_MULTISAMPLE)
+ update_multisample( ctx );
+
if (new_state & _NEW_COLOR)
update_color( ctx );
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 87a91d56d0..ff40bb4312 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)
raster->multisample = 1;
/* _NEW_SCISSOR */
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index c0f32e9c91..f4b3650210 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -250,7 +250,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA);
/* alpha attenuation / fade factor */
- if (ctx->Multisample.Enabled) {
+ if (ctx->Multisample._Enabled) {
if (vert->pointSize >= ctx->Point.Threshold) {
alphaAtten = 1.0F;
}