From 61aa272bfb71ace8823a86ad08813f644db7cad2 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 25 May 2013 22:17:05 -0500 Subject: [PATCH] [Android] Qualcomm drivers require that the EGL context is created on the same thread that the OpenGL commands are run on. Crappy driver limitation since eglMakeCurrent should work to let it be on a different thread. --- .../Plugin_VideoSoftware/Src/SWmain.cpp | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index 82aa72ab2e..c63ad2e446 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -39,7 +39,7 @@ namespace SW static volatile bool fifoStateRun = false; static volatile bool emuRunningState = false; static std::mutex m_csSWVidOccupied; - +static void* m_windowhandle; std::string VideoSoftware::GetName() { @@ -62,15 +62,9 @@ void VideoSoftware::ShowConfig(void *_hParent) bool VideoSoftware::Initialize(void *&window_handle) { g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); - InitInterface(); - - if (!GLInterface->Create(window_handle)) - { - INFO_LOG(VIDEO, "%s", "SWRenderer::Create failed\n"); - return false; - } - // Do our OSD callbacks - OSD::DoCallbacks(OSD::OSD_INIT); + InitInterface(); + + m_windowhandle = window_handle; InitBPMemory(); InitXFMemory(); @@ -166,6 +160,12 @@ void VideoSoftware::Video_Cleanup() // This is called after Video_Initialize() from the Core void VideoSoftware::Video_Prepare() { + if (!GLInterface->Create(m_windowhandle)) + { + INFO_LOG(VIDEO, "%s", "SWRenderer::Create failed\n"); + return; + } + GLInterface->MakeCurrent(); // Init extension support. #ifndef USE_GLES @@ -180,6 +180,9 @@ void VideoSoftware::Video_Prepare() // Handle VSync on/off GLInterface->SwapInterval(VSYNC_ENABLED); + // Do our OSD callbacks + OSD::DoCallbacks(OSD::OSD_INIT); + HwRasterizer::Prepare(); SWRenderer::Prepare();