From acc760f7555682484071afaab907a2951b693b3b Mon Sep 17 00:00:00 2001 From: Alexander Bobrovnik Date: Tue, 7 Jan 2025 14:01:24 +0200 Subject: [PATCH] Fix eglMakeCurrent and eglDestroySurface validation checks 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 --- third_party/angle/src/libANGLE/validationEGL.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/third_party/angle/src/libANGLE/validationEGL.cpp b/third_party/angle/src/libANGLE/validationEGL.cpp index ff4cea7492fc..53189f0282ee 100644 --- a/third_party/angle/src/libANGLE/validationEGL.cpp +++ b/third_party/angle/src/libANGLE/validationEGL.cpp @@ -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(); } @@ -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) {