Move Win32 specific function grabbing fallback to WGL.cpp. Fixes issue 6964.
This commit is contained in:
parent
839df31347
commit
bea484e12f
|
@ -13,6 +13,7 @@
|
||||||
#include "EmuWindow.h"
|
#include "EmuWindow.h"
|
||||||
static HDC hDC = NULL; // Private GDI Device Context
|
static HDC hDC = NULL; // Private GDI Device Context
|
||||||
static HGLRC hRC = NULL; // Permanent Rendering Context
|
static HGLRC hRC = NULL; // Permanent Rendering Context
|
||||||
|
static HINSTANCE dllHandle = NULL; // Handle to OpenGL32.dll
|
||||||
|
|
||||||
// typedef from wglext.h
|
// typedef from wglext.h
|
||||||
typedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
typedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||||
|
@ -32,7 +33,10 @@ void cInterfaceWGL::Swap()
|
||||||
|
|
||||||
void* cInterfaceWGL::GetProcAddress(std::string name)
|
void* cInterfaceWGL::GetProcAddress(std::string name)
|
||||||
{
|
{
|
||||||
return (void*)wglGetProcAddress((LPCSTR)name.c_str());
|
void* func = (void*)wglGetProcAddress((LPCSTR)name.c_str());
|
||||||
|
if (func == NULL)
|
||||||
|
func = (void*)GetProcAddress(dllHandle, (LPCSTR)name.c_str());
|
||||||
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw messages on top of the screen
|
// Draw messages on top of the screen
|
||||||
|
@ -69,6 +73,10 @@ bool cInterfaceWGL::Create(void *&window_handle)
|
||||||
s_backbuffer_width = _twidth;
|
s_backbuffer_width = _twidth;
|
||||||
s_backbuffer_height = _theight;
|
s_backbuffer_height = _theight;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
dllHandle = LoadLibrary(TEXT("OpenGL32.dll"));
|
||||||
|
#endif
|
||||||
|
|
||||||
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Please wait..."));
|
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Please wait..."));
|
||||||
if (window_handle == NULL)
|
if (window_handle == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
// gl_1_1
|
// gl_1_1
|
||||||
|
@ -779,9 +776,6 @@ namespace GLExtensions
|
||||||
bool _isES3;
|
bool _isES3;
|
||||||
bool _isES;
|
bool _isES;
|
||||||
u32 _GLVersion;
|
u32 _GLVersion;
|
||||||
#ifdef _WIN32
|
|
||||||
HINSTANCE dllHandle = NULL;
|
|
||||||
#endif
|
|
||||||
std::unordered_map<std::string, bool> _extensionlist;
|
std::unordered_map<std::string, bool> _extensionlist;
|
||||||
// Forward declared init functions
|
// Forward declared init functions
|
||||||
bool init_gl_1_1();
|
bool init_gl_1_1();
|
||||||
|
@ -954,10 +948,6 @@ namespace GLExtensions
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
// Give it a second try with dlsym
|
// Give it a second try with dlsym
|
||||||
*func = dlsym(RTLD_NEXT, name.c_str());
|
*func = dlsym(RTLD_NEXT, name.c_str());
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (*func == NULL)
|
|
||||||
*func = (void*)GetProcAddress(dllHandle, (LPCSTR)name.c_str());
|
|
||||||
#endif
|
#endif
|
||||||
if (*func == NULL && _isES)
|
if (*func == NULL && _isES)
|
||||||
*func = (void*)0xFFFFFFFF; // Easy to determine invalid function, just so we continue on
|
*func = (void*)0xFFFFFFFF; // Easy to determine invalid function, just so we continue on
|
||||||
|
@ -979,9 +969,7 @@ namespace GLExtensions
|
||||||
bool success = true;
|
bool success = true;
|
||||||
_isES3 = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3;
|
_isES3 = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3;
|
||||||
_isES = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 || GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES2;
|
_isES = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 || GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES2;
|
||||||
#ifdef _WIN32
|
|
||||||
dllHandle = LoadLibrary(TEXT("OpenGL32.dll"));
|
|
||||||
#endif
|
|
||||||
// Grab glGetStringi and glGetIntegerv immediately
|
// Grab glGetStringi and glGetIntegerv immediately
|
||||||
// We need them to grab the extension list
|
// We need them to grab the extension list
|
||||||
// If it fails then the user's drivers don't support GL 3.0
|
// If it fails then the user's drivers don't support GL 3.0
|
||||||
|
|
Loading…
Reference in New Issue