From 8678fa9e2d3c9aaeac77480a433d7a0c6c9f2b0c Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 18 Sep 2015 23:31:34 +0200 Subject: [PATCH] Call SetLastError(0) to mute any errors after RenderDoc work * Obviously not ideal, but better than passing spurious error codes back to the application where presumably it wasn't getting them before. --- renderdoc/driver/gl/gl_hooks_win32.cpp | 12 ++++++++++++ renderdoc/os/win32/win32_libentry.cpp | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/gl/gl_hooks_win32.cpp b/renderdoc/driver/gl/gl_hooks_win32.cpp index a98dc92f0..89f5ec2fa 100644 --- a/renderdoc/driver/gl/gl_hooks_win32.cpp +++ b/renderdoc/driver/gl/gl_hooks_win32.cpp @@ -384,6 +384,8 @@ class OpenGLHook : LibraryHook glhooks.GetDriver()->CreateContext(data, NULL, GetInitParamsForDC(dc), false, false); + SetLastError(0); + return ret; } @@ -391,6 +393,8 @@ class OpenGLHook : LibraryHook { glhooks.GetDriver()->DeleteContext(rc); + SetLastError(0); + return glhooks.wglDeleteContext_hook()(rc); } @@ -405,6 +409,8 @@ class OpenGLHook : LibraryHook glhooks.GetDriver()->CreateContext(data, NULL, GetInitParamsForDC(dc), false, false); + SetLastError(0); + return ret; } @@ -480,6 +486,8 @@ class OpenGLHook : LibraryHook glhooks.GetDriver()->CreateContext(data, hShareContext, GetInitParamsForDC(dc), core, true); + SetLastError(0); + return ret; } @@ -516,6 +524,8 @@ class OpenGLHook : LibraryHook glhooks.GetDriver()->ActivateContext(data); + SetLastError(0); + return ret; } @@ -531,6 +541,8 @@ class OpenGLHook : LibraryHook glhooks.GetDriver()->WindowSize(w, r.right - r.left, r.bottom - r.top); glhooks.GetDriver()->SwapBuffers(w); + + SetLastError(0); } return glhooks.SwapBuffers_hook()(dc); diff --git a/renderdoc/os/win32/win32_libentry.cpp b/renderdoc/os/win32/win32_libentry.cpp index e749e22aa..a2289e04d 100644 --- a/renderdoc/os/win32/win32_libentry.cpp +++ b/renderdoc/os/win32/win32_libentry.cpp @@ -80,7 +80,11 @@ BOOL APIENTRY DllMain( HMODULE hModule, ) { if(ul_reason_for_call == DLL_PROCESS_ATTACH) - return add_hooks(); + { + BOOL ret = add_hooks(); + SetLastError(0); + return ret; + } return TRUE; }