diff --git a/renderdoc/driver/gl/egl_dispatch_table.h b/renderdoc/driver/gl/egl_dispatch_table.h index 303d992d9..357024325 100644 --- a/renderdoc/driver/gl/egl_dispatch_table.h +++ b/renderdoc/driver/gl/egl_dispatch_table.h @@ -65,33 +65,33 @@ typedef PFNEGLPOSTSUBBUFFERNVPROC PFN_eglPostSubBufferNV; typedef PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC PFN_eglSwapBuffersWithDamageEXT; typedef PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC PFN_eglSwapBuffersWithDamageKHR; -#define EGL_HOOKED_SYMBOLS(FUNC) \ - FUNC(BindAPI, false); \ - FUNC(GetProcAddress, false); \ - FUNC(GetDisplay, false); \ - FUNC(GetPlatformDisplay, false); \ - FUNC(CreateContext, false); \ - FUNC(DestroyContext, false); \ - FUNC(CreateWindowSurface, false); \ - FUNC(CreatePlatformWindowSurface, false); \ - FUNC(MakeCurrent, false); \ - FUNC(SwapBuffers, false); \ - FUNC(PostSubBufferNV, true); \ - FUNC(SwapBuffersWithDamageEXT, true); \ - FUNC(SwapBuffersWithDamageKHR, true); +#define EGL_HOOKED_SYMBOLS(FUNC) \ + FUNC(BindAPI, false, true); \ + FUNC(GetProcAddress, false, true); \ + FUNC(GetDisplay, false, true); \ + FUNC(GetPlatformDisplay, false, false); \ + FUNC(CreateContext, false, true); \ + FUNC(DestroyContext, false, true); \ + FUNC(CreateWindowSurface, false, true); \ + FUNC(CreatePlatformWindowSurface, false, false); \ + FUNC(MakeCurrent, false, true); \ + FUNC(SwapBuffers, false, true); \ + FUNC(PostSubBufferNV, true, false); \ + FUNC(SwapBuffersWithDamageEXT, true, false); \ + FUNC(SwapBuffersWithDamageKHR, true, false); -#define EGL_NONHOOKED_SYMBOLS(FUNC) \ - FUNC(ChooseConfig, false); \ - FUNC(CreatePbufferSurface, false); \ - FUNC(DestroySurface, false); \ - FUNC(GetConfigAttrib, false); \ - FUNC(GetCurrentContext, false); \ - FUNC(GetCurrentDisplay, false); \ - FUNC(GetCurrentSurface, false); \ - FUNC(GetError, false); \ - FUNC(Initialize, false); \ - FUNC(QueryString, false); \ - FUNC(QuerySurface, false); +#define EGL_NONHOOKED_SYMBOLS(FUNC) \ + FUNC(ChooseConfig, false, true); \ + FUNC(CreatePbufferSurface, false, true); \ + FUNC(DestroySurface, false, true); \ + FUNC(GetConfigAttrib, false, false); \ + FUNC(GetCurrentContext, false, true); \ + FUNC(GetCurrentDisplay, false, true); \ + FUNC(GetCurrentSurface, false, true); \ + FUNC(GetError, false, true); \ + FUNC(Initialize, false, true); \ + FUNC(QueryString, false, true); \ + FUNC(QuerySurface, false, true); struct EGLDispatchTable { @@ -109,7 +109,7 @@ struct EGLDispatchTable // Generate the EGL function pointers. We need to consider hooked and non-hooked symbols separately // - non-hooked symbols don't have a function hook to register, or if they do it's a dummy // pass-through hook that will risk calling itself via trampoline. -#define EGL_PTR_GEN(func, isext) CONCAT(PFN_egl, func) func; +#define EGL_PTR_GEN(func, isext, replayrequired) CONCAT(PFN_egl, func) func; EGL_HOOKED_SYMBOLS(EGL_PTR_GEN) EGL_NONHOOKED_SYMBOLS(EGL_PTR_GEN) #undef EGL_PTR_GEN diff --git a/renderdoc/driver/gl/egl_hooks.cpp b/renderdoc/driver/gl/egl_hooks.cpp index 67056a647..d84d14c20 100644 --- a/renderdoc/driver/gl/egl_hooks.cpp +++ b/renderdoc/driver/gl/egl_hooks.cpp @@ -637,8 +637,8 @@ eglGetProcAddress_renderdoc_hooked(const char *func) return realFunc; // return our egl hooks -#define GPA_FUNCTION(name, isext) \ - if(!strcmp(func, "egl" STRINGIZE(name))) \ +#define GPA_FUNCTION(name, isext, replayrequired) \ + if(!strcmp(func, "egl" STRINGIZE(name))) \ return (__eglMustCastToProperFunctionPointerType)&CONCAT(egl, CONCAT(name, _renderdoc_hooked)); EGL_HOOKED_SYMBOLS(GPA_FUNCTION) #undef GPA_FUNCTION @@ -876,7 +876,7 @@ static void EGLHooked(void *handle) RDCASSERT(!RenderDoc::Inst().IsReplayApp()); // fetch non-hooked functions into our dispatch table -#define EGL_FETCH(func, isext) \ +#define EGL_FETCH(func, isext, replayrequired) \ EGL.func = (CONCAT(PFN_egl, func))Process::GetFunctionAddress(handle, "egl" STRINGIZE(func)); \ if(!EGL.func && CheckConstParam(isext)) \ EGL.func = (CONCAT(PFN_egl, func))EGL.GetProcAddress("egl" STRINGIZE(func)); @@ -985,7 +985,7 @@ void EGLHook::RegisterHooks() #endif // register EGL hooks -#define EGL_REGISTER(func, isext) \ +#define EGL_REGISTER(func, isext, replayrequired) \ LibraryHooks::RegisterFunctionHook( \ "libEGL" LIBSUFFIX, FunctionHook("egl" STRINGIZE(func), (void **)&EGL.func, \ (void *)&CONCAT(egl, CONCAT(func, _renderdoc_hooked)))); @@ -1009,7 +1009,7 @@ HOOK_EXPORT void AndroidGLESLayer_Initialize(void *layer_id, // populate EGL dispatch table with the next layer's function pointers. Fetch all 'hooked' and // non-hooked functions -#define EGL_FETCH(func, isext) \ +#define EGL_FETCH(func, isext, replayrequired) \ EGL.func = (CONCAT(PFN_egl, func))next_gpa(layer_id, "egl" STRINGIZE(func)); \ if(!EGL.func) \ RDCWARN("Couldn't fetch function pointer for egl" STRINGIZE(func)); @@ -1026,8 +1026,8 @@ HOOK_EXPORT void *AndroidGLESLayer_GetProcAddress(const char *funcName, __eglMustCastToProperFunctionPointerType next) { // return our egl hooks -#define GPA_FUNCTION(name, isext) \ - if(!strcmp(funcName, "egl" STRINGIZE(name))) \ +#define GPA_FUNCTION(name, isext, replayrequired) \ + if(!strcmp(funcName, "egl" STRINGIZE(name))) \ return (void *)&CONCAT(egl, CONCAT(name, _renderdoc_hooked)); EGL_HOOKED_SYMBOLS(GPA_FUNCTION) #undef GPA_FUNCTION diff --git a/renderdoc/driver/gl/egl_layer_android.cpp b/renderdoc/driver/gl/egl_layer_android.cpp deleted file mode 100644 index 2446738a3..000000000 --- a/renderdoc/driver/gl/egl_layer_android.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2019 Baldur Karlsson - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - ******************************************************************************/ - -#include "driver/gl/egl_dispatch_table.h" -#include "driver/gl/gl_driver.h" diff --git a/renderdoc/driver/gl/egl_platform.cpp b/renderdoc/driver/gl/egl_platform.cpp index d8c17ed8a..5c5b05de6 100644 --- a/renderdoc/driver/gl/egl_platform.cpp +++ b/renderdoc/driver/gl/egl_platform.cpp @@ -435,7 +435,7 @@ bool EGLDispatchTable::PopulateForReplay() bool symbols_ok = true; -#define LOAD_FUNC(func, isext) \ +#define LOAD_FUNC(func, isext, replayrequired) \ if(!this->func) \ this->func = (CONCAT(PFN_egl, func))Process::GetFunctionAddress(handle, "egl" STRINGIZE(func)); \ if(!this->func && CheckConstParam(isext)) \ @@ -443,7 +443,8 @@ bool EGLDispatchTable::PopulateForReplay() \ if(!this->func && !CheckConstParam(isext)) \ { \ - symbols_ok = false; \ + if(CheckConstParam(replayrequired)) \ + symbols_ok = false; \ RDCWARN("Unable to load '%s'", STRINGIZE(func)); \ } diff --git a/renderdoc/driver/gl/renderdoc_gl.vcxproj b/renderdoc/driver/gl/renderdoc_gl.vcxproj index aeb9c92ef..77761492d 100644 --- a/renderdoc/driver/gl/renderdoc_gl.vcxproj +++ b/renderdoc/driver/gl/renderdoc_gl.vcxproj @@ -135,7 +135,6 @@ true - true diff --git a/renderdoc/driver/gl/renderdoc_gl.vcxproj.filters b/renderdoc/driver/gl/renderdoc_gl.vcxproj.filters index 0e494c412..dd03361a1 100644 --- a/renderdoc/driver/gl/renderdoc_gl.vcxproj.filters +++ b/renderdoc/driver/gl/renderdoc_gl.vcxproj.filters @@ -260,9 +260,6 @@ Platform Interfaces\Linux - - EGL -