From 2a9b7962ce6673c60ef06c7a82888dbd57845700 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 31 May 2014 00:51:21 +0100 Subject: [PATCH] Hook into wglCreateLayerContext --- renderdoc/hooks/gl_win32_hooks.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/renderdoc/hooks/gl_win32_hooks.cpp b/renderdoc/hooks/gl_win32_hooks.cpp index 63981f192..bf18f3172 100644 --- a/renderdoc/hooks/gl_win32_hooks.cpp +++ b/renderdoc/hooks/gl_win32_hooks.cpp @@ -217,6 +217,7 @@ class OpenGLHook : LibraryHook } Hook wglCreateContext_hook; + Hook wglCreateLayerContext_hook; Hook wglMakeCurrent_hook; Hook wglGetProcAddress_hook; Hook 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);