Mesa (main): radeonsi: unify how ngg_cull_flags are set
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 20:00:21 UTC 2021
Module: Mesa
Branch: main
Commit: 881c45919194b386080ed97c955470358c02255e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=881c45919194b386080ed97c955470358c02255e
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sun Nov 7 15:49:19 2021 -0500
radeonsi: unify how ngg_cull_flags are set
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13811>
---
src/gallium/drivers/radeonsi/si_shader.h | 2 +-
src/gallium/drivers/radeonsi/si_state.c | 19 +++++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index a6292f9b397..44021cab095 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -278,7 +278,7 @@ enum
SI_VS_BLIT_SGPRS_POS_TEXCOORD = 9,
};
-#define SI_NGG_CULL_ENABLED (1 << 0) /* this implies W, view.xy, and small prim culling */
+#define SI_NGG_CULL_TRIANGLES (1 << 0) /* this implies W, view.xy, and small prim culling */
#define SI_NGG_CULL_BACK_FACE (1 << 1) /* back faces */
#define SI_NGG_CULL_FRONT_FACE (1 << 2) /* front faces */
#define SI_NGG_CULL_LINES (1 << 3) /* the primitive type is lines */
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index ffff6234572..c618e03f522 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -960,18 +960,17 @@ static void *si_create_rs_state(struct pipe_context *ctx, const struct pipe_rast
S_028810_DX_RASTERIZATION_KILL(state->rasterizer_discard) |
S_028810_DX_LINEAR_ATTR_CLIP_ENA(1);
+ rs->ngg_cull_flags_tris = SI_NGG_CULL_TRIANGLES;
+ rs->ngg_cull_flags_tris_y_inverted = rs->ngg_cull_flags_tris;
+
+ rs->ngg_cull_flags_lines = SI_NGG_CULL_LINES |
+ (!rs->perpendicular_end_caps ? SI_NGG_CULL_SMALL_LINES_DIAMOND_EXIT : 0);
+
if (rs->rasterizer_discard) {
- rs->ngg_cull_flags_tris = rs->ngg_cull_flags_tris_y_inverted = SI_NGG_CULL_ENABLED |
- SI_NGG_CULL_FRONT_FACE |
- SI_NGG_CULL_BACK_FACE;
- rs->ngg_cull_flags_lines = SI_NGG_CULL_ENABLED |
- SI_NGG_CULL_LINES;
+ rs->ngg_cull_flags_tris |= SI_NGG_CULL_FRONT_FACE |
+ SI_NGG_CULL_BACK_FACE;
+ rs->ngg_cull_flags_tris_y_inverted = rs->ngg_cull_flags_tris;
} else {
- rs->ngg_cull_flags_tris = rs->ngg_cull_flags_tris_y_inverted = SI_NGG_CULL_ENABLED;
- rs->ngg_cull_flags_lines = SI_NGG_CULL_ENABLED |
- SI_NGG_CULL_LINES |
- (!rs->perpendicular_end_caps ? SI_NGG_CULL_SMALL_LINES_DIAMOND_EXIT : 0);
-
bool cull_front, cull_back;
if (!state->front_ccw) {
More information about the mesa-commit
mailing list