summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-08-12 19:47:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-12 19:31:43 +0000
commitc7d62b777b4da14e45e010817e4dc9fbf316da7e (patch)
tree0917c0469a54e2f0c05b455a151ecaa4e9fd2426 /libs/hwui/ProgramCache.cpp
parentb3cca876c2e11b865cb4f83abe2c48a60b95af5b (diff)
parentbf75945e7a1ae7c1000682716643c942c1e19ba6 (diff)
Merge "Rework shadow interpolation" into lmp-dev
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r--libs/hwui/ProgramCache.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 3ef2a716905d..2dd89b857107 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -121,8 +121,12 @@ const char* gVS_Main_OutBitmapTexCoords =
const char* gVS_Main_Position =
" vec4 transformedPosition = projection * transform * position;\n"
" gl_Position = transformedPosition;\n";
+
+const char* gVS_Main_ShadowAAVertexShape =
+ " alpha = pow(vtxAlpha, 0.667);\n";
const char* gVS_Main_AAVertexShape =
" alpha = vtxAlpha;\n";
+
const char* gVS_Main_HasRoundRectClip =
" roundRectPos = (roundRectInvTransform * transformedPosition).xy;\n";
const char* gVS_Footer =
@@ -237,6 +241,8 @@ const char* gFS_Main_ModulateColor =
" fragColor *= color.a;\n";
const char* gFS_Main_AccountForAAVertexShape =
" fragColor *= alpha;\n";
+const char* gFS_Main_AccountForShadowAAVertexShape =
+ " fragColor *= pow(alpha, 1.5);\n";
const char* gFS_Main_FetchTexture[2] = {
// Don't modulate
@@ -515,7 +521,11 @@ String8 ProgramCache::generateVertexShader(const ProgramDescription& description
shader.append(gVS_Main_OutTexCoords);
}
if (description.isAA) {
- shader.append(gVS_Main_AAVertexShape);
+ if (description.isShadowAA) {
+ shader.append(gVS_Main_ShadowAAVertexShape);
+ } else {
+ shader.append(gVS_Main_AAVertexShape);
+ }
}
if (description.hasColors) {
shader.append(gVS_Main_OutColors);
@@ -750,7 +760,11 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
shader.append(gFS_Main_ApplyColorOp[description.colorOp]);
if (description.isAA) {
- shader.append(gFS_Main_AccountForAAVertexShape);
+ if (description.isShadowAA) {
+ shader.append(gFS_Main_AccountForShadowAAVertexShape);
+ } else {
+ shader.append(gFS_Main_AccountForAAVertexShape);
+ }
}
// Output the fragment