summaryrefslogtreecommitdiffstats
path: root/libs/hwui/SkiaShader.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-12-13 14:55:06 -0800
committerRomain Guy <romainguy@google.com>2011-12-13 14:58:14 -0800
commita1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5 (patch)
tree25fabe19bc7667a756c27aec7b541acee0f49def /libs/hwui/SkiaShader.cpp
parente829bc0f0364e942bed01536d115a5c08d25d776 (diff)
downloadframeworks_base-a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5.zip
frameworks_base-a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5.tar.gz
frameworks_base-a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5.tar.bz2
Further reduce the number of GL commands sent to the driver
Change-Id: Id922b2a166ea4573b767c27d3195e11c70320b23
Diffstat (limited to 'libs/hwui/SkiaShader.cpp')
-rw-r--r--libs/hwui/SkiaShader.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index 32e7533..66993a4 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -20,6 +20,7 @@
#include <SkMatrix.h>
+#include "Caches.h"
#include "SkiaShader.h"
#include "Texture.h"
#include "Matrix.h"
@@ -31,12 +32,6 @@ namespace uirenderer {
// Support
///////////////////////////////////////////////////////////////////////////////
-static const GLenum gTextureUnitsMap[] = {
- GL_TEXTURE0,
- GL_TEXTURE1,
- GL_TEXTURE2
-};
-
static const GLint gTileModes[] = {
GL_CLAMP_TO_EDGE, // == SkShader::kClamp_TileMode
GL_REPEAT, // == SkShader::kRepeat_Mode
@@ -129,7 +124,7 @@ void SkiaBitmapShader::describe(ProgramDescription& description, const Extension
void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView,
const Snapshot& snapshot, GLuint* textureUnit) {
GLuint textureSlot = (*textureUnit)++;
- glActiveTexture(gTextureUnitsMap[textureSlot]);
+ Caches::getInstance().activeTexture(textureSlot);
Texture* texture = mTexture;
mTexture = NULL;
@@ -223,7 +218,7 @@ void SkiaLinearGradientShader::describe(ProgramDescription& description,
void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelView,
const Snapshot& snapshot, GLuint* textureUnit) {
GLuint textureSlot = (*textureUnit)++;
- glActiveTexture(gTextureUnitsMap[textureSlot]);
+ Caches::getInstance().activeTexture(textureSlot);
Texture* texture = mGradientCache->get(mColors, mPositions, mCount, mTileX);
@@ -335,7 +330,7 @@ void SkiaSweepGradientShader::describe(ProgramDescription& description,
void SkiaSweepGradientShader::setupProgram(Program* program, const mat4& modelView,
const Snapshot& snapshot, GLuint* textureUnit) {
GLuint textureSlot = (*textureUnit)++;
- glActiveTexture(gTextureUnitsMap[textureSlot]);
+ Caches::getInstance().activeTexture(textureSlot);
Texture* texture = mGradientCache->get(mColors, mPositions, mCount);