Function subresourceBarriers

Synopsis

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

bool subresourceBarriers(const Texture *pTexture, Resource::State newState, const ResourceViewInfo *pViewInfo)

Description

No description yet.

Source

Lines 112-144 in Source/Falcor/Core/API/CopyContext.cpp. Line 149 in Source/Falcor/Core/API/CopyContext.h.

bool CopyContext::subresourceBarriers(const Texture* pTexture, Resource::State newState, const ResourceViewInfo* pViewInfo)
{
    ResourceViewInfo fullResource;
    bool setGlobal = false;
    if (pViewInfo == nullptr)
    {
        fullResource.arraySize = pTexture->getArraySize();
        fullResource.firstArraySlice = 0;
        fullResource.mipCount = pTexture->getMipCount();
        fullResource.mostDetailedMip = 0;
        setGlobal = true;
        pViewInfo = &fullResource;
    }
    bool entireViewTransitioned = true;
    for (uint32_t a = pViewInfo->firstArraySlice; a < pViewInfo->firstArraySlice + pViewInfo->arraySize; a++)
    {
        for (uint32_t m = pViewInfo->mostDetailedMip; m < pViewInfo->mipCount + pViewInfo->mostDetailedMip; m++)
        {
            Resource::State oldState = pTexture->getSubresourceState(a, m);
            if (oldState != newState)
            {
                apiSubresourceBarrier(pTexture, newState, oldState, a, m);
                if (setGlobal == false) pTexture->setSubresourceState(a, m, newState);
                mCommandsPending = true;
            }
            else entireViewTransitioned = false;
        }
    }
    if (setGlobal) pTexture->setGlobalState(newState);
    return entireViewTransitioned;
}





Add Discussion as Guest

Log in to DocsForge