Commit ea8ae897 by Jamie Madill

Expose FunctionsWGL::getProcAddress.

Change-Id: I263f00e67eb3243c661de8f949933ea56e34d4b5 Reviewed-on: https://chromium-review.googlesource.com/251220Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 80d934bb
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
namespace rx namespace rx
{ {
typedef PROC(WINAPI *PFNWGLGETPROCADDRESSPROC)(LPCSTR);
template <typename T> template <typename T>
static void GetWGLProcAddress(HMODULE glModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL, static void GetWGLProcAddress(HMODULE glModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL,
const std::string &procName, T *outProcAddress) const std::string &procName, T *outProcAddress)
...@@ -49,6 +47,7 @@ FunctionsWGL::FunctionsWGL() ...@@ -49,6 +47,7 @@ FunctionsWGL::FunctionsWGL()
: createContext(nullptr), : createContext(nullptr),
deleteContext(nullptr), deleteContext(nullptr),
makeCurrent(nullptr), makeCurrent(nullptr),
getProcAddress(nullptr),
createContextAttribsARB(nullptr), createContextAttribsARB(nullptr),
getPixelFormatAttribivARB(nullptr), getPixelFormatAttribivARB(nullptr),
swapIntervalEXT(nullptr) swapIntervalEXT(nullptr)
...@@ -58,20 +57,19 @@ FunctionsWGL::FunctionsWGL() ...@@ -58,20 +57,19 @@ FunctionsWGL::FunctionsWGL()
void FunctionsWGL::intialize(HMODULE glModule, HDC context) void FunctionsWGL::intialize(HMODULE glModule, HDC context)
{ {
// First grab the wglGetProcAddress function from the gl module // First grab the wglGetProcAddress function from the gl module
PFNWGLGETPROCADDRESSPROC getProcAddressWGL = nullptr; GetWGLProcAddress(glModule, nullptr, "wglGetProcAddress", &getProcAddress);
GetWGLProcAddress(glModule, nullptr, "wglGetProcAddress", &getProcAddressWGL);
// Load the core wgl functions // Load the core wgl functions
GetWGLProcAddress(glModule, getProcAddressWGL, "wglCreateContext", &createContext); GetWGLProcAddress(glModule, getProcAddress, "wglCreateContext", &createContext);
GetWGLProcAddress(glModule, getProcAddressWGL, "wglDeleteContext", &deleteContext); GetWGLProcAddress(glModule, getProcAddress, "wglDeleteContext", &deleteContext);
GetWGLProcAddress(glModule, getProcAddressWGL, "wglMakeCurrent", &makeCurrent); GetWGLProcAddress(glModule, getProcAddress, "wglMakeCurrent", &makeCurrent);
// Load extension string getter functions // Load extension string getter functions
PFNWGLGETEXTENSIONSSTRINGEXTPROC getExtensionStringEXT = nullptr; PFNWGLGETEXTENSIONSSTRINGEXTPROC getExtensionStringEXT = nullptr;
GetWGLProcAddress(glModule, getProcAddressWGL, "wglGetExtensionsStringEXT", &getExtensionStringEXT); GetWGLProcAddress(glModule, getProcAddress, "wglGetExtensionsStringEXT", &getExtensionStringEXT);
PFNWGLGETEXTENSIONSSTRINGARBPROC getExtensionStringARB = nullptr; PFNWGLGETEXTENSIONSSTRINGARBPROC getExtensionStringARB = nullptr;
GetWGLProcAddress(glModule, getProcAddressWGL, "wglGetExtensionsStringARB", &getExtensionStringARB); GetWGLProcAddress(glModule, getProcAddress, "wglGetExtensionsStringARB", &getExtensionStringARB);
std::string extensions = ""; std::string extensions = "";
if (getExtensionStringEXT) if (getExtensionStringEXT)
...@@ -84,9 +82,9 @@ void FunctionsWGL::intialize(HMODULE glModule, HDC context) ...@@ -84,9 +82,9 @@ void FunctionsWGL::intialize(HMODULE glModule, HDC context)
} }
// Load the wgl extension functions by checking if the context supports the extension first // Load the wgl extension functions by checking if the context supports the extension first
GetWGLExtensionProcAddress(glModule, getProcAddressWGL, extensions, "WGL_ARB_create_context", "wglCreateContextAttribsARB", &createContextAttribsARB); GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_create_context", "wglCreateContextAttribsARB", &createContextAttribsARB);
GetWGLExtensionProcAddress(glModule, getProcAddressWGL, extensions, "WGL_ARB_pixel_format", "wglGetPixelFormatAttribivARB", &getPixelFormatAttribivARB); GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pixel_format", "wglGetPixelFormatAttribivARB", &getPixelFormatAttribivARB);
GetWGLExtensionProcAddress(glModule, getProcAddressWGL, extensions, "WGL_EXT_swap_control", "wglSwapIntervalEXT", &swapIntervalEXT); GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_EXT_swap_control", "wglSwapIntervalEXT", &swapIntervalEXT);
} }
} }
...@@ -18,6 +18,7 @@ namespace rx ...@@ -18,6 +18,7 @@ namespace rx
typedef HGLRC(WINAPI *PFNWGLCREATECONTEXTPROC)(HDC); typedef HGLRC(WINAPI *PFNWGLCREATECONTEXTPROC)(HDC);
typedef BOOL(WINAPI *PFNWGLDELETECONTEXTPROC)(HGLRC); typedef BOOL(WINAPI *PFNWGLDELETECONTEXTPROC)(HGLRC);
typedef BOOL(WINAPI *PFNWGLMAKECURRENTPROC)(HDC, HGLRC); typedef BOOL(WINAPI *PFNWGLMAKECURRENTPROC)(HDC, HGLRC);
typedef PROC(WINAPI *PFNWGLGETPROCADDRESSPROC)(LPCSTR);
class FunctionsWGL class FunctionsWGL
{ {
...@@ -31,6 +32,7 @@ class FunctionsWGL ...@@ -31,6 +32,7 @@ class FunctionsWGL
PFNWGLCREATECONTEXTPROC createContext; PFNWGLCREATECONTEXTPROC createContext;
PFNWGLDELETECONTEXTPROC deleteContext; PFNWGLDELETECONTEXTPROC deleteContext;
PFNWGLMAKECURRENTPROC makeCurrent; PFNWGLMAKECURRENTPROC makeCurrent;
PFNWGLGETPROCADDRESSPROC getProcAddress;
// Extension functions, may be NULL // Extension functions, may be NULL
PFNWGLCREATECONTEXTATTRIBSARBPROC createContextAttribsARB; PFNWGLCREATECONTEXTATTRIBSARBPROC createContextAttribsARB;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment