Fixed total frame GPU time query

This commit is contained in:
Robert Beckebans 2022-03-24 19:28:10 +01:00
parent 4e776840d9
commit cf128e42c8
5 changed files with 15 additions and 5 deletions

View file

@ -673,6 +673,9 @@ void idRenderBackend::GL_StartFrame()
deviceManager->BeginFrame();
commandList->open();
renderLog.StartFrame( commandList );
renderLog.OpenMainBlock( MRB_GPU_TIME );
}
/*
@ -682,6 +685,8 @@ idRenderBackend::GL_EndFrame
*/
void idRenderBackend::GL_EndFrame()
{
renderLog.CloseMainBlock( MRB_GPU_TIME );
commandList->close();
deviceManager->GetDevice()->executeCommandList( commandList );

View file

@ -5911,7 +5911,6 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
}
GL_StartFrame();
renderLog.StartFrame( commandList );
void* textureId = globalImages->hierarchicalZbufferImage->GetTextureID();
globalImages->LoadDeferredImages( commandList );

View file

@ -406,15 +406,21 @@ void idRenderLog::OpenMainBlock( renderLogMainBlock_t block )
idRenderLog::CloseMainBlock
========================
*/
void idRenderLog::CloseMainBlock()
void idRenderLog::CloseMainBlock( int _block )
{
// SRS - Use glConfig.timerQueryAvailable flag to control timestamp capture for all platforms
if( glConfig.timerQueryAvailable )
{
renderLogMainBlock_t block = mainBlock;
if( _block != -1 )
{
block = renderLogMainBlock_t( _block );
}
#if defined( USE_NVRHI )
int timerIndex = mainBlock + frameParity * MRB_TOTAL;
int timerIndex = block + frameParity * MRB_TOTAL;
commandList->endTimerQuery( timerQueries[ timerIndex ] );

View file

@ -109,7 +109,7 @@ public:
void OpenBlock( const char* label, const idVec4& color = colorBlack );
void CloseBlock();
void OpenMainBlock( renderLogMainBlock_t block );
void CloseMainBlock();
void CloseMainBlock( int block = -1 );
void Printf( VERIFY_FORMAT_STRING const char* fmt, ... ) {}

View file

@ -138,7 +138,7 @@ void idRenderSystemLocal::RenderCommandBuffers( const emptyCommand_t* const cmdH
{
#if defined(USE_NVRHI)
renderLog.FetchGPUTimers( backend.pc );
//renderLog.FetchGPUTimers( backend.pc );
// SRS - For OSX skip total rendering time query due to missing GL_TIMESTAMP support in Apple OpenGL 4.1, will calculate it inside SwapCommandBuffers_FinishRendering instead
#elif !defined(USE_VULKAN) && !defined(__APPLE__)