Commit 0acac464 by David 'Digit' Turner Committed by David Turner

vulkan: use a marl::Event in the VkSemaphore implementation.

Bug: 140421726 Change-Id: I375d937c92d1e88d30720cb0deca52c079fab134 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39249Tested-by: 's avatarDavid Turner <digit@google.com> Kokoro-Presubmit: David Turner <digit@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com>
parent 43e33165
......@@ -93,7 +93,7 @@ void Semaphore::wait()
}
else
{
waitInternal();
internal.wait();
}
}
......@@ -107,26 +107,7 @@ void Semaphore::signal()
}
else
{
signalInternal();
}
}
void Semaphore::waitInternal()
{
// Wait on the marl condition variable only.
std::unique_lock<std::mutex> lock(mutex);
condition.wait(lock, [this] { return this->signaled; });
signaled = false; // Vulkan requires resetting after waiting.
}
void Semaphore::signalInternal()
{
// Signal the marl condition variable only.
std::unique_lock<std::mutex> lock(mutex);
if(!signaled)
{
signaled = true;
condition.notify_one();
internal.signal();
}
}
......
......@@ -18,7 +18,7 @@
#include "VkConfig.h"
#include "VkObject.hpp"
#include "marl/conditionvariable.h"
#include "marl/event.h"
#include <mutex>
#if VK_USE_PLATFORM_FUCHSIA
......@@ -58,17 +58,12 @@ public:
class External;
private:
void waitInternal();
void signalInternal();
void allocateExternal();
void deallocateExternal();
const VkAllocationCallbacks *allocator = nullptr;
marl::Event internal;
std::mutex mutex;
marl::ConditionVariable condition;
bool signaled = false;
External *external = nullptr;
bool temporaryImport = false;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment