| 49 | } |
| 50 | |
| 51 | void Tr2RenderNodeEffect::Execute( const Span<const Tr2TextureAL>& destinations, const Span<TempOutput>& outputs, Be::Time realTime, Be::Time simTime, const Tr2ProfileTimer& rootTimer, Tr2RenderContext& renderContext ) |
| 52 | { |
| 53 | std::vector<Tr2GpuResourcePool::Texture> tempTextures; |
| 54 | for( auto& source : m_sources ) |
| 55 | { |
| 56 | char nameBuffer[256]; |
| 57 | sprintf_s( nameBuffer, "Tr2RenderNodeUnaryEffect_Source_%u", uint32_t( tempTextures.size() ) ); |
| 58 | |
| 59 | auto width = destinations.data->GetWidth(); |
| 60 | auto height = destinations.data->GetHeight(); |
| 61 | if( m_viewport ) |
| 62 | { |
| 63 | width = std::max( 0, m_viewport->width ); |
| 64 | height = std::max( 0, m_viewport->height ); |
| 65 | } |
| 66 | |
| 67 | auto sourceTarget = GetGlobalGpuResourcePool().GetTempTexture( |
| 68 | nameBuffer, |
| 69 | width, |
| 70 | height, |
| 71 | destinations.data->GetFormat(), |
| 72 | Tr2GpuUsage::SHADER_RESOURCE | Tr2GpuUsage::RENDER_TARGET ); |
| 73 | |
| 74 | source.node->Execute( { &sourceTarget.Get(), 1 }, { source.outputs.data(), source.outputs.size() }, realTime, simTime, rootTimer, renderContext ); |
| 75 | |
| 76 | for( auto& param : source.params ) |
| 77 | { |
| 78 | if( param.outputName.empty() ) |
| 79 | { |
| 80 | m_effect->SetParameter( param.paramName, sourceTarget ); |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | m_effect->SetParameter( param.paramName, source.outputs[param.outputIndex].texture ); |
| 85 | } |
| 86 | } |
| 87 | tempTextures.push_back( sourceTarget ); |
| 88 | } |
| 89 | for( size_t i = 0; i < destinations.size; ++i ) |
| 90 | { |
| 91 | renderContext.m_esm.SetRenderTarget( uint32_t( i ), destinations[i] ); |
| 92 | } |
| 93 | renderContext.m_esm.SetDepthStencilBuffer( {} ); |
| 94 | renderContext.m_esm.SetFullScreenViewport(); |
| 95 | if( m_viewport ) |
| 96 | { |
| 97 | renderContext.m_esm.SetViewport( *m_viewport ); |
| 98 | } |
| 99 | renderContext.m_esm.ApplyStandardStates( m_renderingMode ); |
| 100 | Tr2Renderer::DrawTexture( renderContext, m_effect, { 0, 0 }, { 1, 1 } ); |
| 101 | for( auto& source : m_sources ) |
| 102 | { |
| 103 | for( auto& param : source.params ) |
| 104 | { |
| 105 | m_effect->SetParameter( param.paramName, Tr2TextureAL{} ); |
| 106 | } |
| 107 | } |
| 108 | for( auto& source : m_sources ) |
nothing calls this directly
no test coverage detected