summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-12-10 17:56:27 -0800
committerChris Craik <ccraik@google.com>2013-02-06 15:35:12 -0800
commit65cd612face362d054a85d0f7e5881c59cd523be (patch)
tree8d71fb22d3a6dd515456a44b0d1010c906abb774 /libs/hwui/ProgramCache.cpp
parentc93c6aa5553203f05df871804517885fcc071cfd (diff)
Add cap tessellation support
bug:7117155 bug:8114304 Currently used for lines (with and without AA) and arcs with useCenter=false Also removes 0.375, 0.375 offset for AA lines Change-Id: Ic8ace418739344db1e2814edf65253fe7448b0b0
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r--libs/hwui/ProgramCache.cpp51
1 files changed, 6 insertions, 45 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index f536adeff374..fb00335ebd49 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -40,9 +40,6 @@ const char* gVS_Header_Attributes =
"attribute vec4 position;\n";
const char* gVS_Header_Attributes_TexCoords =
"attribute vec2 texCoords;\n";
-const char* gVS_Header_Attributes_AALineParameters =
- "attribute float vtxWidth;\n"
- "attribute float vtxLength;\n";
const char* gVS_Header_Attributes_AAVertexShapeParameters =
"attribute float vtxAlpha;\n";
const char* gVS_Header_Uniforms_TextureTransform =
@@ -68,9 +65,6 @@ const char* gVS_Header_Uniforms_HasBitmap =
"uniform mediump vec2 textureDimension;\n";
const char* gVS_Header_Varyings_HasTexture =
"varying vec2 outTexCoords;\n";
-const char* gVS_Header_Varyings_IsAALine =
- "varying float widthProportion;\n"
- "varying float lengthProportion;\n";
const char* gVS_Header_Varyings_IsAAVertexShape =
"varying float alpha;\n";
const char* gVS_Header_Varyings_HasBitmap =
@@ -129,9 +123,6 @@ const char* gVS_Main_Position =
" gl_Position = projection * transform * position;\n";
const char* gVS_Main_PointSize =
" gl_PointSize = pointSize;\n";
-const char* gVS_Main_AALine =
- " widthProportion = vtxWidth;\n"
- " lengthProportion = vtxLength;\n";
const char* gVS_Main_AAVertexShape =
" alpha = vtxAlpha;\n";
const char* gVS_Footer =
@@ -149,9 +140,6 @@ const char* gFS_Header =
"precision mediump float;\n\n";
const char* gFS_Uniforms_Color =
"uniform vec4 color;\n";
-const char* gFS_Uniforms_AALine =
- "uniform float boundaryWidth;\n"
- "uniform float boundaryLength;\n";
const char* gFS_Header_Uniforms_PointHasBitmap =
"uniform vec2 textureDimension;\n"
"uniform float pointSize;\n";
@@ -259,9 +247,6 @@ const char* gFS_Main_FetchColor =
" fragColor = color;\n";
const char* gFS_Main_ModulateColor =
" fragColor *= color.a;\n";
-const char* gFS_Main_AccountForAALine =
- " fragColor *= (1.0 - smoothstep(boundaryWidth, 0.5, abs(0.5 - widthProportion)))\n"
- " * (1.0 - smoothstep(boundaryLength, 0.5, abs(0.5 - lengthProportion)));\n";
const char* gFS_Main_AccountForAAVertexShape =
" fragColor *= alpha;\n";
@@ -472,11 +457,7 @@ String8 ProgramCache::generateVertexShader(const ProgramDescription& description
shader.append(gVS_Header_Attributes_TexCoords);
}
if (description.isAA) {
- if (description.isVertexShape) {
- shader.append(gVS_Header_Attributes_AAVertexShapeParameters);
- } else {
- shader.append(gVS_Header_Attributes_AALineParameters);
- }
+ shader.append(gVS_Header_Attributes_AAVertexShapeParameters);
}
// Uniforms
shader.append(gVS_Header_Uniforms);
@@ -497,11 +478,7 @@ String8 ProgramCache::generateVertexShader(const ProgramDescription& description
shader.append(gVS_Header_Varyings_HasTexture);
}
if (description.isAA) {
- if (description.isVertexShape) {
- shader.append(gVS_Header_Varyings_IsAAVertexShape);
- } else {
- shader.append(gVS_Header_Varyings_IsAALine);
- }
+ shader.append(gVS_Header_Varyings_IsAAVertexShape);
}
if (description.hasGradient) {
shader.append(gVS_Header_Varyings_HasGradient[gradientIndex(description)]);
@@ -520,11 +497,7 @@ String8 ProgramCache::generateVertexShader(const ProgramDescription& description
shader.append(gVS_Main_OutTexCoords);
}
if (description.isAA) {
- if (description.isVertexShape) {
- shader.append(gVS_Main_AAVertexShape);
- } else {
- shader.append(gVS_Main_AALine);
- }
+ shader.append(gVS_Main_AAVertexShape);
}
if (description.hasBitmap) {
shader.append(description.isPoint ?
@@ -574,11 +547,7 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
shader.append(gVS_Header_Varyings_HasTexture);
}
if (description.isAA) {
- if (description.isVertexShape) {
- shader.append(gVS_Header_Varyings_IsAAVertexShape);
- } else {
- shader.append(gVS_Header_Varyings_IsAALine);
- }
+ shader.append(gVS_Header_Varyings_IsAAVertexShape);
}
if (description.hasGradient) {
shader.append(gVS_Header_Varyings_HasGradient[gradientIndex(description)]);
@@ -603,9 +572,6 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
} else if (description.hasExternalTexture) {
shader.append(gFS_Uniforms_ExternalTextureSampler);
}
- if (description.isAA && !description.isVertexShape) {
- shader.append(gFS_Uniforms_AALine);
- }
if (description.hasGradient) {
shader.append(gFS_Uniforms_GradientSampler[gradientIndex(description)]);
}
@@ -618,8 +584,7 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
// Optimization for common cases
if (!description.isAA && !blendFramebuffer &&
- description.colorOp == ProgramDescription::kColorNone &&
- !description.isPoint && !description.isVertexShape) {
+ description.colorOp == ProgramDescription::kColorNone && !description.isPoint) {
bool fast = false;
const bool noShader = !description.hasGradient && !description.hasBitmap;
@@ -754,11 +719,7 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
shader.append(gFS_Main_ApplyColorOp[description.colorOp]);
if (description.isAA) {
- if (description.isVertexShape) {
- shader.append(gFS_Main_AccountForAAVertexShape);
- } else {
- shader.append(gFS_Main_AccountForAALine);
- }
+ shader.append(gFS_Main_AccountForAAVertexShape);
}
// Output the fragment