Merge "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."
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user