From fe31566fbbefba719204bf04820c36e06a192d41 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 6 Oct 2020 12:33:39 -0400 Subject: [PATCH] zink: remove intermediate func for descriptor set getting we can simplify this a bit by just getting the objects in the function Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/gallium/drivers/zink/zink_descriptors.c | 6 +++--- src/gallium/drivers/zink/zink_descriptors.h | 2 -- src/gallium/drivers/zink/zink_draw.c | 10 +--------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index f6963674488..c23935b7620 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -262,8 +262,6 @@ populate_zds_key(struct zink_context *ctx, enum zink_descriptor_type type, bool struct zink_descriptor_set * zink_descriptor_set_get(struct zink_context *ctx, - struct zink_batch *batch, - struct zink_program *pg, enum zink_descriptor_type type, bool is_compute, bool *cache_hit) @@ -271,6 +269,8 @@ zink_descriptor_set_get(struct zink_context *ctx, *cache_hit = false; struct zink_descriptor_set *zds; struct zink_screen *screen = zink_screen(ctx->base.screen); + struct zink_program *pg = is_compute ? (struct zink_program *)ctx->curr_compute : (struct zink_program *)ctx->curr_program; + struct zink_batch *batch = is_compute ? &ctx->compute_batch : zink_curr_batch(ctx); struct zink_descriptor_pool *pool = pg->pool[type]; unsigned descs_used = 1; assert(type < ZINK_DESCRIPTOR_TYPES); @@ -338,7 +338,7 @@ zink_descriptor_set_get(struct zink_context *ctx, if (pool->num_sets_allocated + pool->key.num_descriptors > ZINK_DEFAULT_MAX_DESCS) { batch = zink_flush_batch(ctx, batch); zink_batch_reference_program(batch, pg); - return zink_descriptor_set_get(ctx, batch, pg, type, is_compute, cache_hit); + return zink_descriptor_set_get(ctx, type, is_compute, cache_hit); } } else { if (pg->last_set[type] && !pg->last_set[type]->hash) { diff --git a/src/gallium/drivers/zink/zink_descriptors.h b/src/gallium/drivers/zink/zink_descriptors.h index a5cb3c480e5..7f00a66a22a 100644 --- a/src/gallium/drivers/zink/zink_descriptors.h +++ b/src/gallium/drivers/zink/zink_descriptors.h @@ -118,8 +118,6 @@ zink_resource_desc_set_add(struct zink_resource *res, struct zink_descriptor_set struct zink_descriptor_set * zink_descriptor_set_get(struct zink_context *ctx, - struct zink_batch *batch, - struct zink_program *pg, enum zink_descriptor_type type, bool is_compute, bool *cache_hit); diff --git a/src/gallium/drivers/zink/zink_draw.c b/src/gallium/drivers/zink/zink_draw.c index ebfcc37080c..979a15aab5e 100644 --- a/src/gallium/drivers/zink/zink_draw.c +++ b/src/gallium/drivers/zink/zink_draw.c @@ -266,14 +266,6 @@ get_gfx_program(struct zink_context *ctx) return ctx->curr_program; } -static struct zink_descriptor_set * -get_descriptor_set(struct zink_context *ctx, bool is_compute, enum zink_descriptor_type type, bool *cache_hit) -{ - struct zink_program *pg = is_compute ? (struct zink_program *)ctx->curr_compute : (struct zink_program *)ctx->curr_program; - struct zink_batch *batch = is_compute ? &ctx->compute_batch : zink_curr_batch(ctx); - return zink_descriptor_set_get(ctx, batch, pg, type, is_compute, cache_hit); -} - struct zink_transition { struct zink_resource *res; VkImageLayout layout; @@ -743,7 +735,7 @@ update_descriptors(struct zink_context *ctx, struct zink_screen *screen, bool is struct zink_descriptor_set *zds[ZINK_DESCRIPTOR_TYPES]; for (int h = 0; h < ZINK_DESCRIPTOR_TYPES; h++) { if (pg->pool[h]) - zds[h] = get_descriptor_set(ctx, is_compute, h, &cache_hit[h]); + zds[h] = zink_descriptor_set_get(ctx, h, is_compute, &cache_hit[h]); else zds[h] = NULL; }