Skip to content

Commit

Permalink
HWUI: reset buffer state only for ES3 context
Browse files Browse the repository at this point in the history
Reset buffer state only for ES3 context and above since other context
type can't have buffer state set to GL_NONE.

Change-Id: I4da3bda6e48afce9bc94abd54ccc403de88c3597
  • Loading branch information
shihhsinli authored and basamaryan committed Aug 8, 2023
1 parent ed2463e commit 8832875
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
Expand Up @@ -66,12 +66,15 @@ MakeCurrentResult SkiaOpenGLPipeline::makeCurrent() {
return MakeCurrentResult::AlreadyCurrent;
}

// Make sure read/draw buffer state of default framebuffer is GL_BACK. Vendor implementations
EGLint majorVersion = 0;
eglQueryContext(eglGetCurrentDisplay(), eglGetCurrentContext(), EGL_CONTEXT_CLIENT_VERSION, &majorVersion);

// Make sure read/draw buffer state of default framebuffer is GL_BACK for ES 3.X. Vendor implementations
// disagree on the draw/read buffer state if the default framebuffer transitions from a surface
// to EGL_NO_SURFACE and vice-versa. There was a related discussion within Khronos on this topic.
// See https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13534.
// The discussion was not resolved with a clear consensus
if (error == 0 && wasSurfaceless && mEglSurface != EGL_NO_SURFACE) {
if (error == 0 && (majorVersion > 2) && wasSurfaceless && mEglSurface != EGL_NO_SURFACE) {
GLint curReadFB = 0;
GLint curDrawFB = 0;
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &curReadFB);
Expand Down

0 comments on commit 8832875

Please sign in to comment.