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

Method RenderTaa

trinity/PostProcess/Tr2PostProcessRenderer.cpp:1435–1529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1433}
1434
1435void Tr2PostProcessRenderer::RenderTaa( const Tr2TextureAL& dest, const Tr2TextureAL& velocity, const Tr2TextureAL& opaqueColor, Tr2GpuResourcePool& gpuResourcePool, Tr2RenderContext& renderContext, Tr2PPTaaEffect* taa, Tr2PPDynamicExposureEffect* dynamicExposure )
1436{
1437 GPU_REGION( renderContext, "TAA" );
1438 renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_FULLSCREEN );
1439
1440 auto Clear = []( const Tr2TextureAL& tex, Tr2RenderContextAL& renderContext ) {
1441 renderContext.SetRenderTarget( tex, 0 );
1442 renderContext.Clear( Tr2RenderContextEnum::CLEARFLAGS_TARGET, 0, 1.0f );
1443 };
1444 auto ClearUav = []( const Tr2TextureAL& tex, Tr2RenderContextAL& renderContext ) {
1445 uint32_t zeroes[4] = {};
1446 renderContext.ClearUav( tex, 0, zeroes );
1447 };
1448
1449 auto accumulationBuffer0 = gpuResourcePool.GetPersistentTexture(
1450 "TAA Accumulation 0",
1451 dest.GetWidth(),
1452 dest.GetHeight(),
1453 Tr2RenderContextEnum::PIXEL_FORMAT_R16G16B16A16_UNORM,
1454 Tr2GpuUsage::RENDER_TARGET | Tr2GpuUsage::SHADER_RESOURCE,
1455 Clear );
1456 auto accumulationBuffer1 = gpuResourcePool.GetPersistentTexture(
1457 "TAA Accumulation 1",
1458 dest.GetWidth(),
1459 dest.GetHeight(),
1460 Tr2RenderContextEnum::PIXEL_FORMAT_R16G16B16A16_UNORM,
1461 Tr2GpuUsage::RENDER_TARGET | Tr2GpuUsage::SHADER_RESOURCE,
1462 Clear );
1463
1464 auto cooldownBuffer = gpuResourcePool.GetPersistentTexture(
1465 "TAA Cooldown",
1466 dest.GetWidth(),
1467 dest.GetHeight(),
1468 Tr2RenderContextEnum::PIXEL_FORMAT_R32_UINT,
1469 Tr2GpuUsage::UNORDERED_ACCESS | Tr2GpuUsage::SHADER_RESOURCE,
1470 ClearUav );
1471
1472
1473 Tr2TextureAL input;
1474 Tr2TextureAL output;
1475
1476 uint32_t frame_count = m_taaFrameCounter++;
1477 if( ( frame_count & 1 ) == 0 )
1478 {
1479 input = accumulationBuffer0;
1480 output = accumulationBuffer1;
1481 }
1482 else
1483 {
1484 input = accumulationBuffer1;
1485 output = accumulationBuffer0;
1486 }
1487
1488
1489 Tr2EffectPtr effects[] = { m_taaEffect, m_taaCopyEffect };
1490 for( auto& effect : effects )
1491 {
1492 if( dynamicExposure )

Callers

nothing calls this directly

Calls 12

DrawIntoFunction · 0.85
ApplyStandardStatesMethod · 0.80
GetPersistentTextureMethod · 0.80
SetOptionMethod · 0.80
SetRenderTargetMethod · 0.45
ClearMethod · 0.45
ClearUavMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45
SetParameterMethod · 0.45

Tested by

no test coverage detected