[Mesa-dev] [PATCH 3/4] radeonsi: allow sample mask export for single-sample framebuffers

Nicolai Hähnle nhaehnle at gmail.com
Wed Nov 16 09:42:54 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This fixes GL45-CTS.sample_variables.mask.*.samples_1.*.
---
 src/gallium/drivers/radeonsi/si_state.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index f8dfcf2..c64bb5b 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -860,25 +860,26 @@ static void *si_create_rs_state(struct pipe_context *ctx,
 static void si_bind_rs_state(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_state_rasterizer *old_rs =
 		(struct si_state_rasterizer*)sctx->queued.named.rasterizer;
 	struct si_state_rasterizer *rs = (struct si_state_rasterizer *)state;
 
 	if (!state)
 		return;
 
-	if (sctx->framebuffer.nr_samples > 1 &&
-	    (!old_rs || old_rs->multisample_enable != rs->multisample_enable)) {
+	if (!old_rs || old_rs->multisample_enable != rs->multisample_enable) {
 		si_mark_atom_dirty(sctx, &sctx->db_render_state);
 
-		if (sctx->b.family >= CHIP_POLARIS10)
+		/* Update the small primitive filter workaround if necessary. */
+		if (sctx->b.family >= CHIP_POLARIS10 &&
+		    sctx->framebuffer.nr_samples > 1)
 			si_mark_atom_dirty(sctx, &sctx->msaa_sample_locs.atom);
 	}
 
 	r600_viewport_set_rast_deps(&sctx->b, rs->scissor_enable, rs->clip_halfz);
 
 	si_pm4_bind_state(sctx, rasterizer, rs);
 	si_update_poly_offset_state(sctx);
 
 	si_mark_atom_dirty(sctx, &sctx->clip_regs);
 	sctx->do_update_shaders = true;
@@ -1146,21 +1147,21 @@ static void si_emit_db_render_state(struct si_context *sctx, struct r600_atom *s
 
 	db_shader_control = sctx->ps_db_shader_control;
 
 	/* Bug workaround for smoothing (overrasterization) on SI. */
 	if (sctx->b.chip_class == SI && sctx->smoothing_enabled) {
 		db_shader_control &= C_02880C_Z_ORDER;
 		db_shader_control |= S_02880C_Z_ORDER(V_02880C_LATE_Z);
 	}
 
 	/* Disable the gl_SampleMask fragment shader output if MSAA is disabled. */
-	if (sctx->framebuffer.nr_samples <= 1 || (rs && !rs->multisample_enable))
+	if (!rs || !rs->multisample_enable)
 		db_shader_control &= C_02880C_MASK_EXPORT_ENABLE;
 
 	if (sctx->b.family == CHIP_STONEY &&
 	    sctx->screen->b.debug_flags & DBG_NO_RB_PLUS)
 		db_shader_control |= S_02880C_DUAL_QUAD_DISABLE(1);
 
 	radeon_set_context_reg(cs, R_02880C_DB_SHADER_CONTROL,
 			       db_shader_control);
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list