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

Function ProcessCubemapFaces

PBR/src/PBR_Renderer.cpp:211–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210template <typename FaceHandlerType>
211void ProcessCubemapFaces(IDeviceContext* pCtx, ITexture* pCubemap, FaceHandlerType&& FaceHandler)
212{
213 const auto& CubemapDesc = pCubemap->GetDesc();
214 for (Uint32 mip = 0; mip < CubemapDesc.MipLevels; ++mip)
215 {
216 for (Uint32 face = 0; face < 6; ++face)
217 {
218 const std::string Name = "RTV for face " + std::to_string(face) + " mip " + std::to_string(mip) + " of cubemap '" + CubemapDesc.Name + "'";
219 TextureViewDesc RTVDesc{Name.c_str(), TEXTURE_VIEW_RENDER_TARGET, RESOURCE_DIM_TEX_2D_ARRAY};
220 RTVDesc.MostDetailedMip = mip;
221 RTVDesc.FirstArraySlice = face;
222 RTVDesc.NumArraySlices = 1;
223 RefCntAutoPtr<ITextureView> pRTV;
224 pCubemap->CreateView(RTVDesc, &pRTV);
225 VERIFY_EXPR(pCubemap);
226
227 ITextureView* ppRTVs[] = {pRTV};
228 pCtx->SetRenderTargets(_countof(ppRTVs), ppRTVs, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
229 FaceHandler(pRTV, mip, face);
230 }
231 }
232}
233
234static void ClearCubemap(IDeviceContext* pCtx, ITexture* pCubemap)
235{

Callers 2

ClearCubemapFunction · 0.85
PrecomputeCubemapsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected