From 35f7273379e7e51dad547bff08fa2628ccc70a79 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 23 Jan 2019 14:37:08 +0000 Subject: [PATCH] Fix missing egl functions in eglGetProcAddress, use hook set macro --- renderdoc/driver/gl/egl_hooks.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/renderdoc/driver/gl/egl_hooks.cpp b/renderdoc/driver/gl/egl_hooks.cpp index e27d2b6e3..f0b838586 100644 --- a/renderdoc/driver/gl/egl_hooks.cpp +++ b/renderdoc/driver/gl/egl_hooks.cpp @@ -425,21 +425,12 @@ eglGetProcAddress_renderdoc_hooked(const char *func) if(realFunc == NULL) return realFunc; - // return our egl hooks - if(!strcmp(func, "eglCreateContext")) - return (__eglMustCastToProperFunctionPointerType)&eglCreateContext_renderdoc_hooked; - if(!strcmp(func, "eglGetDisplay")) - return (__eglMustCastToProperFunctionPointerType)&eglGetDisplay_renderdoc_hooked; - if(!strcmp(func, "eglDestroyContext")) - return (__eglMustCastToProperFunctionPointerType)&eglDestroyContext_renderdoc_hooked; - if(!strcmp(func, "eglMakeCurrent")) - return (__eglMustCastToProperFunctionPointerType)&eglMakeCurrent_renderdoc_hooked; - if(!strcmp(func, "eglSwapBuffers")) - return (__eglMustCastToProperFunctionPointerType)&eglSwapBuffers_renderdoc_hooked; - if(!strcmp(func, "eglPostSubBufferNV")) - return (__eglMustCastToProperFunctionPointerType)&eglPostSubBufferNV_renderdoc_hooked; - if(!strcmp(func, "eglGetProcAddress")) - return (__eglMustCastToProperFunctionPointerType)&eglGetProcAddress_renderdoc_hooked; +// return our egl hooks +#define GPA_FUNCTION(name) \ + if(!strcmp(func, "egl" STRINGIZE(name))) \ + return (__eglMustCastToProperFunctionPointerType)&CONCAT(egl, CONCAT(name, _renderdoc_hooked)); \ + EGL_HOOKED_SYMBOLS(GPA_FUNCTION) +#undef GPA_FUNCTION // any other egl functions are safe to pass through unchanged if(!strncmp(func, "egl", 3))