Function findViewCommon

Summary

#include <Source/Falcor/Core/API/Buffer.cpp>

(1) template <typename ViewClass, typename ViewMapType>
    ViewClass::SharedPtr findViewCommon(Buffer *pBuffer, uint32_t firstElement, uint32_t elementCount, ViewMapType &viewMap, CreateFuncType< ViewClass > createFunc)

#include <Source/Falcor/Core/API/Texture.cpp>

(2) template <typename ViewClass, typename ViewMapType>
    ViewClass::SharedPtr findViewCommon(Texture *pTexture, uint32_t mostDetailedMip, uint32_t mipCount, uint32_t firstArraySlice, uint32_t arraySize, ViewMapType &viewMap, CreateFuncType< ViewClass > createFunc)

Function overload

Synopsis

#include <Source/Falcor/Core/API/Buffer.cpp>

template <typename ViewClass, typename ViewMapType>
ViewClass::SharedPtr findViewCommon(Buffer *pBuffer, uint32_t firstElement, uint32_t elementCount, ViewMapType &viewMap, CreateFuncType< ViewClass > createFunc)

Description

No description yet.

Source

Lines 197-208 in Source/Falcor/Core/API/Buffer.cpp.

template<typename ViewClass, typename ViewMapType>
typename ViewClass::SharedPtr findViewCommon(Buffer* pBuffer, uint32_t firstElement, uint32_t elementCount, ViewMapType& viewMap, CreateFuncType<ViewClass> createFunc)
{
    ResourceViewInfo view = ResourceViewInfo(firstElement, elementCount);
    if (viewMap.find(view) == viewMap.end())
    {
        viewMap[view] = createFunc(pBuffer, firstElement, elementCount);
    }
    return viewMap[view];
}

Synopsis

#include <Source/Falcor/Core/API/Texture.cpp>

template <typename ViewClass, typename ViewMapType>
ViewClass::SharedPtr findViewCommon(Texture *pTexture, uint32_t mostDetailedMip, uint32_t mipCount, uint32_t firstArraySlice, uint32_t arraySize, ViewMapType &viewMap, CreateFuncType< ViewClass > createFunc)

Description

No description yet.

Source

Lines 150-199 in Source/Falcor/Core/API/Texture.cpp.

template<typename ViewClass, typename ViewMapType>
typename ViewClass::SharedPtr findViewCommon(Texture* pTexture, uint32_t mostDetailedMip, uint32_t mipCount, uint32_t firstArraySlice, uint32_t arraySize, ViewMapType& viewMap, CreateFuncType<ViewClass> createFunc)
{
    uint32_t resMipCount = 1;
    uint32_t resArraySize = 1;
    resArraySize = pTexture->getArraySize();
    resMipCount = pTexture->getMipCount();
    if (firstArraySlice >= resArraySize)
    {
        logWarning("First array slice is OOB when creating resource view. Clamping");
        firstArraySlice = resArraySize - 1;
    }
    if (mostDetailedMip >= resMipCount)
    {
        logWarning("Most detailed mip is OOB when creating resource view. Clamping");
        mostDetailedMip = resMipCount - 1;
    }
    if (mipCount == Resource::kMaxPossible)
    {
        mipCount = resMipCount - mostDetailedMip;
    }
    else if (mipCount + mostDetailedMip > resMipCount)
    {
        logWarning("Mip count is OOB when creating resource view. Clamping");
        mipCount = resMipCount - mostDetailedMip;
    }
    if (arraySize == Resource::kMaxPossible)
    {
        arraySize = resArraySize - firstArraySlice;
    }
    else if (arraySize + firstArraySlice > resArraySize)
    {
        logWarning("Array size is OOB when creating resource view. Clamping");
        arraySize = resArraySize - firstArraySlice;
    }
    ResourceViewInfo view = ResourceViewInfo(mostDetailedMip, mipCount, firstArraySlice, arraySize);
    if (viewMap.find(view) == viewMap.end())
    {
        viewMap[view] = createFunc(pTexture, mostDetailedMip, mipCount, firstArraySlice, arraySize);
    }
    return viewMap[view];
}





Add Discussion as Guest

Log in