diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/enable.c | 37 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 12 | ||||
-rw-r--r-- | src/mesa/main/multisample.c | 10 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 36 |
4 files changed, 68 insertions, 27 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index d33fc8b3dda..9ff3c5af530 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -239,7 +239,18 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state) { 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) { @@ -808,7 +819,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) 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: @@ -816,13 +829,17 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) 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: @@ -830,7 +847,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) 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; @@ -841,7 +860,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) 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; @@ -1036,7 +1057,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) 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; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 640202cbe7c..c4e67353e9f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4493,6 +4493,18 @@ struct gl_driver_flags /** 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; }; diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 07786130d51..38d91f7204e 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -47,7 +47,8 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert) 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; } @@ -122,7 +123,8 @@ _mesa_SampleMaski(GLuint index, GLbitfield mask) 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; } @@ -145,7 +147,9 @@ _mesa_MinSampleShading(GLclampf value) 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; } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 2bd91530312..23e3768373f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -213,23 +213,12 @@ st_invalidate_state(struct gl_context * ctx) } } - 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) && @@ -522,6 +511,19 @@ static void st_init_driver_flags(struct st_context *st) 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, |