From: Erik Faye-Lund Date: Tue, 29 Oct 2019 12:27:58 +0000 (+0100) Subject: zink: use bitfield for dirty flagging X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b222f28357cb3cb2bae751675614a39362da2816;p=mesa.git zink: use bitfield for dirty flagging Bitfields are a bit more ideomatic than explicit flags, and harder to get wrong. Reviewed-by: Dave Airlie --- diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index c6f32f83aec..b97cc16455d 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -306,7 +306,7 @@ bind_stage(struct zink_context *ctx, enum pipe_shader_type stage, { assert(stage < PIPE_SHADER_COMPUTE); ctx->gfx_stages[stage] = shader; - ctx->dirty |= ZINK_DIRTY_PROGRAM; + ctx->dirty_program = true; } static void @@ -974,7 +974,7 @@ equals_framebuffer_state(const void *a, const void *b) static struct zink_gfx_program * get_gfx_program(struct zink_context *ctx) { - if (ctx->dirty & ZINK_DIRTY_PROGRAM) { + if (ctx->dirty_program) { struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache, ctx->gfx_stages); if (!entry) { @@ -986,7 +986,7 @@ get_gfx_program(struct zink_context *ctx) return NULL; } ctx->curr_program = entry->data; - ctx->dirty &= ~ZINK_DIRTY_PROGRAM; + ctx->dirty_program = false; } assert(ctx->curr_program); @@ -1596,7 +1596,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) !ctx->framebuffer_cache) goto fail; - ctx->dirty = ZINK_DIRTY_PROGRAM; + ctx->dirty_program = true; /* start the first batch */ zink_start_batch(ctx, zink_curr_batch(ctx)); diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 4abca476007..35c4ec22e83 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -57,8 +57,6 @@ zink_sampler_view(struct pipe_sampler_view *pview) return (struct zink_sampler_view *)pview; } -#define ZINK_DIRTY_PROGRAM (1 << 0) - struct zink_context { struct pipe_context base; struct slab_child_pool transfer_pool; @@ -80,7 +78,8 @@ struct zink_context { struct zink_gfx_pipeline_state gfx_pipeline_state; struct hash_table *program_cache; struct zink_gfx_program *curr_program; - unsigned dirty; + + unsigned dirty_program : 1; struct hash_table *render_pass_cache; struct hash_table *framebuffer_cache;