mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[vulkan] Make QFV_PacketCopyBuffer take destination offset
It's useful being able to update a subregion of a buffer (needed for the quad drawing changes).
This commit is contained in:
parent
b310ece7bd
commit
c8afad4d3d
4 changed files with 15 additions and 7 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue