From f09aaa32052d757ce644c9af0fce04358867181a Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 5 Feb 2013 00:10:40 +0000 Subject: [PATCH] win32-clarify threading logic in ogl display method --- desmume/src/windows/main.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 009f7d588..0bb7ce650 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1433,17 +1433,16 @@ struct GLDISPLAY bool begin() { DWORD myThread = GetCurrentThreadId(); - //if(myThread != dwMainThread) //single threading differences not needed right now - { - if(!init) - { - if(!initialize()) return false; - } - wglMakeCurrent(privateDC,privateContext); - return true; - } - //we can render no problem in this thread (i hope) + //always use another context for display logic + //1. if this is a single threaded process (3d rendering and display in the main thread) then alternating contexts is benign + //2. if this is a multi threaded process (3d rendernig and display in other threads) then the display needs some context + + if(!init) + { + if(!initialize()) return false; + } + wglMakeCurrent(privateDC,privateContext); return true; }