Skip to content

Commit ec75366

Browse files
committed
CompositorBase: Remove frame locking for now.
This resulted in undefined behaviour due to UE4 sometimes calling EndFrame from a different thread than BeginFrame.
1 parent a2f671e commit ec75366

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

Revive/CompositorBase.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ CompositorBase::CompositorBase()
6161
, m_OverlayCount(0)
6262
, m_ActiveOverlays()
6363
, m_FrameMutex()
64-
, m_FrameLock(m_FrameMutex, std::defer_lock)
6564
, m_FrameEvent()
6665
{
6766
// We want to handle all graphics tasks explicitly instead of implicitly letting WaitGetPoses execute them
@@ -121,7 +120,6 @@ ovrResult CompositorBase::WaitToBeginFrame(ovrSession session, long long frameIn
121120
MICROPROFILE_SCOPE(WaitToBeginFrame);
122121

123122
// Protect the wait order with a mutex
124-
// This also waits for any frame still in-flight
125123
std::unique_lock<std::mutex> lk(m_FrameMutex);
126124

127125
// Wait for any extra frames beyond just the next frame
@@ -140,11 +138,6 @@ ovrResult CompositorBase::WaitToBeginFrame(ovrSession session, long long frameIn
140138
ovrResult CompositorBase::BeginFrame(ovrSession session, long long frameIndex)
141139
{
142140
MICROPROFILE_SCOPE(BeginFrame);
143-
144-
// Lock the frame mutex only if we don't already own it
145-
if (!m_FrameLock)
146-
m_FrameLock.lock();
147-
148141
session->FrameIndex = frameIndex;
149142
vr::VRCompositor()->SubmitExplicitTimingData();
150143
return session->Input->UpdateInputState();
@@ -255,8 +248,6 @@ ovrResult CompositorBase::EndFrame(ovrSession session, ovrLayerHeader const * co
255248

256249
// Frame now completed so we can let anyone waiting on the next frame call WaitGetPoses
257250
m_FrameEvent.notify_all();
258-
if (m_FrameLock)
259-
m_FrameLock.unlock();
260251

261252
if (m_MirrorTexture && error == vr::VRCompositorError_None)
262253
RenderMirrorTexture(m_MirrorTexture);

Revive/CompositorBase.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,5 @@ class CompositorBase
5252

5353
// Call order enforcement
5454
std::mutex m_FrameMutex;
55-
std::unique_lock<std::mutex> m_FrameLock;
5655
std::condition_variable m_FrameEvent;
5756
};

0 commit comments

Comments
 (0)