X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmultisample.c;h=38d91f7204e2d27527006c5b45bcd9a5a5626c2a;hb=167f6a33fa7be914f4b5171eeeb82bc5e01255f9;hp=77773a20883878d0d07b67c9450dc29b0da91929;hpb=7f6a0cb29c89a03441be744680a2145445be3a3c;p=mesa.git diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 77773a20883..38d91f7204e 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -41,11 +41,16 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + value = CLAMP(value, 0.0f, 1.0f); - ctx->Multisample.SampleCoverageValue = CLAMP(value, 0.0f, 1.0f); + if (ctx->Multisample.SampleCoverageInvert == invert && + ctx->Multisample.SampleCoverageValue == value) + return; + + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE); + ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; + ctx->Multisample.SampleCoverageValue = value; ctx->Multisample.SampleCoverageInvert = invert; - ctx->NewState |= _NEW_MULTISAMPLE; } @@ -115,7 +120,11 @@ _mesa_SampleMaski(GLuint index, GLbitfield mask) return; } - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + if (ctx->Multisample.SampleMaskValue == mask) + return; + + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE); + ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; ctx->Multisample.SampleMaskValue = mask; } @@ -127,15 +136,21 @@ _mesa_MinSampleShading(GLclampf value) { GET_CURRENT_CONTEXT(ctx); - if (!ctx->Extensions.ARB_sample_shading || !_mesa_is_desktop_gl(ctx)) { + if (!_mesa_has_ARB_sample_shading(ctx) && + !_mesa_has_OES_sample_shading(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading"); return; } - FLUSH_VERTICES(ctx, 0); + value = CLAMP(value, 0.0f, 1.0f); + + if (ctx->Multisample.MinSampleShadingValue == value) + return; - ctx->Multisample.MinSampleShadingValue = CLAMP(value, 0.0f, 1.0f); - ctx->NewState |= _NEW_MULTISAMPLE; + FLUSH_VERTICES(ctx, + ctx->DriverFlags.NewSampleShading ? 0 : _NEW_MULTISAMPLE); + ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading; + ctx->Multisample.MinSampleShadingValue = value; } /**