summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2021-01-10 02:00:58 -0500
committerMarge Bot <eric+marge@anholt.net>2021-01-22 16:45:30 +0000
commit26d785fbbdf7635607510ebf7e78d93db532bf21 (patch)
treeeaf13ca0069690bc03dba864eb8d5305fbc4790c
parentc1957e58a6165b7daeb8519b4214428a5d8fcfb2 (diff)
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>
-rw-r--r--src/gallium/drivers/radeonsi/si_compute_prim_discard.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.cpp4
-rw-r--r--src/gallium/drivers/radeonsi/si_state_viewport.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
index bad93320496..78f1628ddda 100644
--- a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
+++ b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
@@ -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) {
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index c3b7f064de8..333054ec09b 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -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;
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 9f8ec51a98b..7921c97d9eb 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -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;
}
diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c b/src/gallium/drivers/radeonsi/si_state_viewport.c
index 0327d2f5d15..7dda99a181e 100644
--- a/src/gallium/drivers/radeonsi/si_state_viewport.c
+++ b/src/gallium/drivers/radeonsi/si_state_viewport.c
@@ -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. */