aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ccpr
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-02-02 11:06:30 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-02 18:43:29 +0000
commit7b046312edd9219ba8e66c255f5347c000b69ee1 (patch)
tree1119465d75682b9d5952e30695033d1105a24c93 /src/gpu/ccpr
parent7a9263906c677c0fa5636521e3cc58ba60837720 (diff)
ccpr: Don't use flat interpolation when it is slow
Bug: skia: Change-Id: I1bc087187541183fdbaa5f2b93e8b8d287ac8ef8 Reviewed-on: https://skia-review.googlesource.com/102100 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ccpr')
-rw-r--r--src/gpu/ccpr/GrCCCubicShader.cpp6
-rw-r--r--src/gpu/ccpr/GrCCPathProcessor.cpp6
-rw-r--r--src/gpu/ccpr/GrCCQuadraticShader.cpp6
-rw-r--r--src/gpu/ccpr/GrCCTriangleShader.cpp8
4 files changed, 17 insertions, 9 deletions
diff --git a/src/gpu/ccpr/GrCCCubicShader.cpp b/src/gpu/ccpr/GrCCCubicShader.cpp
index fbaf7d9da8..3bf8479536 100644
--- a/src/gpu/ccpr/GrCCCubicShader.cpp
+++ b/src/gpu/ccpr/GrCCCubicShader.cpp
@@ -133,14 +133,16 @@ void GrCCCubicCornerShader::onEmitSetupCode(GrGLSLVertexGeoBuilder* s, const cha
void GrCCCubicCornerShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler,
GrGLSLVarying::Scope scope, SkString* code) {
+ using Interpolation = GrGLSLVaryingHandler::Interpolation;
+
fdKLMDdx.reset(kFloat4_GrSLType, scope);
- varyingHandler->addFlatVarying("dklmddx", &fdKLMDdx);
+ varyingHandler->addVarying("dklmddx", &fdKLMDdx, Interpolation::kCanBeFlat);
code->appendf("%s = float4(%s[0].x, %s[1].x, %s[2].x, %s.x);",
OutName(fdKLMDdx), fKLMMatrix.c_str(), fKLMMatrix.c_str(),
fKLMMatrix.c_str(), fEdgeDistanceEquation.c_str());
fdKLMDdy.reset(kFloat4_GrSLType, scope);
- varyingHandler->addFlatVarying("dklmddy", &fdKLMDdy);
+ varyingHandler->addVarying("dklmddy", &fdKLMDdy, Interpolation::kCanBeFlat);
code->appendf("%s = float4(%s[0].y, %s[1].y, %s[2].y, %s.y);",
OutName(fdKLMDdy), fKLMMatrix.c_str(), fKLMMatrix.c_str(),
fKLMMatrix.c_str(), fEdgeDistanceEquation.c_str());
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp
index f93a0bd631..986b5870d7 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPathProcessor.cpp
@@ -146,6 +146,8 @@ GrGLSLPrimitiveProcessor* GrCCPathProcessor::createGLSLInstance(const GrShaderCa
void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
using InstanceAttribs = GrCCPathProcessor::InstanceAttribs;
+ using Interpolation = GrGLSLVaryingHandler::Interpolation;
+
const GrCCPathProcessor& proc = args.fGP.cast<GrCCPathProcessor>();
GrGLSLUniformHandler* uniHandler = args.fUniformHandler;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -160,8 +162,8 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLVarying texcoord(kFloat2_GrSLType);
GrGLSLVarying color(kHalf4_GrSLType);
varyingHandler->addVarying("texcoord", &texcoord);
- varyingHandler->addFlatPassThroughAttribute(&proc.getInstanceAttrib(InstanceAttribs::kColor),
- args.fOutputColor);
+ varyingHandler->addPassThroughAttribute(&proc.getInstanceAttrib(InstanceAttribs::kColor),
+ args.fOutputColor, Interpolation::kCanBeFlat);
// The vertex shader bloats and intersects the devBounds and devBounds45 rectangles, in order to
// find an octagon that circumscribes the (bloated) path.
diff --git a/src/gpu/ccpr/GrCCQuadraticShader.cpp b/src/gpu/ccpr/GrCCQuadraticShader.cpp
index 002fcfd340..1122eafc98 100644
--- a/src/gpu/ccpr/GrCCQuadraticShader.cpp
+++ b/src/gpu/ccpr/GrCCQuadraticShader.cpp
@@ -101,14 +101,16 @@ void GrCCQuadraticCornerShader::onEmitSetupCode(GrGLSLVertexGeoBuilder* s, const
void GrCCQuadraticCornerShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler,
GrGLSLVarying::Scope scope, SkString* code) {
+ using Interpolation = GrGLSLVaryingHandler::Interpolation;
+
fdXYDdx.reset(kFloat3_GrSLType, scope);
- varyingHandler->addFlatVarying("dXYDdx", &fdXYDdx);
+ varyingHandler->addVarying("dXYDdx", &fdXYDdx, Interpolation::kCanBeFlat);
code->appendf("%s = float3(%s[0].x, %s[0].y, %s.x);",
OutName(fdXYDdx), fCanonicalMatrix.c_str(), fCanonicalMatrix.c_str(),
fEdgeDistanceEquation.c_str());
fdXYDdy.reset(kFloat3_GrSLType, scope);
- varyingHandler->addFlatVarying("dXYDdy", &fdXYDdy);
+ varyingHandler->addVarying("dXYDdy", &fdXYDdy, Interpolation::kCanBeFlat);
code->appendf("%s = float3(%s[1].x, %s[1].y, %s.y);",
OutName(fdXYDdy), fCanonicalMatrix.c_str(), fCanonicalMatrix.c_str(),
fEdgeDistanceEquation.c_str());
diff --git a/src/gpu/ccpr/GrCCTriangleShader.cpp b/src/gpu/ccpr/GrCCTriangleShader.cpp
index 6e9b13ef69..6ed875822e 100644
--- a/src/gpu/ccpr/GrCCTriangleShader.cpp
+++ b/src/gpu/ccpr/GrCCTriangleShader.cpp
@@ -18,7 +18,8 @@ void GrCCTriangleShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler,
const char* wind) {
fCoverageTimesWind.reset(kHalf_GrSLType, scope);
if (!inputCoverage) {
- varyingHandler->addFlatVarying("wind", &fCoverageTimesWind);
+ varyingHandler->addVarying("wind", &fCoverageTimesWind,
+ GrGLSLVaryingHandler::Interpolation::kCanBeFlat);
code->appendf("%s = %s;", OutName(fCoverageTimesWind), wind);
} else {
varyingHandler->addVarying("coverage_times_wind", &fCoverageTimesWind);
@@ -89,13 +90,14 @@ void GrCCTriangleCornerShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandl
GrGLSLVarying::Scope scope, SkString* code,
const char* position, const char* inputCoverage,
const char* wind) {
+ using Interpolation = GrGLSLVaryingHandler::Interpolation;
SkASSERT(!inputCoverage);
fCornerLocationInAABoxes.reset(kFloat2x2_GrSLType, scope);
varyingHandler->addVarying("corner_location_in_aa_boxes", &fCornerLocationInAABoxes);
fBisectInAABoxes.reset(kFloat2x2_GrSLType, scope);
- varyingHandler->addFlatVarying("bisect_in_aa_boxes", &fBisectInAABoxes);
+ varyingHandler->addVarying("bisect_in_aa_boxes", &fBisectInAABoxes, Interpolation::kCanBeFlat);
code->appendf("for (int i = 0; i < 2; ++i) {");
code->appendf( "%s[i] = %s * %s[i] + %s[i];",
@@ -105,7 +107,7 @@ void GrCCTriangleCornerShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandl
code->appendf("}");
fWindTimesHalf.reset(kHalf_GrSLType, scope);
- varyingHandler->addFlatVarying("wind_times_half", &fWindTimesHalf);
+ varyingHandler->addVarying("wind_times_half", &fWindTimesHalf, Interpolation::kCanBeFlat);
code->appendf("%s = %s * .5;", OutName(fWindTimesHalf), wind);
}