Loading libs/rs/rsContext.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -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"); } } Loading libs/rs/rsContext.h +4 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,8 @@ public: mutable const ObjectBase * mObjHead; bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;} protected: Device *mDev; Loading Loading @@ -196,6 +198,8 @@ protected: int32_t mMaxVertexAttribs; int32_t mMaxVertexUniformVectors; int32_t mMaxVertexTextureUnits; bool OES_texture_npot; } mGL; uint32_t mWidth; Loading libs/rs/rsProgramFragment.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading libs/rs/rsSampler.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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"); } Loading libs/rs/rsSampler.h +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
libs/rs/rsContext.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -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"); } } Loading
libs/rs/rsContext.h +4 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,8 @@ public: mutable const ObjectBase * mObjHead; bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;} protected: Device *mDev; Loading Loading @@ -196,6 +198,8 @@ protected: int32_t mMaxVertexAttribs; int32_t mMaxVertexUniformVectors; int32_t mMaxVertexTextureUnits; bool OES_texture_npot; } mGL; uint32_t mWidth; Loading
libs/rs/rsProgramFragment.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading
libs/rs/rsSampler.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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"); } Loading
libs/rs/rsSampler.h +1 −1 Original line number Diff line number Diff line Loading @@ -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