Skip to content

Commit

Permalink
Fix eglMakeCurrent and eglDestroySurface validation checks (#4652)
Browse files Browse the repository at this point in the history
eglMakeCurrent and eglDestroySurface validation checks fail and exit
earlier after device lost were detected, preventing the release of
surface and underling swap chain.
This makes it impossible to recreate device after device lost.

b/329326128
  • Loading branch information
kaidokert authored Jan 24, 2025
2 parents 2ee62f0 + acc760f commit aa30fce
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions third_party/angle/src/libANGLE/validationEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,8 @@ Error ValidateMakeCurrent(Display *display, Surface *draw, Surface *read, gl::Co
ANGLE_TRY(ValidateContext(display, context));
}

if (display->isInitialized() && display->isDeviceLost())
if (display->isInitialized() && display->isDeviceLost() &&
(context != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
{
return EglContextLost();
}
Expand Down Expand Up @@ -3059,7 +3060,17 @@ Error ValidateDestroySurface(const Display *display,
const Surface *surface,
const EGLSurface eglSurface)
{
ANGLE_TRY(ValidateSurface(display, surface));
ANGLE_TRY(ValidateDisplayPointer(display));

if (!display->isInitialized())
{
return EglNotInitialized() << "display is not initialized.";
}

if (!display->isValidSurface(surface))
{
return EglBadSurface();
}

if (eglSurface == EGL_NO_SURFACE)
{
Expand Down

0 comments on commit aa30fce

Please sign in to comment.