[Mesa-dev] [PATCH] radeonsi: enable dithered alpha-to-coverage for better quality

Marek Olšák maraeo at gmail.com
Tue Jan 15 18:04:05 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

same as AMDVLK.

GL_NV_alpha_to_coverage_dither_control allows controlling this behavior.
The default is implementation-dependent.
---
 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 d1c0e0371dc..2282dbf7017 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -467,24 +467,25 @@ static void *si_create_blend_state_mode(struct pipe_context *ctx,
 	blend->logicop_enable = state->logicop_enable;
 
 	if (state->logicop_enable) {
 		color_control |= S_028808_ROP3(state->logicop_func | (state->logicop_func << 4));
 	} else {
 		color_control |= S_028808_ROP3(0xcc);
 	}
 
 	si_pm4_set_reg(pm4, R_028B70_DB_ALPHA_TO_MASK,
 		       S_028B70_ALPHA_TO_MASK_ENABLE(state->alpha_to_coverage) |
-		       S_028B70_ALPHA_TO_MASK_OFFSET0(2) |
-		       S_028B70_ALPHA_TO_MASK_OFFSET1(2) |
-		       S_028B70_ALPHA_TO_MASK_OFFSET2(2) |
-		       S_028B70_ALPHA_TO_MASK_OFFSET3(2));
+		       S_028B70_ALPHA_TO_MASK_OFFSET0(3) |
+		       S_028B70_ALPHA_TO_MASK_OFFSET1(1) |
+		       S_028B70_ALPHA_TO_MASK_OFFSET2(0) |
+		       S_028B70_ALPHA_TO_MASK_OFFSET3(2) |
+		       S_028B70_OFFSET_ROUND(1));
 
 	if (state->alpha_to_coverage)
 		blend->need_src_alpha_4bit |= 0xf;
 
 	blend->cb_target_mask = 0;
 	blend->cb_target_enabled_4bit = 0;
 
 	for (int i = 0; i < 8; i++) {
 		/* state->rt entries > 0 only written if independent blending */
 		const int j = state->independent_blend_enable ? i : 0;
-- 
2.17.1



More information about the mesa-dev mailing list