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:
parent
3166d4428d
commit
701a0b5165
|
@ -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);
|
S_028810_DX_LINEAR_ATTR_CLIP_ENA(1);
|
||||||
|
|
||||||
if (rs->rasterizer_discard) {
|
if (rs->rasterizer_discard) {
|
||||||
rs->ngg_cull_flags = SI_NGG_CULL_ENABLED |
|
rs->ngg_cull_flags_tris = rs->ngg_cull_flags_tris_y_inverted = SI_NGG_CULL_ENABLED |
|
||||||
SI_NGG_CULL_FRONT_FACE |
|
SI_NGG_CULL_FRONT_FACE |
|
||||||
SI_NGG_CULL_BACK_FACE;
|
SI_NGG_CULL_BACK_FACE;
|
||||||
rs->ngg_cull_flags_y_inverted = rs->ngg_cull_flags;
|
rs->ngg_cull_flags_lines = SI_NGG_CULL_ENABLED |
|
||||||
|
SI_NGG_CULL_LINES;
|
||||||
} else {
|
} else {
|
||||||
rs->ngg_cull_flags = SI_NGG_CULL_ENABLED;
|
rs->ngg_cull_flags_tris = rs->ngg_cull_flags_tris_y_inverted = SI_NGG_CULL_ENABLED;
|
||||||
rs->ngg_cull_flags_y_inverted = rs->ngg_cull_flags;
|
rs->ngg_cull_flags_lines = SI_NGG_CULL_ENABLED |
|
||||||
|
SI_NGG_CULL_LINES;
|
||||||
|
|
||||||
bool cull_front, cull_back;
|
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) {
|
if (cull_front) {
|
||||||
rs->ngg_cull_flags |= SI_NGG_CULL_FRONT_FACE;
|
rs->ngg_cull_flags_tris |= SI_NGG_CULL_FRONT_FACE;
|
||||||
rs->ngg_cull_flags_y_inverted |= SI_NGG_CULL_BACK_FACE;
|
rs->ngg_cull_flags_tris_y_inverted |= SI_NGG_CULL_BACK_FACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cull_back) {
|
if (cull_back) {
|
||||||
rs->ngg_cull_flags |= SI_NGG_CULL_BACK_FACE;
|
rs->ngg_cull_flags_tris |= SI_NGG_CULL_BACK_FACE;
|
||||||
rs->ngg_cull_flags_y_inverted |= SI_NGG_CULL_FRONT_FACE;
|
rs->ngg_cull_flags_tris_y_inverted |= SI_NGG_CULL_FRONT_FACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,9 @@ struct si_state_rasterizer {
|
||||||
unsigned pa_cl_clip_cntl;
|
unsigned pa_cl_clip_cntl;
|
||||||
float line_width;
|
float line_width;
|
||||||
float max_point_size;
|
float max_point_size;
|
||||||
unsigned ngg_cull_flags : 8;
|
unsigned ngg_cull_flags_tris : 8;
|
||||||
unsigned ngg_cull_flags_y_inverted : 8;
|
unsigned ngg_cull_flags_tris_y_inverted : 8;
|
||||||
|
unsigned ngg_cull_flags_lines : 8;
|
||||||
unsigned sprite_coord_enable : 8;
|
unsigned sprite_coord_enable : 8;
|
||||||
unsigned clip_plane_enable : 8;
|
unsigned clip_plane_enable : 8;
|
||||||
unsigned half_pixel_center : 1;
|
unsigned half_pixel_center : 1;
|
||||||
|
|
|
@ -2278,13 +2278,15 @@ static void si_draw(struct pipe_context *ctx,
|
||||||
/* Check that the current shader allows culling. */
|
/* Check that the current shader allows culling. */
|
||||||
assert(hw_vs->ngg_cull_vert_threshold != UINT_MAX);
|
assert(hw_vs->ngg_cull_vert_threshold != UINT_MAX);
|
||||||
|
|
||||||
uint8_t ngg_culling = sctx->viewport0_y_inverted ? rs->ngg_cull_flags_y_inverted :
|
uint8_t ngg_culling;
|
||||||
rs->ngg_cull_flags;
|
|
||||||
assert(ngg_culling); /* rasterizer state should always set this to non-zero */
|
|
||||||
|
|
||||||
if (util_prim_is_lines(sctx->current_rast_prim)) {
|
if (util_prim_is_lines(sctx->current_rast_prim)) {
|
||||||
/* Overwrite it to mask out face cull flags. */
|
/* 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) {
|
if (ngg_culling != old_ngg_culling) {
|
||||||
|
|
Loading…
Reference in New Issue