MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / readBuffer

Method readBuffer

Source/Falcor/Core/API/CopyContext.cpp:551–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549}
550
551void CopyContext::readBuffer(const Buffer* pBuffer, void* pData, size_t offset, size_t numBytes)
552{
553 if (numBytes == 0)
554 numBytes = pBuffer->getSize() - offset;
555
556 if (pBuffer->adjustSizeOffsetParams(numBytes, offset) == false)
557 {
558 logWarning("CopyContext::readBuffer() - size and offset are invalid. Nothing to read.");
559 return;
560 }
561
562 const auto& pReadBackHeap = mpDevice->getReadBackHeap();
563
564 auto allocation = pReadBackHeap->allocate(numBytes);
565
566 bufferBarrier(pBuffer, Resource::State::CopySource);
567
568 auto resourceEncoder = getLowLevelData()->getResourceCommandEncoder();
569 resourceEncoder->copyBuffer(allocation.gfxBufferResource, allocation.offset, pBuffer->getGfxBufferResource(), offset, numBytes);
570 mCommandsPending = true;
571 submit(true);
572
573 std::memcpy(pData, allocation.pData, numBytes);
574
575 pReadBackHeap->release(allocation);
576}
577
578void CopyContext::copyBufferRegion(const Buffer* pDst, uint64_t dstOffset, const Buffer* pSrc, uint64_t srcOffset, uint64_t numBytes)
579{

Callers 1

getBlobMethod · 0.80

Calls 7

getLowLevelDataFunction · 0.85
logWarningFunction · 0.50
getSizeMethod · 0.45
allocateMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected