vkd3d-shader/ir: Allow adding to a block list without checking for duplicates.

This commit is contained in:
Giovanni Mascellani 2024-02-02 23:35:21 +01:00 committed by Alexandre Julliard
parent 75c019074a
commit 880d781b57
Notes: Alexandre Julliard 2024-03-08 23:47:19 +01:00
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/672

View File

@ -3032,14 +3032,8 @@ static void vsir_block_list_cleanup(struct vsir_block_list *list)
vkd3d_free(list->blocks);
}
static enum vkd3d_result vsir_block_list_add(struct vsir_block_list *list, struct vsir_block *block)
static enum vkd3d_result vsir_block_list_add_checked(struct vsir_block_list *list, struct vsir_block *block)
{
size_t i;
for (i = 0; i < list->count; ++i)
if (block == list->blocks[i])
return VKD3D_FALSE;
if (!vkd3d_array_reserve((void **)&list->blocks, &list->capacity, list->count + 1, sizeof(*list->blocks)))
{
ERR("Cannot extend block list.\n");
@ -3051,6 +3045,17 @@ static enum vkd3d_result vsir_block_list_add(struct vsir_block_list *list, struc
return VKD3D_OK;
}
static enum vkd3d_result vsir_block_list_add(struct vsir_block_list *list, struct vsir_block *block)
{
size_t i;
for (i = 0; i < list->count; ++i)
if (block == list->blocks[i])
return VKD3D_FALSE;
return vsir_block_list_add_checked(list, block);
}
struct vsir_block
{
unsigned int label;