Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from LibreVR:master #82

Merged
merged 5 commits into from
Oct 14, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CompositorBase: Don't use the wrapper in WaitToBeginFrame.
Avoids a race condition since unique_lock isn't thread-safe.
  • Loading branch information
CrossVR committed Oct 13, 2019
commit 890b93e64c489a705091aec2d7f2dc163ab0ad4d
8 changes: 5 additions & 3 deletions Revive/CompositorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ ovrResult CompositorBase::WaitToBeginFrame(ovrSession session, long long frameIn
MICROPROFILE_SCOPE(WaitToBeginFrame);

// WaitGetPoses is equivalent to calling BeginFrame, so we need to wait for any frame still in-flight
m_FrameLock.lock();
m_FrameLock.unlock();
m_FrameMutex.lock();
m_FrameMutex.unlock();

MICROPROFILE_SCOPE(WaitGetPoses);
vr::VRCompositor()->WaitGetPoses(nullptr, 0, nullptr, 0);
Expand All @@ -131,7 +131,9 @@ ovrResult CompositorBase::BeginFrame(ovrSession session, long long frameIndex)
{
MICROPROFILE_SCOPE(BeginFrame);

m_FrameLock.lock();
// Lock the mutex only if we don't already own it
if (!m_FrameLock)
m_FrameLock.lock();

session->FrameIndex = frameIndex;
return session->Input->UpdateInputState();
Expand Down