vkd3d-shader/tpf: Use iterators in tpf_write_program().

This commit is contained in:
Giovanni Mascellani
2025-07-21 21:43:52 +02:00
committed by Henri Verbeet
parent 0789578175
commit 7e76e62db7
Notes: Henri Verbeet 2025-07-22 17:21:09 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1635

View File

@@ -4334,20 +4334,23 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
}
}
static void tpf_write_program(struct tpf_compiler *tpf, const struct vsir_program *program)
static void tpf_write_program(struct tpf_compiler *tpf, struct vsir_program *program)
{
unsigned int i;
struct vsir_program_iterator it = vsir_program_iterator(&program->instructions);
struct vkd3d_shader_instruction *ins;
if (tpf->program->shader_version.type == VKD3D_SHADER_TYPE_COMPUTE)
tpf_dcl_thread_group(tpf, &tpf->program->thread_group_size);
for (i = 0; i < program->instructions.count; ++i)
tpf_handle_instruction(tpf, &program->instructions.elements[i]);
for (ins = vsir_program_iterator_head(&it); ins; ins = vsir_program_iterator_next(&it))
{
tpf_handle_instruction(tpf, ins);
}
}
static void tpf_write_shdr(struct tpf_compiler *tpf)
{
const struct vsir_program *program = tpf->program;
struct vsir_program *program = tpf->program;
const struct vkd3d_shader_version *version;
struct vkd3d_bytecode_buffer buffer = {0};
size_t token_count_position;