Loading libs/hwui/OpenGLRenderer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -1463,7 +1463,9 @@ void OpenGLRenderer::setupColorRect(float left, float top, float right, float bo dirtyLayer(left, top, right, bottom); } } if (!mShader || (mShader && setColor)) { mCaches.currentProgram->setColor(r, g, b, a); } // Setup attributes and uniforms required by the shaders if (mShader) { Loading libs/hwui/SkiaShader.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -63,8 +63,7 @@ void SkiaShader::setupProgram(Program* program, const mat4& modelView, const Sna GLuint* textureUnit) { } void SkiaShader::bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit) { glActiveTexture(gTextureUnitsMap[textureUnit]); void SkiaShader::bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT) { glBindTexture(GL_TEXTURE_2D, texture->id); if (wrapS != texture->wrapS) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS); Loading Loading @@ -132,7 +131,7 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView, computeScreenSpaceMatrix(textureTransform, modelView); // Uniforms bindTexture(texture, mWrapS, mWrapT, textureSlot); bindTexture(texture, mWrapS, mWrapT); glUniform1i(program->getUniform("bitmapSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("textureTransform"), 1, GL_FALSE, &textureTransform.data[0]); Loading Loading @@ -204,7 +203,7 @@ void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelV computeScreenSpaceMatrix(screenSpace, modelView); // Uniforms bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY], textureSlot); bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY]); glUniform1i(program->getUniform("gradientSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]); } Loading Loading @@ -297,7 +296,7 @@ void SkiaSweepGradientShader::setupProgram(Program* program, const mat4& modelVi computeScreenSpaceMatrix(screenSpace, modelView); // Uniforms bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY], textureSlot); bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY]); glUniform1i(program->getUniform("gradientSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]); } Loading libs/hwui/SkiaShader.h +5 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,11 @@ struct SkiaShader { void computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView); protected: inline void bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit); /** * The appropriate texture unit must have been activated prior to invoking * this method. */ inline void bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT); Type mType; SkShader* mKey; Loading Loading
libs/hwui/OpenGLRenderer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -1463,7 +1463,9 @@ void OpenGLRenderer::setupColorRect(float left, float top, float right, float bo dirtyLayer(left, top, right, bottom); } } if (!mShader || (mShader && setColor)) { mCaches.currentProgram->setColor(r, g, b, a); } // Setup attributes and uniforms required by the shaders if (mShader) { Loading
libs/hwui/SkiaShader.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -63,8 +63,7 @@ void SkiaShader::setupProgram(Program* program, const mat4& modelView, const Sna GLuint* textureUnit) { } void SkiaShader::bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit) { glActiveTexture(gTextureUnitsMap[textureUnit]); void SkiaShader::bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT) { glBindTexture(GL_TEXTURE_2D, texture->id); if (wrapS != texture->wrapS) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS); Loading Loading @@ -132,7 +131,7 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView, computeScreenSpaceMatrix(textureTransform, modelView); // Uniforms bindTexture(texture, mWrapS, mWrapT, textureSlot); bindTexture(texture, mWrapS, mWrapT); glUniform1i(program->getUniform("bitmapSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("textureTransform"), 1, GL_FALSE, &textureTransform.data[0]); Loading Loading @@ -204,7 +203,7 @@ void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelV computeScreenSpaceMatrix(screenSpace, modelView); // Uniforms bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY], textureSlot); bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY]); glUniform1i(program->getUniform("gradientSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]); } Loading Loading @@ -297,7 +296,7 @@ void SkiaSweepGradientShader::setupProgram(Program* program, const mat4& modelVi computeScreenSpaceMatrix(screenSpace, modelView); // Uniforms bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY], textureSlot); bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY]); glUniform1i(program->getUniform("gradientSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]); } Loading
libs/hwui/SkiaShader.h +5 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,11 @@ struct SkiaShader { void computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView); protected: inline void bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit); /** * The appropriate texture unit must have been activated prior to invoking * this method. */ inline void bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT); Type mType; SkShader* mKey; Loading