Function create

Synopsis

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

static SharedPtr create(ConstTextureSharedPtrRef pTexture, uint32_t mipLevel, uint32_t firstArraySlice, uint32_t arraySize)

Description

No description yet.

Source

Lines 329-353 in Source/Falcor/Core/API/D3D12/D3D12ResourceViews.cpp. Line 130 in Source/Falcor/Core/API/ResourceViews.h.

DepthStencilView::SharedPtr DepthStencilView::create(ConstTextureSharedPtrRef pTexture, uint32_t mipLevel, uint32_t firstArraySlice, uint32_t arraySize)
{
    if (!pTexture && getNullView()) return getNullView();
    D3D12_DEPTH_STENCIL_VIEW_DESC desc;
    Resource::ApiHandle resHandle = nullptr;
    if(pTexture)
    {
        desc = createDsvDesc(pTexture.get(), mipLevel, firstArraySlice, arraySize);
        resHandle = pTexture->getApiHandle();
    }
    else
    {
        desc = {};
        desc.Format = DXGI_FORMAT_D16_UNORM;
        desc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
    }
    DescriptorSet::Layout layout;
    layout.addRange(DescriptorSet::Type::Dsv, 0, 1);
    ApiHandle handle = DescriptorSet::create(gpDevice->getCpuDescriptorPool(), layout);
    gpDevice->getApiHandle()->CreateDepthStencilView(resHandle, &desc, handle->getCpuHandle(0));
    return SharedPtr(new DepthStencilView(pTexture, handle, mipLevel, firstArraySlice, arraySize));
}





Add Discussion as Guest

Log in to DocsForge