MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / create

Method create

Source/Falcor/Core/API/ResourceViews.cpp:89–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89ref<ShaderResourceView> ShaderResourceView::create(
90 Device* pDevice,
91 Texture* pTexture,
92 uint32_t mostDetailedMip,
93 uint32_t mipCount,
94 uint32_t firstArraySlice,
95 uint32_t arraySize
96)
97{
98 FALCOR_CHECK(is_set(pTexture->getBindFlags(), ResourceBindFlags::ShaderResource), "Texture does not have SRV bind flag set.");
99 Slang::ComPtr<gfx::IResourceView> handle;
100 gfx::IResourceView::Desc desc = {};
101 desc.format = getGFXFormat(depthToColorFormat(pTexture->getFormat()));
102 desc.type = gfx::IResourceView::Type::ShaderResource;
103 desc.subresourceRange.baseArrayLayer = firstArraySlice;
104 desc.subresourceRange.layerCount = arraySize;
105 desc.subresourceRange.mipLevel = mostDetailedMip;
106 desc.subresourceRange.mipLevelCount = mipCount;
107 FALCOR_GFX_CALL(pDevice->getGfxDevice()->createTextureView(pTexture->getGfxTextureResource(), desc, handle.writeRef()));
108 return ref<ShaderResourceView>(new ShaderResourceView(pDevice, pTexture, handle, mostDetailedMip, mipCount, firstArraySlice, arraySize)
109 );
110}
111
112ref<ShaderResourceView> ShaderResourceView::create(Device* pDevice, Buffer* pBuffer, uint64_t offset, uint64_t size)
113{

Callers

nothing calls this directly

Calls 5

getGFXFormatFunction · 0.85
depthToColorFormatFunction · 0.85
getGFXResourceTypeFunction · 0.85
getFormatMethod · 0.80
writeRefMethod · 0.80

Tested by

no test coverage detected