From 17ffd211139773890198d6e9d16d5224a59a6c46 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 22 Jul 2025 10:08:44 +0200 Subject: [PATCH] vkd3d-shader/ir: Use size_t in the instruction array. --- libs/vkd3d-shader/vkd3d_shader_main.c | 8 ++++---- libs/vkd3d-shader/vkd3d_shader_private.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index a6b748402..06c693bcb 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -2234,7 +2234,7 @@ void *shader_param_allocator_get(struct vkd3d_shader_param_allocator *allocator, return params; } -bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve) +bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, size_t reserve) { memset(instructions, 0, sizeof(*instructions)); /* Size the parameter initial allocations so they are large enough for most shaders. The @@ -2245,7 +2245,7 @@ bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instru return shader_instruction_array_reserve(instructions, reserve); } -bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve) +bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, size_t reserve) { if (!vkd3d_array_reserve((void **)&instructions->elements, &instructions->capacity, reserve, sizeof(*instructions->elements))) @@ -2257,7 +2257,7 @@ bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *ins } bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions, - unsigned int idx, unsigned int count) + size_t idx, size_t count) { VKD3D_ASSERT(idx <= instructions->count); @@ -2347,7 +2347,7 @@ static struct vkd3d_shader_src_param *shader_instruction_array_clone_src_params( /* NOTE: Immediate constant buffers are not cloned, so the source must not be destroyed while the * destination is in use. This seems like a reasonable requirement given how this is currently used. */ bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions, - unsigned int dst, unsigned int src) + size_t dst, size_t src) { struct vkd3d_shader_instruction *ins = &instructions->elements[dst]; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 1c72f09ea..a1de5d59d 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1413,14 +1413,14 @@ struct vkd3d_shader_instruction_array struct vkd3d_shader_src_param *outpointid_param; }; -bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve); -bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve); +bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, size_t reserve); +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, - unsigned int idx, unsigned int count); + size_t idx, size_t count); bool shader_instruction_array_add_icb(struct vkd3d_shader_instruction_array *instructions, struct vkd3d_shader_immediate_constant_buffer *icb); bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions, - unsigned int dst, unsigned int src); + size_t dst, size_t src); void shader_instruction_array_destroy(struct vkd3d_shader_instruction_array *instructions); struct vsir_program_iterator @@ -1463,7 +1463,7 @@ static inline struct vkd3d_shader_instruction *vsir_program_iterator_next( /* When insertion takes place, argument `it' is updated to point to the same * instruction as before the insertion, but all other iterators and pointers * to the same container are invalidated and cannot be used any more. */ -static inline bool vsir_program_iterator_insert_after(struct vsir_program_iterator *it, unsigned int count) +static inline bool vsir_program_iterator_insert_after(struct vsir_program_iterator *it, size_t count) { return shader_instruction_array_insert_at(it->array, it->idx + 1, count); }