aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathProcessor.cpp
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-02-12 12:14:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-12 12:14:06 -0800
commitc08f196648463d44eb85e17c5815dbf8f709a42a (patch)
treec6207815ec240c521636248118372ef3a88d4a73 /src/gpu/GrPathProcessor.cpp
parent083617b9a7247dd4c52f8dfd195fa34a083e6f1d (diff)
Use noperspective interpolation for 2D draws
Adds a mechanism to notify GrGLSLVaryingHandler that a shader will not emit geometry in perspective. This gives it a chance to use the noperspective keyword if it is supported. Updates the existing processors to notify the varying handler when there is no perspective. Begins using the noperspective keyword in GrGLGpu internal shaders. Web scenes with observable benefit (Pixel C, gpu config): tabl_nofolo.skp 4.62 -> 3.33 ms 28% desk_tigersvg.skp 26.5 -> 24 ms 9% desk_pokemonwiki.skp 16.1 -> 14.9 ms 7% tabl_deviantart.skp 3.97 -> 3.7 ms 7% desk_gws.skp 3.85 -> 3.65 ms 5% Also adds new methods for creating varyings with flat interpolation. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1673093002 Review URL: https://codereview.chromium.org/1673093002
Diffstat (limited to 'src/gpu/GrPathProcessor.cpp')
-rw-r--r--src/gpu/GrPathProcessor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gpu/GrPathProcessor.cpp b/src/gpu/GrPathProcessor.cpp
index cb33010f7e..1d70dea289 100644
--- a/src/gpu/GrPathProcessor.cpp
+++ b/src/gpu/GrPathProcessor.cpp
@@ -22,13 +22,18 @@ public:
const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
b->add32(SkToInt(pathProc.overrides().readsColor()) |
- SkToInt(pathProc.overrides().readsCoverage()) << 16);
+ (SkToInt(pathProc.overrides().readsCoverage()) << 1) |
+ (SkToInt(pathProc.viewMatrix().hasPerspective()) << 2));
}
void emitCode(EmitArgs& args) override {
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrPathProcessor& pathProc = args.fGP.cast<GrPathProcessor>();
+ if (!pathProc.viewMatrix().hasPerspective()) {
+ args.fVaryingHandler->setNoPerspective();
+ }
+
// emit transforms
this->emitTransforms(args.fVaryingHandler, args.fTransformsIn, args.fTransformsOut);