radeonsi: enable dithered alpha-to-coverage for better quality

Submitted by Marek Olšák on Jan. 15, 2019, 6:04 p.m.

Details

Message ID 20190115180405.2241-1-maraeo@gmail.com
State New
Headers show
Series "radeonsi: enable dithered alpha-to-coverage for better quality" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák Jan. 15, 2019, 6:04 p.m.
From: Marek Olšák <marek.olsak@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(-)

Patch hide | download patch | download mbox

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;