[Mesa-dev] glDrawBuffer crashes in case of surfaceless context

Volker Vogelhuber v.vogelhuber at digitalendoscopy.de
Wed Sep 6 18:47:15 UTC 2017


I'm currently creating a surfaceless OpenGL context using the
EGL_KHR_surfaceless_context extension together with
eglGetPlatformDisplay/EGL_PLATFORM_GBM_MESA. So my default
framebuffer has no real buffers. I normally only render
to textures bound to FBOs. Due to an error on my side I called
glDrawBuffer with GL_FRONT_LEFT while no FBO was bound. This
result in a crash in intel_buffers.c because in intelDrawBuffer()
dri2InvalidateDrawable is called with a null pointer which is
not checked in dri2InvalidateDrawable() or anywhere before.
While the root cause for triggering the error is on my side,
I think it may be better to raise an error instead of crashing.
So I propose to add a check to brw->driContext->driDrawablePriv
within intelDrawBuffer. Probably if the driDrawablePriv is nullptr
one should not call intel_prepare_render either.

Regards
    Volker


More information about the mesa-dev mailing list