We don't need to deref and check rast state every time scissor changes,
only when rast state changes.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>
list_add(&ctx->node, &ctx->screen->context_list);
fd_screen_unlock(ctx->screen);
+ ctx->current_scissor = &ctx->disabled_scissor;
+
ctx->log_out = stdout;
if ((fd_mesa_debug & FD_DBG_LOG) &&
*/
bool in_discard_blit : 1;
+ /* points to either scissor or disabled_scissor depending on rast state: */
+ struct pipe_scissor_state *current_scissor;
+
struct pipe_scissor_state scissor;
/* we don't have a disable/enable bit for scissor, so instead we keep
static inline struct pipe_scissor_state *
fd_context_get_scissor(struct fd_context *ctx)
{
- if (ctx->rasterizer && ctx->rasterizer->scissor)
- return &ctx->scissor;
- return &ctx->disabled_scissor;
+ return ctx->current_scissor;
}
static inline bool
ctx->rasterizer = hwcso;
ctx->dirty |= FD_DIRTY_RASTERIZER;
+ if (ctx->rasterizer && ctx->rasterizer->scissor) {
+ ctx->current_scissor = &ctx->scissor;
+ } else {
+ ctx->current_scissor = &ctx->disabled_scissor;
+ }
+
/* if scissor enable bit changed we need to mark scissor
* state as dirty as well:
* NOTE: we can do a shallow compare, since we only care