Use pair of spans instead of references in copy command buffers function

This commit is contained in:
Anton Kovalev 2024-08-28 11:24:15 +02:00
parent 87ccfdfbbd
commit dfb30ea955
2 changed files with 9 additions and 5 deletions

View File

@ -569,7 +569,8 @@ Liverpool::Task Liverpool::ProcessCompute(std::span<const u32> acb, int vqid) {
TracyFiberLeave;
}
void Liverpool::CopyCmdBuffers(std::span<const u32>& dcb, std::span<const u32>& ccb) {
std::pair<std::span<const u32>, std::span<const u32>> Liverpool::CopyCmdBuffers(
std::span<const u32> dcb, std::span<const u32> ccb) {
auto& queue = mapped_queues[GfxQueueId];
queue.dcb_buffer.resize(
@ -594,13 +595,15 @@ void Liverpool::CopyCmdBuffers(std::span<const u32>& dcb, std::span<const u32>&
ccb = std::span<const u32>{queue.ccb_buffer.begin() + prev_ccb_buffer_offset,
queue.ccb_buffer.begin() + queue.ccb_buffer_offset};
}
return std::make_pair(dcb, ccb);
}
void Liverpool::SubmitGfx(std::span<const u32> dcb, std::span<const u32> ccb) {
auto& queue = mapped_queues[GfxQueueId];
if (Config::copyGPUCmdBuffers()) {
CopyCmdBuffers(dcb, ccb);
std::tie(dcb, ccb) = CopyCmdBuffers(dcb, ccb);
}
auto task = ProcessGraphics(dcb, ccb);

View File

@ -1111,7 +1111,8 @@ private:
Handle handle;
};
void CopyCmdBuffers(std::span<const u32>& dcb, std::span<const u32>& ccb);
std::pair<std::span<const u32>, std::span<const u32>> CopyCmdBuffers(std::span<const u32> dcb,
std::span<const u32> ccb);
Task ProcessGraphics(std::span<const u32> dcb, std::span<const u32> ccb);
Task ProcessCeUpdate(std::span<const u32> ccb);
Task ProcessCompute(std::span<const u32> acb, int vqid);
@ -1120,8 +1121,8 @@ private:
struct GpuQueue {
std::mutex m_access{};
std::atomic_uint32_t dcb_buffer_offset;
std::atomic_uint32_t ccb_buffer_offset;
std::atomic<u32> dcb_buffer_offset;
std::atomic<u32> ccb_buffer_offset;
std::vector<u32> dcb_buffer;
std::vector<u32> ccb_buffer;
std::queue<Task::Handle> submits{};