Mesa (main): radeonsi: add si_state_rasterizer::ngg_cull_flags_lines and rename the others
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 02:41:11 UTC 2021
Module: Mesa
Branch: main
Commit: 701a0b51659eec37eb107c658fa9b8bddf922049
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=701a0b51659eec37eb107c658fa9b8bddf922049
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Nov 5 20:13:35 2021 -0400
radeonsi: add si_state_rasterizer::ngg_cull_flags_lines and rename the others
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 | 22 ++++++++++++----------
src/gallium/drivers/radeonsi/si_state.h | 5 +++--
src/gallium/drivers/radeonsi/si_state_draw.cpp | 10 ++++++----
3 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 3839c2b19ec..d12424cbe29 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -961,13 +961,15 @@ static void *si_create_rs_state(struct pipe_context *ctx, const struct pipe_rast
S_028810_DX_LINEAR_ATTR_CLIP_ENA(1);
if (rs->rasterizer_discard) {
- rs->ngg_cull_flags = SI_NGG_CULL_ENABLED |
- SI_NGG_CULL_FRONT_FACE |
- SI_NGG_CULL_BACK_FACE;
- rs->ngg_cull_flags_y_inverted = rs->ngg_cull_flags;
+ 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;
} else {
- rs->ngg_cull_flags = SI_NGG_CULL_ENABLED;
- rs->ngg_cull_flags_y_inverted = rs->ngg_cull_flags;
+ 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;
bool cull_front, cull_back;
@@ -980,13 +982,13 @@ static void *si_create_rs_state(struct pipe_context *ctx, const struct pipe_rast
}
if (cull_front) {
- rs->ngg_cull_flags |= SI_NGG_CULL_FRONT_FACE;
- rs->ngg_cull_flags_y_inverted |= SI_NGG_CULL_BACK_FACE;
+ rs->ngg_cull_flags_tris |= SI_NGG_CULL_FRONT_FACE;
+ rs->ngg_cull_flags_tris_y_inverted |= SI_NGG_CULL_BACK_FACE;
}
if (cull_back) {
- rs->ngg_cull_flags |= SI_NGG_CULL_BACK_FACE;
- rs->ngg_cull_flags_y_inverted |= SI_NGG_CULL_FRONT_FACE;
+ rs->ngg_cull_flags_tris |= SI_NGG_CULL_BACK_FACE;
+ rs->ngg_cull_flags_tris_y_inverted |= SI_NGG_CULL_FRONT_FACE;
}
}
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index d01da541b61..4c5941388ac 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -76,8 +76,9 @@ struct si_state_rasterizer {
unsigned pa_cl_clip_cntl;
float line_width;
float max_point_size;
- unsigned ngg_cull_flags : 8;
- unsigned ngg_cull_flags_y_inverted : 8;
+ unsigned ngg_cull_flags_tris : 8;
+ unsigned ngg_cull_flags_tris_y_inverted : 8;
+ unsigned ngg_cull_flags_lines : 8;
unsigned sprite_coord_enable : 8;
unsigned clip_plane_enable : 8;
unsigned half_pixel_center : 1;
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index e806d8a89ae..c721ce5c532 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -2278,13 +2278,15 @@ static void si_draw(struct pipe_context *ctx,
/* Check that the current shader allows culling. */
assert(hw_vs->ngg_cull_vert_threshold != UINT_MAX);
- uint8_t ngg_culling = sctx->viewport0_y_inverted ? rs->ngg_cull_flags_y_inverted :
- rs->ngg_cull_flags;
- assert(ngg_culling); /* rasterizer state should always set this to non-zero */
+ uint8_t ngg_culling;
if (util_prim_is_lines(sctx->current_rast_prim)) {
/* Overwrite it to mask out face cull flags. */
- ngg_culling = SI_NGG_CULL_ENABLED | SI_NGG_CULL_LINES;
+ ngg_culling = rs->ngg_cull_flags_lines;
+ } else {
+ ngg_culling = sctx->viewport0_y_inverted ? rs->ngg_cull_flags_tris_y_inverted :
+ rs->ngg_cull_flags_tris;
+ assert(ngg_culling); /* rasterizer state should always set this to non-zero */
}
if (ngg_culling != old_ngg_culling) {
More information about the mesa-commit
mailing list