diff options
author | Jason Sams <rjsams@android.com> | 2010-05-14 15:30:29 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-05-14 15:30:29 -0700 |
commit | f603d212552485c634e25f3556f847dc2b022bd5 (patch) | |
tree | a2112e01bd2f7d72465717a153216a6d8b6e63f4 /libs/rs | |
parent | 54db59c3594e887a412a24713fc3daa1c2404593 (diff) | |
download | frameworks_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')
-rw-r--r-- | libs/rs/rsContext.cpp | 24 | ||||
-rw-r--r-- | libs/rs/rsContext.h | 4 | ||||
-rw-r--r-- | libs/rs/rsProgramFragment.cpp | 2 | ||||
-rw-r--r-- | libs/rs/rsProgramFragment.h | 2 | ||||
-rw-r--r-- | libs/rs/rsProgramRaster.cpp | 2 | ||||
-rw-r--r-- | libs/rs/rsProgramRaster.h | 2 | ||||
-rw-r--r-- | libs/rs/rsProgramStore.cpp | 2 | ||||
-rw-r--r-- | libs/rs/rsProgramStore.h | 2 | ||||
-rw-r--r-- | libs/rs/rsProgramVertex.cpp | 8 | ||||
-rw-r--r-- | libs/rs/rsProgramVertex.h | 4 | ||||
-rw-r--r-- | libs/rs/rsScript.cpp | 2 |
11 files changed, 26 insertions, 28 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); diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h index c8f0be5..4a6072d 100644 --- a/libs/rs/rsContext.h +++ b/libs/rs/rsContext.h @@ -125,8 +125,8 @@ public: return mStateRaster.mDefault.get(); } - uint32_t getWidth() const {return mEGL.mWidth;} - uint32_t getHeight() const {return mEGL.mHeight;} + uint32_t getWidth() const {return mWidth;} + uint32_t getHeight() const {return mHeight;} ThreadIO mIO; diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp index d192195..aaa9a08 100644 --- a/libs/rs/rsProgramFragment.cpp +++ b/libs/rs/rsProgramFragment.cpp @@ -300,7 +300,7 @@ ProgramFragmentState::~ProgramFragmentState() } -void ProgramFragmentState::init(Context *rsc, int32_t w, int32_t h) +void ProgramFragmentState::init(Context *rsc) { uint32_t tmp[5] = { RS_TEX_ENV_MODE_NONE, 0, diff --git a/libs/rs/rsProgramFragment.h b/libs/rs/rsProgramFragment.h index 9fa565d..db91524 100644 --- a/libs/rs/rsProgramFragment.h +++ b/libs/rs/rsProgramFragment.h @@ -57,7 +57,7 @@ public: ~ProgramFragmentState(); ProgramFragment *mPF; - void init(Context *rsc, int32_t w, int32_t h); + void init(Context *rsc); void deinit(Context *rsc); ObjectBaseRef<Type> mTextureTypes[ProgramFragment::MAX_TEXTURE]; diff --git a/libs/rs/rsProgramRaster.cpp b/libs/rs/rsProgramRaster.cpp index 13887d1..c095635 100644 --- a/libs/rs/rsProgramRaster.cpp +++ b/libs/rs/rsProgramRaster.cpp @@ -102,7 +102,7 @@ ProgramRasterState::~ProgramRasterState() { } -void ProgramRasterState::init(Context *rsc, int32_t w, int32_t h) +void ProgramRasterState::init(Context *rsc) { ProgramRaster *pr = new ProgramRaster(rsc, false, false, false); mDefault.set(pr); diff --git a/libs/rs/rsProgramRaster.h b/libs/rs/rsProgramRaster.h index c3a9c90..04eaaa8 100644 --- a/libs/rs/rsProgramRaster.h +++ b/libs/rs/rsProgramRaster.h @@ -56,7 +56,7 @@ class ProgramRasterState public: ProgramRasterState(); ~ProgramRasterState(); - void init(Context *rsc, int32_t w, int32_t h); + void init(Context *rsc); void deinit(Context *rsc); ObjectBaseRef<ProgramRaster> mDefault; diff --git a/libs/rs/rsProgramStore.cpp b/libs/rs/rsProgramStore.cpp index 2e5114f..ff70509 100644 --- a/libs/rs/rsProgramStore.cpp +++ b/libs/rs/rsProgramStore.cpp @@ -247,7 +247,7 @@ ProgramStoreState::~ProgramStoreState() } -void ProgramStoreState::init(Context *rsc, int32_t w, int32_t h) +void ProgramStoreState::init(Context *rsc) { ProgramStore *pfs = new ProgramStore(rsc); mDefault.set(pfs); diff --git a/libs/rs/rsProgramStore.h b/libs/rs/rsProgramStore.h index 1b5543c..d686aa8 100644 --- a/libs/rs/rsProgramStore.h +++ b/libs/rs/rsProgramStore.h @@ -65,7 +65,7 @@ class ProgramStoreState public: ProgramStoreState(); ~ProgramStoreState(); - void init(Context *rsc, int32_t w, int32_t h); + void init(Context *rsc); void deinit(Context *rsc); ObjectBaseRef<ProgramStore> mDefault; diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp index a2b2df4..c3264ae 100644 --- a/libs/rs/rsProgramVertex.cpp +++ b/libs/rs/rsProgramVertex.cpp @@ -362,7 +362,7 @@ ProgramVertexState::~ProgramVertexState() { } -void ProgramVertexState::init(Context *rsc, int32_t w, int32_t h) +void ProgramVertexState::init(Context *rsc) { RsElement e = (RsElement) Element::create(rsc, RS_TYPE_FLOAT_32, RS_KIND_USER, false, 1); @@ -382,13 +382,13 @@ void ProgramVertexState::init(Context *rsc, int32_t w, int32_t h) color[2] = 1.f; color[3] = 1.f; - updateSize(rsc, w, h); + updateSize(rsc); } -void ProgramVertexState::updateSize(Context *rsc, int32_t w, int32_t h) +void ProgramVertexState::updateSize(Context *rsc) { Matrix m; - m.loadOrtho(0,w, h,0, -1,1); + m.loadOrtho(0,rsc->getWidth(), rsc->getHeight(),0, -1,1); mDefaultAlloc->subData(RS_PROGRAM_VERTEX_PROJECTION_OFFSET, 16, &m.m[0], 16*4); m.loadIdentity(); diff --git a/libs/rs/rsProgramVertex.h b/libs/rs/rsProgramVertex.h index 28554cc..bdac978 100644 --- a/libs/rs/rsProgramVertex.h +++ b/libs/rs/rsProgramVertex.h @@ -71,9 +71,9 @@ public: ProgramVertexState(); ~ProgramVertexState(); - void init(Context *rsc, int32_t w, int32_t h); + void init(Context *rsc); void deinit(Context *rsc); - void updateSize(Context *rsc, int32_t w, int32_t h); + void updateSize(Context *rsc); ObjectBaseRef<ProgramVertex> mDefault; ObjectBaseRef<ProgramVertex> mLast; diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp index 1c63c11..1dd9554 100644 --- a/libs/rs/rsScript.cpp +++ b/libs/rs/rsScript.cpp @@ -145,7 +145,7 @@ void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *dat } s->setupScript(); - LOGE("rsi_ScriptInvokeV, len=%i", len); + //LOGE("rsi_ScriptInvokeV, len=%i", len); const uint32_t * dPtr = (const uint32_t *)data; switch(len) { case 0: |