Mesa (main): radeonsi: fix shader culling with integer pixel centers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 02:41:11 UTC 2021
Module: Mesa
Branch: main
Commit: 8f687bb5dcf665c2b57d99982eacea9d29810b3a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f687bb5dcf665c2b57d99982eacea9d29810b3a
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Nov 5 23:31:07 2021 -0400
radeonsi: fix shader culling with integer pixel centers
Only Nine was using them.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13700>
---
src/gallium/drivers/radeonsi/si_state.c | 4 ++++
src/gallium/drivers/radeonsi/si_state_viewport.c | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 53e1f7226c2..828b3467e63 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1108,6 +1108,10 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
si_mark_atom_dirty(sctx, &sctx->atoms.s.ngg_cull_state);
}
+ if (sctx->screen->use_ngg_culling &&
+ old_rs->half_pixel_center != rs->half_pixel_center)
+ si_mark_atom_dirty(sctx, &sctx->atoms.s.ngg_cull_state);
+
sctx->current_vs_state &= C_VS_STATE_CLAMP_VERTEX_COLOR;
sctx->current_vs_state |= S_VS_STATE_CLAMP_VERTEX_COLOR(rs->clamp_vertex_color);
diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c b/src/gallium/drivers/radeonsi/si_state_viewport.c
index 991f3d6f4bd..f5d7a59a52e 100644
--- a/src/gallium/drivers/radeonsi/si_state_viewport.c
+++ b/src/gallium/drivers/radeonsi/si_state_viewport.c
@@ -55,6 +55,12 @@ void si_get_small_prim_cull_info(struct si_context *sctx, struct si_small_prim_c
info.translate[1] = -info.translate[1];
}
+ /* This is what the hardware does. */
+ if (!sctx->queued.named.rasterizer->half_pixel_center) {
+ info.translate[0] += 0.5;
+ info.translate[1] += 0.5;
+ }
+
/* Scale the framebuffer up, so that samples become pixels and small
* primitive culling is the same for all sample counts.
* This only works with the standard DX sample positions, because
More information about the mesa-commit
mailing list