Skip to content

Commit cbc0d69

Browse files
committed
fix hardware sync crash
1 parent dec6ea2 commit cbc0d69

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

materialsystem/cmaterialsystem.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3485,9 +3485,8 @@ void CMaterialSystem::BeginFrame( float frameTime )
34853485
VPROF_BUDGET( "CMaterialSystem::BeginFrame", VPROF_BUDGETGROUP_SWAP_BUFFERS );
34863486
tmZoneFiltered( TELEMETRY_LEVEL0, 50, TMZF_NONE, "%s", __FUNCTION__ );
34873487

3488-
IMatRenderContextInternal *pRenderContext = GetRenderContextInternal();
3489-
3490-
if (g_config.ForceHWSync() && m_ThreadMode != MATERIAL_QUEUED_THREADED)
3488+
IMatRenderContextInternal* pRenderContext = GetRenderContextInternal();
3489+
if (g_config.ForceHWSync() && (IsPC() || m_ThreadMode != MATERIAL_QUEUED_THREADED))
34913490
{
34923491
tmZoneFiltered(TELEMETRY_LEVEL0, 50, TMZF_NONE, "ForceHardwareSync");
34933492
pRenderContext->ForceHardwareSync();
@@ -3703,19 +3702,15 @@ void CMaterialSystem::EndFrame( void )
37033702

37043703
if ( m_pActiveAsyncJob )
37053704
{
3706-
// Sync with GPU if we had a job for it, even if it finished early on CPU!
3707-
// We want to sync at the end of the frame, because hardware sync
3708-
// lags behind by one frame already, and r_reduce_frame_latency wouldn't make
3709-
// much of a difference if it happened later
3710-
// Do this before the wait for finish so that we can hide the hardware sync time.
3711-
if (g_config.ForceHWSync())
3712-
{
3713-
g_pShaderAPI->ForceHardwareSync();
3714-
}
37153705
if ( !m_pActiveAsyncJob->IsFinished() )
37163706
{
37173707
m_pActiveAsyncJob->WaitForFinish();
37183708
}
3709+
// Sync with GPU if we had a job for it, even if it finished early on CPU!
3710+
if (!IsPC() && g_config.ForceHWSync())
3711+
{
3712+
g_pShaderAPI->ForceHardwareSync();
3713+
}
37193714
}
37203715
SafeRelease( m_pActiveAsyncJob );
37213716

0 commit comments

Comments
 (0)