Function cleanup

Synopsis

#include <Source/Falcor/Core/API/Device.h>

void cleanup()

Description

Acts as the destructor for Device. Some resources use gpDevice in their cleanup. Cleaning up the SharedPtr directly would clear gpDevice before calling destructors.

Source

Lines 175-193 in Source/Falcor/Core/API/Device.cpp. Line 95 in Source/Falcor/Core/API/Device.h.

void Device::cleanup()
{
    toggleFullScreen(false);
    mpRenderContext->flush(true);
    // Release all the bound resources. Need to do that before deleting the RenderContext
    for (uint32_t i = 0; i < arraysize(mCmdQueues); i++) mCmdQueues[i].clear();
    for (uint32_t i = 0; i < kSwapChainBuffersCount; i++) mpSwapChainFbos[i].reset();
    mDeferredReleases = decltype(mDeferredReleases)();
    releaseNullViews();
    mpRenderContext.reset();
    mpUploadHeap.reset();
    mpCpuDescPool.reset();
    mpGpuDescPool.reset();
    mpFrameFence.reset();
    for (auto& heap : mTimestampQueryHeaps) heap.reset();
    destroyApiObjects();
    mpWindow.reset();
}





Add Discussion as Guest

Log in