diff options
author | Erik Faye-Lund <[email protected]> | 2019-10-29 13:27:58 +0100 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-10-30 10:29:23 +0000 |
commit | b222f28357cb3cb2bae751675614a39362da2816 (patch) | |
tree | f4ac94f20789710c74c957668335976fae5d46a8 /src/gallium | |
parent | 6d30abb4f14e238d128ab05479c6d4377a27ebfa (diff) |
zink: use bitfield for dirty flagging
Bitfields are a bit more ideomatic than explicit flags, and harder to
get wrong.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/zink/zink_context.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_context.h | 5 |
2 files changed, 6 insertions, 7 deletions
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; |