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

Method RenderMainPass

trinity/Eve/EveSpaceScene.cpp:2682–2773  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Main rendering of foreground objects. --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2680// Main rendering of foreground objects.
2681// --------------------------------------------------------------------------------------
2682bool EveSpaceScene::RenderMainPass(
2683 const Tr2TextureAL& colorMap,
2684 const Tr2TextureAL& depthMap,
2685 const Tr2TextureAL& distortionMap,
2686 const Tr2TextureAL& velocityMap,
2687 const Tr2TextureAL& opaqueColorMap,
2688 Tr2GpuResourcePool& gpuResourcePool,
2689 Tr2RenderContext& renderContext )
2690{
2691 CCP_STATS_ZONE( __FUNCTION__ );
2692
2693 bool hasForegroundDistortionBatches = false;
2694
2695 renderContext.m_esm.BeginManagedRendering();
2696
2697 if( !m_display )
2698 {
2699 return hasForegroundDistortionBatches;
2700 }
2701
2702 renderContext.AddGpuMarker( __FUNCTION__ );
2703
2704 renderContext.SetReadOnlyDepth( true );
2705
2706 GPU_REGION( renderContext, "Color Pass" );
2707
2708 {
2709 GPU_REGION( renderContext, "Opaque" );
2710
2711 {
2712 if( velocityMap.IsValid() )
2713 {
2714 if( !m_velocityMapDirty )
2715 {
2716 ClearRenderTargetIfNoBatches( velocityMap, 1, renderContext, m_primaryBatches[TRIBATCHTYPE_OPAQUE]->GetBatchCount() );
2717 }
2718
2719 Tr2PushPopRT rt( velocityMap, renderContext, 1 );
2720 renderContext.RenderPassHint( { Tr2LoadAction::LOAD, Tr2StoreAction::STORE }, { m_velocityMapDirty ? Tr2LoadAction::LOAD : Tr2LoadAction::CLEAR, Tr2StoreAction::STORE }, { Tr2LoadAction::LOAD, Tr2StoreAction::STORE } );
2721 RenderOpaqueBatches( m_primaryBatches, renderContext );
2722 m_velocityMapDirty = true;
2723 }
2724 else
2725 {
2726 renderContext.RenderPassHint( { Tr2LoadAction::LOAD, Tr2StoreAction::STORE }, { Tr2LoadAction::LOAD, Tr2StoreAction::DONT_CARE } );
2727 RenderOpaqueBatches( m_primaryBatches, renderContext );
2728 }
2729 }
2730 }
2731
2732 if( opaqueColorMap.IsValid() )
2733 {
2734 renderContext.RenderPassHint( { Tr2LoadAction::DONT_CARE, Tr2StoreAction::STORE }, {} );
2735 renderContext.m_esm.PushDepthStencilBuffer( Tr2TextureAL() );
2736 renderContext.m_esm.PushRenderTarget( opaqueColorMap );
2737 renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_FULLSCREEN );
2738 Tr2Renderer::DrawTexture( renderContext, colorMap );
2739 renderContext.m_esm.PopRenderTarget();

Callers 1

ExecuteMethod · 0.80

Calls 15

GetGpuParticleSystemFunction · 0.85
BeginManagedRenderingMethod · 0.80
GetBatchCountMethod · 0.80
ApplyStandardStatesMethod · 0.80
PopDepthStencilBufferMethod · 0.80
RegisterVariableMethod · 0.80
EndManagedRenderingMethod · 0.80
Tr2TextureALClass · 0.50
AddGpuMarkerMethod · 0.45
SetReadOnlyDepthMethod · 0.45

Tested by

no test coverage detected