diff options
author | Eric Anholt <[email protected]> | 2017-02-10 13:18:06 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2017-02-10 14:17:04 -0800 |
commit | 5c86f119b946e2557643b78687326322feb1ecea (patch) | |
tree | 1a9d6f10a0141289810251bba9229b7e903a1a1a /src/gallium/drivers/vc4 | |
parent | 30237193f5f0f28c900052296a0f8d0619e7f50d (diff) |
vc4: Respect glSampleMask() even when we're not writing color.
gallium's quad-based blitter for copying MSAA depth textures expects to be
able to do 4 passes updating a sample at a time using glSampleMask, and
there's no color buffer bound when it's doing that.
Diffstat (limited to 'src/gallium/drivers/vc4')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index 7811f1ce40a..56f6c3bd0e9 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -630,9 +630,7 @@ vc4_nir_lower_blend_instr(struct vc4_compile *c, nir_builder *b, { nir_ssa_def *frag_color = intr->src[0].ssa; - if (c->fs_key->sample_coverage) { - vc4_nir_store_sample_mask(c, b, nir_load_sample_mask_in(b)); - } else if (c->fs_key->sample_alpha_to_coverage) { + if (c->fs_key->sample_alpha_to_coverage) { nir_ssa_def *a = nir_channel(b, frag_color, 3); /* XXX: We should do a nice dither based on the fragment @@ -721,4 +719,16 @@ vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c) nir_metadata_dominance); } } + + /* If we didn't do alpha-to-coverage on the output color, we still + * need to pass glSampleMask() through. + */ + if (c->fs_key->sample_coverage && !c->fs_key->sample_alpha_to_coverage) { + nir_function_impl *impl = nir_shader_get_entrypoint(s); + nir_builder b; + nir_builder_init(&b, impl); + b.cursor = nir_after_block(nir_impl_last_block(impl)); + + vc4_nir_store_sample_mask(c, &b, nir_load_sample_mask_in(&b)); + } } |