Astyle cleanup

This commit is contained in:
Robert Beckebans 2021-09-28 09:58:48 +02:00
parent af08e7d414
commit 79b28779b7
9 changed files with 156 additions and 156 deletions

View file

@ -130,7 +130,7 @@ struct frameTiming_t
uint64 finishDrawTime;
uint64 startRenderTime;
uint64 finishRenderTime;
uint64 finishSyncTime_EndFrame;
uint64 finishSyncTime_EndFrame;
};
#define MAX_PRINT_MSG_SIZE 4096
@ -368,18 +368,18 @@ public:
return stats_backend.gpuPostProcessingMicroSec;
}
// RB end
// SRS start
uint64 GetRendererStartFrameSyncMicroseconds() const
{
return mainFrameTiming.finishSyncTime - mainFrameTiming.startSyncTime;
}
uint64 GetRendererEndFrameSyncMicroseconds() const
{
return mainFrameTiming.finishSyncTime_EndFrame - mainFrameTiming.startRenderTime;
}
// SRS end
// SRS start
uint64 GetRendererStartFrameSyncMicroseconds() const
{
return mainFrameTiming.finishSyncTime - mainFrameTiming.startSyncTime;
}
uint64 GetRendererEndFrameSyncMicroseconds() const
{
return mainFrameTiming.finishSyncTime_EndFrame - mainFrameTiming.startRenderTime;
}
// SRS end
// foresthale 2014-05-30: a special binarize pacifier has to be shown in
// some cases, which includes filename and ETA information, note that

View file

@ -213,8 +213,8 @@ idConsoleLocal::DrawFPS
#define FPS_FRAMES_HISTORY 90
float idConsoleLocal::DrawFPS( float y )
{
extern idCVar com_smp;
extern idCVar com_smp;
static float previousTimes[FPS_FRAMES];
static float previousTimesNormalized[FPS_FRAMES_HISTORY];
static int index;
@ -280,7 +280,7 @@ float idConsoleLocal::DrawFPS( float y )
const uint64 rendererBackEndTime = commonLocal.GetRendererBackEndMicroseconds();
const uint64 rendererShadowsTime = commonLocal.GetRendererShadowsMicroseconds();
// SRS - GPU idle time calculation depends on whether game is operating in smp mode or not
// SRS - GPU idle time calculation depends on whether game is operating in smp mode or not
const uint64 rendererGPUIdleTime = commonLocal.GetRendererIdleMicroseconds() - ( com_smp.GetInteger() > 0 && com_editors == 0 ? 0 : gameThreadTotalTime );
const uint64 rendererGPUTime = commonLocal.GetRendererGPUMicroseconds();
const uint64 rendererGPUEarlyZTime = commonLocal.GetRendererGpuEarlyZMicroseconds();
@ -291,14 +291,14 @@ float idConsoleLocal::DrawFPS( float y )
const uint64 rendererGPUShaderPassesTime = commonLocal.GetRendererGpuShaderPassMicroseconds();
const uint64 rendererGPUPostProcessingTime = commonLocal.GetRendererGpuPostProcessingMicroseconds();
const int maxTime = int( 1000 / com_engineHz_latched ) * 1000;
// SRS - Get GPU sync time at the start of a frame (com_smp = 1 or 0) and at the end of a frame (com_smp = -1)
const uint64 rendererStartFrameSyncTime = commonLocal.GetRendererStartFrameSyncMicroseconds();
const uint64 rendererEndFrameSyncTime = commonLocal.GetRendererEndFrameSyncMicroseconds();
// SRS - Total CPU and Frame time calculations depend on whether game is operating in smp mode or not
const uint64 totalCPUTime = ( com_smp.GetInteger() > 0 && com_editors == 0 ? std::max( gameThreadTotalTime, rendererBackEndTime ) : gameThreadTotalTime + rendererBackEndTime );
const uint64 totalFrameTime = ( com_smp.GetInteger() > 0 && com_editors == 0 ? std::max( gameThreadTotalTime, rendererEndFrameSyncTime ) : gameThreadTotalTime + rendererEndFrameSyncTime ) + rendererStartFrameSyncTime;
// SRS - Get GPU sync time at the start of a frame (com_smp = 1 or 0) and at the end of a frame (com_smp = -1)
const uint64 rendererStartFrameSyncTime = commonLocal.GetRendererStartFrameSyncMicroseconds();
const uint64 rendererEndFrameSyncTime = commonLocal.GetRendererEndFrameSyncMicroseconds();
// SRS - Total CPU and Frame time calculations depend on whether game is operating in smp mode or not
const uint64 totalCPUTime = ( com_smp.GetInteger() > 0 && com_editors == 0 ? std::max( gameThreadTotalTime, rendererBackEndTime ) : gameThreadTotalTime + rendererBackEndTime );
const uint64 totalFrameTime = ( com_smp.GetInteger() > 0 && com_editors == 0 ? std::max( gameThreadTotalTime, rendererEndFrameSyncTime ) : gameThreadTotalTime + rendererEndFrameSyncTime ) + rendererStartFrameSyncTime;
#if 1
@ -417,7 +417,7 @@ float idConsoleLocal::DrawFPS( float y )
}
else
{
ImGui::TextColored( fps < com_engineHz_latched ? colorRed : colorYellow, "Average FPS %i", fps );
ImGui::TextColored( fps < com_engineHz_latched ? colorRed : colorYellow, "Average FPS %i", fps );
}
ImGui::Spacing();
@ -431,8 +431,8 @@ float idConsoleLocal::DrawFPS( float y )
ImGui::TextColored( rendererGPUShaderPassesTime > maxTime ? colorRed : colorWhite, " ShaderPass: %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 );
ImGui::TextColored( totalFrameTime > maxTime ? colorRed : colorWhite, "Frame: %5llu us Idle: %5llu us", totalFrameTime, rendererGPUIdleTime );
"Total: %5llu us Total: %5llu us", totalCPUTime, rendererGPUTime );
ImGui::TextColored( totalFrameTime > maxTime ? colorRed : colorWhite, "Frame: %5llu us Idle: %5llu us", totalFrameTime, rendererGPUIdleTime );
ImGui::End();
}

