| 646 | |
| 647 | |
| 648 | void Tr2PostProcessRenderer::Execute( |
| 649 | const Tr2TextureAL& destination, |
| 650 | Tr2GpuResourcePool::Texture sourceBuffer, |
| 651 | Tr2GpuResourcePool::Texture depthMap, |
| 652 | Tr2GpuResourcePool::Texture velocity, |
| 653 | Tr2GpuResourcePool::Texture opaqueColor, |
| 654 | EveSpaceScene* scene, |
| 655 | Tr2UpscalingContextAL* upscalingContext, |
| 656 | Tr2GpuResourcePool& gpuResourcePool, |
| 657 | Tr2RenderContext& renderContext ) |
| 658 | { |
| 659 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 660 | |
| 661 | if( !sourceBuffer.IsValid() ) |
| 662 | { |
| 663 | CCP_LOGERR( "Tr2PostProcessRenderer::Execute: Source buffer is invalid!" ); |
| 664 | return; |
| 665 | } |
| 666 | const auto renderSize = TextureSize2D{ sourceBuffer->GetWidth(), sourceBuffer->GetHeight() }; |
| 667 | auto displaySize = renderSize; |
| 668 | |
| 669 | GPU_REGION( renderContext, "Post-processing" ); |
| 670 | |
| 671 | Tr2PostProcess2Ptr postProcess = scene->GetPostProcess(); |
| 672 | |
| 673 | renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_FULLSCREEN ); |
| 674 | |
| 675 | renderContext.m_esm.PushRenderTarget(); |
| 676 | renderContext.m_esm.PushDepthStencilBuffer( Tr2TextureAL() ); |
| 677 | |
| 678 | const auto upscalingInfo = renderContext.GetPrimaryRenderContext().GetUpscalingInfo( upscalingContext ? upscalingContext->GetID() : Tr2UpscalingAL::INVALID_CONTEXT_ID ); |
| 679 | |
| 680 | auto upscalingEnabled = upscalingInfo.technique != Tr2UpscalingAL::NONE; |
| 681 | bool sharpeningRequired = !upscalingInfo.hasSharpening; |
| 682 | |
| 683 | Tr2GpuResourcePool::Texture output; |
| 684 | if( upscalingEnabled ) |
| 685 | { |
| 686 | displaySize = { upscalingInfo.displayWidth, upscalingInfo.displayHeight }; |
| 687 | |
| 688 | output = gpuResourcePool.GetTempTexture( "Final Result", displaySize, destination.GetFormat(), RENDER_TARGET ); |
| 689 | } |
| 690 | else |
| 691 | { |
| 692 | output = gpuResourcePool.GetTempTexture( "Final Result", displaySize, destination.GetFormat(), RENDER_TARGET ); |
| 693 | } |
| 694 | |
| 695 | // Always copy |
| 696 | auto nonMsaaSource = gpuResourcePool.GetTempTexture( "Pre-upscaling Composite", renderSize, sourceBuffer->GetFormat(), RENDER_TARGET ); |
| 697 | sourceBuffer->Resolve( nonMsaaSource, renderContext ); |
| 698 | |
| 699 | Tr2PPDynamicExposureEffect* dynamicExposure = nullptr; |
| 700 | Tr2GpuResourcePool::Buffer histogramBuffer; |
| 701 | |
| 702 | if( postProcess != nullptr ) |
| 703 | { |
| 704 | if( auto genericEffect = postProcess->GetGenericEffectIfAvailable( m_quality ) ) |
| 705 | { |
nothing calls this directly
no test coverage detected