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

Commit 2c94ba74 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Don't change texture unit when not needed."

parents e6b80989 3e3ba155
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1391,16 +1391,19 @@ void OpenGLRenderer::bindTexture(GLuint texture, GLuint textureUnit) {

void OpenGLRenderer::setTextureWrapModes(Texture* texture, GLenum wrapS, GLenum wrapT,
        GLuint textureUnit) {
    glActiveTexture(gTextureUnits[textureUnit]);
    bool bound = false;
    if (wrapS != texture->wrapS) {
        glActiveTexture(gTextureUnits[textureUnit]);
        glBindTexture(GL_TEXTURE_2D, texture->id);
        bound = true;
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS);
        texture->wrapS = wrapS;
    }
    if (wrapT != texture->wrapT) {
        if (!bound) glBindTexture(GL_TEXTURE_2D, texture->id);
        if (!bound) {
            glActiveTexture(gTextureUnits[textureUnit]);
            glBindTexture(GL_TEXTURE_2D, texture->id);
        }
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT);
        texture->wrapT = wrapT;
    }