summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2008-07-02 20:20:33 +0200
committerRoland Scheidegger <[email protected]>2008-07-02 20:21:06 +0200
commit5ef4e4ffb8053db87f52df3c9b2ddb71d9c7d6e5 (patch)
tree0ede7c8b1c6e98a20205109a888352255db46cbc /src
parent6befdca6a3d65d7e49c0c54a7a8f091cd05034ea (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')
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c2
-rw-r--r--src/mesa/main/buffers.c2
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/state.c17
-rw-r--r--src/mesa/swrast/s_points.c2
5 files changed, 21 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 8f74f9d785e..69ff6d573e2 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -373,7 +373,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/buffers.c b/src/mesa/main/buffers.c
index b08095465d8..5ab969e0ebb 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -829,7 +829,7 @@ _mesa_init_scissor(GLcontext *ctx)
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/mtypes.h b/src/mesa/main/mtypes.h
index 04da767ec91..9339146e25c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -958,6 +958,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/state.c b/src/mesa/main/state.c
index 1c73c5c462b..7192bed4a3d 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1061,6 +1061,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
@@ -1223,6 +1237,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/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 350a0682d69..1a8fd7d6db2 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -263,7 +263,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
size = get_size(ctx, vert, GL_TRUE);
/* alpha attenuation / fade factor */
- if (ctx->Multisample.Enabled) {
+ if (ctx->Multisample._Enabled) {
if (vert->pointSize >= ctx->Point.Threshold) {
alphaAtten = 1.0F;
}