From e8b696cbbf6e6f1d8e501a32d8fa00d940206b8d Mon Sep 17 00:00:00 2001 From: Alexandros Frantzis Date: Thu, 10 Oct 2019 15:14:37 +0300 Subject: [PATCH] Use EGL directly for Wayland GL support For Wayland support on GL we currently fall back to the GLES code path just to get EGL. This commit uses the EGL platform directly for Wayland, also removing the dependency on GLES. --- CMakeLists.txt | 4 ++-- renderdoc/driver/gl/gl_replay.cpp | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 495d355fe..20fa0745a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,8 +189,8 @@ if(ENABLE_WAYLAND) pkg_check_modules(PKG_WAYLAND QUIET wayland-client) if(PKG_WAYLAND_FOUND) - if(NOT ENABLE_GLES) - message(WARNING "On Wayland GLES support is required for EGL, disabling GL support") + if(NOT ENABLE_EGL) + message(WARNING "On Wayland EGL is required for GL, disabling GL support") set(ENABLE_GL OFF CACHE BOOL "" FORCE) endif() else() diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 5b6a16897..226d3e958 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -3594,28 +3594,31 @@ static DriverRegistration GLESDriverRegistration(RDCDriver::OpenGLES, &GLES_Crea ReplayStatus GL_CreateReplayDevice(RDCFile *rdc, const ReplayOptions &opts, IReplayDriver **driver) { + GLPlatform *gl_platform = &GetGLPlatform(); + if(RenderDoc::Inst().GetGlobalEnvironment().waylandDisplay) { -#if defined(RENDERDOC_SUPPORT_GLES) +#if defined(RENDERDOC_SUPPORT_EGL) RDCLOG("Forcing EGL device creation for wayland"); - return GLES_CreateReplayDevice(rdc, opts, driver); + gl_platform = &GetEGLPlatform(); #else - RDCERR("GLES support must be enabled at build time when using Wayland"); + RDCERR("EGL support must be enabled at build time when using Wayland"); return ReplayStatus::InternalError; #endif } RDCDEBUG("Creating an OpenGL replay device"); - bool load_ok = GetGLPlatform().PopulateForReplay(); + bool load_ok = gl_platform->PopulateForReplay(); if(!load_ok) { - RDCERR("Couldn't find required platform GL function addresses"); + RDCERR("Couldn't find required platform %s function addresses", + gl_platform == &GetGLPlatform() ? "GL" : "EGL"); return ReplayStatus::APIInitFailed; } - return CreateReplayDevice(rdc ? rdc->GetDriver() : RDCDriver::OpenGL, rdc, opts, GetGLPlatform(), + return CreateReplayDevice(rdc ? rdc->GetDriver() : RDCDriver::OpenGL, rdc, opts, *gl_platform, driver); }