radeonsi: move y_inverted out of si_viewports

for better packing

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
This commit is contained in:
Marek Olšák 2021-01-10 02:00:58 -05:00 committed by Marge Bot
parent c1957e58a6
commit 26d785fbbd
4 changed files with 7 additions and 7 deletions

View File

@ -874,8 +874,8 @@ static bool si_shader_select_prim_discard_cs(struct si_context *sctx,
key.opt.cs_cull_front = 1;
key.opt.cs_cull_back = 1;
} else {
key.opt.cs_cull_front = sctx->viewports.y_inverted ? rs->cull_back : rs->cull_front;
key.opt.cs_cull_back = sctx->viewports.y_inverted ? rs->cull_front : rs->cull_back;
key.opt.cs_cull_front = sctx->viewport0_y_inverted ? rs->cull_back : rs->cull_front;
key.opt.cs_cull_back = sctx->viewport0_y_inverted ? rs->cull_front : rs->cull_back;
}
if (!rs->depth_clamp_any && CULL_Z) {

View File

@ -754,7 +754,6 @@ struct si_signed_scissor {
struct si_viewports {
struct pipe_viewport_state states[SI_MAX_VIEWPORTS];
struct si_signed_scissor as_scissor[SI_MAX_VIEWPORTS];
bool y_inverted;
};
struct si_streamout_target {
@ -1025,6 +1024,7 @@ struct si_context {
struct si_stencil_ref stencil_ref;
bool blend_color_any_nonzeros:1;
bool clip_state_any_nonzeros:1;
bool viewport0_y_inverted;
struct pipe_scissor_state scissors[SI_MAX_VIEWPORTS];
struct si_streamout streamout;
struct si_viewports viewports;

View File

@ -1947,9 +1947,9 @@ static void si_draw_vbo(struct pipe_context *ctx,
if (!rs->polygon_mode_enabled)
ngg_culling |= SI_NGG_CULL_VIEW_SMALLPRIMS;
if (sctx->viewports.y_inverted ? rs->cull_back : rs->cull_front)
if (sctx->viewport0_y_inverted ? rs->cull_back : rs->cull_front)
ngg_culling |= SI_NGG_CULL_FRONT_FACE;
if (sctx->viewports.y_inverted ? rs->cull_front : rs->cull_back)
if (sctx->viewport0_y_inverted ? rs->cull_front : rs->cull_back)
ngg_culling |= SI_NGG_CULL_BACK_FACE;
}

View File

@ -50,7 +50,7 @@ void si_get_small_prim_cull_info(struct si_context *sctx, struct si_small_prim_c
* bounding box, so min becomes max, which breaks small primitive
* culling.
*/
if (sctx->viewports.y_inverted) {
if (sctx->viewport0_y_inverted) {
info.scale[1] = -info.scale[1];
info.translate[1] = -info.translate[1];
}
@ -471,7 +471,7 @@ static void si_set_viewport_states(struct pipe_context *pctx, unsigned start_slo
}
if (start_slot == 0) {
ctx->viewports.y_inverted =
ctx->viewport0_y_inverted =
-state->scale[1] + state->translate[1] > state->scale[1] + state->translate[1];
/* NGG cull state uses the viewport and quant mode. */