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.
This commit is contained in:
Roland Scheidegger
2008-07-02 20:08:27 +02:00
parent cc31eecbcb
commit 489fc4d10a
6 changed files with 22 additions and 4 deletions

View File

@@ -359,7 +359,7 @@ static int r300Fallback(GLcontext * ctx)
if (!r300->disable_lowimpact_fallback) { if (!r300->disable_lowimpact_fallback) {
FALLBACK_IF(ctx->Polygon.StippleFlag); FALLBACK_IF(ctx->Polygon.StippleFlag);
FALLBACK_IF(ctx->Multisample.Enabled); FALLBACK_IF(ctx->Multisample._Enabled);
FALLBACK_IF(ctx->Line.StippleFlag); FALLBACK_IF(ctx->Line.StippleFlag);
FALLBACK_IF(ctx->Line.SmoothFlag); FALLBACK_IF(ctx->Line.SmoothFlag);
FALLBACK_IF(ctx->Point.SmoothFlag); FALLBACK_IF(ctx->Point.SmoothFlag);

View File

@@ -961,6 +961,7 @@ struct gl_list_extensions
struct gl_multisample_attrib struct gl_multisample_attrib
{ {
GLboolean Enabled; GLboolean Enabled;
GLboolean _Enabled; /**< true if Enabled and multisample buffer */
GLboolean SampleAlphaToCoverage; GLboolean SampleAlphaToCoverage;
GLboolean SampleAlphaToOne; GLboolean SampleAlphaToOne;
GLboolean SampleCoverage; GLboolean SampleCoverage;

View File

@@ -57,7 +57,7 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
void void
_mesa_init_multisample(GLcontext *ctx) _mesa_init_multisample(GLcontext *ctx)
{ {
ctx->Multisample.Enabled = GL_FALSE; ctx->Multisample.Enabled = GL_TRUE;
ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
ctx->Multisample.SampleAlphaToOne = GL_FALSE; ctx->Multisample.SampleAlphaToOne = GL_FALSE;
ctx->Multisample.SampleCoverage = GL_FALSE; ctx->Multisample.SampleCoverage = GL_FALSE;

View File

@@ -288,6 +288,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. * Update derived color/blend/logicop state.
*/ */
@@ -425,6 +439,9 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
update_viewport_matrix(ctx); update_viewport_matrix(ctx);
if (new_state & _NEW_MULTISAMPLE)
update_multisample( ctx );
if (new_state & _NEW_COLOR) if (new_state & _NEW_COLOR)
update_color( ctx ); update_color( ctx );

View File

@@ -254,7 +254,7 @@ static void update_raster_state( struct st_context *st )
raster->line_stipple_factor = ctx->Line.StippleFactor - 1; raster->line_stipple_factor = ctx->Line.StippleFactor - 1;
/* _NEW_MULTISAMPLE */ /* _NEW_MULTISAMPLE */
if (ctx->Multisample.Enabled) if (ctx->Multisample._Enabled)
raster->multisample = 1; raster->multisample = 1;
/* _NEW_SCISSOR */ /* _NEW_SCISSOR */

View File

@@ -250,7 +250,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA);
/* alpha attenuation / fade factor */ /* alpha attenuation / fade factor */
if (ctx->Multisample.Enabled) { if (ctx->Multisample._Enabled) {
if (vert->pointSize >= ctx->Point.Threshold) { if (vert->pointSize >= ctx->Point.Threshold) {
alphaAtten = 1.0F; alphaAtten = 1.0F;
} }