vkd3d-shader/ir: Use size_t in the instruction array.

This commit is contained in:
Giovanni Mascellani
2025-07-22 10:08:44 +02:00
committed by Henri Verbeet
parent bb51b976df
commit 17ffd21113
Notes: Henri Verbeet 2025-07-23 17:30:32 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1638
2 changed files with 9 additions and 9 deletions

View File

@@ -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];

View File

@@ -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);
}