vkd3d-shader/ir: Introduce shader_instruction_array_append().

This commit is contained in:
Francisco Casas
2025-09-15 09:33:45 -03:00
committed by Henri Verbeet
parent b7a36fef6a
commit e935e06e23
Notes: Henri Verbeet 2025-09-29 13:04:35 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1739
2 changed files with 11 additions and 8 deletions

View File

@@ -502,6 +502,14 @@ bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *a
return true;
}
struct vkd3d_shader_instruction *shader_instruction_array_append(struct vkd3d_shader_instruction_array *array)
{
if (!shader_instruction_array_insert_at(array, array->count, 1))
return NULL;
return &array->elements[array->count - 1];
}
bool vsir_program_add_icb(struct vsir_program *program, struct vkd3d_shader_immediate_constant_buffer *icb)
{
if (!vkd3d_array_reserve((void **)&program->icbs, &program->icb_capacity,

View File

@@ -1428,9 +1428,9 @@ struct vkd3d_shader_instruction_array
size_t count;
};
struct vkd3d_shader_instruction *shader_instruction_array_append(struct vkd3d_shader_instruction_array *array);
bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions, size_t idx, size_t count);
bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, size_t reserve);
bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions,
size_t idx, size_t count);
struct vsir_program_iterator
{
@@ -1651,12 +1651,7 @@ bool vsir_instruction_init_with_params(struct vsir_program *program,
static inline struct vkd3d_shader_instruction *vsir_program_append(struct vsir_program *program)
{
struct vkd3d_shader_instruction_array *array = &program->instructions;
if (!shader_instruction_array_insert_at(array, array->count, 1))
return NULL;
return &array->elements[array->count - 1];
return shader_instruction_array_append(&program->instructions);
}
static inline struct vkd3d_shader_dst_param *vsir_program_get_dst_params(