Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: src/gpu/instanced/InstanceProcessor.cpp

Issue 2148633003: Fix various issues with instanced rendering precision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "InstanceProcessor.h" 8 #include "InstanceProcessor.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 554
555 void onEmitCode(GrGLSLVertexBuilder*, GrGLSLPPFragmentBuilder*, const char*, 555 void onEmitCode(GrGLSLVertexBuilder*, GrGLSLPPFragmentBuilder*, const char*,
556 const char*) override; 556 const char*) override;
557 557
558 typedef Backend INHERITED; 558 typedef Backend INHERITED;
559 }; 559 };
560 560
561 void GLSLInstanceProcessor::BackendNonAA::onInit(GrGLSLVaryingHandler* varyingHa ndler, 561 void GLSLInstanceProcessor::BackendNonAA::onInit(GrGLSLVaryingHandler* varyingHa ndler,
562 GrGLSLVertexBuilder*) { 562 GrGLSLVertexBuilder*) {
563 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) { 563 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) {
564 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kHigh_G rSLPrecision); 564 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kLow_Gr SLPrecision);
565 varyingHandler->addVarying("arcCoords", &fArcCoords, kMedium_GrSLPrecisi on); 565 varyingHandler->addVarying("arcCoords", &fArcCoords, kMedium_GrSLPrecisi on);
566 } 566 }
567 } 567 }
568 568
569 void GLSLInstanceProcessor::BackendNonAA::setupRect(GrGLSLVertexBuilder* v) { 569 void GLSLInstanceProcessor::BackendNonAA::setupRect(GrGLSLVertexBuilder* v) {
570 if (fTriangleIsArc.vsOut()) { 570 if (fTriangleIsArc.vsOut()) {
571 v->codeAppendf("%s = 0;", fTriangleIsArc.vsOut()); 571 v->codeAppendf("%s = 0;", fTriangleIsArc.vsOut());
572 } 572 }
573 } 573 }
574 574
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 kLow_GrSLPrecision); 731 kLow_GrSLPrecision);
732 if (kRect_ShapeFlag == fBatchInfo.fShapeTypes) { 732 if (kRect_ShapeFlag == fBatchInfo.fShapeTypes) {
733 fColor = fColorTimesRectCoverage; 733 fColor = fColorTimesRectCoverage;
734 } 734 }
735 } else { 735 } else {
736 varyingHandler->addVarying("rectCoverage", &fRectCoverage, kLow_GrSL Precision); 736 varyingHandler->addVarying("rectCoverage", &fRectCoverage, kLow_GrSL Precision);
737 } 737 }
738 v->codeAppend("float rectCoverage = 0.0;"); 738 v->codeAppend("float rectCoverage = 0.0;");
739 } 739 }
740 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) { 740 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) {
741 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kHigh_G rSLPrecision); 741 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kLow_Gr SLPrecision);
742 if (!fShapeIsCircle) { 742 if (!fShapeIsCircle) {
743 varyingHandler->addVarying("ellipseCoords", &fEllipseCoords, kHigh_G rSLPrecision); 743 varyingHandler->addVarying("ellipseCoords", &fEllipseCoords, kMedium _GrSLPrecision);
744 varyingHandler->addFlatVarying("ellipseName", &fEllipseName, kHigh_G rSLPrecision); 744 varyingHandler->addFlatVarying("ellipseName", &fEllipseName, kHigh_G rSLPrecision);
745 } else { 745 } else {
746 varyingHandler->addVarying("circleCoords", &fEllipseCoords, kMedium_ GrSLPrecision); 746 varyingHandler->addVarying("circleCoords", &fEllipseCoords, kMedium_ GrSLPrecision);
747 varyingHandler->addFlatVarying("bloatedRadius", &fBloatedRadius, kMe dium_GrSLPrecision); 747 varyingHandler->addFlatVarying("bloatedRadius", &fBloatedRadius, kMe dium_GrSLPrecision);
748 } 748 }
749 } 749 }
750 } 750 }
751 751
752 void GLSLInstanceProcessor::BackendCoverage::setupRect(GrGLSLVertexBuilder* v) { 752 void GLSLInstanceProcessor::BackendCoverage::setupRect(GrGLSLVertexBuilder* v) {
753 // Make the border one pixel wide. Inner vs outer is indicated by coordAttrs . 753 // Make the border one pixel wide. Inner vs outer is indicated by coordAttrs .
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 fEllipseName.vsOut()); 838 fEllipseName.vsOut());
839 } 839 }
840 840
841 void GLSLInstanceProcessor::BackendCoverage::onInitInnerShape(GrGLSLVaryingHandl er* varyingHandler, 841 void GLSLInstanceProcessor::BackendCoverage::onInitInnerShape(GrGLSLVaryingHandl er* varyingHandler,
842 GrGLSLVertexBuilde r* v) { 842 GrGLSLVertexBuilde r* v) {
843 v->codeAppend("vec2 innerShapeHalfSize = shapeHalfSize / outer2Inner.xy;"); 843 v->codeAppend("vec2 innerShapeHalfSize = shapeHalfSize / outer2Inner.xy;");
844 844
845 if (kOval_ShapeFlag == fBatchInfo.fInnerShapeTypes) { 845 if (kOval_ShapeFlag == fBatchInfo.fInnerShapeTypes) {
846 varyingHandler->addVarying("innerEllipseCoords", &fInnerEllipseCoords, 846 varyingHandler->addVarying("innerEllipseCoords", &fInnerEllipseCoords,
847 kMedium_GrSLPrecision); 847 kMedium_GrSLPrecision);
848 varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseName, 848 varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseName, k High_GrSLPrecision);
849 kMedium_GrSLPrecision);
850 } else { 849 } else {
851 varyingHandler->addVarying("distanceToInnerEdge", &fDistanceToInnerEdge, 850 varyingHandler->addVarying("distanceToInnerEdge", &fDistanceToInnerEdge,
852 kMedium_GrSLPrecision); 851 kMedium_GrSLPrecision);
853 varyingHandler->addFlatVarying("innerShapeBloatedHalfSize", &fInnerShape BloatedHalfSize, 852 varyingHandler->addFlatVarying("innerShapeBloatedHalfSize", &fInnerShape BloatedHalfSize,
854 kMedium_GrSLPrecision); 853 kMedium_GrSLPrecision);
855 if (kRect_ShapeFlag != fBatchInfo.fInnerShapeTypes) { 854 if (kRect_ShapeFlag != fBatchInfo.fInnerShapeTypes) {
856 varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords, k High_GrSLPrecision); 855 varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords,
856 kMedium_GrSLPrecision);
857 varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseNam e, 857 varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseNam e,
858 kMedium_GrSLPrecision); 858 kHigh_GrSLPrecision);
859 varyingHandler->addFlatVarying("innerRRect", &fInnerRRect, kHigh_GrS LPrecision); 859 varyingHandler->addFlatVarying("innerRRect", &fInnerRRect, kMedium_G rSLPrecision);
860 } 860 }
861 } 861 }
862 } 862 }
863 863
864 void GLSLInstanceProcessor::BackendCoverage::setupInnerRect(GrGLSLVertexBuilder* v) { 864 void GLSLInstanceProcessor::BackendCoverage::setupInnerRect(GrGLSLVertexBuilder* v) {
865 if (fInnerRRect.vsOut()) { 865 if (fInnerRRect.vsOut()) {
866 // The fragment shader will generalize every inner shape as a round rect . Since this one 866 // The fragment shader will generalize every inner shape as a round rect . Since this one
867 // is a rect, we simply emit bogus parameters for the round rect (effect ively negative 867 // is a rect, we simply emit bogus parameters for the round rect (effect ively negative
868 // radii) that ensure the fragment shader always takes the "emitRect" co depath. 868 // radii) that ensure the fragment shader always takes the "emitRect" co depath.
869 v->codeAppendf("%s.xy = abs(outer2Inner.xy) * (1.0 + bloat) + abs(outer2 Inner.zw);", 869 v->codeAppendf("%s.xy = abs(outer2Inner.xy) * (1.0 + bloat) + abs(outer2 Inner.zw);",
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 innerCoverageDecl.c_str()); 945 innerCoverageDecl.c_str());
946 } else { 946 } else {
947 v->codeAppendf("%s = innerShapeCoords * innerShapeHalfSize;", 947 v->codeAppendf("%s = innerShapeCoords * innerShapeHalfSize;",
948 fDistanceToInnerEdge.vsOut()); 948 fDistanceToInnerEdge.vsOut());
949 v->codeAppendf("%s = innerShapeHalfSize + 0.5;", fInnerShapeBloatedH alfSize.vsOut()); 949 v->codeAppendf("%s = innerShapeHalfSize + 0.5;", fInnerShapeBloatedH alfSize.vsOut());
950 950
951 if (kRect_ShapeFlag == fBatchInfo.fInnerShapeTypes) { 951 if (kRect_ShapeFlag == fBatchInfo.fInnerShapeTypes) {
952 this->emitInnerRect(f, innerCoverageDecl.c_str()); 952 this->emitInnerRect(f, innerCoverageDecl.c_str());
953 } else { 953 } else {
954 f->codeAppendf("%s = 0.0;", innerCoverageDecl.c_str()); 954 f->codeAppendf("%s = 0.0;", innerCoverageDecl.c_str());
955 f->appendPrecisionModifier(kMedium_GrSLPrecision);
955 f->codeAppendf("vec2 distanceToArcEdge = abs(%s) - %s.xy;", 956 f->codeAppendf("vec2 distanceToArcEdge = abs(%s) - %s.xy;",
956 fInnerShapeCoords.fsIn(), fInnerRRect.fsIn()); 957 fInnerShapeCoords.fsIn(), fInnerRRect.fsIn());
957 f->codeAppend ("if (any(lessThan(distanceToArcEdge, vec2(1e-5))) ) {"); 958 f->codeAppend ("if (any(lessThan(distanceToArcEdge, vec2(1e-5))) ) {");
958 this->emitInnerRect(f, "innerCoverage"); 959 this->emitInnerRect(f, "innerCoverage");
959 f->codeAppend ("} else {"); 960 f->codeAppend ("} else {");
961 f->appendPrecisionModifier(kMedium_GrSLPrecision);
960 f->codeAppendf( "vec2 ellipseCoords = distanceToArcEdge * %s. zw;", 962 f->codeAppendf( "vec2 ellipseCoords = distanceToArcEdge * %s. zw;",
961 fInnerRRect.fsIn()); 963 fInnerRRect.fsIn());
962 this->emitArc(f, "ellipseCoords", fInnerEllipseName.fsIn(), 964 this->emitArc(f, "ellipseCoords", fInnerEllipseName.fsIn(),
963 false /*ellipseCoordsNeedClamp*/, 965 false /*ellipseCoordsNeedClamp*/,
964 false /*ellipseCoordsMayBeNegative*/, "innerCovera ge"); 966 false /*ellipseCoordsMayBeNegative*/, "innerCovera ge");
965 f->codeAppend ("}"); 967 f->codeAppend ("}");
966 } 968 }
967 } 969 }
968 f->codeAppendf("%s = vec4(max(coverage - innerCoverage, 0.0));", outCove rage); 970 f->codeAppendf("%s = vec4(max(coverage - innerCoverage, 0.0));", outCove rage);
969 } else if (!fTweakAlphaForCoverage) { 971 } else if (!fTweakAlphaForCoverage) {
(...skipping 13 matching lines...) Expand all
983 f->codeAppendf("%s = %s;", outCoverage, fRectCoverage.fsIn()); 985 f->codeAppendf("%s = %s;", outCoverage, fRectCoverage.fsIn());
984 } else { 986 } else {
985 f->codeAppendf("%s = 1.0;", outCoverage); 987 f->codeAppendf("%s = 1.0;", outCoverage);
986 } 988 }
987 } 989 }
988 990
989 void GLSLInstanceProcessor::BackendCoverage::emitCircle(GrGLSLPPFragmentBuilder* f, 991 void GLSLInstanceProcessor::BackendCoverage::emitCircle(GrGLSLPPFragmentBuilder* f,
990 const char* outCoverage) { 992 const char* outCoverage) {
991 // TODO: circleCoords = max(circleCoords, 0) if we decide to do this optimiz ation on rrects. 993 // TODO: circleCoords = max(circleCoords, 0) if we decide to do this optimiz ation on rrects.
992 SkASSERT(!(kRRect_ShapesMask & fBatchInfo.fShapeTypes)); 994 SkASSERT(!(kRRect_ShapesMask & fBatchInfo.fShapeTypes));
995 f->appendPrecisionModifier(kLow_GrSLPrecision);
993 f->codeAppendf("float distanceToEdge = %s - length(%s);", 996 f->codeAppendf("float distanceToEdge = %s - length(%s);",
994 fBloatedRadius.fsIn(), fEllipseCoords.fsIn()); 997 fBloatedRadius.fsIn(), fEllipseCoords.fsIn());
995 f->codeAppendf("%s = clamp(distanceToEdge, 0.0, 1.0);", outCoverage); 998 f->codeAppendf("%s = clamp(distanceToEdge, 0.0, 1.0);", outCoverage);
996 } 999 }
997 1000
998 void GLSLInstanceProcessor::BackendCoverage::emitArc(GrGLSLPPFragmentBuilder* f, 1001 void GLSLInstanceProcessor::BackendCoverage::emitArc(GrGLSLPPFragmentBuilder* f,
999 const char* ellipseCoords, 1002 const char* ellipseCoords,
1000 const char* ellipseName, 1003 const char* ellipseName,
1001 bool ellipseCoordsNeedClamp , 1004 bool ellipseCoordsNeedClamp ,
1002 bool ellipseCoordsMayBeNega tive, 1005 bool ellipseCoordsMayBeNega tive,
1003 const char* outCoverage) { 1006 const char* outCoverage) {
1004 SkASSERT(!ellipseCoordsMayBeNegative || ellipseCoordsNeedClamp); 1007 SkASSERT(!ellipseCoordsMayBeNegative || ellipseCoordsNeedClamp);
1005 if (ellipseCoordsNeedClamp) { 1008 if (ellipseCoordsNeedClamp) {
1006 // This serves two purposes: 1009 // This serves two purposes:
1007 // - To restrict the arcs of rounded rects to their positive quadrants. 1010 // - To restrict the arcs of rounded rects to their positive quadrants.
1008 // - To avoid inversesqrt(0) in the ellipse formula. 1011 // - To avoid inversesqrt(0) in the ellipse formula.
1012 f->appendPrecisionModifier(kMedium_GrSLPrecision);
1009 if (ellipseCoordsMayBeNegative) { 1013 if (ellipseCoordsMayBeNegative) {
1010 f->codeAppendf("vec2 ellipseClampedCoords = max(abs(%s), vec2(1e-4)) ;", ellipseCoords); 1014 f->codeAppendf("vec2 ellipseClampedCoords = max(abs(%s), vec2(1e-4)) ;", ellipseCoords);
1011 } else { 1015 } else {
1012 f->codeAppendf("vec2 ellipseClampedCoords = max(%s, vec2(1e-4));", e llipseCoords); 1016 f->codeAppendf("vec2 ellipseClampedCoords = max(%s, vec2(1e-4));", e llipseCoords);
1013 } 1017 }
1014 ellipseCoords = "ellipseClampedCoords"; 1018 ellipseCoords = "ellipseClampedCoords";
1015 } 1019 }
1016 // ellipseCoords are in pixel space and ellipseName is 1 / rx^2, 1 / ry^2. 1020 // ellipseCoords are in pixel space and ellipseName is 1 / rx^2, 1 / ry^2.
1021 f->appendPrecisionModifier(kHigh_GrSLPrecision);
1017 f->codeAppendf("vec2 Z = %s * %s;", ellipseCoords, ellipseName); 1022 f->codeAppendf("vec2 Z = %s * %s;", ellipseCoords, ellipseName);
1018 // implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1. 1023 // implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1.
1024 f->appendPrecisionModifier(kHigh_GrSLPrecision);
1019 f->codeAppendf("float implicit = dot(Z, %s) - 1.0;", ellipseCoords); 1025 f->codeAppendf("float implicit = dot(Z, %s) - 1.0;", ellipseCoords);
1020 // gradDot is the squared length of the gradient of the implicit. 1026 // gradDot is the squared length of the gradient of the implicit.
1027 f->appendPrecisionModifier(kHigh_GrSLPrecision);
1021 f->codeAppendf("float gradDot = 4.0 * dot(Z, Z);"); 1028 f->codeAppendf("float gradDot = 4.0 * dot(Z, Z);");
1022 f->appendPrecisionModifier(kLow_GrSLPrecision); 1029 f->appendPrecisionModifier(kMedium_GrSLPrecision);
1023 f->codeAppend ("float approxDist = implicit * inversesqrt(gradDot);"); 1030 f->codeAppend ("float approxDist = implicit * inversesqrt(gradDot);");
1024 f->codeAppendf("%s = clamp(0.5 - approxDist, 0.0, 1.0);", outCoverage); 1031 f->codeAppendf("%s = clamp(0.5 - approxDist, 0.0, 1.0);", outCoverage);
1025 } 1032 }
1026 1033
1027 void GLSLInstanceProcessor::BackendCoverage::emitInnerRect(GrGLSLPPFragmentBuild er* f, 1034 void GLSLInstanceProcessor::BackendCoverage::emitInnerRect(GrGLSLPPFragmentBuild er* f,
1028 const char* outCovera ge) { 1035 const char* outCovera ge) {
1029 f->appendPrecisionModifier(kLow_GrSLPrecision); 1036 f->appendPrecisionModifier(kLow_GrSLPrecision);
1030 f->codeAppendf("vec2 c = %s - abs(%s);", 1037 f->codeAppendf("vec2 c = %s - abs(%s);",
1031 fInnerShapeBloatedHalfSize.fsIn(), fDistanceToInnerEdge.fsIn( )); 1038 fInnerShapeBloatedHalfSize.fsIn(), fDistanceToInnerEdge.fsIn( ));
1032 f->codeAppendf("%s = clamp(min(c.x, c.y), 0.0, 1.0);", outCoverage); 1039 f->codeAppendf("%s = clamp(min(c.x, c.y), 0.0, 1.0);", outCoverage);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 GrGLSLVertToFrag fFragInnerShapeHalfSpan; 1112 GrGLSLVertToFrag fFragInnerShapeHalfSpan;
1106 SkString fSquareFun; 1113 SkString fSquareFun;
1107 1114
1108 typedef Backend INHERITED; 1115 typedef Backend INHERITED;
1109 }; 1116 };
1110 1117
1111 void GLSLInstanceProcessor::BackendMultisample::onInit(GrGLSLVaryingHandler* var yingHandler, 1118 void GLSLInstanceProcessor::BackendMultisample::onInit(GrGLSLVaryingHandler* var yingHandler,
1112 GrGLSLVertexBuilder* v) { 1119 GrGLSLVertexBuilder* v) {
1113 if (!this->isMixedSampled()) { 1120 if (!this->isMixedSampled()) {
1114 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) { 1121 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) {
1115 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, 1122 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kLo w_GrSLPrecision);
1116 kHigh_GrSLPrecision);
1117 varyingHandler->addVarying("arcCoords", &fArcCoords, kHigh_GrSLPreci sion); 1123 varyingHandler->addVarying("arcCoords", &fArcCoords, kHigh_GrSLPreci sion);
1118 if (!fBatchInfo.fHasPerspective) { 1124 if (!fBatchInfo.fHasPerspective) {
1119 varyingHandler->addFlatVarying("arcInverseMatrix", &fArcInverseM atrix, 1125 varyingHandler->addFlatVarying("arcInverseMatrix", &fArcInverseM atrix,
1120 kHigh_GrSLPrecision); 1126 kHigh_GrSLPrecision);
1121 varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfS pan, 1127 varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfS pan,
1122 kHigh_GrSLPrecision); 1128 kHigh_GrSLPrecision);
1123 } 1129 }
1124 } else if (!fBatchInfo.fInnerShapeTypes) { 1130 } else if (!fBatchInfo.fInnerShapeTypes) {
1125 return; 1131 return;
1126 } 1132 }
(...skipping 13 matching lines...) Expand all
1140 kHigh_GrSLPrecision); 1146 kHigh_GrSLPrecision);
1141 varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfS pan, 1147 varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfS pan,
1142 kHigh_GrSLPrecision); 1148 kHigh_GrSLPrecision);
1143 } 1149 }
1144 } else if (fBatchInfo.fShapeTypes & kOval_ShapeFlag) { 1150 } else if (fBatchInfo.fShapeTypes & kOval_ShapeFlag) {
1145 fArcCoords = fShapeCoords; 1151 fArcCoords = fShapeCoords;
1146 fArcInverseMatrix = fShapeInverseMatrix; 1152 fArcInverseMatrix = fShapeInverseMatrix;
1147 fFragArcHalfSpan = fFragShapeHalfSpan; 1153 fFragArcHalfSpan = fFragShapeHalfSpan;
1148 if (fBatchInfo.fShapeTypes & kRect_ShapeFlag) { 1154 if (fBatchInfo.fShapeTypes & kRect_ShapeFlag) {
1149 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, 1155 varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc,
1150 kHigh_GrSLPrecision); 1156 kLow_GrSLPrecision);
1151 } 1157 }
1152 } 1158 }
1153 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) { 1159 if (kRect_ShapeFlag != fBatchInfo.fShapeTypes) {
1154 v->definef("SAMPLE_MASK_ALL", "0x%x", (1 << fEffectiveSampleCnt) - 1) ; 1160 v->definef("SAMPLE_MASK_ALL", "0x%x", (1 << fEffectiveSampleCnt) - 1) ;
1155 varyingHandler->addFlatVarying("earlyAccept", &fEarlyAccept, kHigh_Gr SLPrecision); 1161 varyingHandler->addFlatVarying("earlyAccept", &fEarlyAccept, kHigh_Gr SLPrecision);
1156 } 1162 }
1157 } 1163 }
1158 if (!fBatchInfo.fHasPerspective) { 1164 if (!fBatchInfo.fHasPerspective) {
1159 v->codeAppend("mat2 shapeInverseMatrix = inverse(mat2(shapeMatrix));"); 1165 v->codeAppend("mat2 shapeInverseMatrix = inverse(mat2(shapeMatrix));");
1160 v->codeAppend("vec2 fragShapeSpan = abs(vec4(shapeInverseMatrix).xz) + " 1166 v->codeAppend("vec2 fragShapeSpan = abs(vec4(shapeInverseMatrix).xz) + "
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 2093
2088 case kCorneredRect_FirstIndex: return "basic_round_rect"; 2094 case kCorneredRect_FirstIndex: return "basic_round_rect";
2089 case kCorneredFramedRect_FirstIndex: return "coverage_round_rect"; 2095 case kCorneredFramedRect_FirstIndex: return "coverage_round_rect";
2090 case kCorneredRectFanned_FirstIndex: return "mixed_samples_round_rect"; 2096 case kCorneredRectFanned_FirstIndex: return "mixed_samples_round_rect";
2091 2097
2092 default: return "unknown"; 2098 default: return "unknown";
2093 } 2099 }
2094 } 2100 }
2095 2101
2096 } 2102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698