Description
Description of Bug
Output of qrenderdoc --version
:
QRenderDoc v1.37 (cd94206b0fd995bfb3e5ed95c1e68d4f5d38ea7e)
Packaged for Arch - https://archlinux.org/packages/renderdoc
When running RenderDoc with a program using EGL with OpenGL I am getting the following EGL error in the callback provided to eglDebugMessageControlKHR
:
error: EGL_BAD_CONFIG
command: eglGetConfigAttrib
message: "EGL_BAD_CONFIG error: In internal function: Additional INFO may be available\n"
.
Running this through gdb
I get this abbreviated stack trace:
#18 0x00007ffff6b995bb in EGLHook::RefreshWindowParameters (this=this@entry=0x7ffff7ecbf20 <eglhook>, data=...) at /usr/src/debug/renderdoc/renderdoc/renderdoc/driver/gl/egl_hooks.cpp:131
#19 0x00007ffff6b967b3 in eglSwapBuffers_renderdoc_hooked (dpy=0x555555a4b880, surface=<optimized out>) at /usr/src/debug/renderdoc/renderdoc/renderdoc/driver/gl/egl_hooks.cpp:557
Indeed, the value of data.egl_cfg
is NULL
.
It looks like the following code is at fault:
renderdoc/renderdoc/driver/gl/egl_hooks.cpp
Lines 552 to 557 in cd94206
It does not set data.egl_cfg
and leaves it at its NULL
default value. I searched for other uses of RefreshWindowParameters
and looks like this is the only place where the value is unset, it's set in:
renderdoc/renderdoc/driver/gl/egl_hooks.cpp
Lines 522 to 523 in cd94206
I wonder if the problem was introduced by 89befed as the swap buffers injection didn't check the samples before and didn't need context. This is pretty surprising because I'm sure this must have come up as the commit is 3 years old, unless no one is using eglDebugMessageControlKHR
or checking for EGL errors after swapBuffers. I feel like maybe I'm missing something?
Steps to reproduce
Attaching a capture is not exactly useful as there is nothing in renderdoc that checks for an egl error after swapping. However with this patch:
diff --git a/renderdoc/driver/gl/egl_hooks.cpp b/renderdoc/driver/gl/egl_hooks.cpp
index ef735d878..81837db99 100644
--- a/renderdoc/driver/gl/egl_hooks.cpp
+++ b/renderdoc/driver/gl/egl_hooks.cpp
@@ -129,6 +129,8 @@ public:
int multiSamples;
EGL.GetConfigAttrib(display, config, EGL_SAMPLES, &multiSamples);
+ if (EGL.GetError() != EGL_SUCCESS)
+ std::abort();
if(multiSamples != 1 && multiSamples != 2 && multiSamples != 4 && multiSamples != 8)
{
multiSamples = 1;
You can run a trivial EGL program (that calls swapbuffers) and aborts, i.e. LD_PRELOAD=build/lib/librenderdoc.so eglgears_x11
Environment
- RenderDoc version: 1.37 (arch repos) and 1.38 (built from source)
- Operating System: Arch Linux
- Graphics API: OpenGL/EGL
NVIDIA GeForce RTX 2070
Driver Version: 575.57.08