Reverted com_smp back to boolean

This commit is contained in:
Robert Beckebans 2023-03-30 19:30:33 +02:00
parent aeb219589a
commit 49dc6cee46
5 changed files with 15 additions and 38 deletions

View file

@ -55,8 +55,6 @@ static idStr FindUnusedFileName( const char* format )
return filename;
}
//extern idCVar com_smp; // SRS - No longer require non-smp mode for demos
void WriteDeclCache( idDemoFile* f, int demoCategory, int demoCode, declType_t declType )
{
f->WriteInt( demoCategory );
@ -106,8 +104,6 @@ void idCommonLocal::StartRecordingRenderDemo( const char* demoName )
console->Close();
// com_smp.SetInteger( 0 ); // SRS - No longer require non-smp mode for demos
writeDemo = new( TAG_SYSTEM ) idDemoFile;
if( !writeDemo->OpenForWriting( demoName ) )
{
@ -146,7 +142,6 @@ void idCommonLocal::StopRecordingRenderDemo()
common->Printf( "stopped recording %s.\n", writeDemo->GetName() );
delete writeDemo;
writeDemo = NULL;
// com_smp.SetInteger( 1 ); // motorsep 12-30-2014; turn multithreading back on; SRS - No longer require non-smp mode for demos
}
/*
@ -190,8 +185,6 @@ void idCommonLocal::StopPlayingRenderDemo()
}
timeDemo = TD_NO;
}
// com_smp.SetInteger( 1 ); // motorsep 12-30-2014; turn multithreading back on; SRS - No longer require non-smp mode for demos
}
/*
@ -225,8 +218,6 @@ void idCommonLocal::StartPlayingRenderDemo( idStr demoName )
return;
}
// com_smp.SetInteger( 0 ); // SRS - No longer require non-smp mode for demos
// make sure localSound / GUI intro music shuts up
soundWorld->StopAllSounds();
soundWorld->PlayShaderDirectly( "", 0 );
@ -319,8 +310,8 @@ void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit
{
timeDemo = TD_YES; // SRS - Set timeDemo to TD_YES to disable time demo playback pause when window not in focus
int smp_mode = com_smp.GetInteger();
com_smp.SetInteger( 0 ); // SRS - First pass of timedemo is effectively in com_smp == 0 mode, so set this for ImGui timings to be correct
bool smp_mode = com_smp.GetBool();
com_smp.SetBool( false ); // SRS - First pass of timedemo is effectively in com_smp == 0 mode, so set this for ImGui timings to be correct
while( readDemo )
{
@ -340,7 +331,7 @@ void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit
eventLoop->RunEventLoop( false ); // SRS - Run event loop (with no commands) to allow keyboard escape to cancel first pass of the timedemo
}
com_smp.SetInteger( smp_mode ); // SRS - Restore original com_smp mode before second pass of timedemo which runs within normal rendering loop
com_smp.SetBool( smp_mode ); // SRS - Restore original com_smp mode before second pass of timedemo which runs within normal rendering loop
StartPlayingRenderDemo( demo );
}

View file

@ -64,7 +64,7 @@ idCVar com_deltaTimeClamp( "com_deltaTimeClamp", "50", CVAR_INTEGER, "don't proc
idCVar com_fixedTic( "com_fixedTic", DEFAULT_FIXED_TIC, CVAR_BOOL, "run a single game frame per render frame" );
idCVar com_noSleep( "com_noSleep", DEFAULT_NO_SLEEP, CVAR_BOOL, "don't sleep if the game is running too fast" );
idCVar com_smp( "com_smp", "1", CVAR_INTEGER | CVAR_SYSTEM | CVAR_NOCHEAT, "run the game and draw code in a separate thread" );
idCVar com_smp( "com_smp", "1", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "run the game and draw code in a separate thread" );
idCVar com_aviDemoWidth( "com_aviDemoWidth", "256", CVAR_SYSTEM, "" );
idCVar com_aviDemoHeight( "com_aviDemoHeight", "256", CVAR_SYSTEM, "" );
idCVar com_skipGameDraw( "com_skipGameDraw", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
@ -196,7 +196,7 @@ gameReturn_t idGameThread::RunGameAndDraw( int numGameFrames_, idUserCmdMgr& use
// start the thread going
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
if( com_smp.GetInteger() <= 0 || com_editors != 0 )
if( !com_smp.GetBool() || com_editors != 0 )
{
// run it in the main thread so PIX profiling catches everything
Run();
@ -518,6 +518,8 @@ void idCommonLocal::Frame()
// This is the only place this is incremented
idLib::frameNumber++;
OPTICK_TAG( "N", idLib::frameNumber );
// allow changing SIMD usage on the fly
if( com_forceGenericSIMD.IsModified() )
{
@ -610,15 +612,10 @@ void idCommonLocal::Frame()
const emptyCommand_t* renderCommands = NULL;
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
if( com_smp.GetInteger() > 0 && com_editors == 0 )
if( com_smp.GetBool() && com_editors == 0 )
{
renderCommands = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu, &stats_backend, &stats_frontend );
}
else if( com_smp.GetInteger() < 0 )
{
// RB: this is the same as Doom 3 renderSystem->BeginFrame()
renderCommands = renderSystem->SwapCommandBuffers_FinishCommandBuffers();
}
else
{
// the GPU will stay idle through command generation for minimal
@ -764,11 +761,6 @@ void idCommonLocal::Frame()
ExecuteMapChange();
mapSpawnData.savegameFile = NULL;
mapSpawnData.persistentPlayerInfo.Clear();
// SRS - If in Doom 3 mode (com_smp = -1) on map change, must obey fence before returning to avoid command buffer sync issues
if( com_smp.GetInteger() < 0 )
{
renderSystem->SwapCommandBuffers_FinishRendering( &time_frontend, &time_backend, &time_shadows, &time_gpu, &stats_backend, &stats_frontend );
}
return;
}
else if( session->GetState() != idSession::INGAME && mapSpawned )
@ -865,10 +857,10 @@ void idCommonLocal::Frame()
// start the game / draw command generation thread going in the background
gameReturn_t ret = gameThread.RunGameAndDraw( numGameFrames, userCmdMgr, IsClient(), gameFrame - numGameFrames );
// 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();
if( com_smp.GetInteger() == 0 || ( com_smp.GetInteger() > 0 && com_editors != 0 ) )
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
if( !com_smp.GetBool() || com_editors != 0 )
{
// in non-smp mode, run the commands we just generated, instead of
// frame-delayed ones from a background thread
@ -887,13 +879,7 @@ void idCommonLocal::Frame()
}
frameTiming.finishRenderTime = Sys_Microseconds();
// SRS - If in Doom 3 mode (com_smp = -1), must sync after RenderCommandBuffers() otherwise get artifacts due to improper command buffer swap timing
if( com_smp.GetInteger() < 0 )
{
// 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
// SRS - Use finishSyncTime_EndFrame to record timing just before gameThread.WaitForThread() for com_smp = 1
frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
// make sure the game / draw thread has completed

View file

@ -45,7 +45,7 @@ If you have questions concerning this license or the applicable additional terms
#if USE_OPTICK
#define USE_OPTICK_GPU 0
#define USE_OPTICK_GPU 1
#else
#define USE_OPTICK_GPU 0
#endif

View file

@ -612,7 +612,7 @@ void DeviceManager_DX12::Present()
// SRS - For triple buffering, sync on previous frame's command queue completion
m_NvrhiDevice->waitEventQuery( m_FrameWaitQuery );
}
m_NvrhiDevice->resetEventQuery( m_FrameWaitQuery );
m_NvrhiDevice->setEventQuery( m_FrameWaitQuery, nvrhi::CommandQueue::Graphics );

View file

@ -1316,7 +1316,7 @@ void DeviceManager_VK::Present()
// SRS - For triple buffering, sync on previous frame's command queue completion
m_NvrhiDevice->waitEventQuery( m_FrameWaitQuery );
}
m_NvrhiDevice->resetEventQuery( m_FrameWaitQuery );
m_NvrhiDevice->setEventQuery( m_FrameWaitQuery, nvrhi::CommandQueue::Graphics );