mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Don't use atlas for interactions that didn't fit into the atlas
This commit is contained in:
parent
98368669fa
commit
d6a43278db
8 changed files with 50 additions and 19 deletions
|
@ -353,6 +353,11 @@ public:
|
|||
return stats_backend.gpuAmbientPassMicroSec;
|
||||
}
|
||||
|
||||
uint64 GetRendererGpuShadowAtlasPassMicroseconds() const
|
||||
{
|
||||
return stats_backend.gpuShadowAtlasPassMicroSec;
|
||||
}
|
||||
|
||||
uint64 GetRendererGpuInteractionsMicroseconds() const
|
||||
{
|
||||
return stats_backend.gpuInteractionsMicroSec;
|
||||
|
|
|
@ -288,6 +288,7 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
const uint64 rendererGPU_SSAOTime = commonLocal.GetRendererGpuSSAOMicroseconds();
|
||||
const uint64 rendererGPU_SSRTime = commonLocal.GetRendererGpuSSRMicroseconds();
|
||||
const uint64 rendererGPUAmbientPassTime = commonLocal.GetRendererGpuAmbientPassMicroseconds();
|
||||
const uint64 rendererGPUShadowAtlasPassTime = commonLocal.GetRendererGpuShadowAtlasPassMicroseconds();
|
||||
const uint64 rendererGPUInteractionsTime = commonLocal.GetRendererGpuInteractionsMicroseconds();
|
||||
const uint64 rendererGPUShaderPassesTime = commonLocal.GetRendererGpuShaderPassMicroseconds();
|
||||
const uint64 rendererGPUPostProcessingTime = commonLocal.GetRendererGpuPostProcessingMicroseconds();
|
||||
|
@ -308,12 +309,12 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
{
|
||||
// start smaller
|
||||
int32 statsWindowWidth = 320;
|
||||
int32 statsWindowHeight = 260;
|
||||
int32 statsWindowHeight = 270;
|
||||
|
||||
if( com_showFPS.GetInteger() > 2 )
|
||||
{
|
||||
statsWindowWidth = 550;
|
||||
statsWindowHeight = 370;
|
||||
statsWindowWidth += 230;
|
||||
statsWindowHeight += 110;
|
||||
}
|
||||
|
||||
ImVec2 pos;
|
||||
|
@ -429,9 +430,10 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
ImGui::TextColored( gameThreadTotalTime > maxTime ? colorRed : colorWhite, "Game+RF: %5llu us EarlyZ: %5llu us", gameThreadTotalTime, rendererGPUEarlyZTime );
|
||||
ImGui::TextColored( gameThreadGameTime > maxTime ? colorRed : colorWhite, "Game: %5llu us SSAO: %5llu us", gameThreadGameTime, rendererGPU_SSAOTime );
|
||||
ImGui::TextColored( gameThreadRenderTime > maxTime ? colorRed : colorWhite, "RF: %5llu us SSR: %5llu us", gameThreadRenderTime, rendererGPU_SSRTime );
|
||||
ImGui::TextColored( rendererBackEndTime > maxTime ? colorRed : colorWhite, "RB: %5llu us AmbientPass: %5llu us", rendererBackEndTime, rendererGPUAmbientPassTime );
|
||||
ImGui::TextColored( rendererBackEndTime > maxTime ? colorRed : colorWhite, "RB: %5llu us Ambient Pass: %5llu us", rendererBackEndTime, rendererGPUAmbientPassTime );
|
||||
ImGui::TextColored( rendererShadowsTime > maxTime ? colorRed : colorWhite, " Shadow Atlas: %5llu us", rendererGPUShadowAtlasPassTime );
|
||||
ImGui::TextColored( rendererShadowsTime > maxTime ? colorRed : colorWhite, "Shadows: %5llu us Interactions: %5llu us", rendererShadowsTime, rendererGPUInteractionsTime );
|
||||
ImGui::TextColored( rendererGPUShaderPassesTime > maxTime ? colorRed : colorWhite, " ShaderPass: %5llu us", rendererGPUShaderPassesTime );
|
||||
ImGui::TextColored( rendererGPUShaderPassesTime > maxTime ? colorRed : colorWhite, " Shader Pass: %5llu us", rendererGPUShaderPassesTime );
|
||||
ImGui::TextColored( rendererGPUPostProcessingTime > maxTime ? colorRed : colorWhite, " PostFX: %5llu us", rendererGPUPostProcessingTime );
|
||||
ImGui::TextColored( totalCPUTime > maxTime || rendererGPUTime > maxTime ? colorRed : colorWhite,
|
||||
"Total: %5llu us Total: %5llu us", totalCPUTime, rendererGPUTime );
|
||||
|
|
|
@ -293,7 +293,7 @@ void RectAllocatorBinPack2D( const idList<idVec2i>& inputSizes, const idStrList&
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
for( binpack2d_iterator itor = remainder.Get().begin(); itor != remainder.Get().end(); itor++ )
|
||||
{
|
||||
const BinPack2D::Content<MyContent>& content = *itor;
|
||||
|
@ -309,4 +309,5 @@ void RectAllocatorBinPack2D( const idList<idVec2i>& inputSizes, const idStrList&
|
|||
content.size.w,
|
||||
content.size.h );
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -759,20 +759,22 @@ StorageSize
|
|||
*/
|
||||
int idImage::StorageSize() const
|
||||
{
|
||||
|
||||
if( !IsLoaded() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int baseSize = opts.width * opts.height;
|
||||
if( opts.numLevels > 1 )
|
||||
|
||||
size_t baseSize = opts.width * opts.height;
|
||||
if( opts.numLevels > 1 && !opts.isRenderTarget )
|
||||
{
|
||||
baseSize *= 4;
|
||||
baseSize /= 3;
|
||||
}
|
||||
|
||||
baseSize *= BitsForFormat( opts.format );
|
||||
baseSize /= 8;
|
||||
return baseSize;
|
||||
|
||||
return int( baseSize );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -835,11 +837,14 @@ void idImage::Print() const
|
|||
NAME_FORMAT( RGBA16F );
|
||||
NAME_FORMAT( RGBA32F );
|
||||
NAME_FORMAT( R32F );
|
||||
NAME_FORMAT( R8 );
|
||||
NAME_FORMAT( R11G11B10F );
|
||||
// RB end
|
||||
NAME_FORMAT( DEPTH );
|
||||
NAME_FORMAT( DEPTH_STENCIL );
|
||||
NAME_FORMAT( X16 );
|
||||
NAME_FORMAT( Y16_X16 );
|
||||
NAME_FORMAT( SRGB8 );
|
||||
default:
|
||||
common->Printf( "<%3i>", opts.format );
|
||||
break;
|
||||
|
|
|
@ -1229,7 +1229,7 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
|
|||
}
|
||||
else
|
||||
{
|
||||
if( r_useShadowMapping.GetBool() && din->vLight->globalShadows )
|
||||
if( r_useShadowMapping.GetBool() && din->vLight->globalShadows && din->vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
// RB: we have shadow mapping enabled and shadow maps so do a shadow compare
|
||||
|
||||
|
@ -1297,7 +1297,7 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
|
|||
}
|
||||
else
|
||||
{
|
||||
if( r_useShadowMapping.GetBool() && din->vLight->globalShadows )
|
||||
if( r_useShadowMapping.GetBool() && din->vLight->globalShadows && din->vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
// RB: we have shadow mapping enabled and shadow maps so do a shadow compare
|
||||
|
||||
|
@ -1498,7 +1498,7 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
bool lightDepthBoundsDisabled = false;
|
||||
|
||||
// RB begin
|
||||
if( r_useShadowMapping.GetBool() )
|
||||
if( r_useShadowMapping.GetBool() && vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
const static int JITTER_SIZE = 128;
|
||||
|
||||
|
@ -1736,7 +1736,7 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
SetVertexParm( RENDERPARM_LIGHTFALLOFF_S, lightProjection[3].ToFloatPtr() );
|
||||
|
||||
// RB begin
|
||||
if( r_useShadowMapping.GetBool() )
|
||||
if( r_useShadowMapping.GetBool() && vLight->ImageAtlasPlaced() )
|
||||
{
|
||||
if( vLight->parallel )
|
||||
{
|
||||
|
@ -3380,7 +3380,7 @@ void idRenderBackend::ShadowMapPassFast( const drawSurf_t* drawSurfs, viewLight_
|
|||
|
||||
if( atlas )
|
||||
{
|
||||
//globalFramebuffers.shadowAtlasFBO->Bind();
|
||||
globalFramebuffers.shadowAtlasFBO->Bind();
|
||||
|
||||
// TODO light offset in atlas
|
||||
|
||||
|
@ -3434,7 +3434,7 @@ void idRenderBackend::ShadowMapPassFast( const drawSurf_t* drawSurfs, viewLight_
|
|||
for( const drawSurf_t* drawSurf = drawSurfs; drawSurf != NULL; drawSurf = drawSurf->nextOnLight )
|
||||
{
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
// make sure the shadow occluder geometry is done
|
||||
if( drawSurf->shadowVolumeState != SHADOWVOLUME_DONE )
|
||||
{
|
||||
|
@ -3945,8 +3945,8 @@ void idRenderBackend::ShadowAtlasPass( const viewDef_t* _viewDef )
|
|||
continue;
|
||||
}
|
||||
|
||||
const idMaterial* lightShader = vLight->lightShader;
|
||||
renderLog.OpenBlock( lightShader->GetName(), colorMdGrey );
|
||||
//const idMaterial* lightShader = vLight->lightShader;
|
||||
//renderLog.OpenBlock( lightShader->GetName(), colorMdGrey );
|
||||
|
||||
// set the depth bounds for the whole light
|
||||
if( useLightDepthBounds )
|
||||
|
@ -3983,6 +3983,8 @@ void idRenderBackend::ShadowAtlasPass( const viewDef_t* _viewDef )
|
|||
vLight->imageSize.x = shadowMapResolutions[ vLight->shadowLOD ];
|
||||
vLight->imageSize.y = shadowMapResolutions[ vLight->shadowLOD ];
|
||||
|
||||
bool imageFitsIntoAtlas = true;
|
||||
|
||||
for( ; side < sideStop ; side++ )
|
||||
{
|
||||
int slice = Max( 0, side );
|
||||
|
@ -3995,13 +3997,19 @@ void idRenderBackend::ShadowAtlasPass( const viewDef_t* _viewDef )
|
|||
if( vLight->imageAtlasOffset[ slice ].x == -1 || vLight->imageAtlasOffset[ slice ].y == -1 )
|
||||
{
|
||||
// didn't fit into atlas anymore
|
||||
imageFitsIntoAtlas = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
ShadowMapPassFast( vLight->globalShadows, vLight, side, true );
|
||||
}
|
||||
|
||||
renderLog.CloseBlock();
|
||||
if( !imageFitsIntoAtlas )
|
||||
{
|
||||
vLight->imageSize.x = -1;
|
||||
}
|
||||
|
||||
//renderLog.CloseBlock();
|
||||
}
|
||||
|
||||
// go back to main render target
|
||||
|
|
|
@ -434,6 +434,11 @@ struct viewLight_t
|
|||
|
||||
// R_AddSingleLight will build a chain of parameters here to setup shadow volumes
|
||||
preLightShadowVolumeParms_t* preLightShadowVolumes;
|
||||
|
||||
bool ImageAtlasPlaced() const
|
||||
{
|
||||
return ( imageSize.x != -1 ) && ( imageSize.y != -1 );
|
||||
}
|
||||
};
|
||||
|
||||
// a viewEntity is created whenever a idRenderEntityLocal is considered for inclusion
|
||||
|
|
|
@ -490,6 +490,10 @@ void idRenderLog::FetchGPUTimers( backEndCounters_t& pc )
|
|||
{
|
||||
pc.gpuAmbientPassMicroSec = time;
|
||||
}
|
||||
else if( i == MRB_SHADOW_ATLAS_PASS )
|
||||
{
|
||||
pc.gpuShadowAtlasPassMicroSec = time;
|
||||
}
|
||||
else if( i == MRB_DRAW_INTERACTIONS )
|
||||
{
|
||||
pc.gpuInteractionsMicroSec = time;
|
||||
|
|
|
@ -161,6 +161,7 @@ struct backEndCounters_t
|
|||
uint64 gpuScreenSpaceAmbientOcclusionMicroSec;
|
||||
uint64 gpuScreenSpaceReflectionsMicroSec;
|
||||
uint64 gpuAmbientPassMicroSec;
|
||||
uint64 gpuShadowAtlasPassMicroSec;
|
||||
uint64 gpuInteractionsMicroSec;
|
||||
uint64 gpuShaderPassMicroSec;
|
||||
uint64 gpuPostProcessingMicroSec;
|
||||
|
|
Loading…
Reference in a new issue