Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions trinity/Eve/EveSpaceSceneRenderDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ EveSpaceSceneRenderDriver::Features EveSpaceSceneRenderDriver::Features::Main()
features.velocityMap = true;
features.background = true;
features.overlay = true;
features.customStencil = true;
return features;
}

Expand All @@ -350,6 +351,7 @@ EveSpaceSceneRenderDriver::Features EveSpaceSceneRenderDriver::Features::Reflect
features.velocityMap = false;
features.background = false;
features.overlay = false;
features.customStencil = false;
return features;
}

Expand Down Expand Up @@ -587,6 +589,8 @@ void EveSpaceSceneRenderDriver::Execute( const Span<const Tr2TextureAL>& destina

renderContext.m_esm.SetRenderTarget( 0, *destinations.data );
renderContext.m_esm.SetDepthStencilBuffer( {} );
GlobalStore().RegisterVariable( "SpaceSceneCustomStencil", targets.customStencil );
ON_BLOCK_EXIT( [&] { GlobalStore().RegisterVariable( "SpaceSceneCustomStencil", Tr2TextureAL{} ); } );

{
TimeSection postProcessSection( m_timers.postProcess, "PostProcess", rootTimer, renderContext );
Expand Down Expand Up @@ -730,13 +734,13 @@ EveSpaceSceneRenderDriver::ViewTargets EveSpaceSceneRenderDriver::RenderView( co
distortionMap = {};

Tr2GpuResourcePool::Texture normalMap = GetNormalMapIfNeeded( renderSize, outputs, view.features );
Tr2GpuResourcePool::Texture customStencil = GetCustomStencilMapIfNeeded( renderSize, outputs );
targets.customStencil = GetCustomStencilMapIfNeeded( renderSize, outputs, view.features );
{
TimeSection depthPassSection( timers.depthPass, "DepthPass", rootTimer, renderContext );
m_scene->RenderDepthPass( depthBuffer, normalMap, customStencil, view.scene, renderContext, m_depthPassTechnique );
m_scene->RenderDepthPass( depthBuffer, normalMap, targets.customStencil, view.scene, renderContext, m_depthPassTechnique );
}
GlobalStore().RegisterVariable( "SpaceSceneNormalMap", normalMap );
GlobalStore().RegisterVariable( "SpaceSceneCustomStencil", customStencil );
GlobalStore().RegisterVariable( "SpaceSceneCustomStencil", targets.customStencil );
ON_BLOCK_EXIT( [&] { GlobalStore().RegisterVariable( "SpaceSceneCustomStencil", Tr2TextureAL{} ); } );

EveSpaceScene::ShadowResources shadowResources;
Expand Down Expand Up @@ -987,10 +991,10 @@ Tr2GpuResourcePool::Texture EveSpaceSceneRenderDriver::GetNormalMapIfNeeded( con
return {};
}

Tr2GpuResourcePool::Texture EveSpaceSceneRenderDriver::GetCustomStencilMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs )
Tr2GpuResourcePool::Texture EveSpaceSceneRenderDriver::GetCustomStencilMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs, const Features& featureSet )
{
auto namedOutput = FindNamedOutput( outputs, "CustomStencilMap" );
if( m_customStencilFormat != ImageIO::PIXEL_FORMAT_UNKNOWN || namedOutput )
if( ( featureSet.customStencil && m_customStencilFormat != ImageIO::PIXEL_FORMAT_UNKNOWN ) || namedOutput )
{
auto texture = m_gpuResourcePool.GetTempTexture( "customStencil", size, m_customStencilFormat, Tr2GpuUsage::RENDER_TARGET | Tr2GpuUsage::SHADER_RESOURCE );
if( namedOutput )
Expand Down
5 changes: 4 additions & 1 deletion trinity/Eve/EveSpaceSceneRenderDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ BLUE_CLASS( EveSpaceSceneRenderDriver ) :
bool background = false;
// special overlay rendering (f.ex texture overlay)
bool overlay = false;
// custom stencil target written in the depth pre-pass
bool customStencil = false;

static Features Main();
static Features ReflectionFace();
Expand Down Expand Up @@ -137,6 +139,7 @@ BLUE_CLASS( EveSpaceSceneRenderDriver ) :
Tr2GpuResourcePool::Texture depth;
Tr2GpuResourcePool::Texture velocity;
Tr2GpuResourcePool::Texture opaqueColor;
Tr2GpuResourcePool::Texture customStencil;
};

// The faces the reflection probe renders in a frame, built before the lights are gathered
Expand Down Expand Up @@ -166,7 +169,7 @@ BLUE_CLASS( EveSpaceSceneRenderDriver ) :
Tr2GpuResourcePool::Texture GetDistortionMapIfNeeded( const TextureSize2D& size, bool distortion );
Tr2GpuResourcePool::Texture GetVelocityMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs, const Features& featureSet );
Tr2GpuResourcePool::Texture GetNormalMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs, const Features& featureSet );
Tr2GpuResourcePool::Texture GetCustomStencilMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs );
Tr2GpuResourcePool::Texture GetCustomStencilMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs, const Features& featureSet );
Tr2GpuResourcePool::Texture GetOpaqueColorMapIfNeeded( const TextureSize2D& size, const Span<TempOutput>& outputs, const Features& featureSet );

void UpdateGpuParticleSystem( Tr2RenderContext& renderContext );
Expand Down
Loading