Fix GL shader bugs
Fixing errors in emitted shader code that caused GL errors
at runtime
Change-Id: I267a84398a81329a6688b292505f8779bd750ad1
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index 984461c..5b1b57d 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -178,7 +178,7 @@
void Program::use() {
glUseProgram(mProgramId);
if (texCoords >= 0 && !mHasSampler) {
- glUniform1i(getUniform("sampler"), 0);
+ glUniform1i(getUniform("baseSampler"), 0);
mHasSampler = true;
}
mUse = true;
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 2d13f60..6baf448 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -294,8 +294,8 @@
";\n",
";\n",
// Modulate
- " * fragColor.a;\n",
- " * fragColor.a;\n",
+ " * color.a;\n",
+ " * color.a;\n",
// Modulate with alpha 8 texture
" * texture2D(baseSampler, outTexCoords).a;\n",
" * pow(texture2D(baseSampler, outTexCoords).a, gamma);\n"
@@ -305,8 +305,8 @@
" fragColor = gradientColor;\n",
" fragColor = gradientColor;\n",
// Modulate
- " fragColor = gradientColor * fragColor.a;\n",
- " fragColor = gradientColor * fragColor.a;\n",
+ " fragColor = gradientColor * color.a;\n",
+ " fragColor = gradientColor * color.a;\n",
// Modulate with alpha 8 texture
" fragColor = gradientColor * texture2D(baseSampler, outTexCoords).a;\n",
" fragColor = gradientColor * pow(texture2D(baseSampler, outTexCoords).a, gamma);\n"
@@ -316,8 +316,8 @@
" fragColor = bitmapColor;\n",
" fragColor = bitmapColor;\n",
// Modulate
- " fragColor = bitmapColor * fragColor.a;\n",
- " fragColor = bitmapColor * fragColor.a;\n",
+ " fragColor = bitmapColor * color.a;\n",
+ " fragColor = bitmapColor * color.a;\n",
// Modulate with alpha 8 texture
" fragColor = bitmapColor * texture2D(baseSampler, outTexCoords).a;\n",
" fragColor = bitmapColor * pow(texture2D(baseSampler, outTexCoords).a, gamma);\n"