diff options
author | Chris Dalton <csmartdalton@google.com> | 2018-02-02 11:06:30 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-02 18:43:29 +0000 |
commit | 7b046312edd9219ba8e66c255f5347c000b69ee1 (patch) | |
tree | 1119465d75682b9d5952e30695033d1105a24c93 /src/gpu/ops | |
parent | 7a9263906c677c0fa5636521e3cc58ba60837720 (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/ops')
-rw-r--r-- | src/gpu/ops/GrTextureOp.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp index 46d2630270..565a65883d 100644 --- a/src/gpu/ops/GrTextureOp.cpp +++ b/src/gpu/ops/GrTextureOp.cpp @@ -116,6 +116,7 @@ public: private: void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { + using Interpolation = GrGLSLVaryingHandler::Interpolation; const auto& textureGP = args.fGP.cast<TextureGeometryProcessor>(); fColorSpaceXformHelper.emitCode( args.fUniformHandler, textureGP.fColorSpaceXform.get()); @@ -127,26 +128,19 @@ public: args.fUniformHandler, textureGP.fTextureCoords.asShaderVar(), args.fFPCoordTransformHandler); - if (args.fShaderCaps->preferFlatInterpolation()) { - args.fVaryingHandler->addFlatPassThroughAttribute(&textureGP.fColors, - args.fOutputColor); - } else { - args.fVaryingHandler->addPassThroughAttribute(&textureGP.fColors, - args.fOutputColor); - } + args.fVaryingHandler->addPassThroughAttribute(&textureGP.fColors, + args.fOutputColor, + Interpolation::kCanBeFlat); args.fFragBuilder->codeAppend("float2 texCoord;"); args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureCoords, "texCoord"); if (textureGP.numTextureSamplers() > 1) { + // If this changes to float, reconsider Interpolation::kMustBeFlat. + SkASSERT(kInt_GrVertexAttribType == textureGP.fTextureIdx.fType); SkASSERT(args.fShaderCaps->integerSupport()); args.fFragBuilder->codeAppend("int texIdx;"); - if (args.fShaderCaps->flatInterpolationSupport()) { - args.fVaryingHandler->addFlatPassThroughAttribute(&textureGP.fTextureIdx, - "texIdx"); - } else { - args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureIdx, - "texIdx"); - } + args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureIdx, "texIdx", + Interpolation::kMustBeFlat); args.fFragBuilder->codeAppend("switch (texIdx) {"); for (int i = 0; i < textureGP.numTextureSamplers(); ++i) { args.fFragBuilder->codeAppendf("case %d: %s = ", i, args.fOutputColor); |