Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca4d1431 authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Change RS to use the passed surface size rather than EGL size. Its...

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."
parents a6418d8b f603d212
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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];
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading