diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 858e05bbfd..ce31c22f3e 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -90,11 +90,7 @@ else() if(WIN32) set(SRCS ${SRCS} Src/GLInterface/GLW.cpp) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(USE_WX) - set(SRCS ${SRCS} Src/GLInterface/WX.cpp) - else() - set(SRCS ${SRCS} Src/GLInterface/AGL.cpp) - endif() + set(SRCS ${SRCS} Src/GLInterface/AGL.cpp) else() set(SRCS ${SRCS} Src/GLInterface/GLX.cpp Src/GLInterface/X11_Util.cpp) diff --git a/Source/Core/DolphinWX/Src/GLInterface.h b/Source/Core/DolphinWX/Src/GLInterface.h index a81f17104c..307ce2b69d 100644 --- a/Source/Core/DolphinWX/Src/GLInterface.h +++ b/Source/Core/DolphinWX/Src/GLInterface.h @@ -21,8 +21,6 @@ #if defined(USE_EGL) && USE_EGL #include "GLInterface/EGL.h" -#elif defined(USE_WX) && USE_WX -#include "GLInterface/WX.h" #elif defined(__APPLE__) #include "GLInterface/AGL.h" #elif defined(_WIN32) @@ -46,10 +44,6 @@ typedef struct { std::thread xEventThread; int x, y; unsigned int width, height; -#elif defined(USE_WX) && USE_WX - wxGLCanvas *glCanvas; - wxGLContext *glCtxt; - wxPanel *panel; #elif defined(__APPLE__) NSWindow *cocoaWin; NSOpenGLContext *cocoaCtx; diff --git a/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp b/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp index e12e061aa6..65f766d68c 100644 --- a/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp +++ b/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp @@ -48,7 +48,7 @@ bool cInterfaceAGL::Create(void *&window_handle) NSRect size; NSUInteger style = NSMiniaturizableWindowMask; - NSOpenGLPixelFormatAttribute attr[2] = { NSOpenGLPFADoubleBuffer, 0 }; + NSOpenGLPixelFormatAttribute attr[4] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, 0 }; NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: attr]; if (fmt == nil) { @@ -57,7 +57,7 @@ bool cInterfaceAGL::Create(void *&window_handle) } GLWin.cocoaCtx = [[NSOpenGLContext alloc] - initWithFormat: fmt shareContext: nil kCGLPFAOpenGLProfile: kCGLOGLPVersion_3_2_Core ]; + initWithFormat: fmt shareContext: nil]; [fmt release]; if (GLWin.cocoaCtx == nil) { ERROR_LOG(VIDEO, "failed to create context"); @@ -97,7 +97,7 @@ bool cInterfaceAGL::MakeCurrent() width = [[GLWin.cocoaWin contentView] frame].size.width; height = [[GLWin.cocoaWin contentView] frame].size.height; if (width == s_backbuffer_width && height == s_backbuffer_height) - return; + return true; [GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]]; [GLWin.cocoaCtx update]; diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp b/Source/Core/DolphinWX/Src/GLInterface/WX.cpp deleted file mode 100644 index d5415c8ed9..0000000000 --- a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include "VideoConfig.h" -#include "Host.h" -#include "RenderBase.h" - -#include "VertexShaderManager.h" -#include "../GLInterface.h" -#include "WX.h" - -void cInterfaceWX::Swap() -{ - GLWin.glCanvas->SwapBuffers(); -} - -void cInterfaceWX::UpdateFPSDisplay(const char *text) -{ - // Handled by Host_UpdateTitle() -} - -// Create rendering window. -// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() -bool cInterfaceWX::Create(void *&window_handle) -{ - int _tx, _ty, _twidth, _theight; - Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight); - - // Control window size and picture scaling - s_backbuffer_width = _twidth; - s_backbuffer_height = _theight; - - GLWin.panel = (wxPanel *)window_handle; - GLWin.glCanvas = new wxGLCanvas(GLWin.panel, wxID_ANY, NULL, - wxPoint(0, 0), wxSize(_twidth, _theight)); - GLWin.glCanvas->Show(true); - if (GLWin.glCtxt == NULL) // XXX dirty hack - GLWin.glCtxt = new wxGLContext(GLWin.glCanvas); - return true; -} - -bool cInterfaceWX::MakeCurrent() -{ - return GLWin.glCanvas->SetCurrent(*GLWin.glCtxt); -} - -// Update window width, size and etc. Called from Render.cpp -void cInterfaceWX::Update() -{ - int width, height; - - GLWin.panel->GetSize(&width, &height); - if (width == s_backbuffer_width && height == s_backbuffer_height) - return; - - GLWin.glCanvas->SetFocus(); - GLWin.glCanvas->SetSize(0, 0, width, height); - GLWin.glCtxt->SetCurrent(*GLWin.glCanvas); - s_backbuffer_width = width; - s_backbuffer_height = height; -} - -// Close backend -void cInterfaceWX::Shutdown() -{ - GLWin.glCanvas->Hide(); -} - - diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.h b/Source/Core/DolphinWX/Src/GLInterface/WX.h deleted file mode 100644 index 7772f864e5..0000000000 --- a/Source/Core/DolphinWX/Src/GLInterface/WX.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _INTERFACEWX_H_ -#define _INTERFACEWX_H_ - -#if defined HAVE_X11 && HAVE_X11 -#include -#include -#elif defined __APPLE__ -#include -#import -#endif - -#if defined USE_WX && USE_WX -#include "wx/wx.h" -#include "wx/glcanvas.h" -#endif - -#include "InterfaceBase.h" - -class cInterfaceWX : public cInterfaceBase -{ -public: - void Swap(); - void UpdateFPSDisplay(const char *Text); - bool Create(void *&window_handle); - bool MakeCurrent(); - void Shutdown(); - - void Update(); -}; -#endif - diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index e0303d465d..3598f55f3e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -56,8 +56,6 @@ void InitInterface() { #if defined(USE_EGL) && USE_EGL GLInterface = new cInterfaceEGL; - #elif defined(USE_WX) && USE_WX - GLInterface = new cInterfaceWX; #elif defined(__APPLE__) GLInterface = new cInterfaceAGL; #elif defined(_WIN32) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 46b085670b..1ea72c40da 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -334,9 +334,6 @@ Renderer::Renderer() // Handle VSync on/off #ifdef __APPLE__ int swapInterval = g_ActiveConfig.bVSync ? 1 : 0; -#if defined USE_WX && USE_WX - NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext(); -#else NSOpenGLContext *ctx = GLWin.cocoaCtx; #endif [ctx setValues: &swapInterval forParameter: NSOpenGLCPSwapInterval]; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp index dd9d59224a..9ef43f6d53 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp @@ -137,7 +137,8 @@ size_t StreamBuffer::Upload ( u8* data, size_t size ) break; case PINNED_MEMORY: case MAP_AND_RISK: - memcpy(pointer+m_iterator, data, size); + if(pointer) + memcpy(pointer+m_iterator, data, size); break; case BUFFERSUBDATA: glBufferSubData(m_buffertype, m_iterator, size, data); @@ -187,6 +188,8 @@ void StreamBuffer::Init() glBufferData(m_buffertype, m_size, NULL, GL_STREAM_DRAW); pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY); glUnmapBuffer(m_buffertype); + if(!pointer) + ERROR_LOG(VIDEO, "buffer allocation failed"); case STREAM_DETECT: break;