diff options
author | Kenneth Graunke <[email protected]> | 2019-07-30 18:07:17 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-07-31 08:33:50 -0700 |
commit | 2037478702adab5a3863a120be821626191b2e3e (patch) | |
tree | 521d22c3237fcba18c56e4e3918ad0a4e40d5e46 | |
parent | 72b97ad9b2bc84742d289219f9129a68040baf0e (diff) |
st/mesa: Skip scissor rect updates when scissor is entirely disabled.
If any scissor rectangles are enabled, then we need to set proper
scissor rectangles for all viewports. But if the scissor test is
entirely disabled, then we can skip updating any scissor rectangles.
Without this step, we were updating the scissor rectangles based on
the current framebuffer size. So if an app rendered to a variety of
render targets at different sizes, with scissor test disabled each
time, we'd still be continually updating the scissor rectangles,
even though it's not necessary.
In Civilization VI, this drops us from 310-350 set_scissor_state
calls per frame to 0, as it doesn't appear to use scissor testing.
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/mesa/state_tracker/st_atom_scissor.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c index 04135a3a340..f0546df6cb3 100644 --- a/src/mesa/state_tracker/st_atom_scissor.c +++ b/src/mesa/state_tracker/st_atom_scissor.c @@ -54,6 +54,9 @@ st_update_scissor( struct st_context *st ) unsigned i; bool changed = false; + if (!ctx->Scissor.EnableFlags) + return; + for (i = 0 ; i < st->state.num_viewports; i++) { scissor[i].minx = 0; scissor[i].miny = 0; |