Skip to content

Commit 3729f31

Browse files
committed
Disable render thread
Fix broken xrWeatherEditor and Fullscreen mode switch
1 parent 8131106 commit 3729f31

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/xrEngine/device.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ void CRenderDevice::End(void)
113113
m_editor->on_load_finished();
114114
}
115115

116+
// XXX: make it work correct in all situations
116117
void CRenderDevice::RenderThreadProc(void* context)
117118
{
118119
auto& device = *static_cast<CRenderDevice*>(context);
@@ -270,12 +271,30 @@ void CRenderDevice::on_idle()
270271
mViewSaved = mView;
271272
mProjectSaved = mProject;
272273

273-
renderProcessFrame.Set(); // allow render thread to do its job
274+
//renderProcessFrame.Set(); // allow render thread to do its job
274275
syncProcessFrame.Set(); // allow secondary thread to do its job
275276

276277
const auto frameEndTime = TimerGlobal.GetElapsed_ms();
277278
const auto frameTime = frameEndTime - frameStartTime;
278279

280+
if (!GEnv.isDedicatedServer)
281+
{
282+
// all rendering is done here
283+
CStatTimer renderTotalReal;
284+
renderTotalReal.FrameStart();
285+
renderTotalReal.Begin();
286+
if (b_is_Active && Begin())
287+
{
288+
seqRender.Process(rp_Render);
289+
CalcFrameStats();
290+
Statistic->Show();
291+
End(); // Present goes here
292+
}
293+
renderTotalReal.End();
294+
renderTotalReal.FrameEnd();
295+
stats.RenderTotal.accum = renderTotalReal.accum;
296+
}
297+
279298
// Eco render (by alpet)
280299
u32 updateDelta = 10;
281300
if (GEnv.isDedicatedServer)
@@ -285,7 +304,7 @@ void CRenderDevice::on_idle()
285304
Sleep(updateDelta - frameTime);
286305

287306
syncFrameDone.Wait(); // wait until secondary thread finish its job
288-
renderFrameDone.Wait(); // wait until render thread finish its job
307+
//renderFrameDone.Wait(); // wait until render thread finish its job
289308

290309
if (!b_is_Active)
291310
Sleep(1);
@@ -339,7 +358,7 @@ void CRenderDevice::Run()
339358
// Start all threads
340359
mt_bMustExit = FALSE;
341360
thread_spawn(SecondaryThreadProc, "X-RAY Secondary thread", 0, this);
342-
thread_spawn(RenderThreadProc, "X-RAY Render thread", 0, this);
361+
//thread_spawn(RenderThreadProc, "X-RAY Render thread", 0, this);
343362
// Message cycle
344363
seqAppStart.Process(rp_AppStart);
345364
GEnv.Render->ClearTarget();
@@ -349,8 +368,8 @@ void CRenderDevice::Run()
349368
seqAppEnd.Process(rp_AppEnd);
350369
// Stop Balance-Thread
351370
mt_bMustExit = TRUE;
352-
renderProcessFrame.Set();
353-
renderThreadExit.Wait();
371+
//renderProcessFrame.Set();
372+
//renderThreadExit.Wait();
354373
syncProcessFrame.Set();
355374
syncThreadExit.Wait();
356375

0 commit comments

Comments
 (0)