radeonsi: add si_state_rasterizer::ngg_cull_flags_lines and rename the others

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13700>
This commit is contained in:
Marek Olšák 2021-11-05 20:13:35 -04:00 committed by Marge Bot
parent 3166d4428d
commit 701a0b5165
3 changed files with 21 additions and 16 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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) {