diff options
author | Marek Olšák <[email protected]> | 2017-06-14 23:09:24 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-06-22 01:51:02 +0200 |
commit | 743ad599a97d09b119d26b99f6b79e41b567e421 (patch) | |
tree | 3ccdbd3d7ea47037329bc97d8d87e247f7d77c6a /src/mesa/state_tracker/st_atom_viewport.c | |
parent | 2ec1e32d11ed788dfed229a569a238743b9b1f9f (diff) |
st/mesa: don't set 16 scissors and 16 viewports if they're unused
Only do so if there is a shader writing gl_ViewportIndex.
This removes a lot of CPU overhead for the most common case.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_atom_viewport.c')
-rw-r--r-- | src/mesa/state_tracker/st_atom_viewport.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index abf5faa0bc3..6e3347e7cfa 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -47,7 +47,7 @@ st_update_viewport( struct st_context *st ) /* _NEW_VIEWPORT */ - for (i = 0; i < ctx->Const.MaxViewports; i++) { + for (i = 0; i < st->state.num_viewports; i++) { float *scale = st->state.viewport[i].scale; float *translate = st->state.viewport[i].translate; @@ -62,6 +62,11 @@ st_update_viewport( struct st_context *st ) } cso_set_viewport(st->cso_context, &st->state.viewport[0]); - if (ctx->Const.MaxViewports > 1) - st->pipe->set_viewport_states(st->pipe, 1, ctx->Const.MaxViewports - 1, &st->state.viewport[1]); + + if (st->state.num_viewports > 1) { + struct pipe_context *pipe = st->pipe; + + pipe->set_viewport_states(pipe, 1, st->state.num_viewports - 1, + &st->state.viewport[1]); + } } |