diff --git a/include/QF/Vulkan/staging.h b/include/QF/Vulkan/staging.h index 60ba40d13..9abe5a48c 100644 --- a/include/QF/Vulkan/staging.h +++ b/include/QF/Vulkan/staging.h @@ -35,7 +35,8 @@ qfv_packet_t *QFV_PacketAcquire (qfv_stagebuf_t *stage); void *QFV_PacketExtend (qfv_packet_t *packet, size_t size); void QFV_PacketSubmit (qfv_packet_t *packet); struct qfv_bufferbarrier_s; -void QFV_PacketCopyBuffer (qfv_packet_t *packet, VkBuffer dstBuffer, +void QFV_PacketCopyBuffer (qfv_packet_t *packet, + VkBuffer dstBuffer, VkDeviceSize offset, const struct qfv_bufferbarrier_s *dstBarrier); struct qfv_imagebarrier_s; void QFV_PacketCopyImage (qfv_packet_t *packet, VkImage dstImage, diff --git a/libs/video/renderer/vulkan/staging.c b/libs/video/renderer/vulkan/staging.c index ca40eaab7..f7f0b10f6 100644 --- a/libs/video/renderer/vulkan/staging.c +++ b/libs/video/renderer/vulkan/staging.c @@ -284,20 +284,27 @@ QFV_PacketSubmit (qfv_packet_t *packet) } void -QFV_PacketCopyBuffer (qfv_packet_t *packet, VkBuffer dstBuffer, +QFV_PacketCopyBuffer (qfv_packet_t *packet, + VkBuffer dstBuffer, VkDeviceSize offset, const qfv_bufferbarrier_t *dstBarrier) { qfv_devfuncs_t *dfunc = packet->stage->device->funcs; qfv_bufferbarrier_t bb = bufferBarriers[qfv_BB_Unknown_to_TransferWrite]; bb.barrier.buffer = dstBuffer; + bb.barrier.offset = offset; bb.barrier.size = packet->length; dfunc->vkCmdPipelineBarrier (packet->cmd, bb.srcStages, bb.dstStages, 0, 0, 0, 1, &bb.barrier, 0, 0); - VkBufferCopy copy_region = { packet->offset, 0, packet->length }; + VkBufferCopy copy_region = { + .srcOffset = packet->offset, + .dstOffset = offset, + .size = packet->length, + }; dfunc->vkCmdCopyBuffer (packet->cmd, packet->stage->buffer, dstBuffer, 1, ©_region); bb = *dstBarrier; bb.barrier.buffer = dstBuffer; + bb.barrier.offset = offset; bb.barrier.size = packet->length; dfunc->vkCmdPipelineBarrier (packet->cmd, bb.srcStages, bb.dstStages, 0, 0, 0, 1, &bb.barrier, 0, 0); diff --git a/libs/video/renderer/vulkan/vulkan_draw.c b/libs/video/renderer/vulkan/vulkan_draw.c index 7e15731c2..d35bdf584 100644 --- a/libs/video/renderer/vulkan/vulkan_draw.c +++ b/libs/video/renderer/vulkan/vulkan_draw.c @@ -227,7 +227,7 @@ generate_quad_indices (qfv_stagebuf_t *staging, qfv_resobj_t *ind_buffer) // mark end of primitive *ind++ = -1; } - QFV_PacketCopyBuffer (packet, ind_buffer->buffer.buffer, + QFV_PacketCopyBuffer (packet, ind_buffer->buffer.buffer, 0, &bufferBarriers[qfv_BB_TransferWrite_to_IndexRead]); QFV_PacketSubmit (packet); } @@ -243,7 +243,7 @@ generate_slice_indices (qfv_stagebuf_t *staging, qfv_resobj_t *ind_buffer) ind[i + 18] = i + 8; } ind[8] = ind[17] = ~0; - QFV_PacketCopyBuffer (packet, ind_buffer->buffer.buffer, + QFV_PacketCopyBuffer (packet, ind_buffer->buffer.buffer, 0, &bufferBarriers[qfv_BB_TransferWrite_to_IndexRead]); QFV_PacketSubmit (packet); } @@ -1446,7 +1446,7 @@ Vulkan_Draw_AddFont (font_t *rfont, vulkan_ctx_t *ctx) .uv = {(u + w) * s, (v + h) * t }, }; } - QFV_PacketCopyBuffer (packet, glyph_data->buffer.buffer, + QFV_PacketCopyBuffer (packet, glyph_data->buffer.buffer, 0, &bufferBarriers[qfv_BB_TransferWrite_to_UniformRead]); QFV_PacketSubmit (packet); diff --git a/libs/video/renderer/vulkan/vulkan_translucent.c b/libs/video/renderer/vulkan/vulkan_translucent.c index e2e0d8f09..1a82b8321 100644 --- a/libs/video/renderer/vulkan/vulkan_translucent.c +++ b/libs/video/renderer/vulkan/vulkan_translucent.c @@ -292,7 +292,7 @@ translucent_clear (qfv_renderframe_t *rFrame) qfv_transtate_t *state = QFV_PacketExtend (packet, 2 * sizeof (*state)); *state = (qfv_transtate_t) { 0, tctx->maxFragments }; __auto_type bb = &bufferBarriers[qfv_BB_TransferWrite_to_ShaderRW]; - QFV_PacketCopyBuffer (packet, tframe->state, bb); + QFV_PacketCopyBuffer (packet, tframe->state, 0, bb); QFV_PacketSubmit (packet); }