mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Try to resolve another race condition. Improve an assert.
This commit is contained in:
parent
16d1d5566b
commit
3802d4ee16
@ -459,6 +459,7 @@ VulkanRenderManager::~VulkanRenderManager() {
|
||||
void VulkanRenderManager::CompileThreadFunc() {
|
||||
SetCurrentThreadName("ShaderCompile");
|
||||
while (true) {
|
||||
bool exitAfterCompile = false;
|
||||
std::vector<CompileQueueEntry> toCompile;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(compileMutex_);
|
||||
@ -467,6 +468,9 @@ void VulkanRenderManager::CompileThreadFunc() {
|
||||
}
|
||||
toCompile = std::move(compileQueue_);
|
||||
compileQueue_.clear();
|
||||
if (!runCompileThread_) {
|
||||
exitAfterCompile = true;
|
||||
}
|
||||
}
|
||||
|
||||
int countToCompile = (int)toCompile.size();
|
||||
@ -509,7 +513,7 @@ void VulkanRenderManager::CompileThreadFunc() {
|
||||
g_threadManager.EnqueueTask(task);
|
||||
}
|
||||
|
||||
if (!runCompileThread_) {
|
||||
if (exitAfterCompile) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,8 @@ private:
|
||||
int curHeight_ = -1;
|
||||
|
||||
bool insideFrame_ = false;
|
||||
bool runCompileThread_ = false;
|
||||
// probably doesn't need to be atomic.
|
||||
std::atomic<bool> runCompileThread_;
|
||||
|
||||
bool useRenderThread_ = true;
|
||||
bool measurePresentTime_ = false;
|
||||
|
@ -88,7 +88,8 @@ public:
|
||||
// Returns T if the data is ready, nullptr if it's not.
|
||||
// Obviously, can only be used if T is nullable, otherwise it won't compile.
|
||||
T Poll() {
|
||||
_assert_(sentinel_ == 0xffc0ffee);
|
||||
uint32_t sentinel = sentinel_;
|
||||
_assert_msg_(sentinel == 0xffc0ffee, "%08x", sentinel);
|
||||
std::lock_guard<std::mutex> guard(readyMutex_);
|
||||
if (ready_) {
|
||||
return data_;
|
||||
@ -105,7 +106,8 @@ public:
|
||||
}
|
||||
|
||||
T BlockUntilReady() {
|
||||
_assert_(sentinel_ == 0xffc0ffee);
|
||||
uint32_t sentinel = sentinel_;
|
||||
_assert_msg_(sentinel == 0xffc0ffee, "%08x", sentinel);
|
||||
std::lock_guard<std::mutex> guard(readyMutex_);
|
||||
if (ready_) {
|
||||
return data_;
|
||||
|
Loading…
Reference in New Issue
Block a user