mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 01:58:16 +02:00
util/set: set _mesa_set_init return type to void
it always returns true because it no longer allocates anything Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
This commit is contained in:
parent
34cfc2600f
commit
ed246aafd8
8 changed files with 27 additions and 52 deletions
|
|
@ -302,18 +302,13 @@ radv_cmd_buffer_finish_shader_part_cache(struct radv_cmd_buffer *cmd_buffer)
|
|||
_mesa_set_fini(&cmd_buffer->ps_epilogs, NULL);
|
||||
}
|
||||
|
||||
static bool
|
||||
static void
|
||||
radv_cmd_buffer_init_shader_part_cache(struct radv_device *device, struct radv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
if (device->vs_prologs.ops) {
|
||||
if (!_mesa_set_init(&cmd_buffer->vs_prologs, NULL, device->vs_prologs.ops->hash, device->vs_prologs.ops->equals))
|
||||
return false;
|
||||
}
|
||||
if (device->ps_epilogs.ops) {
|
||||
if (!_mesa_set_init(&cmd_buffer->ps_epilogs, NULL, device->ps_epilogs.ops->hash, device->ps_epilogs.ops->equals))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (device->vs_prologs.ops)
|
||||
_mesa_set_init(&cmd_buffer->vs_prologs, NULL, device->vs_prologs.ops->hash, device->vs_prologs.ops->equals);
|
||||
if (device->ps_epilogs.ops)
|
||||
_mesa_set_init(&cmd_buffer->ps_epilogs, NULL, device->ps_epilogs.ops->hash, device->ps_epilogs.ops->equals);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -386,11 +381,7 @@ radv_create_cmd_buffer(struct vk_command_pool *pool, VkCommandBufferLevel level,
|
|||
if (cmd_buffer->qf != RADV_QUEUE_SPARSE) {
|
||||
list_inithead(&cmd_buffer->upload.list);
|
||||
|
||||
if (!radv_cmd_buffer_init_shader_part_cache(device, cmd_buffer)) {
|
||||
radv_destroy_cmd_buffer(&cmd_buffer->vk);
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
}
|
||||
|
||||
radv_cmd_buffer_init_shader_part_cache(device, cmd_buffer);
|
||||
result = radv_create_cmd_stream(device, cmd_buffer->qf, cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY,
|
||||
&cmd_buffer->cs);
|
||||
if (result != VK_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -191,8 +191,7 @@ radv_device_init_vs_prologs(struct radv_device *device)
|
|||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
|
||||
if (!radv_shader_part_cache_init(&device->vs_prologs, &vs_prolog_ops))
|
||||
return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
radv_shader_part_cache_init(&device->vs_prologs, &vs_prolog_ops);
|
||||
|
||||
/* don't pre-compile prologs if we want to print them */
|
||||
if (instance->debug_flags & RADV_DEBUG_DUMP_PROLOGS)
|
||||
|
|
@ -1359,12 +1358,8 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
|||
device->vk.enabled_features.extendedDynamicState3ColorBlendEnable ||
|
||||
device->vk.enabled_features.extendedDynamicState3ColorWriteMask ||
|
||||
device->vk.enabled_features.extendedDynamicState3AlphaToCoverageEnable ||
|
||||
device->vk.enabled_features.extendedDynamicState3ColorBlendEquation) {
|
||||
if (!radv_shader_part_cache_init(&device->ps_epilogs, &ps_epilog_ops)) {
|
||||
result = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
device->vk.enabled_features.extendedDynamicState3ColorBlendEquation)
|
||||
radv_shader_part_cache_init(&device->ps_epilogs, &ps_epilog_ops);
|
||||
|
||||
if (pdev->info.has_graphics && !(instance->debug_flags & RADV_DEBUG_NO_IBS))
|
||||
radv_create_gfx_preamble(device);
|
||||
|
|
|
|||
|
|
@ -2870,14 +2870,12 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
radv_shader_part_cache_init(struct radv_shader_part_cache *cache, struct radv_shader_part_cache_ops *ops)
|
||||
{
|
||||
cache->ops = ops;
|
||||
if (!_mesa_set_init(&cache->entries, NULL, cache->ops->hash, cache->ops->equals))
|
||||
return false;
|
||||
_mesa_set_init(&cache->entries, NULL, cache->ops->hash, cache->ops->equals);
|
||||
simple_mtx_init(&cache->lock, mtx_plain);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ struct radv_shader_part *radv_create_ps_epilog(struct radv_device *device, const
|
|||
|
||||
void radv_shader_part_destroy(struct radv_device *device, struct radv_shader_part *shader_part);
|
||||
|
||||
bool radv_shader_part_cache_init(struct radv_shader_part_cache *cache, struct radv_shader_part_cache_ops *ops);
|
||||
void radv_shader_part_cache_init(struct radv_shader_part_cache *cache, struct radv_shader_part_cache_ops *ops);
|
||||
void radv_shader_part_cache_finish(struct radv_device *device, struct radv_shader_part_cache *cache);
|
||||
struct radv_shader_part *radv_shader_part_cache_get(struct radv_device *device, struct radv_shader_part_cache *cache,
|
||||
struct set *local_entries, const void *key);
|
||||
|
|
|
|||
|
|
@ -359,15 +359,14 @@ create_batch_state(struct zink_context *ctx)
|
|||
zink_label_cmd_buffer(ctx, screen->dev, cmdbufs[0], "zink cmdbuf");
|
||||
zink_label_cmd_buffer(ctx, screen->dev, cmdbufs[1], "zink barrier cmdbuf");
|
||||
|
||||
#define SET_CREATE_OR_FAIL(ptr) \
|
||||
if (!_mesa_set_init(ptr, bs, _mesa_hash_pointer, _mesa_key_pointer_equal)) \
|
||||
goto fail
|
||||
#define SET_CREATE(ptr) \
|
||||
_mesa_set_init(ptr, bs, _mesa_hash_pointer, _mesa_key_pointer_equal)
|
||||
|
||||
bs->ctx = ctx;
|
||||
|
||||
SET_CREATE_OR_FAIL(&bs->programs);
|
||||
SET_CREATE_OR_FAIL(&bs->active_queries);
|
||||
SET_CREATE_OR_FAIL(&bs->dmabuf_exports);
|
||||
SET_CREATE(&bs->programs);
|
||||
SET_CREATE(&bs->active_queries);
|
||||
SET_CREATE(&bs->dmabuf_exports);
|
||||
util_dynarray_init(&bs->signal_semaphores, NULL);
|
||||
util_dynarray_init(&bs->user_signal_semaphores, NULL);
|
||||
util_dynarray_init(&bs->user_signal_semaphore_values, NULL);
|
||||
|
|
|
|||
|
|
@ -1671,8 +1671,7 @@ zink_descriptor_layouts_init(struct zink_screen *screen)
|
|||
for (unsigned i = 0; i < ZINK_DESCRIPTOR_BASE_TYPES; i++) {
|
||||
if (!_mesa_hash_table_init(&screen->desc_set_layouts[i], screen, hash_descriptor_layout, equals_descriptor_layout))
|
||||
return false;
|
||||
if (!_mesa_set_init(&screen->desc_pool_keys[i], screen, hash_descriptor_pool_key, equals_descriptor_pool_key))
|
||||
return false;
|
||||
_mesa_set_init(&screen->desc_pool_keys[i], screen, hash_descriptor_pool_key, equals_descriptor_pool_key);
|
||||
}
|
||||
simple_mtx_init(&screen->desc_set_layouts_lock, mtx_plain);
|
||||
simple_mtx_init(&screen->desc_pool_keys_lock, mtx_plain);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ entry_is_present(struct set_entry *entry)
|
|||
return entry->key != NULL && entry->key != deleted_key;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_set_init(struct set *ht, void *mem_ctx,
|
||||
uint32_t (*key_hash_function)(const void *key),
|
||||
bool (*key_equals_function)(const void *a,
|
||||
|
|
@ -151,15 +151,12 @@ _mesa_set_init(struct set *ht, void *mem_ctx,
|
|||
memset(ht->table, 0, sizeof(ht->_initial_storage));
|
||||
ht->entries = 0;
|
||||
ht->deleted_entries = 0;
|
||||
|
||||
return ht->table != NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_pointer_set_init(struct set *ht, void *mem_ctx)
|
||||
{
|
||||
return _mesa_set_init(ht, mem_ctx, _mesa_hash_pointer,
|
||||
_mesa_key_pointer_equal);
|
||||
_mesa_set_init(ht, mem_ctx, _mesa_hash_pointer, _mesa_key_pointer_equal);
|
||||
}
|
||||
|
||||
/* It's preferred to use _mesa_set_init instead of this to skip ralloc. */
|
||||
|
|
@ -175,11 +172,7 @@ _mesa_set_create(void *mem_ctx,
|
|||
if (ht == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!_mesa_set_init(ht, ht, key_hash_function, key_equals_function)) {
|
||||
ralloc_free(ht);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_mesa_set_init(ht, ht, key_hash_function, key_equals_function);
|
||||
return ht;
|
||||
}
|
||||
|
||||
|
|
@ -196,10 +189,10 @@ key_u32_equals(const void *a, const void *b)
|
|||
return (uint32_t)(uintptr_t)a == (uint32_t)(uintptr_t)b;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_u32_set_init(struct set *ht, void *mem_ctx)
|
||||
{
|
||||
return _mesa_set_init(ht, mem_ctx, key_u32_hash, key_u32_equals);
|
||||
_mesa_set_init(ht, mem_ctx, key_u32_hash, key_u32_equals);
|
||||
}
|
||||
|
||||
/* key == 0 and key == deleted_key are not allowed */
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ struct set {
|
|||
*/
|
||||
};
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_set_init(struct set *ht, void *mem_ctx,
|
||||
uint32_t (*key_hash_function)(const void *key),
|
||||
bool (*key_equals_function)(const void *a,
|
||||
|
|
@ -74,10 +74,10 @@ void
|
|||
_mesa_set_fini(struct set *ht,
|
||||
void (*delete_function)(struct set_entry *entry));
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_pointer_set_init(struct set *ht, void *mem_ctx);
|
||||
|
||||
bool
|
||||
void
|
||||
_mesa_u32_set_init(struct set *ht, void *mem_ctx);
|
||||
|
||||
struct set *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue