Merge pull request #16156 from hrydgard/opengl-thread-refactor

OpenGL threading refactor
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-01-31 11:14:01 +01:00
commit c8dce81ff0
23 files changed
+224 -286

No files matched your search

+5 -5
View File
@@ -327,14 +327,14 @@ void Core_ProcessStepping() {
// Many platforms, like Android, do not call this function but handle things on their own.
// Instead they simply call NativeRender and NativeUpdate directly.
void Core_Run(GraphicsContext *ctx) {
bool Core_Run(GraphicsContext *ctx) {
host->UpdateDisassembly();
while (true) {
if (GetUIState() != UISTATE_INGAME) {
Core_StateProcessed();
if (GetUIState() == UISTATE_EXIT) {
UpdateRunLoop();
return;
return false;
}
Core_RunLoop(ctx);
continue;
@@ -347,7 +347,7 @@ void Core_Run(GraphicsContext *ctx) {
Core_RunLoop(ctx);
if (coreState == CORE_POWERDOWN) {
Core_StateProcessed();
return;
return true;
}
break;
@@ -358,10 +358,10 @@ void Core_Run(GraphicsContext *ctx) {
// Exit loop!!
Core_StateProcessed();
return;
return true;
case CORE_NEXTFRAME:
return;
return true;
}
}
}
+3 -1
View File
@@ -27,8 +27,10 @@ class GraphicsContext;
// called from emu thread
void UpdateRunLoop();
void Core_Run(GraphicsContext *ctx);
// Returns false when an UI exit state is detected.
bool Core_Run(GraphicsContext *ctx);
void Core_Stop();
// For platforms that don't call Core_Run
void Core_SetGraphicsContext(GraphicsContext *ctx);
+8 -5
View File
@@ -233,16 +233,14 @@ void Shutdown()
ClearPendingEvents();
UnregisterAllEvents();
while(eventPool)
{
while (eventPool) {
Event *ev = eventPool;
eventPool = ev->next;
delete ev;
}
std::lock_guard<std::mutex> lk(externalEventLock);
while(eventTsPool)
{
while (eventTsPool) {
Event *ev = eventTsPool;
eventTsPool = ev->next;
delete ev;
@@ -251,7 +249,12 @@ void Shutdown()
u64 GetTicks()
{
return (u64)globalTimer + slicelength - currentMIPS->downcount;
if (currentMIPS) {
return (u64)globalTimer + slicelength - currentMIPS->downcount;
} else {
// Reporting can actually end up here during weird task switching sequences on Android
return false;
}
}
u64 GetIdleTicks()