{
if (ctx->Multisample.Enabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+
+ /* GL compatibility needs Multisample.Enable to determine program state
+ * constants.
+ */
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES ||
+ !ctx->DriverFlags.NewMultisampleEnable) {
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ } else {
+ FLUSH_VERTICES(ctx, 0);
+ }
+
+ ctx->NewDriverState |= ctx->DriverFlags.NewMultisampleEnable;
ctx->Multisample.Enabled = state;
if (ctx->Driver.Enable) {
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
if (ctx->Multisample.SampleAlphaToCoverage == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 :
+ _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable;
ctx->Multisample.SampleAlphaToCoverage = state;
break;
case GL_SAMPLE_ALPHA_TO_ONE_ARB:
goto invalid_enum_error;
if (ctx->Multisample.SampleAlphaToOne == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 :
+ _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable;
ctx->Multisample.SampleAlphaToOne = state;
break;
case GL_SAMPLE_COVERAGE_ARB:
if (ctx->Multisample.SampleCoverage == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 :
+ _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
ctx->Multisample.SampleCoverage = state;
break;
case GL_SAMPLE_COVERAGE_INVERT_ARB:
goto invalid_enum_error;
if (ctx->Multisample.SampleCoverageInvert == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 :
+ _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
ctx->Multisample.SampleCoverageInvert = state;
break;
CHECK_EXTENSION(ARB_sample_shading, cap);
if (ctx->Multisample.SampleShading == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleShading ? 0 :
+ _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading;
ctx->Multisample.SampleShading = state;
break;
CHECK_EXTENSION(ARB_texture_multisample, cap);
if (ctx->Multisample.SampleMask == state)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 :
+ _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
ctx->Multisample.SampleMask = state;
break;
/** gl_context::Color::LogicOp/ColorLogicOp/IndexLogicOp */
uint64_t NewLogicOp;
+ /** gl_context::Multisample::Enabled */
+ uint64_t NewMultisampleEnable;
+
+ /** gl_context::Multisample::SampleAlphaTo* */
+ uint64_t NewSampleAlphaToXEnable;
+
+ /** gl_context::Multisample::SampleCoverage/SampleMaskValue */
+ uint64_t NewSampleMask;
+
+ /** gl_context::Multisample::(Min)SampleShading */
+ uint64_t NewSampleShading;
+
/** gl_context::Stencil */
uint64_t NewStencil;
};
ctx->Multisample.SampleCoverageValue == value)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
ctx->Multisample.SampleCoverageValue = value;
ctx->Multisample.SampleCoverageInvert = invert;
}
if (ctx->Multisample.SampleMaskValue == mask)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
ctx->Multisample.SampleMaskValue = mask;
}
if (ctx->Multisample.MinSampleShadingValue == value)
return;
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ FLUSH_VERTICES(ctx,
+ ctx->DriverFlags.NewSampleShading ? 0 : _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading;
ctx->Multisample.MinSampleShadingValue = value;
}
}
}
- if (new_state & _NEW_MULTISAMPLE) {
- st->dirty |= ST_NEW_BLEND |
- ST_NEW_SAMPLE_MASK |
- ST_NEW_SAMPLE_SHADING |
- ST_NEW_RASTERIZER |
- ST_NEW_FS_STATE;
- } else {
- /* These set a subset of flags set by _NEW_MULTISAMPLE, so we only
- * have to check them when _NEW_MULTISAMPLE isn't set.
- */
- if (new_state & (_NEW_LIGHT |
- _NEW_LINE |
- _NEW_POINT |
- _NEW_POLYGON |
- _NEW_TRANSFORM))
- st->dirty |= ST_NEW_RASTERIZER;
- }
+ if (new_state & (_NEW_LIGHT |
+ _NEW_LINE |
+ _NEW_POINT |
+ _NEW_POLYGON |
+ _NEW_TRANSFORM))
+ st->dirty |= ST_NEW_RASTERIZER;
if (new_state & (_NEW_PROJECTION |
_NEW_TRANSFORM) &&
f->NewDepth = ST_NEW_DSA;
f->NewLogicOp = ST_NEW_BLEND;
f->NewStencil = ST_NEW_DSA;
+ f->NewMultisampleEnable = ST_NEW_BLEND | ST_NEW_RASTERIZER |
+ ST_NEW_SAMPLE_MASK | ST_NEW_SAMPLE_SHADING;
+ f->NewSampleAlphaToXEnable = ST_NEW_BLEND;
+ f->NewSampleMask = ST_NEW_SAMPLE_MASK;
+ f->NewSampleShading = ST_NEW_SAMPLE_SHADING;
+
+ /* This depends on what the gallium driver wants. */
+ if (st->force_persample_in_shader) {
+ f->NewMultisampleEnable |= ST_NEW_FS_STATE;
+ f->NewSampleShading |= ST_NEW_FS_STATE;
+ } else {
+ f->NewSampleShading |= ST_NEW_RASTERIZER;
+ }
}
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,