OLD | NEW |
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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 f->codeAppendf("if (%s != 0) {", fTriangleIsArc.fsIn()); | 1401 f->codeAppendf("if (%s != 0) {", fTriangleIsArc.fsIn()); |
1402 this->emitArc(f, arcCoords, false, clampArcCoords, opts); | 1402 this->emitArc(f, arcCoords, false, clampArcCoords, opts); |
1403 | 1403 |
1404 f->codeAppend ("}"); | 1404 f->codeAppend ("}"); |
1405 } | 1405 } |
1406 } else { | 1406 } else { |
1407 const char* arcTest = fArcTest.fsIn(); | 1407 const char* arcTest = fArcTest.fsIn(); |
1408 if (arcTest && fBatchInfo.fHasPerspective) { | 1408 if (arcTest && fBatchInfo.fHasPerspective) { |
1409 // The non-perspective version accounts for fwidth() in the vertex s
hader. | 1409 // The non-perspective version accounts for fwidth() in the vertex s
hader. |
1410 // We make sure to take the derivative here, before a neighbor pixel
may early accept. | 1410 // We make sure to take the derivative here, before a neighbor pixel
may early accept. |
1411 f->enableFeature(GrGLSLPPFragmentBuilder::kStandardDerivatives_GLSLF
eature); | |
1412 f->appendPrecisionModifier(kHigh_GrSLPrecision); | 1411 f->appendPrecisionModifier(kHigh_GrSLPrecision); |
1413 f->codeAppendf("vec2 arcTest = %s - 0.5 * fwidth(%s);", | 1412 f->codeAppendf("vec2 arcTest = %s - 0.5 * fwidth(%s);", |
1414 fArcTest.fsIn(), fArcTest.fsIn()); | 1413 fArcTest.fsIn(), fArcTest.fsIn()); |
1415 arcTest = "arcTest"; | 1414 arcTest = "arcTest"; |
1416 } | 1415 } |
1417 const char* earlyAccept = fEarlyAccept.fsIn() ? fEarlyAccept.fsIn() : "S
AMPLE_MASK_ALL"; | 1416 const char* earlyAccept = fEarlyAccept.fsIn() ? fEarlyAccept.fsIn() : "S
AMPLE_MASK_ALL"; |
1418 f->codeAppendf("if (gl_SampleMaskIn[0] == %s) {", earlyAccept); | 1417 f->codeAppendf("if (gl_SampleMaskIn[0] == %s) {", earlyAccept); |
1419 f->overrideSampleCoverage(earlyAccept); | 1418 f->overrideSampleCoverage(earlyAccept); |
1420 f->codeAppend ("} else {"); | 1419 f->codeAppend ("} else {"); |
1421 if (arcTest) { | 1420 if (arcTest) { |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 | 2113 |
2115 case kCorneredRect_FirstIndex: return "basic_round_rect"; | 2114 case kCorneredRect_FirstIndex: return "basic_round_rect"; |
2116 case kCorneredFramedRect_FirstIndex: return "coverage_round_rect"; | 2115 case kCorneredFramedRect_FirstIndex: return "coverage_round_rect"; |
2117 case kCorneredRectFanned_FirstIndex: return "mixed_samples_round_rect"; | 2116 case kCorneredRectFanned_FirstIndex: return "mixed_samples_round_rect"; |
2118 | 2117 |
2119 default: return "unknown"; | 2118 default: return "unknown"; |
2120 } | 2119 } |
2121 } | 2120 } |
2122 | 2121 |
2123 } | 2122 } |
OLD | NEW |