From b67a3365698ebc083359ab04e7ccd5123bf86eef Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Thu, 21 Jan 2021 22:06:04 -0700 Subject: [PATCH] Disable inner fan triangulation for the tessellation atlas Temporarily puts inner fan triangulation behind a flag so we can disable it for the atlas. The next CL will do the same thing by creating an op that doesn't triangulate, but making the functional change in this CL allows us to triage the diffs ahead of time. It will also ensure the next CL doesn't introduce any others diffs. Bug: skia:10419 Change-Id: Ia498957c53e83fe40aa797cadace171902dbf548 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357137 Reviewed-by: Greg Daniel Reviewed-by: Brian Salomon Commit-Queue: Chris Dalton --- src/gpu/tessellate/GrPathTessellateOp.cpp | 3 ++- src/gpu/tessellate/GrTessellationPathRenderer.cpp | 3 ++- src/gpu/tessellate/GrTessellationPathRenderer.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gpu/tessellate/GrPathTessellateOp.cpp b/src/gpu/tessellate/GrPathTessellateOp.cpp index 1bd78f3b24..5c78c5d6fe 100644 --- a/src/gpu/tessellate/GrPathTessellateOp.cpp +++ b/src/gpu/tessellate/GrPathTessellateOp.cpp @@ -78,7 +78,8 @@ void GrPathTessellateOp::prePreparePrograms(const PrePrepareArgs& args) { const SkRect& bounds = fPath.getBounds(); float gpuFragmentWork = bounds.height() * scales[0] * bounds.width() * scales[1]; float cpuTessellationWork = (float)numVerbs * SkNextLog2(numVerbs); // N log N. - if (cpuTessellationWork * 500 + (256 * 256) < gpuFragmentWork) { // Don't try below 256x256. + if (!(fOpFlags & OpFlags::kDisableInnerFanTriangulation) && + cpuTessellationWork * 500 + (256 * 256) < gpuFragmentWork) { // Don't try below 256x256. bool isLinear; // This will fail if the inner triangles do not form a simple polygon (e.g., self // intersection, double winding). diff --git a/src/gpu/tessellate/GrTessellationPathRenderer.cpp b/src/gpu/tessellate/GrTessellationPathRenderer.cpp index 3c71115aa0..5389de4bbd 100644 --- a/src/gpu/tessellate/GrTessellationPathRenderer.cpp +++ b/src/gpu/tessellate/GrTessellationPathRenderer.cpp @@ -68,7 +68,8 @@ void GrTessellationPathRenderer::initAtlasFlags(GrRecordingContext* rContext) { return; } - fStencilAtlasFlags = OpFlags::kStencilOnly | OpFlags::kDisableHWTessellation; + fStencilAtlasFlags = OpFlags::kStencilOnly | OpFlags::kDisableHWTessellation | + OpFlags::kDisableInnerFanTriangulation; fMaxAtlasPathWidth = fAtlas.maxAtlasSize() / 2; // The atlas usually does better with hardware tessellation. If hardware tessellation is diff --git a/src/gpu/tessellate/GrTessellationPathRenderer.h b/src/gpu/tessellate/GrTessellationPathRenderer.h index 020ae0d79b..fd6b7208ce 100644 --- a/src/gpu/tessellate/GrTessellationPathRenderer.h +++ b/src/gpu/tessellate/GrTessellationPathRenderer.h @@ -40,7 +40,8 @@ public: // the max number of segments supported by the hardware. kDisableHWTessellation = (1 << 0), kStencilOnly = (1 << 1), - kWireframe = (1 << 2) + kWireframe = (1 << 2), + kDisableInnerFanTriangulation = (1 << 3) // TEMPORARY }; static bool IsSupported(const GrCaps&);