MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CopyBuffer

Method CopyBuffer

Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp:1496–1522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494}
1495
1496void GPUContextVulkan::CopyBuffer(GPUBuffer* dstBuffer, GPUBuffer* srcBuffer, uint32 size, uint32 dstOffset, uint32 srcOffset)
1497{
1498 ASSERT(dstBuffer && srcBuffer);
1499 const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer();
1500
1501 // Ensure to end active render pass
1502 if (cmdBuffer->IsInsideRenderPass())
1503 EndRenderPass();
1504
1505 auto dstBufferVulkan = static_cast<GPUBufferVulkan*>(dstBuffer);
1506 auto srcBufferVulkan = static_cast<GPUBufferVulkan*>(srcBuffer);
1507
1508 // Transition resources
1509 AddBufferBarrier(dstBufferVulkan, VK_ACCESS_TRANSFER_WRITE_BIT);
1510 AddBufferBarrier(srcBufferVulkan, VK_ACCESS_TRANSFER_READ_BIT);
1511 FlushBarriers();
1512
1513 VkBufferCopy bufferCopy;
1514 bufferCopy.srcOffset = srcOffset;
1515 bufferCopy.dstOffset = dstOffset;
1516 bufferCopy.size = size;
1517 vkCmdCopyBuffer(cmdBuffer->GetHandle(), srcBufferVulkan->GetHandle(), dstBufferVulkan->GetHandle(), 1, &bufferCopy);
1518
1519 // Memory transfer barrier to ensure buffer is ready to read (eg. by Draw or Dispatch)
1520 if (_pass == 0)
1521 AddMemoryBarrier();
1522}
1523
1524void GPUContextVulkan::UpdateTexture(GPUTexture* texture, int32 arrayIndex, int32 mipIndex, const void* data, uint32 rowPitch, uint32 slicePitch)
1525{

Callers 6

RenderInnerMethod · 0.45
RenderMethod · 0.45
saveStateMethod · 0.45
DrawEmittersGPUFunction · 0.45
CopyParticlesCountMethod · 0.45
PostSimMethod · 0.45

Calls 3

GetCmdBufferMethod · 0.80
IsInsideRenderPassMethod · 0.80
GetHandleMethod · 0.45

Tested by

no test coverage detected