MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / Commit

Method Commit

Hydrogent/src/HnShadowMapManager.cpp:66–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void HnShadowMapManager::Commit(IRenderDevice* pDevice, IDeviceContext* pCtx)
67{
68 m_ShadowMapAtlas->Update(pDevice, pCtx);
69
70 const Uint32 AtlasVersion = m_ShadowMapAtlas->GetVersion();
71 if (AtlasVersion == m_AtlasVersion)
72 return;
73
74 m_DSVs.clear();
75
76 ITexture* pShadowTexture = m_ShadowMapAtlas->GetTexture();
77 if (pShadowTexture == nullptr)
78 {
79 UNEXPECTED("Shadow map atlas texture is null");
80 return;
81 }
82
83 const TextureDesc& SMDesc = pShadowTexture->GetDesc();
84 VERIFY_EXPR(m_DSVs.empty() || m_DSVs.size() == SMDesc.ArraySize);
85
86 if (m_DSVs.empty())
87 {
88 m_DSVs.resize(SMDesc.ArraySize);
89 for (Uint32 Slice = 0; Slice < SMDesc.ArraySize; ++Slice)
90 {
91 std::string Name = std::string{"Shadow map DSV for slice "} + std::to_string(Slice);
92
93 TextureViewDesc DSVDesc;
94 DSVDesc.Name = Name.c_str();
95 DSVDesc.ViewType = TEXTURE_VIEW_DEPTH_STENCIL;
96 DSVDesc.Format = SMDesc.Format;
97 DSVDesc.TextureDim = SMDesc.Type;
98 DSVDesc.NumArraySlices = 1;
99 DSVDesc.FirstArraySlice = Slice;
100 DSVDesc.MostDetailedMip = 0;
101 DSVDesc.NumMipLevels = 1;
102 RefCntAutoPtr<ITextureView> pDSV;
103 pShadowTexture->CreateView(DSVDesc, &pDSV);
104 VERIFY_EXPR(pDSV);
105 m_DSVs[Slice] = std::move(pDSV);
106 }
107 }
108
109 m_AtlasVersion = AtlasVersion;
110}
111
112const TextureDesc& HnShadowMapManager::GetAtlasDesc() const
113{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected