+typedef void (*d3d12_command_list_handler)(struct d3d12_command_list *list, const void *data); + +struct draw_instanced_op +{ + d3d12_command_list_handler handler; + unsigned int vertex_count_per_instance; + unsigned int instance_count; + unsigned int start_vertex_location; + unsigned int start_instance_location; +};
Using a callback here works, but I'd prefer having explicit operation IDs.
+ header_size = offsetof(struct command_op_packet, data[0]); + packet_size = offsetof(struct command_op_packet, data[size]); + packet_size = (packet_size + header_size - 1) & ~(header_size - 1);
I.e., "packet_size = align(packet_size, header_size)".
+ new_size = command_heap->data_size + packet_size; + if (!vkd3d_array_reserve((void **)&command_heap->data, &command_heap->data_capacity, max(new_size, 1024u), 1)) + {
So we want this array to be at least 1024 bytes large. That seems somewhat speculative, but in any case, why not add a vkd3d_array_reserve() call to d3d12_command_heap_init() then? I'd also feel slightly better about this if "1024" was an appropriately named constant.