#include "glheader.h"
+#include "blend.h"
#include "clip.h"
#include "context.h"
#include "debug_output.h"
{
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) {
goto invalid_enum_error;
if (ctx->Color.AlphaEnabled == state)
return;
+ /* AlphaEnabled is used by the fixed-func fragment program */
FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->NewDriverState |= ctx->DriverFlags.NewAlphaTest;
ctx->Color.AlphaEnabled = state;
break;
case GL_AUTO_NORMAL:
GLbitfield newEnabled =
state * ((1 << ctx->Const.MaxDrawBuffers) - 1);
if (newEnabled != ctx->Color.BlendEnabled) {
- FLUSH_VERTICES(ctx, _NEW_COLOR);
+ _mesa_flush_vertices_for_blend_state(ctx);
ctx->Color.BlendEnabled = newEnabled;
}
}
case GL_DITHER:
if (ctx->Color.DitherFlag == state)
return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR);
+ ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
ctx->Color.DitherFlag = state;
break;
case GL_FOG:
goto invalid_enum_error;
if (ctx->Color.IndexLogicOpEnabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR);
+ ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
ctx->Color.IndexLogicOpEnabled = state;
break;
case GL_CONSERVATIVE_RASTERIZATION_INTEL:
goto invalid_enum_error;
if (ctx->Color.ColorLogicOpEnabled == state)
return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR);
+ ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
ctx->Color.ColorLogicOpEnabled = state;
break;
case GL_MAP1_COLOR_4:
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;
goto invalid_enum_error;
}
if (ctx->Array.PrimitiveRestart != state) {
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ FLUSH_VERTICES(ctx, 0);
ctx->Array.PrimitiveRestart = state;
update_derived_primitive_restart_state(ctx);
}
if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility)
goto invalid_enum_error;
if (ctx->Array.PrimitiveRestartFixedIndex != state) {
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ FLUSH_VERTICES(ctx, 0);
ctx->Array.PrimitiveRestartFixedIndex = state;
update_derived_primitive_restart_state(ctx);
}
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;
CHECK_EXTENSION(KHR_blend_equation_advanced_coherent, cap);
if (ctx->Color.BlendCoherent == state)
return;
- FLUSH_VERTICES(ctx, _NEW_COLOR);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR);
+ ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
ctx->Color.BlendCoherent = state;
break;
return;
}
if (((ctx->Color.BlendEnabled >> index) & 1) != state) {
- FLUSH_VERTICES(ctx, _NEW_COLOR);
+ _mesa_flush_vertices_for_blend_state(ctx);
if (state)
ctx->Color.BlendEnabled |= (1 << index);
else