Apply 3D transformations to gradient shaders.
This fixes only linear gradients. Sweep and radial gradients, as well as
bitmap shaders, will be fixed in a future commit.
Change-Id: I4eee4ff62e9bbf3b9339fc111a780167449ecfef
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 3e9412c..d1a1b45 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -35,9 +35,6 @@
"uniform mat4 transform;\n";
const char* gVS_Header_Uniforms_HasGradient[3] = {
// Linear
- "uniform float gradientLength;\n"
- "uniform vec2 gradient;\n"
- "uniform vec2 gradientStart;\n"
"uniform mat4 screenSpace;\n",
// Circular
"uniform vec2 gradientStart;\n"
@@ -69,8 +66,7 @@
" outTexCoords = texCoords;\n";
const char* gVS_Main_OutGradient[3] = {
// Linear
- " vec4 location = screenSpace * position;\n"
- " index = dot(location.xy - gradientStart, gradient) * gradientLength;\n",
+ " index = (screenSpace * position).x;\n",
// Circular
" vec4 location = screenSpace * position;\n"
" circular = (gradientMatrix * vec4(location.xy - gradientStart, 0.0, 0.0)).xy;\n",