summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflacs <tilkax@gmail.com>2015-09-20 03:30:46 +0200
committerJules Blok <jules.blok@gmail.com>2015-09-23 21:09:03 +0200
commitbfd5c6c69d3aeb43c1bdc3f8edaee67c886f2380 (patch)
treed356de7171cb72337b7aa22a012c6d6d7f0f3284
parent2814aa20c843f3a6d0fc050804aa128f2111e2c3 (diff)
Merge pull request #3066 from degasus/master
GLInterface: Fix VideoSW on linux + OSX (v2) Conflicts: Source/Core/VideoBackends/OGL/GLInterface/GLX.cpp
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/AGL.cpp4
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/AGL.h2
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp2
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/EGL.h2
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/GLX.cpp15
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/GLX.h2
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/WGL.cpp2
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterface/WGL.h2
-rw-r--r--Source/Core/VideoBackends/OGL/GLInterfaceBase.h2
-rw-r--r--Source/Core/VideoBackends/Software/SWmain.cpp2
10 files changed, 20 insertions, 15 deletions
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/AGL.cpp b/Source/Core/VideoBackends/OGL/GLInterface/AGL.cpp
index 924fdea821..62286cb956 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/AGL.cpp
+++ b/Source/Core/VideoBackends/OGL/GLInterface/AGL.cpp
@@ -15,7 +15,7 @@ void cInterfaceAGL::Swap()
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
-bool cInterfaceAGL::Create(void *window_handle)
+bool cInterfaceAGL::Create(void *window_handle, bool core)
{
cocoaWin = reinterpret_cast<NSView*>(window_handle);
NSSize size = [cocoaWin frame].size;
@@ -33,7 +33,7 @@ bool cInterfaceAGL::Create(void *window_handle)
s_backbuffer_width = size.width;
s_backbuffer_height = size.height;
- NSOpenGLPixelFormatAttribute attr[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, NSOpenGLPFAAccelerated, 0 };
+ NSOpenGLPixelFormatAttribute attr[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, core ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy, NSOpenGLPFAAccelerated, 0 };
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
initWithAttributes: attr];
if (fmt == nil)
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/AGL.h b/Source/Core/VideoBackends/OGL/GLInterface/AGL.h
index f228bcb877..4e453aab29 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/AGL.h
+++ b/Source/Core/VideoBackends/OGL/GLInterface/AGL.h
@@ -17,7 +17,7 @@ private:
NSOpenGLContext *cocoaCtx;
public:
void Swap();
- bool Create(void *window_handle);
+ bool Create(void *window_handle, bool core);
bool MakeCurrent();
bool ClearCurrent();
void Shutdown();
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp b/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
index f83b540cbd..6e9903003a 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
+++ b/Source/Core/VideoBackends/OGL/GLInterface/EGL.cpp
@@ -84,7 +84,7 @@ err_exit:
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
-bool cInterfaceEGL::Create(void *window_handle)
+bool cInterfaceEGL::Create(void *window_handle, bool core)
{
const char *s;
EGLint egl_major, egl_minor;
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/EGL.h b/Source/Core/VideoBackends/OGL/GLInterface/EGL.h
index 2d290bf02f..c54b0e5dc1 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/EGL.h
+++ b/Source/Core/VideoBackends/OGL/GLInterface/EGL.h
@@ -26,7 +26,7 @@ public:
void Swap();
void SetMode(u32 mode) { s_opengl_mode = mode; }
void* GetFuncAddress(const std::string& name);
- bool Create(void *window_handle);
+ bool Create(void *window_handle, bool core);
bool MakeCurrent();
void Shutdown();
};
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/GLX.cpp b/Source/Core/VideoBackends/OGL/GLInterface/GLX.cpp
index 623466cdbd..3cb75ec9db 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/GLX.cpp
+++ b/Source/Core/VideoBackends/OGL/GLInterface/GLX.cpp
@@ -44,7 +44,7 @@ void cInterfaceGLX::Swap()
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
-bool cInterfaceGLX::Create(void *window_handle)
+bool cInterfaceGLX::Create(void *window_handle, bool core)
{
dpy = XOpenDisplay(nullptr);
int screen = DefaultScreen(dpy);
@@ -94,6 +94,9 @@ bool cInterfaceGLX::Create(void *window_handle)
// Get an appropriate visual
XVisualInfo* vi = glXGetVisualFromFBConfig(dpy, fbconfig);
+ s_glxError = false;
+ XErrorHandler oldHandler = XSetErrorHandler(&ctxErrorHandler);
+
// Create a GLX context.
// We try to get a 3.3 core profile, else we try it with anything we get.
int context_attribs[] =
@@ -104,10 +107,12 @@ bool cInterfaceGLX::Create(void *window_handle)
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
None
};
- s_glxError = false;
- XErrorHandler oldHandler = XSetErrorHandler(&ctxErrorHandler);
- ctx = glXCreateContextAttribs(dpy, fbconfig, 0, True, context_attribs);
- XSync(dpy, False);
+ ctx = nullptr;
+ if (core)
+ {
+ ctx = glXCreateContextAttribs(dpy, fbconfig, 0, True, context_attribs);
+ XSync(dpy, False);
+ }
if (!ctx || s_glxError)
{
int context_attribs_legacy[] =
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/GLX.h b/Source/Core/VideoBackends/OGL/GLInterface/GLX.h
index b9d047bc0c..d1431f9112 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/GLX.h
+++ b/Source/Core/VideoBackends/OGL/GLInterface/GLX.h
@@ -23,7 +23,7 @@ public:
void SwapInterval(int Interval) override;
void Swap() override;
void* GetFuncAddress(const std::string& name) override;
- bool Create(void *window_handle) override;
+ bool Create(void *window_handle, bool core) override;
bool MakeCurrent() override;
bool ClearCurrent() override;
void Shutdown() override;
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/WGL.cpp b/Source/Core/VideoBackends/OGL/GLInterface/WGL.cpp
index b974bb5955..27f36e617d 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/WGL.cpp
+++ b/Source/Core/VideoBackends/OGL/GLInterface/WGL.cpp
@@ -57,7 +57,7 @@ bool cInterfaceWGL::PeekMessages()
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
-bool cInterfaceWGL::Create(void *window_handle)
+bool cInterfaceWGL::Create(void *window_handle, bool core)
{
if (window_handle == nullptr)
return false;
diff --git a/Source/Core/VideoBackends/OGL/GLInterface/WGL.h b/Source/Core/VideoBackends/OGL/GLInterface/WGL.h
index 6c1ece457d..4382a0cf9a 100644
--- a/Source/Core/VideoBackends/OGL/GLInterface/WGL.h
+++ b/Source/Core/VideoBackends/OGL/GLInterface/WGL.h
@@ -13,7 +13,7 @@ public:
void SwapInterval(int Interval);
void Swap();
void* GetFuncAddress(const std::string& name);
- bool Create(void *window_handle);
+ bool Create(void *window_handle, bool core);
bool MakeCurrent();
bool ClearCurrent();
void Shutdown();
diff --git a/Source/Core/VideoBackends/OGL/GLInterfaceBase.h b/Source/Core/VideoBackends/OGL/GLInterfaceBase.h
index 31d107ad86..84d4be9a79 100644
--- a/Source/Core/VideoBackends/OGL/GLInterfaceBase.h
+++ b/Source/Core/VideoBackends/OGL/GLInterfaceBase.h
@@ -29,7 +29,7 @@ public:
virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual u32 GetMode() { return s_opengl_mode; }
virtual void* GetFuncAddress(const std::string& name) { return nullptr; }
- virtual bool Create(void *window_handle) { return true; }
+ virtual bool Create(void *window_handle, bool core = true) { return true; }
virtual bool MakeCurrent() { return true; }
virtual bool ClearCurrent() { return true; }
virtual void Shutdown() {}
diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp
index e0afd7d857..915d2465f5 100644
--- a/Source/Core/VideoBackends/Software/SWmain.cpp
+++ b/Source/Core/VideoBackends/Software/SWmain.cpp
@@ -78,7 +78,7 @@ bool VideoSoftware::Initialize(void *window_handle)
InitInterface();
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
- if (!GLInterface->Create(window_handle))
+ if (!GLInterface->Create(window_handle, false))
{
INFO_LOG(VIDEO, "GLInterface::Create failed.");
return false;