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
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index f536ade..fb00335 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -40,9 +40,6 @@
"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 @@
"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 @@
" 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 @@
"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 @@
" 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 @@
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 @@
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 @@
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 @@
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 @@
} 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 @@
// 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 @@
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