MCPcopy Create free account
hub / github.com/carbonengine/trinity / PrepareShadowRendering

Method PrepareShadowRendering

trinity/Tr2ShadowMap.cpp:226–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226Tr2GpuResourcePool::Texture Tr2ShadowMap::PrepareShadowRendering( Tr2GpuResourcePool& gpuResourcePool, Tr2RenderContext& renderContext )
227{
228 CCP_STATS_ZONE( __FUNCTION__ );
229
230 auto cascadedShadowDepth = gpuResourcePool.GetTempTexture( "cascadedShadowDepth", m_size * m_width, m_size * m_height, PixelFormat::PIXEL_FORMAT_D32_FLOAT, Tr2GpuUsage::DEPTH_STENCIL | Tr2GpuUsage::SHADER_RESOURCE );
231
232 if( !cascadedShadowDepth.IsValid() )
233 {
234 // This could happen if device is lost
235 return {};
236 }
237
238 // Using depth stencil as shadow map
239 renderContext.m_esm.PushViewport();
240 renderContext.m_esm.PushRenderTarget( Tr2TextureAL() ); //empty texture
241 renderContext.m_esm.PushDepthStencilBuffer( cascadedShadowDepth );
242
243 renderContext.m_esm.UpdateRenderTargetViewport( cascadedShadowDepth->GetWidth(), cascadedShadowDepth->GetHeight() );
244
245 // we want a clean depth buffer for this
246 CR( renderContext.Clear( CLEARFLAGS_ZBUFFER, 0xffffffff, 1, 0 ) );
247
248 renderContext.SetReadOnlyDepth( false );
249
250 return cascadedShadowDepth;
251}
252
253void Tr2ShadowMap::BeginShadowRendering( Tr2RenderContext& renderContext, int splitIndex )
254{

Callers 1

SetupCascadedShadowsMethod · 0.80

Calls 11

GetTempTextureMethod · 0.80
PushViewportMethod · 0.80
Tr2TextureALClass · 0.70
IsValidMethod · 0.45
PushRenderTargetMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45
ClearMethod · 0.45
SetReadOnlyDepthMethod · 0.45

Tested by

no test coverage detected