Permalink
Browse files

Let's try a mutex. Doesn't completely solve the problem though..

  • Loading branch information...
hrydgard committed Aug 25, 2017
1 parent d3672d9 commit 72a41cd5245e68ab053d961eda709d77baab2535
Showing with 5 additions and 0 deletions.
  1. +4 −0 ext/native/thin3d/VulkanRenderManager.cpp
  2. +1 −0 ext/native/thin3d/VulkanRenderManager.h
@@ -215,9 +215,11 @@ void VulkanRenderManager::ThreadFunc() {
condVar_.wait(lock);
if (frameAvailable_) {
int frame = threadFrame_;
frameData_[frame].mutex.lock();
frameAvailable_ = false;
Run(frame);
EndFrame(frame);
frameData_[frame].mutex.unlock();
}
}
}
@@ -236,6 +238,7 @@ void VulkanRenderManager::BeginFrame() {
;
}
frameData.readyForFence = false;
frameData.mutex.lock();
}
ILOG("Fencing %d", curFrame);
@@ -656,6 +659,7 @@ void VulkanRenderManager::Flush() {
Run(curFrame);
EndFrame(curFrame);
} else {
frameData.mutex.unlock();
{
std::unique_lock<std::mutex> lock(mutex_);
frameAvailable_ = true;
@@ -335,6 +335,7 @@ class VulkanRenderManager {
// Per-frame data, round-robin so we can overlap submission with execution of the previous frame.
struct FrameData {
std::mutex mutex;
bool readyForFence = true;
VkFence fence;
// These are on different threads so need separate pools.

0 comments on commit 72a41cd

Please sign in to comment.