summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-07-14 17:35:50 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-14 17:35:50 +0000
commite2a5c184e396b748e390672996ebeca25c2b9b83 (patch)
treeb607f28804f135e46e8cd04fd80d743d41531830 /libs
parent5eaf24126d4496f9a157280007b8bb89500a3ea1 (diff)
parent941bcedb4c03832cd54225217697c7b8cba6e07c (diff)
downloadframeworks_base-e2a5c184e396b748e390672996ebeca25c2b9b83.zip
frameworks_base-e2a5c184e396b748e390672996ebeca25c2b9b83.tar.gz
frameworks_base-e2a5c184e396b748e390672996ebeca25c2b9b83.tar.bz2
am 941bcedb: Merge "Fix unsafety in SkiaShader storage, and texture unit accounting" into mnc-dev
* commit '941bcedb4c03832cd54225217697c7b8cba6e07c': Fix unsafety in SkiaShader storage, and texture unit accounting
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/SkiaShader.cpp4
-rw-r--r--libs/hwui/renderstate/TextureState.cpp8
-rw-r--r--libs/hwui/renderstate/TextureState.h2
3 files changed, 11 insertions, 3 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index 2cfb9e1..a2aa2d1 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -370,7 +370,11 @@ void SkiaShader::store(Caches& caches, const SkShader& shader, const Matrix4& mo
if (tryStoreLayer(caches, shader, modelViewMatrix,
textureUnit, description, &outData->layerData)) {
outData->skiaShaderType = kLayer_SkiaShaderType;
+ return;
}
+
+ // Unknown/unsupported type, so explicitly ignore shader
+ outData->skiaShaderType = kNone_SkiaShaderType;
}
void SkiaShader::apply(Caches& caches, const SkiaShaderData& data) {
diff --git a/libs/hwui/renderstate/TextureState.cpp b/libs/hwui/renderstate/TextureState.cpp
index a211de7..987d4cd 100644
--- a/libs/hwui/renderstate/TextureState.cpp
+++ b/libs/hwui/renderstate/TextureState.cpp
@@ -22,7 +22,8 @@ namespace uirenderer {
const GLenum kTextureUnits[] = {
GL_TEXTURE0,
GL_TEXTURE1,
- GL_TEXTURE2
+ GL_TEXTURE2,
+ GL_TEXTURE3
};
TextureState::TextureState()
@@ -33,10 +34,13 @@ TextureState::TextureState()
GLint maxTextureUnits;
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
LOG_ALWAYS_FATAL_IF(maxTextureUnits < kTextureUnitsCount,
- "At least %d texture units are required!", kTextureUnitsCount);
+ "At least %d texture units are required!", kTextureUnitsCount);
}
void TextureState::activateTexture(GLuint textureUnit) {
+ LOG_ALWAYS_FATAL_IF(textureUnit >= kTextureUnitsCount,
+ "Tried to use texture unit index %d, only %d exist",
+ textureUnit, kTextureUnitsCount);
if (mTextureUnit != textureUnit) {
glActiveTexture(kTextureUnits[textureUnit]);
mTextureUnit = textureUnit;
diff --git a/libs/hwui/renderstate/TextureState.h b/libs/hwui/renderstate/TextureState.h
index 5a57b9f..d3c014c 100644
--- a/libs/hwui/renderstate/TextureState.h
+++ b/libs/hwui/renderstate/TextureState.h
@@ -73,7 +73,7 @@ public:
void unbindTexture(GLuint texture);
private:
// total number of texture units available for use
- static const int kTextureUnitsCount = 3;
+ static const int kTextureUnitsCount = 4;
TextureState();
GLuint mTextureUnit;