mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Hook into wglCreateLayerContext
This commit is contained in:
@@ -217,6 +217,7 @@ class OpenGLHook : LibraryHook
|
||||
}
|
||||
|
||||
Hook<HGLRC (WINAPI*)(HDC)> wglCreateContext_hook;
|
||||
Hook<HGLRC (WINAPI*)(HDC,int)> wglCreateLayerContext_hook;
|
||||
Hook<BOOL (WINAPI*)(HDC, HGLRC)> wglMakeCurrent_hook;
|
||||
Hook<PROC (WINAPI*)(const char*)> wglGetProcAddress_hook;
|
||||
Hook<BOOL (WINAPI*)(HDC)> SwapBuffers_hook;
|
||||
@@ -266,6 +267,15 @@ class OpenGLHook : LibraryHook
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HGLRC WINAPI wglCreateLayerContext_hooked(HDC dc, int iLayerPlane)
|
||||
{
|
||||
HGLRC ret = glhooks.wglCreateLayerContext_hook()(dc, iLayerPlane);
|
||||
|
||||
glhooks.GetDriver()->CreateContext(WindowFromDC(dc), ret, NULL, GetInitParamsForDC(dc));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HGLRC WINAPI wglCreateContextAttribsARB_hooked(HDC dc, HGLRC hShareContext, const int *attribList)
|
||||
{
|
||||
HGLRC ret = glhooks.wglCreateContextAttribsARB_realfunc(dc, hShareContext, attribList);
|
||||
@@ -367,6 +377,7 @@ class OpenGLHook : LibraryHook
|
||||
bool success = true;
|
||||
|
||||
success &= wglCreateContext_hook.Initialize("wglCreateContext", DLL_NAME, wglCreateContext_hooked);
|
||||
success &= wglCreateLayerContext_hook.Initialize("wglCreateLayerContext", DLL_NAME, wglCreateLayerContext_hooked);
|
||||
success &= wglMakeCurrent_hook.Initialize("wglMakeCurrent", DLL_NAME, wglMakeCurrent_hooked);
|
||||
success &= wglGetProcAddress_hook.Initialize("wglGetProcAddress", DLL_NAME, wglGetProcAddress_hooked);
|
||||
success &= SwapBuffers_hook.Initialize("SwapBuffers", "gdi32.dll", SwapBuffers_hooked);
|
||||
|
||||
Reference in New Issue
Block a user