diff --git a/CMakeLists.txt b/CMakeLists.txt index 082a6f5a3..495d355fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,7 @@ project(RenderDoc CXX C) option(ENABLE_GL "Enable GL driver" ON) option(ENABLE_GLES "Enable GL ES driver" ON) +option(ENABLE_EGL "Enable EGL" ON) option(ENABLE_VULKAN "Enable Vulkan driver" ON) option(ENABLE_RENDERDOCCMD "Enable renderdoccmd" ON) option(ENABLE_QRENDERDOC "Enable qrenderdoc" ON) @@ -227,6 +228,7 @@ endif() if(APPLE) message(STATUS "Disabling GLES driver on apple") set(ENABLE_GLES OFF CACHE BOOL "" FORCE) + set(ENABLE_EGL OFF CACHE BOOL "" FORCE) endif() if(ANDROID) @@ -235,6 +237,7 @@ if(ANDROID) endif() set(ENABLE_GL OFF CACHE BOOL "" FORCE) set(ENABLE_GLES ON CACHE BOOL "" FORCE) + set(ENABLE_EGL ON CACHE BOOL "" FORCE) # Android doesn't support the Qt UI for obvious reasons message(STATUS "Disabling qrenderdoc for android build") @@ -252,6 +255,7 @@ if(ENABLE_GGP) message(STATUS "Disabling GL, GLES driver on ggp") set(ENABLE_GL OFF CACHE BOOL "" FORCE) set(ENABLE_GLES OFF CACHE BOOL "" FORCE) + set(ENABLE_EGL OFF CACHE BOOL "" FORCE) # GGP doesn't support the Qt UI message(STATUS "Disabling qrenderdoc for ggp build") @@ -261,6 +265,10 @@ if(ENABLE_GGP) set(ENABLE_PYRENDERDOC OFF CACHE BOOL "" FORCE) endif() +if(ENABLE_GLES AND NOT ENABLE_EGL) + message(FATAL_ERROR "EGL is required for GLES") +endif() + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") @@ -272,6 +280,10 @@ if(ENABLE_GLES) add_definitions(-DRENDERDOC_SUPPORT_GLES) endif() +if(ENABLE_EGL) + add_definitions(-DRENDERDOC_SUPPORT_EGL) +endif() + if(ENABLE_VULKAN) add_definitions(-DRENDERDOC_SUPPORT_VULKAN) endif() @@ -378,7 +390,11 @@ install (FILES LICENSE.md DESTINATION share/doc/renderdoc) message(STATUS "Enabled APIs:") if(ENABLE_GL) - message(STATUS " - OpenGL") + if(ENABLE_EGL) + message(STATUS " - OpenGL (with additional EGL support)") + else() + message(STATUS " - OpenGL") + endif() endif() if(ENABLE_GLES) diff --git a/renderdoc/driver/gl/CMakeLists.txt b/renderdoc/driver/gl/CMakeLists.txt index 6e5f28c04..236ec34c1 100644 --- a/renderdoc/driver/gl/CMakeLists.txt +++ b/renderdoc/driver/gl/CMakeLists.txt @@ -67,11 +67,14 @@ else() glx_fake_vk_hooks.cpp) endif() if(ENABLE_GLES) + list(APPEND sources + official/glesext.h) + endif() + if(ENABLE_EGL) list(APPEND sources official/egl.h official/eglext.h official/eglplatform.h - official/glesext.h egl_dispatch_table.h egl_platform.cpp egl_hooks.cpp) diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index 5b709e7d7..2c31fbd36 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -48,6 +48,7 @@ DECLARE_REFLECTION_ENUM(RDCGLenum); // appropriate libEGL.dll into plugins/gles/ in your RenderDoc folder. #define RENDERDOC_SUPPORT_GL #define RENDERDOC_SUPPORT_GLES +#define RENDERDOC_SUPPORT_EGL #else @@ -126,7 +127,7 @@ struct GLWindowingData #endif -#if defined(RENDERDOC_SUPPORT_GLES) +#if defined(RENDERDOC_SUPPORT_EGL) // force include the elgplatform.h, as we want to use // our own because the system one could be a bit older and @@ -144,7 +145,7 @@ struct GLWindowingData dpy = NULL; ctx = NULL; wnd = (GLWindowPtr)NULL; - egl_wnd = (GLESWindowPtr)NULL; + egl_wnd = (EGLSurface)NULL; cfg = NULL; } @@ -160,35 +161,30 @@ struct GLWindowingData typedef void *GLConfigPtr; #endif -#if defined(RENDERDOC_SUPPORT_GLES) - typedef EGLDisplay GLESDisplayPtr; - typedef EGLContext GLESContextPtr; - typedef EGLSurface GLESWindowPtr; - typedef EGLConfig GLESConfigPtr; -#else - typedef void *GLESDisplayPtr; - typedef void *GLESContextPtr; - typedef void *GLESWindowPtr; - typedef void *GLESConfigPtr; +#if !defined(RENDERDOC_SUPPORT_EGL) + typedef void *EGLDisplay; + typedef void *EGLContext; + typedef void *EGLSurface; + typedef void *EGLConfig; #endif union { GLDisplayPtr dpy; - GLESDisplayPtr egl_dpy; + EGLDisplay egl_dpy; }; union { GLContextPtr ctx; - GLESContextPtr egl_ctx; + EGLContext egl_ctx; }; union { GLConfigPtr cfg; - GLESConfigPtr egl_cfg; + EGLConfig egl_cfg; }; GLWindowPtr wnd; - GLESWindowPtr egl_wnd; + EGLSurface egl_wnd; }; #elif ENABLED(RDOC_APPLE) @@ -331,7 +327,7 @@ GLPlatform &GetGLPlatform(); #endif -#if defined(RENDERDOC_SUPPORT_GLES) +#if defined(RENDERDOC_SUPPORT_EGL) // using EGL. Different name since it both platform GL and EGL libraries can be available at once GLPlatform &GetEGLPlatform();