[GLExtensions] Initial code drop for GLExtensions. This drops GLEW entirely from the codebase. This has been tested on Android and Linux+ATI. Of course untested on Windows and Apple. Also untested with Linux + EGL but should be fine there. There are most likely a couple of extensions I'm missing which would result in null pointer runs but not bad for the initial commit.

Conflicts:
	CMakeLists.txt
	Externals/GLew/glew.vcxproj
	Externals/GLew/glew.vcxproj.filters
	Source/Core/VideoBackends/OGL/CMakeLists.txt
	Source/Core/VideoBackends/OGL/GLFunctions.cpp
	Source/Core/VideoBackends/OGL/GLFunctions.h
	Source/Core/VideoBackends/OGL/GLUtil.h
	Source/Core/VideoBackends/OGL/Render.cpp
	Source/VSProps/Base.props
This commit is contained in:
Ryan Houdek
2013-12-30 07:22:50 -06:00
committed by degasus
parent 770485ad04
commit 71681de81a
65 changed files with 16217 additions and 52746 deletions

View File

@ -26,11 +26,31 @@
#include "../GLInterface.h"
#include "AGL.h"
// Copied from
// https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/opengl-macprogguide/opengl_entrypts/opengl_entrypts.html
void* NSGLGetProcAddress (const char *name)
{
NSSymbol symbol;
char *symbolName;
symbolName = malloc (strlen (name) + 2); // 1
strcpy(symbolName + 1, name); // 2
symbolName[0] = '_'; // 3
symbol = NULL;
if (NSIsSymbolNameDefined (symbolName)) // 4
symbol = NSLookupAndBindSymbol (symbolName);
free (symbolName); // 5
return symbol ? NSAddressOfSymbol (symbol) : NULL; // 6
}
void cInterfaceAGL::Swap()
{
[GLWin.cocoaCtx flushBuffer];
}
void* cInterfaceAGL::GetProcAddress(std::string name)
{
return NSGLGetProcAddress(name.c_str());
}
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceAGL::Create(void *&window_handle)

View File

@ -28,6 +28,7 @@ class cInterfaceAGL : public cInterfaceBase
{
public:
void Swap();
void* GetProcAddress(std::string name);
bool Create(void *&window_handle);
bool MakeCurrent();
bool ClearCurrent();

View File

@ -35,6 +35,11 @@ void cInterfaceEGL::SwapInterval(int Interval)
eglSwapInterval(GLWin.egl_dpy, Interval);
}
void* cInterfaceEGL::GetProcAddress(std::string name)
{
return (void*)eglGetProcAddress(name.c_str());
}
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceEGL::Create(void *&window_handle)

View File

@ -18,11 +18,7 @@
#define _INTERFACEEGL_H_
#if USE_GLES
#ifdef USE_GLES3
#include <GLES3/gl3.h>
#else
#include <GLES2/gl2.h>
#endif
#include <GL/gl.h>
#else
#include <GL/glxew.h>
#include <GL/gl.h>
@ -41,6 +37,7 @@ public:
void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
void* GetProcAddress(std::string name);
bool Create(void *&window_handle);
bool MakeCurrent();
void Shutdown();

View File

@ -22,6 +22,9 @@
#include "../GLInterface.h"
#include "GLX.h"
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
// Show the current FPS
void cInterfaceGLX::UpdateFPSDisplay(const char *text)
{
@ -35,6 +38,10 @@ void cInterfaceGLX::SwapInterval(int Interval)
else
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
}
void* cInterfaceGLX::GetProcAddress(std::string name)
{
return (void*)glXGetProcAddress((const GLubyte*)name.c_str());
}
void cInterfaceGLX::Swap()
{
@ -116,6 +123,7 @@ bool cInterfaceGLX::Create(void *&window_handle)
PanicAlert("Unable to create GLX context.");
return false;
}
glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)GLInterface->GetProcAddress("glXSwapIntervalSGI");
GLWin.x = _tx;
GLWin.y = _ty;

View File

@ -17,8 +17,8 @@
#ifndef _INTERFACEGLX_H_
#define _INTERFACEGLX_H_
#include <GL/glxew.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
@ -34,6 +34,7 @@ public:
void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
void* GetProcAddress(std::string name);
bool Create(void *&window_handle);
bool MakeCurrent();
bool ClearCurrent();

View File

@ -17,6 +17,7 @@ public:
virtual void UpdateFPSDisplay(const char *Text) {}
virtual void SetMode(u32 mode) { s_opengl_mode = mode; }
virtual u32 GetMode() { return s_opengl_mode; }
virtual void* GetProcAddress(std::string name) { return NULL; }
virtual bool Create(void *&window_handle) { return true; }
virtual bool MakeCurrent() { return true; }
virtual bool ClearCurrent() { return true; }

View File

@ -26,6 +26,11 @@ void cInterfaceWGL::Swap()
SwapBuffers(hDC);
}
void* cInterfaceWGL::GetProcAddress(std::string name)
{
return (void*)wglGetProcAddress((LPCSTR)name.c_str());
}
// Draw messages on top of the screen
bool cInterfaceWGL::PeekMessages()
{

View File

@ -19,6 +19,7 @@ public:
void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
void* GetProcAddress(std::string name);
bool Create(void *&window_handle);
bool MakeCurrent();
bool ClearCurrent();