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

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

Merge "Cleanup GL setup code and remove legacy 1.1 paths. Reset pointers to...

Merge "Cleanup GL setup code and remove legacy 1.1 paths. Reset pointers to NULL when allocations are unbound."
parents f8438a7d d081fffa
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -724,10 +724,7 @@ RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, uint32_t w, uint32_t h
    const Element *src = static_cast<const Element *>(_src);
    const Element *dst = static_cast<const Element *>(_dst);

    // Check for pow2 on pre es 2.0 versions.
    rsAssert(rsc->checkVersion2_0() || (!(w & (w-1)) && !(h & (h-1))));

    //LOGE("rsi_AllocationCreateFromBitmap %i %i %i %i %i", w, h, dstFmt, srcFmt, genMips);
    //LOGE("%p rsi_AllocationCreateFromBitmap %i %i %i", rsc, w, h, genMips);
    rsi_TypeBegin(rsc, _dst);
    rsi_TypeAdd(rsc, RS_DIMENSION_X, w);
    rsi_TypeAdd(rsc, RS_DIMENSION_Y, h);
+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ public:
    void decRefs(const void *ptr, size_t ct) const;

    void sendDirty() const;
    bool getHasGraphicsMipmaps() const {return mTextureGenMipmap;}

protected:
    ObjectBaseRef<const Type> mType;
+9 −16
Original line number Diff line number Diff line
@@ -232,7 +232,6 @@ void Context::timerPrint()

bool Context::setupCheck()
{
    if (checkVersion2_0()) {
    if (!mShaderCache.lookup(this, mVertex.get(), mFragment.get())) {
        LOGE("Context::setupCheck() 1 fail");
        return false;
@@ -242,13 +241,6 @@ bool Context::setupCheck()
    mFragment->setupGL2(this, &mStateFragment, &mShaderCache);
    mRaster->setupGL2(this, &mStateRaster);
    mVertex->setupGL2(this, &mStateVertex, &mShaderCache);

    } else {
        mFragmentStore->setupGL(this, &mStateFragmentStore);
        mFragment->setupGL(this, &mStateFragment);
        mRaster->setupGL(this, &mStateRaster);
        mVertex->setupGL(this, &mStateVertex);
    }
    return true;
}

@@ -940,6 +932,7 @@ RsContext rsContextCreateGL(RsDevice vdev, uint32_t version, bool useDepth)
    LOGV("rsContextCreateGL %p, %i", vdev, useDepth);
    Device * dev = static_cast<Device *>(vdev);
    Context *rsc = new Context(dev, true, useDepth);
    LOGV("rsContextCreateGL ret %p ", rsc);
    return rsc;
}

+0 −3
Original line number Diff line number Diff line
@@ -153,9 +153,6 @@ public:
    void timerPrint();
    void timerFrame();

    bool checkVersion1_1() const {return (mGL.mMajorVersion > 1) || (mGL.mMinorVersion >= 1); }
    bool checkVersion2_0() const {return mGL.mMajorVersion >= 2; }

    struct {
        bool mLogTimes;
        bool mLogScripts;
+3 −8
Original line number Diff line number Diff line
@@ -103,13 +103,8 @@ void ProgramFragment::setConstantColor(float r, float g, float b, float a)
    mDirty = true;
}

void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state)
{
}

void ProgramFragment::setupGL2(const Context *rsc, ProgramFragmentState *state, ShaderCache *sc)
{

    //LOGE("sgl2 frag1 %x", glGetError());
    if ((state->mLast.get() == this) && !mDirty) {
        return;
@@ -131,12 +126,12 @@ void ProgramFragment::setupGL2(const Context *rsc, ProgramFragmentState *state,
        glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID());
        rsc->checkError("ProgramFragment::setupGL2 tex bind");
        if (mSamplers[ct].get()) {
            mSamplers[ct]->setupGL(rsc, mTextures[ct]->getType()->getIsNp2());
            mSamplers[ct]->setupGL(rsc, mTextures[ct].get());
        } else {
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
            rsc->checkError("ProgramFragment::setupGL2 tex env");
        }

Loading