From ec30933c1d12090de26888c4604a41cb032c56bf Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Wed, 12 Jan 2011 15:26:25 -0800 Subject: [PATCH] WAR driver bug where surfaces of size 0 fail. Change-Id: I72b356c4cfb71f2342479ca21238b763d02e729d --- libs/rs/rsContext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index c5ee7ee98622e..bb38825e12ee3 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -743,7 +743,9 @@ void Context::setSurface(uint32_t w, uint32_t h, ANativeWindow *sur) { rsAssert(mIsGraphicsContext); EGLBoolean ret; - if (mEGL.mSurface != NULL) { + // WAR: Some drivers fail to handle 0 size surfaces correcntly. + // Use the pbuffer to avoid this pitfall. + if ((mEGL.mSurface != NULL) || (w == 0) || (h == 0)) { ret = eglMakeCurrent(mEGL.mDisplay, mEGL.mSurfaceDefault, mEGL.mSurfaceDefault, mEGL.mContext); checkEglError("eglMakeCurrent", ret);