Advertisement
pauldacheez

Dolphin - GLSL for OS X hacky diff

Feb 6th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index b66b45a..b762b05 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -102,7 +102,7 @@ if(NOT MSVC)
  6. endif(NOT MSVC)
  7.  
  8. # gcc uses some optimizations which might break stuff without this flag
  9. -add_definitions(-fno-strict-aliasing -fno-exceptions -Wno-psabi)
  10. +add_definitions(-fno-strict-aliasing -fno-exceptions)
  11.  
  12. include(CheckCXXCompilerFlag)
  13.  
  14. diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt
  15. index 858e05b..fa8f09b 100644
  16. --- a/Source/Core/DolphinWX/CMakeLists.txt
  17. +++ b/Source/Core/DolphinWX/CMakeLists.txt
  18. @@ -91,8 +91,6 @@ else()
  19. set(SRCS ${SRCS} Src/GLInterface/GLW.cpp)
  20. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  21. if(USE_WX)
  22. - set(SRCS ${SRCS} Src/GLInterface/WX.cpp)
  23. - else()
  24. set(SRCS ${SRCS} Src/GLInterface/AGL.cpp)
  25. endif()
  26. else()
  27. diff --git a/Source/Core/DolphinWX/Src/GLInterface.h b/Source/Core/DolphinWX/Src/GLInterface.h
  28. index a81f171..1267074 100644
  29. --- a/Source/Core/DolphinWX/Src/GLInterface.h
  30. +++ b/Source/Core/DolphinWX/Src/GLInterface.h
  31. @@ -21,14 +21,8 @@
  32.  
  33. #if defined(USE_EGL) && USE_EGL
  34. #include "GLInterface/EGL.h"
  35. -#elif defined(USE_WX) && USE_WX
  36. -#include "GLInterface/WX.h"
  37. #elif defined(__APPLE__)
  38. #include "GLInterface/AGL.h"
  39. -#elif defined(_WIN32)
  40. -#include "GLInterface/WGL.h"
  41. -#elif defined(HAVE_X11) && HAVE_X11
  42. -#include "GLInterface/GLX.h"
  43. #endif
  44.  
  45. typedef struct {
  46. @@ -46,10 +40,6 @@ typedef struct {
  47. std::thread xEventThread;
  48. int x, y;
  49. unsigned int width, height;
  50. -#elif defined(USE_WX) && USE_WX
  51. - wxGLCanvas *glCanvas;
  52. - wxGLContext *glCtxt;
  53. - wxPanel *panel;
  54. #elif defined(__APPLE__)
  55. NSWindow *cocoaWin;
  56. NSOpenGLContext *cocoaCtx;
  57. diff --git a/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp b/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
  58. index e12e061..65f766d 100644
  59. --- a/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
  60. +++ b/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
  61. @@ -48,7 +48,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
  62.  
  63. NSRect size;
  64. NSUInteger style = NSMiniaturizableWindowMask;
  65. - NSOpenGLPixelFormatAttribute attr[2] = { NSOpenGLPFADoubleBuffer, 0 };
  66. + NSOpenGLPixelFormatAttribute attr[4] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, 0 };
  67. NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
  68. initWithAttributes: attr];
  69. if (fmt == nil) {
  70. @@ -57,7 +57,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
  71. }
  72.  
  73. GLWin.cocoaCtx = [[NSOpenGLContext alloc]
  74. - initWithFormat: fmt shareContext: nil kCGLPFAOpenGLProfile: kCGLOGLPVersion_3_2_Core ];
  75. + initWithFormat: fmt shareContext: nil];
  76. [fmt release];
  77. if (GLWin.cocoaCtx == nil) {
  78. ERROR_LOG(VIDEO, "failed to create context");
  79. @@ -97,7 +97,7 @@ bool cInterfaceAGL::MakeCurrent()
  80. width = [[GLWin.cocoaWin contentView] frame].size.width;
  81. height = [[GLWin.cocoaWin contentView] frame].size.height;
  82. if (width == s_backbuffer_width && height == s_backbuffer_height)
  83. - return;
  84. + return true;
  85.  
  86. [GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
  87. [GLWin.cocoaCtx update];
  88. diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp b/Source/Core/DolphinWX/Src/GLInterface/WX.cpp
  89. deleted file mode 100644
  90. index d5415c8..0000000
  91. --- a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp
  92. +++ /dev/null
  93. @@ -1,83 +0,0 @@
  94. -// Copyright (C) 2003 Dolphin Project.
  95. -
  96. -// This program is free software: you can redistribute it and/or modify
  97. -// it under the terms of the GNU General Public License as published by
  98. -// the Free Software Foundation, version 2.0.
  99. -
  100. -// This program is distributed in the hope that it will be useful,
  101. -// but WITHOUT ANY WARRANTY; without even the implied warranty of
  102. -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  103. -// GNU General Public License 2.0 for more details.
  104. -
  105. -// A copy of the GPL 2.0 should have been included with the program.
  106. -// If not, see http://www.gnu.org/licenses/
  107. -
  108. -// Official SVN repository and contact information can be found at
  109. -// http://code.google.com/p/dolphin-emu/
  110. -
  111. -#include "VideoConfig.h"
  112. -#include "Host.h"
  113. -#include "RenderBase.h"
  114. -
  115. -#include "VertexShaderManager.h"
  116. -#include "../GLInterface.h"
  117. -#include "WX.h"
  118. -
  119. -void cInterfaceWX::Swap()
  120. -{
  121. - GLWin.glCanvas->SwapBuffers();
  122. -}
  123. -
  124. -void cInterfaceWX::UpdateFPSDisplay(const char *text)
  125. -{
  126. - // Handled by Host_UpdateTitle()
  127. -}
  128. -
  129. -// Create rendering window.
  130. -// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
  131. -bool cInterfaceWX::Create(void *&window_handle)
  132. -{
  133. - int _tx, _ty, _twidth, _theight;
  134. - Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
  135. -
  136. - // Control window size and picture scaling
  137. - s_backbuffer_width = _twidth;
  138. - s_backbuffer_height = _theight;
  139. -
  140. - GLWin.panel = (wxPanel *)window_handle;
  141. - GLWin.glCanvas = new wxGLCanvas(GLWin.panel, wxID_ANY, NULL,
  142. - wxPoint(0, 0), wxSize(_twidth, _theight));
  143. - GLWin.glCanvas->Show(true);
  144. - if (GLWin.glCtxt == NULL) // XXX dirty hack
  145. - GLWin.glCtxt = new wxGLContext(GLWin.glCanvas);
  146. - return true;
  147. -}
  148. -
  149. -bool cInterfaceWX::MakeCurrent()
  150. -{
  151. - return GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
  152. -}
  153. -
  154. -// Update window width, size and etc. Called from Render.cpp
  155. -void cInterfaceWX::Update()
  156. -{
  157. - int width, height;
  158. -
  159. - GLWin.panel->GetSize(&width, &height);
  160. - if (width == s_backbuffer_width && height == s_backbuffer_height)
  161. - return;
  162. -
  163. - GLWin.glCanvas->SetFocus();
  164. - GLWin.glCanvas->SetSize(0, 0, width, height);
  165. - GLWin.glCtxt->SetCurrent(*GLWin.glCanvas);
  166. - s_backbuffer_width = width;
  167. - s_backbuffer_height = height;
  168. -}
  169. -
  170. -// Close backend
  171. -void cInterfaceWX::Shutdown()
  172. -{
  173. - GLWin.glCanvas->Hide();
  174. -}
  175. -
  176. -
  177. diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.h b/Source/Core/DolphinWX/Src/GLInterface/WX.h
  178. deleted file mode 100644
  179. index 7772f86..0000000
  180. --- a/Source/Core/DolphinWX/Src/GLInterface/WX.h
  181. +++ /dev/null
  182. @@ -1,47 +0,0 @@
  183. -// Copyright (C) 2003 Dolphin Project.
  184. -
  185. -// This program is free software: you can redistribute it and/or modify
  186. -// it under the terms of the GNU General Public License as published by
  187. -// the Free Software Foundation, version 2.0.
  188. -
  189. -// This program is distributed in the hope that it will be useful,
  190. -// but WITHOUT ANY WARRANTY; without even the implied warranty of
  191. -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  192. -// GNU General Public License 2.0 for more details.
  193. -
  194. -// A copy of the GPL 2.0 should have been included with the program.
  195. -// If not, see http://www.gnu.org/licenses/
  196. -
  197. -// Official SVN repository and contact information can be found at
  198. -// http://code.google.com/p/dolphin-emu/
  199. -#ifndef _INTERFACEWX_H_
  200. -#define _INTERFACEWX_H_
  201. -
  202. -#if defined HAVE_X11 && HAVE_X11
  203. -#include <GL/glxew.h>
  204. -#include <GL/gl.h>
  205. -#elif defined __APPLE__
  206. -#include <GL/glew.h>
  207. -#import <AppKit/AppKit.h>
  208. -#endif
  209. -
  210. -#if defined USE_WX && USE_WX
  211. -#include "wx/wx.h"
  212. -#include "wx/glcanvas.h"
  213. -#endif
  214. -
  215. -#include "InterfaceBase.h"
  216. -
  217. -class cInterfaceWX : public cInterfaceBase
  218. -{
  219. -public:
  220. - void Swap();
  221. - void UpdateFPSDisplay(const char *Text);
  222. - bool Create(void *&window_handle);
  223. - bool MakeCurrent();
  224. - void Shutdown();
  225. -
  226. - void Update();
  227. -};
  228. -#endif
  229. -
  230. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
  231. index e0303d4..3598f55 100644
  232. --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
  233. +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
  234. @@ -56,8 +56,6 @@ void InitInterface()
  235. {
  236. #if defined(USE_EGL) && USE_EGL
  237. GLInterface = new cInterfaceEGL;
  238. - #elif defined(USE_WX) && USE_WX
  239. - GLInterface = new cInterfaceWX;
  240. #elif defined(__APPLE__)
  241. GLInterface = new cInterfaceAGL;
  242. #elif defined(_WIN32)
  243. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
  244. index 46b0856..b83e19f 100644
  245. --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
  246. +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
  247. @@ -335,7 +335,7 @@ Renderer::Renderer()
  248. #ifdef __APPLE__
  249. int swapInterval = g_ActiveConfig.bVSync ? 1 : 0;
  250. #if defined USE_WX && USE_WX
  251. - NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext();
  252. + NSOpenGLContext *ctx = GLWin.cocoaCtx;
  253. #else
  254. NSOpenGLContext *ctx = GLWin.cocoaCtx;
  255. #endif
  256. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp
  257. index dd9d592..293e035 100644
  258. --- a/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp
  259. +++ b/Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp
  260. @@ -41,7 +41,7 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
  261. if(g_Config.backend_info.bSupportsGLPinnedMemory && g_Config.backend_info.bSupportsGLSync)
  262. m_uploadtype = PINNED_MEMORY;
  263. else if(g_Config.backend_info.bSupportsGLSync)
  264. - m_uploadtype = MAP_AND_RISK;
  265. + m_uploadtype = MAP_AND_ORPHAN;
  266. else
  267. m_uploadtype = MAP_AND_ORPHAN;
  268. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement