Skip to content

Commit 78fc958

Browse files
remove leftover buffer downloads
1 parent 9e6a998 commit 78fc958

File tree

1 file changed

+1
-32
lines changed
  • examples_tests/39.DenoiserTonemapper

1 file changed

+1
-32
lines changed

examples_tests/39.DenoiserTonemapper/main.cpp

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int main(int argc, char* argv[])
6767
params.Vsync = true;
6868
params.Doublebuffer = true;
6969
params.Stencilbuffer = false;
70-
params.StreamingDownloadBufferSize = 2560*1024*1024;
70+
params.StreamingDownloadBufferSize = 1024*1024*1024; // for 16k images
7171
auto device = createDeviceEx(params);
7272

7373
if (check_error(!device,"Could not create Irrlicht Device!"))
@@ -837,37 +837,6 @@ void main()
837837
//input with RGB, Albedo, Normals
838838
OptixImage2D denoiserInputs[EII_COUNT];
839839
OptixImage2D denoiserOutput;
840-
841-
auto downloadStagingArea = driver->getDefaultDownStreamingBuffer();
842-
843-
constexpr uint64_t timeoutInNanoSeconds = 300000000000u;
844-
const auto waitPoint = std::chrono::high_resolution_clock::now() + std::chrono::nanoseconds(timeoutInNanoSeconds);
845-
846-
auto downloadAndGetBuffer = [&, downloadStagingArea](auto& optixGpuBuffer) -> core::smart_refctd_ptr<ICPUBuffer>
847-
{
848-
const video::VkMemoryRequirements& vulkanFetchedReqs = optixGpuBuffer.getObject()->getMemoryReqs().vulkanReqs;
849-
uint32_t address = std::remove_pointer<decltype(downloadStagingArea)>::type::invalid_address; // remember without initializing the address to be allocated to invalid_address you won't get an allocation!
850-
const uint32_t alignment = 4096u; // common page size
851-
const uint32_t size = vulkanFetchedReqs.size;
852-
auto unallocatedSize = downloadStagingArea->multi_alloc(waitPoint, 1u, &address, &size, &alignment);
853-
if (unallocatedSize)
854-
{
855-
os::Printer::log(makeImageIDString(i) + "Could not download the buffer from the GPU!", ELL_ERROR);
856-
return nullptr;
857-
}
858-
859-
driver->copyBuffer(optixGpuBuffer.getObject(), downloadStagingArea->getBuffer(), 0u, address, vulkanFetchedReqs.size);
860-
861-
auto downloadFence = driver->placeFence(true);
862-
863-
auto* data = reinterpret_cast<uint8_t*>(downloadStagingArea->getBufferPointer()) + address;
864-
return core::make_smart_refctd_ptr<asset::CCustomAllocatorCPUBuffer<core::null_allocator<uint8_t>>>(vulkanFetchedReqs.size, data, core::adopt_memory);
865-
866-
while (downloadFence->waitCPU(1000ull, downloadFence->canDeferredFlush()) == video::EDFR_TIMEOUT_EXPIRED) {}
867-
};
868-
869-
core::smart_refctd_ptr<ICPUBuffer> denoiserInputsTexelBuffer = downloadAndGetBuffer(temporaryPixelBuffer);
870-
core::smart_refctd_ptr<ICPUBuffer> denoiserOutputTexelBuffer = downloadAndGetBuffer(imagePixelBuffer);
871840

872841
for (size_t k = 0; k < denoiserInputCount; k++)
873842
{

0 commit comments

Comments
 (0)