View file

@ -872,7 +872,7 @@ void idCommonLocal::Frame()
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
// SRS - if com_editors is active make sure com_smp != -1, otherwise skip and call SwapCommandBuffers_FinishRendering later
frameTiming.startRenderTime = Sys_Microseconds();
frameTiming.startRenderTime = Sys_Microseconds();
if( com_smp.GetInteger() == 0 || ( com_smp.GetInteger() > 0 && com_editors != 0 ) )
{
// in non-smp mode, run the commands we just generated, instead of
@ -898,8 +898,8 @@ void idCommonLocal::Frame()
// RB: this is the same as Doom 3 renderSystem->EndFrame()
renderSystem->SwapCommandBuffers_FinishRendering( &time_frontend, &time_backend, &time_shadows, &time_gpu, &stats_backend, &stats_frontend );
}
// SRS - Use finishSyncTime_EndFrame to record timing after sync for com_smp = -1, and just before gameThread.WaitForThread() for com_smp = 1
frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
// SRS - Use finishSyncTime_EndFrame to record timing after sync for com_smp = -1, and just before gameThread.WaitForThread() for com_smp = 1
frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
// make sure the game / draw thread has completed
// This may block if the game is taking longer than the render back end

View file

@ -1962,7 +1962,7 @@ void idRenderBackend::StereoRenderExecuteBackEndCommands( const emptyCommand_t*
// SRS - Save glConfig.timerQueryAvailable state so it can be disabled for RC_DRAW_VIEW_GUI then restored after it is finished
const bool timerQueryAvailable = glConfig.timerQueryAvailable;
bool drawView3D_timestamps = false;
bool drawView3D_timestamps = false;
for( int stereoEye = 1; stereoEye >= -1; stereoEye -= 2 )
{
@ -1996,26 +1996,26 @@ void idRenderBackend::StereoRenderExecuteBackEndCommands( const emptyCommand_t*
foundEye[ targetEye ] = true;
if( cmds->commandId == RC_DRAW_VIEW_GUI && drawView3D_timestamps )
{
// SRS - Capture separate timestamps for overlay GUI rendering when RC_DRAW_VIEW_3D timestamps are active
renderLog.OpenMainBlock( MRB_DRAW_GUI );
renderLog.OpenBlock( "Render_DrawViewGUI", colorBlue );
// SRS - Disable detailed timestamps during overlay GUI rendering so they do not overwrite timestamps from 3D rendering
glConfig.timerQueryAvailable = false;
{
// SRS - Capture separate timestamps for overlay GUI rendering when RC_DRAW_VIEW_3D timestamps are active
renderLog.OpenMainBlock( MRB_DRAW_GUI );
renderLog.OpenBlock( "Render_DrawViewGUI", colorBlue );
// SRS - Disable detailed timestamps during overlay GUI rendering so they do not overwrite timestamps from 3D rendering
glConfig.timerQueryAvailable = false;
DrawView( dsc, stereoEye );
DrawView( dsc, stereoEye );
// SRS - Restore timestamp capture state after overlay GUI rendering is finished
glConfig.timerQueryAvailable = timerQueryAvailable;
renderLog.CloseBlock();
renderLog.CloseMainBlock();
break;
// SRS - Restore timestamp capture state after overlay GUI rendering is finished
glConfig.timerQueryAvailable = timerQueryAvailable;
renderLog.CloseBlock();
renderLog.CloseMainBlock();
break;
}
else if( cmds->commandId == RC_DRAW_VIEW_3D )
{
drawView3D_timestamps = true;
}
DrawView( dsc, stereoEye );
else if( cmds->commandId == RC_DRAW_VIEW_3D )
{
drawView3D_timestamps = true;
}
DrawView( dsc, stereoEye );
}
break;

View file

@ -5561,10 +5561,10 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
// needed for editor rendering
GL_SetDefaultState();
// SRS - Save glConfig.timerQueryAvailable state so it can be disabled for RC_DRAW_VIEW_GUI then restored after it is finished
const bool timerQueryAvailable = glConfig.timerQueryAvailable;
bool drawView3D_timestamps = false;
// SRS - Save glConfig.timerQueryAvailable state so it can be disabled for RC_DRAW_VIEW_GUI then restored after it is finished
const bool timerQueryAvailable = glConfig.timerQueryAvailable;
bool drawView3D_timestamps = false;
for( ; cmds != NULL; cmds = ( const emptyCommand_t* )cmds->next )
{
@ -5574,34 +5574,34 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
break;
case RC_DRAW_VIEW_GUI:
if( drawView3D_timestamps )
{
// SRS - Capture separate timestamps for overlay GUI rendering when RC_DRAW_VIEW_3D timestamps are active
renderLog.OpenMainBlock( MRB_DRAW_GUI );
renderLog.OpenBlock( "Render_DrawViewGUI", colorBlue );
// SRS - Disable detailed timestamps during overlay GUI rendering so they do not overwrite timestamps from 3D rendering
glConfig.timerQueryAvailable = false;
DrawView( cmds, 0 );
if( drawView3D_timestamps )
{
// SRS - Capture separate timestamps for overlay GUI rendering when RC_DRAW_VIEW_3D timestamps are active
renderLog.OpenMainBlock( MRB_DRAW_GUI );
renderLog.OpenBlock( "Render_DrawViewGUI", colorBlue );
// SRS - Disable detailed timestamps during overlay GUI rendering so they do not overwrite timestamps from 3D rendering
glConfig.timerQueryAvailable = false;
// SRS - Restore timestamp capture state after overlay GUI rendering is finished
glConfig.timerQueryAvailable = timerQueryAvailable;
renderLog.CloseBlock();
renderLog.CloseMainBlock();
}
else
{
DrawView( cmds, 0 );
}
c_draw2d++;
DrawView( cmds, 0 );
// SRS - Restore timestamp capture state after overlay GUI rendering is finished
glConfig.timerQueryAvailable = timerQueryAvailable;
renderLog.CloseBlock();
renderLog.CloseMainBlock();
}
else
{
DrawView( cmds, 0 );
}
c_draw2d++;
break;
case RC_DRAW_VIEW_3D:
drawView3D_timestamps = true;
DrawView( cmds, 0 );
c_draw3d++;
break;
case RC_DRAW_VIEW_3D:
drawView3D_timestamps = true;
DrawView( cmds, 0 );
c_draw3d++;
break;
case RC_SET_BUFFER:
SetBuffer( cmds );
c_setBuffers++;
@ -5870,10 +5870,10 @@ void idRenderBackend::DrawViewInternal( const viewDef_t* _viewDef, const int ste
DBG_RenderDebugTools( drawSurfs, numDrawSurfs );
#if !defined(USE_VULKAN)
// SRS - For OSX OpenGL record the final portion of GPU time while no other elapsed time query is active (after final shader pass and before post processing)
#if defined(__APPLE__)
renderLog.OpenMainBlock( MRB_GPU_TIME );
renderLog.OpenMainBlock( MRB_GPU_TIME );
#endif
// RB: convert back from HDR to LDR range
@ -5940,7 +5940,7 @@ void idRenderBackend::DrawViewInternal( const viewDef_t* _viewDef, const int ste
}
#if defined(__APPLE__)
renderLog.CloseMainBlock();
renderLog.CloseMainBlock();
#endif
#endif

View file

@ -57,7 +57,7 @@ const char* renderLogMainBlockLabels[] =
ASSERT_ENUM_STRING( MRB_DRAW_DEBUG_TOOLS, 10 ),
ASSERT_ENUM_STRING( MRB_CAPTURE_COLORBUFFER, 11 ),
ASSERT_ENUM_STRING( MRB_POSTPROCESS, 12 ),
ASSERT_ENUM_STRING( MRB_DRAW_GUI, 13 ),
ASSERT_ENUM_STRING( MRB_DRAW_GUI, 13 ),
ASSERT_ENUM_STRING( MRB_TOTAL, 14 )
};
@ -604,36 +604,36 @@ idRenderLog::OpenMainBlock
*/
void idRenderLog::OpenMainBlock( renderLogMainBlock_t block )
{
// SRS - Use glConfig.timerQueryAvailable flag to control timestamp capture for all platforms
if( glConfig.timerQueryAvailable )
{
mainBlock = block;
// SRS - Use glConfig.timerQueryAvailable flag to control timestamp capture for all platforms
if( glConfig.timerQueryAvailable )
{
mainBlock = block;
#if defined( USE_VULKAN )
if( vkcontext.queryIndex[ vkcontext.frameParity ] >= ( NUM_TIMESTAMP_QUERIES - 1 ) )
{
return;
}
if( vkcontext.queryIndex[ vkcontext.frameParity ] >= ( NUM_TIMESTAMP_QUERIES - 1 ) )
{
return;
}
VkCommandBuffer commandBuffer = vkcontext.commandBuffer[ vkcontext.frameParity ];
VkQueryPool queryPool = vkcontext.queryPools[ vkcontext.frameParity ];
VkCommandBuffer commandBuffer = vkcontext.commandBuffer[ vkcontext.frameParity ];
VkQueryPool queryPool = vkcontext.queryPools[ vkcontext.frameParity ];
uint32 queryIndex = vkcontext.queryAssignedIndex[ vkcontext.frameParity ][ mainBlock * 2 + 0 ] = vkcontext.queryIndex[ vkcontext.frameParity ]++;
vkCmdWriteTimestamp( commandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, queryPool, queryIndex );
uint32 queryIndex = vkcontext.queryAssignedIndex[ vkcontext.frameParity ][ mainBlock * 2 + 0 ] = vkcontext.queryIndex[ vkcontext.frameParity ]++;
vkCmdWriteTimestamp( commandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, queryPool, queryIndex );
#elif defined(__APPLE__)
// SRS - For OSX use elapsed time query for Apple OpenGL 4.1 using GL_TIME_ELAPSED vs GL_TIMESTAMP (which is not implemented on OSX)
// SRS - OSX AMD drivers have a rendering bug (flashing colours) with an elasped time query when Shadow Mapping is on - turn off query for that case unless r_skipAMDWorkarounds is set
if( !r_useShadowMapping.GetBool() || glConfig.vendor != VENDOR_AMD || r_skipAMDWorkarounds.GetBool() )
{
if( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ] == 0 )
{
glGenQueries( 1, &glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ] );
}
// SRS - For OSX use elapsed time query for Apple OpenGL 4.1 using GL_TIME_ELAPSED vs GL_TIMESTAMP (which is not implemented on OSX)
// SRS - OSX AMD drivers have a rendering bug (flashing colours) with an elasped time query when Shadow Mapping is on - turn off query for that case unless r_skipAMDWorkarounds is set
if( !r_useShadowMapping.GetBool() || glConfig.vendor != VENDOR_AMD || r_skipAMDWorkarounds.GetBool() )
{
if( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ] == 0 )
{
glGenQueries( 1, &glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ] );
}
glBeginQuery( GL_TIME_ELAPSED_EXT, glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ] );
}
glBeginQuery( GL_TIME_ELAPSED_EXT, glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ] );
}
#else
if( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 ] == 0 )
{
@ -643,7 +643,7 @@ void idRenderLog::OpenMainBlock( renderLogMainBlock_t block )
glQueryCounter( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 0 ], GL_TIMESTAMP );
glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ][ mainBlock * 2 + 0 ]++;
#endif
}
}
}
/*
@ -653,36 +653,36 @@ idRenderLog::CloseMainBlock
*/
void idRenderLog::CloseMainBlock()
{
// SRS - Use glConfig.timerQueryAvailable flag to control timestamp capture for all platforms
if( glConfig.timerQueryAvailable )
{
// SRS - Use glConfig.timerQueryAvailable flag to control timestamp capture for all platforms
if( glConfig.timerQueryAvailable )
{
#if defined( USE_VULKAN )
if( vkcontext.queryIndex[ vkcontext.frameParity ] >= ( NUM_TIMESTAMP_QUERIES - 1 ) )
{
return;
}
if( vkcontext.queryIndex[ vkcontext.frameParity ] >= ( NUM_TIMESTAMP_QUERIES - 1 ) )
{
return;
}
VkCommandBuffer commandBuffer = vkcontext.commandBuffer[ vkcontext.frameParity ];
VkQueryPool queryPool = vkcontext.queryPools[ vkcontext.frameParity ];
VkCommandBuffer commandBuffer = vkcontext.commandBuffer[ vkcontext.frameParity ];
VkQueryPool queryPool = vkcontext.queryPools[ vkcontext.frameParity ];
uint32 queryIndex = vkcontext.queryAssignedIndex[ vkcontext.frameParity ][ mainBlock * 2 + 1 ] = vkcontext.queryIndex[ vkcontext.frameParity ]++;
vkCmdWriteTimestamp( commandBuffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, queryPool, queryIndex );
uint32 queryIndex = vkcontext.queryAssignedIndex[ vkcontext.frameParity ][ mainBlock * 2 + 1 ] = vkcontext.queryIndex[ vkcontext.frameParity ]++;
vkCmdWriteTimestamp( commandBuffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, queryPool, queryIndex );
#elif defined(__APPLE__)
// SRS - For OSX use elapsed time query for Apple OpenGL 4.1 using GL_TIME_ELAPSED vs GL_TIMESTAMP (which is not implemented on OSX)
// SRS - OSX AMD drivers have a rendering bug (flashing colours) with an elasped time query when Shadow Mapping is on - turn off query for that case unless r_skipAMDWorkarounds is set
if( !r_useShadowMapping.GetBool() || glConfig.vendor != VENDOR_AMD || r_skipAMDWorkarounds.GetBool() )
{
glEndQuery( GL_TIME_ELAPSED_EXT );
glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ][ mainBlock * 2 + 1 ]++;
}
// SRS - For OSX use elapsed time query for Apple OpenGL 4.1 using GL_TIME_ELAPSED vs GL_TIMESTAMP (which is not implemented on OSX)
// SRS - OSX AMD drivers have a rendering bug (flashing colours) with an elasped time query when Shadow Mapping is on - turn off query for that case unless r_skipAMDWorkarounds is set
if( !r_useShadowMapping.GetBool() || glConfig.vendor != VENDOR_AMD || r_skipAMDWorkarounds.GetBool() )
{
glEndQuery( GL_TIME_ELAPSED_EXT );
glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ][ mainBlock * 2 + 1 ]++;
}
#else
glQueryCounter( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ][ mainBlock * 2 + 1 ], GL_TIMESTAMP );
glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ][ mainBlock * 2 + 1 ]++;
#endif
}
}
}
#endif

