Mesa (master): st/mesa: only enable MSAA coverage options when we have a MSAA buffer
Brian Paul
brianp at kemper.freedesktop.org
Fri Sep 16 14:43:58 UTC 2016
Module: Mesa
Branch: master
Commit: a01872f80880c1b928817d84834b7259d073b367
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a01872f80880c1b928817d84834b7259d073b367
Author: Brian Paul <brianp at vmware.com>
Date: Thu Sep 15 15:13:07 2016 -0600
st/mesa: only enable MSAA coverage options when we have a MSAA buffer
Regardless of whether GL_MULTISAMPLE is enabled (it's enabled by default)
we should not set the alpha_to_coverage or alpha_to_one flags if the
current drawing buffer does not do MSAA.
This fixes the new piglit gl-1.3-alpha_to_coverage_nop test.
ETQW is a game that enables GL_SAMPLE_ALPHA_TO_COVERAGE without MSAA.
Shrubs along the side of roads were invisible because fragments with
alpha < 0.5 were being discarded (zero coverage).
v2: remove ctx->DrawBuffer != NULL check.
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/state_tracker/st_atom_blend.c | 8 +++++---
src/mesa/state_tracker/st_context.c | 3 ++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 65de67b..76d6a644 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -265,9 +265,11 @@ update_blend( struct st_context *st )
blend->dither = ctx->Color.DitherFlag;
- if (ctx->Multisample.Enabled) {
- /* unlike in gallium/d3d10 these operations are only performed
- if msaa is enabled */
+ if (ctx->Multisample.Enabled &&
+ ctx->DrawBuffer->Visual.sampleBuffers > 0) {
+ /* Unlike in gallium/d3d10 these operations are only performed
+ * if both msaa is enabled and we have a multisample buffer.
+ */
blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne;
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index ddc11a4..81b3387 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -166,7 +166,8 @@ void st_invalidate_state(struct gl_context * ctx, GLbitfield new_state)
struct st_context *st = st_context(ctx);
if (new_state & _NEW_BUFFERS) {
- st->dirty |= ST_NEW_DSA |
+ st->dirty |= ST_NEW_BLEND |
+ ST_NEW_DSA |
ST_NEW_FB_STATE |
ST_NEW_SAMPLE_MASK |
ST_NEW_SAMPLE_SHADING |
More information about the mesa-commit
mailing list