mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
Don't display messed up timings caused by taking screenshots using F12
This commit is contained in:
parent
0a1162aea0
commit
3ad7774376
3 changed files with 29 additions and 10 deletions
|
@ -300,18 +300,18 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
const uint64 rendererGPUPostProcessingTime = commonLocal.GetRendererGpuPostProcessingMicroseconds();
|
||||
|
||||
// SRS - Calculate max fps and max frame time based on glConfig.displayFrequency if vsync enabled and lower than engine Hz, otherwise use com_engineHz_latched
|
||||
const int max_FPS = ( r_swapInterval.GetInteger() > 0 && glConfig.displayFrequency > 0 ? std::min( glConfig.displayFrequency, int( com_engineHz_latched ) ) : com_engineHz_latched );
|
||||
const int maxTime = 1000.0 / max_FPS * 1000;
|
||||
const int maxFPS = ( r_swapInterval.GetInteger() > 0 && glConfig.displayFrequency > 0 ? std::min( glConfig.displayFrequency, int( com_engineHz_latched ) ) : com_engineHz_latched );
|
||||
const int maxTime = 1000.0 / maxFPS * 1000;
|
||||
|
||||
// SRS - Frame idle and busy time calculations are based on direct frame-over-frame measurement relative to finishSyncTime
|
||||
const uint64 frameIdleTime = commonLocal.mainFrameTiming.startGameTime - commonLocal.mainFrameTiming.finishSyncTime;
|
||||
const uint64 frameBusyTime = commonLocal.frameTiming.finishSyncTime - commonLocal.mainFrameTiming.startGameTime;
|
||||
const int64 frameIdleTime = int64( commonLocal.mainFrameTiming.startGameTime ) - int64( commonLocal.mainFrameTiming.finishSyncTime );
|
||||
const int64 frameBusyTime = int64( commonLocal.frameTiming.finishSyncTime ) - int64( commonLocal.mainFrameTiming.startGameTime );
|
||||
|
||||
// SRS - Frame sync time represents swap buffer synchronization + game thread wait + other time spent outside of rendering
|
||||
const uint64 frameSyncTime = commonLocal.frameTiming.finishSyncTime - commonLocal.mainFrameTiming.finishRenderTime;
|
||||
const int64 frameSyncTime = int64( commonLocal.frameTiming.finishSyncTime ) - int64( commonLocal.mainFrameTiming.finishRenderTime );
|
||||
|
||||
// SRS - GPU idle time is simply the difference between measured frame-over-frame time and GPU busy time (directly from GPU timers)
|
||||
const uint64 rendererGPUIdleTime = frameBusyTime + frameIdleTime - rendererGPUTime;
|
||||
const int64 rendererGPUIdleTime = frameBusyTime + frameIdleTime - rendererGPUTime;
|
||||
|
||||
#if 1
|
||||
|
||||
|
@ -479,7 +479,7 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextColored( fps < max_FPS ? colorRed : colorYellow, "Average FPS %i", fps );
|
||||
ImGui::TextColored( fps < maxFPS ? colorRed : colorYellow, "Average FPS %i", fps );
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
@ -490,12 +490,26 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
ImGui::TextColored( gameThreadRenderTime > maxTime ? colorRed : colorWhite, "RF: %5llu us SSR: %5llu us", gameThreadRenderTime, rendererGPU_SSRTime );
|
||||
ImGui::TextColored( rendererBackEndTime > maxTime ? colorRed : colorWhite, "RB: %5llu us Ambient Pass: %5llu us", rendererBackEndTime, rendererGPUAmbientPassTime );
|
||||
ImGui::TextColored( rendererGPUShadowAtlasTime > maxTime ? colorRed : colorWhite, "Shadows: %5llu us Shadow Atlas: %5llu us", rendererShadowsTime, rendererGPUShadowAtlasTime );
|
||||
ImGui::TextColored( rendererGPUInteractionsTime > maxTime ? colorRed : colorWhite, "Sync: %5llu us Interactions: %5llu us", frameSyncTime, rendererGPUInteractionsTime );
|
||||
if( renderSystem->IsTakingScreenshot() )
|
||||
{
|
||||
ImGui::TextColored( rendererGPUInteractionsTime > maxTime ? colorRed : colorWhite, " Interactions: %5llu us", rendererGPUInteractionsTime );
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextColored( rendererGPUInteractionsTime > maxTime ? colorRed : colorWhite, "Sync: %5lld us Interactions: %5llu us", frameSyncTime, rendererGPUInteractionsTime );
|
||||
}
|
||||
ImGui::TextColored( rendererGPUShaderPassesTime > maxTime ? colorRed : colorWhite, " Shader Pass: %5llu us", rendererGPUShaderPassesTime );
|
||||
ImGui::TextColored( rendererGPU_TAATime > maxTime ? colorRed : colorWhite, " TAA: %5llu us", rendererGPU_TAATime );
|
||||
ImGui::TextColored( rendererGPUPostProcessingTime > maxTime ? colorRed : colorWhite, " PostFX: %5llu us", rendererGPUPostProcessingTime );
|
||||
ImGui::TextColored( frameBusyTime > maxTime || rendererGPUTime > maxTime ? colorRed : colorWhite, "Total: %5llu us Total: %5llu us", frameBusyTime, rendererGPUTime );
|
||||
ImGui::TextColored( colorWhite, "Idle: %5llu us Idle: %5llu us", frameIdleTime, rendererGPUIdleTime );
|
||||
if( renderSystem->IsTakingScreenshot() )
|
||||
{
|
||||
ImGui::TextColored( rendererGPUTime > maxTime ? colorRed : colorWhite, " Total: %5lld us", rendererGPUTime );
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextColored( frameBusyTime > maxTime || rendererGPUTime > maxTime ? colorRed : colorWhite, "Total: %5lld us Total: %5lld us", frameBusyTime, rendererGPUTime );
|
||||
ImGui::TextColored( colorWhite, "Idle: %5lld us Idle: %5lld us", frameIdleTime, rendererGPUIdleTime );
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
|
|
@ -958,6 +958,10 @@ public:
|
|||
|
||||
virtual void RenderCommandBuffers( const emptyCommand_t* commandBuffers );
|
||||
virtual void TakeScreenshot( int width, int height, const char* fileName, renderView_t* ref );
|
||||
virtual bool IsTakingScreenshot()
|
||||
{
|
||||
return takingScreenshot;
|
||||
}
|
||||
virtual byte* CaptureRenderToBuffer( int width, int height, renderView_t* ref );
|
||||
virtual void CropRenderSize( int width, int height );
|
||||
virtual void CropRenderSize( int x, int y, int width, int height, bool topLeftAncor );
|
||||
|
|
|
@ -417,6 +417,7 @@ public:
|
|||
virtual void TakeScreenshot( int width, int height, const char* fileName, struct renderView_s* ref ) = 0;
|
||||
|
||||
// RB
|
||||
virtual bool IsTakingScreenshot() = 0;
|
||||
virtual byte* CaptureRenderToBuffer( int width, int height, renderView_t* ref ) = 0;
|
||||
|
||||
// the render output can be cropped down to a subset of the real screen, as
|
||||
|
|
Loading…
Reference in a new issue