summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsContext.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-05-14 15:30:29 -0700
committerJason Sams <rjsams@android.com>2010-05-14 15:30:29 -0700
commitf603d212552485c634e25f3556f847dc2b022bd5 (patch)
treea2112e01bd2f7d72465717a153216a6d8b6e63f4 /libs/rs/rsContext.cpp
parent54db59c3594e887a412a24713fc3daa1c2404593 (diff)
downloadframeworks_base-f603d212552485c634e25f3556f847dc2b022bd5.zip
frameworks_base-f603d212552485c634e25f3556f847dc2b022bd5.tar.gz
frameworks_base-f603d212552485c634e25f3556f847dc2b022bd5.tar.bz2
Change RS to use the passed surface size rather than EGL size.
Its possible that during a resize the EGL information could be stale so caching this is bad. The surface size should always be correct. Change-Id: Ifd479e1ea70b1cada1a8690c7c82e91aa391b685 Conflicts: libs/rs/rsProgramStore.cpp libs/rs/rsProgramStore.h
Diffstat (limited to 'libs/rs/rsContext.cpp')
-rw-r--r--libs/rs/rsContext.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index f802a7f..da85f83 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -111,6 +111,9 @@ void Context::initEGL(bool useGL2)
LOGE("eglCreateContext returned EGL_NO_CONTEXT");
}
gGLContextCount++;
+
+ eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
+ eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_HEIGHT, &mEGL.mHeight);
}
void Context::deinitEGL()
@@ -155,11 +158,8 @@ uint32_t Context::runRootScript()
{
timerSet(RS_TIMER_CLEAR_SWAP);
- eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
- eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_HEIGHT, &mEGL.mHeight);
- glViewport(0, 0, mEGL.mWidth, mEGL.mHeight);
+ glViewport(0, 0, mWidth, mHeight);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
glClearColor(mRootScript->mEnviroment.mClearColor[0],
mRootScript->mEnviroment.mClearColor[1],
mRootScript->mEnviroment.mClearColor[2],
@@ -299,13 +299,13 @@ void * Context::threadProc(void *vrsc)
}
if (rsc->mIsGraphicsContext) {
- rsc->mStateRaster.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
+ rsc->mStateRaster.init(rsc);
rsc->setRaster(NULL);
- rsc->mStateVertex.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
+ rsc->mStateVertex.init(rsc);
rsc->setVertex(NULL);
- rsc->mStateFragment.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
+ rsc->mStateFragment.init(rsc);
rsc->setFragment(NULL);
- rsc->mStateFragmentStore.init(rsc, rsc->mEGL.mWidth, rsc->mEGL.mHeight);
+ rsc->mStateFragmentStore.init(rsc);
rsc->setFragmentStore(NULL);
rsc->mStateVertexArray.init(rsc);
}
@@ -493,6 +493,8 @@ void Context::setSurface(uint32_t w, uint32_t h, android_native_window_t *sur)
mWndSurface = sur;
if (mWndSurface != NULL) {
+ mWidth = w;
+ mHeight = h;
bool first = false;
if (!mEGL.mContext) {
first = true;
@@ -510,11 +512,7 @@ void Context::setSurface(uint32_t w, uint32_t h, android_native_window_t *sur)
ret = eglMakeCurrent(mEGL.mDisplay, mEGL.mSurface, mEGL.mSurface, mEGL.mContext);
checkEglError("eglMakeCurrent", ret);
- eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_WIDTH, &mEGL.mWidth);
- eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_HEIGHT, &mEGL.mHeight);
- mWidth = w;
- mHeight = h;
- mStateVertex.updateSize(this, w, h);
+ mStateVertex.updateSize(this);
if ((int)mWidth != mEGL.mWidth || (int)mHeight != mEGL.mHeight) {
LOGE("EGL/Surface mismatch EGL (%i x %i) SF (%i x %i)", mEGL.mWidth, mEGL.mHeight, mWidth, mHeight);