r600: Add shader key item to identify when the sample mask should be used
authorGert Wollny <gert.wollny@collabora.com>
Sun, 5 Jul 2020 16:35:35 +0000 (18:35 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 20 Jul 2020 09:32:51 +0000 (09:32 +0000)
The sample mask must be applied when more then one sample is available or
multisamplig is not enabled, so add a shader key to track this.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5963>

src/gallium/drivers/r600/r600_shader.h
src/gallium/drivers/r600/r600_state_common.c

index 1e00a9527b521bb1c4afc1ca3e6a49e551bddc2e..4e4942c1ba4b449709b652ec38ff79d517b7d9c3 100644 (file)
@@ -136,6 +136,7 @@ union r600_shader_key {
                unsigned        image_size_const_offset:5;
                unsigned        color_two_side:1;
                unsigned        alpha_to_one:1;
+               unsigned        apply_sample_id_mask:1;
        } ps;
        struct {
                unsigned        prim_id_out:8;
index 44c88548b8bded4c0f2924749023def49793ac42..89429dd504e43d5ac5cda52ef6c4dd251b2bdd27 100644 (file)
@@ -819,6 +819,7 @@ static inline void r600_shader_selector_key(const struct pipe_context *ctx,
                                      rctx->rasterizer && rctx->rasterizer->multisample_enable &&
                                      !rctx->framebuffer.cb0_is_integer;
                key->ps.nr_cbufs = rctx->framebuffer.state.nr_cbufs;
+                key->ps.apply_sample_id_mask = (rctx->ps_iter_samples > 1) || !rctx->rasterizer->multisample_enable;
                /* Dual-source blending only makes sense with nr_cbufs == 1. */
                if (key->ps.nr_cbufs == 1 && rctx->dual_src_blend)
                        key->ps.nr_cbufs = 2;