diff --git a/client/src/draw.c b/client/src/draw.c index 2e486d5..9f41c3f 100644 --- a/client/src/draw.c +++ b/client/src/draw.c @@ -94,6 +94,13 @@ VkResult draw_frame( VkDeviceSize src_offset = 0; for(uint32_t tid = 0; tid < transfer->count; tid++) { +#ifdef DEBUG_GPU_TRANSFERS + fprintf(stderr, "Transferring %lld bytes: ", transfer->infos[tid].size); + for(VkDeviceSize i = 0; i < transfer->infos[tid].size; i++) { + fprintf(stderr, "%02X", ((uint8_t*)transfer->mapped)[src_offset + i]); + } + fprintf(stderr, " to %p\n", transfer->infos[tid].buffer); +#endif command_copy_buffer( transfer_commands, transfer->buffer, diff --git a/client/src/gpu.c b/client/src/gpu.c index 36cb795..8de7ed1 100644 --- a/client/src/gpu.c +++ b/client/src/gpu.c @@ -1294,8 +1294,25 @@ VkResult add_transfer( VkDeviceSize src_offset = 0; for(uint32_t i = 0; i < transfer->count; i++) { - if(transfer->infos[i].buffer == buffer && transfer->infos[i].size == size && transfer->infos[i].offset == offset) { - memcpy(transfer->mapped + src_offset, data, size); +/* + +Adding size 32 write to 0x4b000000004b at offset 0 +size = 32, offset = 0, info->offset = 0 +Adding size 8 write to 0x4b000000004b at offset 44 +size = 8, offset = 44, info->offset = 0 +Transferring 32 bytes: 90605F3D228D5A448B925AC4C8FA45429E195A42E0EE36C4E0CA214400B07F3F to 0x4b000000004b + +*/ + + + VkDeviceSize diff = offset - transfer->infos[i].offset; + if(transfer->infos[i].buffer == buffer + && transfer->infos[i].offset <= offset + && transfer->infos[i].size >= (size + diff)) { +#ifdef DEBUG_GPU_TRANSFERS + fprintf(stderr, "Adding size %lld write to %p at offset %lld with diff %lld\n", size, buffer, src_offset + diff, diff); +#endif + memcpy(transfer->mapped + src_offset + diff, data, size); return VK_SUCCESS; } else { src_offset += transfer->infos[i].size;