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

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

Merge "beging np2 extension check work."

parents 79db13bf 2978bfc6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -546,6 +546,8 @@ void Context::setSurface(uint32_t w, uint32_t h, android_native_window_t *sur)

            glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &mGL.mMaxFragmentTextureImageUnits);
            glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGL.mMaxFragmentUniformVectors);

            mGL.OES_texture_npot = NULL != strstr((const char *)mGL.mExtensions, "GL_OES_texture_npot");
        }

    }
+4 −0
Original line number Diff line number Diff line
@@ -163,6 +163,8 @@ public:

    mutable const ObjectBase * mObjHead;

    bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;}

protected:
    Device *mDev;

@@ -196,6 +198,8 @@ protected:
        int32_t mMaxVertexAttribs;
        int32_t mMaxVertexUniformVectors;
        int32_t mMaxVertexTextureUnits;

        bool OES_texture_npot;
    } mGL;

    uint32_t mWidth;
+2 −2
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state)
        }

        if (mSamplers[ct].get()) {
            mSamplers[ct]->setupGL(rsc);
            mSamplers[ct]->setupGL(rsc, mTextures[ct]->getType()->getIsNp2());
        } else {
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -159,7 +159,7 @@ 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);
            mSamplers[ct]->setupGL(rsc, mTextures[ct]->getType()->getIsNp2());
        } else {
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+12 −2
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ Sampler::~Sampler()
{
}

void Sampler::setupGL(const Context *rsc)
void Sampler::setupGL(const Context *rsc, bool npot)
{
    GLenum trans[] = {
        GL_NEAREST, //RS_SAMPLER_NEAREST,
@@ -64,11 +64,21 @@ void Sampler::setupGL(const Context *rsc)

    };

    bool forceNonMip = false;
    if (!rsc->ext_OES_texture_npot() && npot) {
        forceNonMip = true;
    }

    if ((mMinFilter == RS_SAMPLER_LINEAR_MIP_LINEAR) && forceNonMip) {
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    } else {
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, trans[mMinFilter]);
    }
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, trans[mMagFilter]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, trans[mWrapS]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, trans[mWrapT]);


    rsc->checkError("ProgramFragment::setupGL2 tex env");
}

+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public:
    virtual ~Sampler();

    void bind(Allocation *);
    void setupGL(const Context *);
    void setupGL(const Context *, bool npot);

    void bindToContext(SamplerState *, uint32_t slot);
    void unbindFromContext(SamplerState *);
Loading