View file

@ -55,7 +55,7 @@ enum renderLogMainBlock_t
MRB_DRAW_DEBUG_TOOLS,
MRB_CAPTURE_COLORBUFFER,
MRB_POSTPROCESS,
MRB_DRAW_GUI,
MRB_DRAW_GUI,
MRB_TOTAL,
MRB_TOTAL_QUERIES = MRB_TOTAL * 2,

View file

@ -749,45 +749,45 @@ void idRenderSystemLocal::SwapCommandBuffers_FinishRendering(
// SRS - For OSX OpenGL calculate total rendering time vs direct measurement due to missing GL_TIMESTAMP support in Apple OpenGL 4.1
#if defined(__APPLE__)
// SRS - On OSX gpuMicroSec starts with only a portion of the GPU rendering time, must add additional components for more accurate estimate
// SRS - On OSX gpuMicroSec starts with only a portion of the GPU rendering time, must add additional components for more accurate estimate
backend.pc.gpuMicroSec += backend.pc.gpuDepthMicroSec + backend.pc.gpuScreenSpaceAmbientOcclusionMicroSec + backend.pc.gpuScreenSpaceReflectionsMicroSec + backend.pc.gpuAmbientPassMicroSec + backend.pc.gpuInteractionsMicroSec + backend.pc.gpuShaderPassMicroSec + backend.pc.gpuPostProcessingMicroSec;
// SRS - For OSX elapsed time queries, no need to perform unnecessary calls to glGetQueryObjectui64vEXT since gpuStartNanoseconds will always equal 0
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_FILL_GEOMETRY_BUFFER * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_FILL_GEOMETRY_BUFFER * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
// SRS - For OSX elapsed time queries, no need to perform unnecessary calls to glGetQueryObjectui64vEXT since gpuStartNanoseconds will always equal 0
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_FILL_GEOMETRY_BUFFER * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_FILL_GEOMETRY_BUFFER * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_FOG_ALL_LIGHTS * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_FOG_ALL_LIGHTS * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_FOG_ALL_LIGHTS * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_FOG_ALL_LIGHTS * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_DRAW_SHADER_PASSES_POST * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_DRAW_SHADER_PASSES_POST * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_DRAW_DEBUG_TOOLS * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_DRAW_DEBUG_TOOLS * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_DRAW_SHADER_PASSES_POST * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_DRAW_SHADER_PASSES_POST * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_DRAW_DEBUG_TOOLS * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_DRAW_DEBUG_TOOLS * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_DRAW_GUI * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_DRAW_GUI * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
if( glcontext.renderLogMainBlockTimeQueryIssued[ glcontext.frameParity ^ 1 ][ MRB_DRAW_GUI * 2 + 1 ] > 0 )
{
glGetQueryObjectui64vEXT( glcontext.renderLogMainBlockTimeQueryIds[ glcontext.frameParity ^ 1 ][ MRB_DRAW_GUI * 2 + 1], GL_QUERY_RESULT, &gpuEndNanoseconds );
backend.pc.gpuMicroSec += gpuEndNanoseconds / 1000;
}
if( gpuMicroSec != NULL )
{
*gpuMicroSec = backend.pc.gpuMicroSec;

View file

@ -1498,7 +1498,7 @@ void idRenderBackend::Init()
idLib::Printf( "----- Initializing Vulkan driver -----\n" );
glConfig.driverType = GLDRV_VULKAN;
glConfig.timerQueryAvailable = true; // SRS - Use glConfig.timerQueryAvailable flag to control Vulkan timestamp capture
glConfig.timerQueryAvailable = true; // SRS - Use glConfig.timerQueryAvailable flag to control Vulkan timestamp capture
glConfig.gpuSkinningAvailable = true;
// create the Vulkan instance and enable validation layers