diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj index fc713d7140..c5a3399f57 100644 --- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj +++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj @@ -1129,14 +1129,6 @@ > - - - - @@ -1193,6 +1185,14 @@ RelativePath=".\Src\Globals.h" > + + + + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp similarity index 97% rename from Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp rename to Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 480dd929c9..3a958b6720 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -31,7 +31,7 @@ struct RECT }; #endif -#include "GLInit.h" +#include "GLUtil.h" #ifndef USE_SDL #define USE_SDL 0 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h similarity index 53% rename from Source/Plugins/Plugin_VideoOGL/Src/GLInit.h rename to Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index 0821cdc585..d52e2b636e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -18,6 +18,66 @@ #ifndef _GLINIT_H #define _GLINIT_H +#ifdef _WIN32 + +#define GLEW_STATIC + +#include +#include +#include +#include + +#else // linux basic definitions + +#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#define I_NEED_OS2_H // HAXXOR +//#include +#include + +#if defined(__APPLE__) + +#include + +#else + +#include + +#endif +//#include +#define __inline inline + +#include // ftime(), struct timeb + +inline unsigned long timeGetTime() +{ +#ifdef _WIN32 + _timeb t; + _ftime(&t); +#else + timeb t; + ftime(&t); +#endif + + return (unsigned long)(t.time*1000+t.millitm); +} + +#endif // linux basic definitions + +#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif + +#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } + +#ifdef _DEBUG +#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } +#else +#define GL_REPORT_ERRORD() +#endif + #ifndef _WIN32 #undef I_NEED_OS2_H diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h index cf32b3d4c2..b4cd1bd64e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h @@ -24,58 +24,6 @@ #include "Common.h" #include "x64Emitter.h" -#ifdef _WIN32 - -#define GLEW_STATIC - -#include -#include -#include -#include - -#else // linux basic definitions - -#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) -#define I_NEED_OS2_H // HAXXOR -//#include -#include - -#if defined(__APPLE__) - -#include - -#else - -#include - -#endif -//#include -#define __inline inline - -#include // ftime(), struct timeb - -inline unsigned long timeGetTime() -{ -#ifdef _WIN32 - _timeb t; - _ftime(&t); -#else - timeb t; - ftime(&t); -#endif - - return (unsigned long)(t.time*1000+t.millitm); -} - -#endif // linux basic definitions - -#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 -#endif - #define ERROR_LOG __Log #if defined(_DEBUG) || defined(DEBUGFAST) @@ -88,15 +36,6 @@ inline unsigned long timeGetTime() #define DEBUG_LOG(...) #endif -#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } - -#ifdef _DEBUG -#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } -#else -#define GL_REPORT_ERRORD() -#endif - - #define CONF_LOG 1 #define CONF_PRIMLOG 2 #define CONF_SAVETEXTURES 4 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.cpp index 65b37d3099..2e14576a3e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.cpp @@ -16,12 +16,12 @@ // http://code.google.com/p/dolphin-emu/ #include "Globals.h" +#include "GLUtil.h" #include #include #include - #include "ImageWrite.h" #if defined(_MSC_VER) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp index b608f40318..ad136da5f2 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp @@ -18,6 +18,8 @@ #include "Globals.h" #include "Profiler.h" +#include "GLUtil.h" + #include #include diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 1477d967ad..87381a2955 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -19,6 +19,7 @@ #include #include +#include "GLUtil.h" #include #include @@ -27,7 +28,6 @@ #include #endif -#include "GLInit.h" #include "Profiler.h" #include "Statistics.h" #include "ImageWrite.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index 4128b3d136..1423be74a8 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -9,7 +9,7 @@ import utils files = [ 'BPStructs.cpp', 'Globals.cpp', - 'GLInit.cpp', + 'GLUtil.cpp', 'main.cpp', 'memcpy_amd.cpp', 'OpcodeDecoding.cpp', diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h index be82e70abf..bbc2849b96 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h @@ -19,6 +19,8 @@ #define _TextureMngr_H #include + +#include "GLUtil.h" #include "BPStructs.h" struct TRectangle diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp index d16c5cf3f6..09a5c0e5fa 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp @@ -18,6 +18,8 @@ #include "Globals.h" #include "Profiler.h" +#include "GLUtil.h" + #include #include diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h index e4d8f66175..1d08ace835 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h @@ -20,6 +20,8 @@ #include +#include "GLUtil.h" + struct VERTEXSHADER { VERTEXSHADER() : glprogid(0) {} diff --git a/Source/Plugins/Plugin_VideoOGL/Src/XFB.cpp b/Source/Plugins/Plugin_VideoOGL/Src/XFB.cpp index cdb5fb8932..b00ab9e8e0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/XFB.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/XFB.cpp @@ -19,8 +19,8 @@ // Preliminary non-working code. #include "Globals.h" +#include "GLUtil.h" #include "MemoryUtil.h" -#include "GLInit.h" #include "Render.h" #include "TextureMngr.h" #include "VertexShaderManager.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index a84e1ea2a0..2f6f09946f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -30,7 +30,7 @@ #include "LookUpTables.h" #include "ImageWrite.h" #include "Render.h" -#include "GLInit.h" +#include "GLUtil.h" #include "Fifo.h" #include "OpcodeDecoding.h" #include "TextureMngr.h"