aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathUtils.h
Commit message (Collapse)AuthorAge
* Add GrPathUtils::calcCubicInverseTransposePowerBasisMatrixGravatar Chris Dalton2017-08-28
| | | | | | | | | | | Cleans up calc_inverse_transpose_power_basis_matrix and makes it publicly visible. Bug: skia: Change-Id: I568c2b8518c74931962ece23ed07490e7e10e94b Reviewed-on: https://skia-review.googlesource.com/39180 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* Add a GrCCPRGeometry fileGravatar Chris Dalton2017-08-28
| | | | | | | | | | | Enough ccpr-specific geometry code is in flight that it feels like it should have its own file. Bug: skia: Change-Id: I99ef620a7dc35178cf774b3a4ec6159d46f401c7 Reviewed-on: https://skia-review.googlesource.com/39162 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* CCPR: Process quadratic flat edges without soft msaaGravatar Chris Dalton2017-08-07
| | | | | | | | | | | | | | | | | | | | | | The artifacts previously thought to require msaa can be handled by (1) converting near-linear quadratics into lines, and (2) ensuring all quadratic segments are monotonic with respect to the vector of their closing edge [P2 -> P0]. No. 1 was already in effect. No. 2 is implemented by this change. Now we only fall back on soft msaa for the two corner pixels. This change also does some generic housekeeping in the quadratic processor. Bug: skia: Change-Id: Ib3309c2ed86d3d8bec5f451125a69326e82eeb1c Reviewed-on: https://skia-review.googlesource.com/29721 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* Handle too many (or too large) paths in GrDefaultPathRendererGravatar Brian Osman2017-06-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PathGeoBuilder constructs the geometry with the same basic technique as before, but allows interrupting the process to emit multiple draws. Original test case was 2000 non-AA stroked circles, which created ~66000 vertices. That now renders, as do various tests with a single large path (as well as filled paths). Added a new set of 'AtLeast' allocators for vertex and index data. These take a minimum size and a fallback size. If the minimum size can be satisfied by an existing block, then the caller gets *all* memory in that block, otherwise they get a new block sized for the fallback amount. The previous allocation scheme wasn't a good fit for the new use-case, and because we don't usually need many verts, the flexible approach seems appropriate. TODO: I think that this could be extracted and re-used for MSAA path renderer without too much work? I need to read that code more carefully to make sure it lines up. Re-land of: https://skia-review.googlesource.com/18360 Re-land of: https://skia-review.googlesource.com/18983 Bug: skia:6695 Change-Id: I09ac1273e5af67ed0e3e886de90e2970c3d0b239 Reviewed-on: https://skia-review.googlesource.com/19480 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Convert SkClassifyCubic to double precisionGravatar Chris Dalton2017-06-12
| | | | | | | | | | | | | Even though it's in homogeneous coordinates, we still get unfortunate artifacts if this math is not done in double precision. Prioritizing correctness for now; we can revisit in the future as the need for performance dictates. Bug: skia: Change-Id: If416ef6b70291f1454fcb9f7630d1108644ac2a5 Reviewed-on: https://skia-review.googlesource.com/19501 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* Improve cubic KLM accuracyGravatar Chris Dalton2017-06-09
| | | | | | | | | | | | | | | | | | | | | | Moves cubic root finding logic out of GrPathUtils and PathOpsCubicIntersectionTest, and unifies it in SkGeometry. "Normalizes" the homogeneous parameter values of the roots, rather than the cubic inflection function. Does this normalization by twiddling the exponents instead of division (which causes a loss of precision). Abandons the built-in derivatives in GrCubicEffect. These don't have high enough precision on many mobile gpus. Instead we pass the KLM matrix to the vertex shader via uniform, where we can use it to set up new linear functionals from which the fragment shader can calculate the gradient of the implicit function. Bug: skia:4410 Change-Id: Ibd64e999520adc8cdef7803a492d3699995aef5a Reviewed-on: https://skia-review.googlesource.com/19017 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Revert "Handle too many (or too large) paths in GrDefaultPathRenderer"Gravatar Brian Osman2017-06-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit eb86b7094755a5fc1e49d22b4c5323f372344d61. Reason for revert: May be responsible for Command Buffer failure? Original change's description: > Handle too many (or too large) paths in GrDefaultPathRenderer > > PathGeoBuilder constructs the geometry with the same basic > technique as before, but allows interrupting the process > to emit multiple draws. > > Original test case was 2000 non-AA stroked circles, which > created ~66000 vertices. That now renders, as do various > tests with a single large path (as well as filled paths). > > TODO: I think that this could be extracted and re-used for > MSAA path renderer without too much work? I need to read > that code more carefully to make sure it lines up. > > Re-land of: https://skia-review.googlesource.com/18360 > > Bug: skia:6695 > Change-Id: Ibdedeb0ea2570a8847ba42328588bd7203411573 > Reviewed-on: https://skia-review.googlesource.com/18983 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Brian Osman <brianosman@google.com> TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:6695 Change-Id: I2cb010db502c315b3e2f7212818aea5503ecb28c Reviewed-on: https://skia-review.googlesource.com/19270 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Handle too many (or too large) paths in GrDefaultPathRendererGravatar Brian Osman2017-06-09
| | | | | | | | | | | | | | | | | | | | | | PathGeoBuilder constructs the geometry with the same basic technique as before, but allows interrupting the process to emit multiple draws. Original test case was 2000 non-AA stroked circles, which created ~66000 vertices. That now renders, as do various tests with a single large path (as well as filled paths). TODO: I think that this could be extracted and re-used for MSAA path renderer without too much work? I need to read that code more carefully to make sure it lines up. Re-land of: https://skia-review.googlesource.com/18360 Bug: skia:6695 Change-Id: Ibdedeb0ea2570a8847ba42328588bd7203411573 Reviewed-on: https://skia-review.googlesource.com/18983 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Revert "Handle too many (or too large) paths in GrDefaultPathRenderer"Gravatar Brian Osman2017-06-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6383b298489504d7f8f822d7da575b04b14a9737. Reason for revert: Test failures Original change's description: > Handle too many (or too large) paths in GrDefaultPathRenderer > > PathGeoBuilder constructs the geometry with the same basic > technique as before, but allows interrupting the process > to emit multiple draws. > > Original test case was 2000 non-AA stroked circles, which > created ~66000 vertices. That now renders, as do various > tests with a single large path (as well as filled paths). > > TODO: I think that this could be extracted and re-used for > MSAA path renderer without too much work? I need to read > that code more carefully to make sure it lines up. > > Bug: skia:6695 > Change-Id: I18983ba3d4f475ae0651946958b4911008aa623f > Reviewed-on: https://skia-review.googlesource.com/18360 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Brian Osman <brianosman@google.com> TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:6695 Change-Id: I78ce9879a2e45e19f53027ca506cc2e8fae664b3 Reviewed-on: https://skia-review.googlesource.com/18981 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Handle too many (or too large) paths in GrDefaultPathRendererGravatar Brian Osman2017-06-07
| | | | | | | | | | | | | | | | | | | | PathGeoBuilder constructs the geometry with the same basic technique as before, but allows interrupting the process to emit multiple draws. Original test case was 2000 non-AA stroked circles, which created ~66000 vertices. That now renders, as do various tests with a single large path (as well as filled paths). TODO: I think that this could be extracted and re-used for MSAA path renderer without too much work? I need to read that code more carefully to make sure it lines up. Bug: skia:6695 Change-Id: I18983ba3d4f475ae0651946958b4911008aa623f Reviewed-on: https://skia-review.googlesource.com/18360 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Pre-clamp path toleranceGravatar Brian Osman2017-05-09
| | | | | | | | | | | | | GrDefaultPathRenderer was using GrPathUtils::worstCasePointCount, which clamped the tolerance. Then it built geometry with the unclamped value, leading to vertex overflow (found by canvas fuzzer). The new rule is if you use GrPathUtils, your tolerance must come from scaleToleranceToSrc. Bug: skia:6569 Change-Id: I851519db8e569e570c717033d697f3d4d3d787fb Reviewed-on: https://skia-review.googlesource.com/16234 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Find cubic KLM functionals directlyGravatar csmartdalton2017-03-23
| | | | | | | | | | | | | | | - Updates GrPathUtils to computes the KLM functionals directly instead of deriving them from their explicit values at the control points. - Updates the utility to return these functionals as a matrix rather than an array of scalar values. - Adds a benchmark for chopCubicAtLoopIntersection. BUG=skia: Change-Id: I97a9b5cf610d33e15c9af96b9d9a8eb4a94b1ca7 Reviewed-on: https://skia-review.googlesource.com/9951 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* Generaly Fixes to gpu bezier codeGravatar Greg Daniel2017-03-14
| | | | | | | | | BUG=skia: Change-Id: I2246aa0b2bc3327df42ca30d35020a4b878a819b Reviewed-on: https://skia-review.googlesource.com/9555 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com>
* Remove stray semicolons.Gravatar Mike Klein2016-09-27
| | | | | | | | | | | | | | | | Turns out function declarations don't end in semicolons... BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2720 No public API changes. TBR=reed@google.com Change-Id: I72b56d52e1ff7fa6e89c295b0de8c46599791ebb Reviewed-on: https://skia-review.googlesource.com/2720 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Modify interface to GrPathUtils::convertCubicToQuadsGravatar bsalomon2016-02-16
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1694403003 Review URL: https://codereview.chromium.org/1694403003
* Make onPrepareDraws constGravatar joshualitt2015-11-30
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1483103003
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* SkPath::Direction serves two masters:Gravatar reed2015-06-10
| | | | | | | | | | | | | - input param to addFoo (e.g. addRect), where only CW or CCW are valid) - output param from computing functions, that sometimes return kUnknown This CL's intent is to split these into distinct enums/features: - Direction (public) loses kUnknown, and is only used for input - FirstDirection (private) is used for computing the first direction we see when analyzing a contour BUG=skia: Review URL: https://codereview.chromium.org/1176953002
* Improve the curve tessellation subdivision of the path renderers.Gravatar senorblanco2015-04-22
| | | | | | | | | | | | | | | | | | | The stencil-and-cover and tessellating path renderers currently tessellate curves to linear segments to within one screen space pixel. This is fairly poor accuracy, as can be seen from the strokecircle GM: there are noticeable rotating bumps on the circles. Improving the tolerance to 0.25 pixel eliminates the bumps, and approximates the 16x supersampling of the raster path. This does have a performance hit: 3-6% on desktop on the IE chalkboard demo, ~1% on Nexus 7 2013. Note: this will require rebaselining a number of GPU and MSAA images in Skia, but nothing in Chrome (yet). BUG=skia:3731 Review URL: https://codereview.chromium.org/1072273007
* Move GrIPoint16 to SkIPoint16 (and remove GrPoint.h)Gravatar robertphillips2014-06-02
| | | | | | | | R=bsalomon@google.com, reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/309683002
* SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.hGravatar commit-bot@chromium.org2014-03-28
| | | | | | | | | | | BUG=skia: R=bsalomon@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/216503004 git-svn-id: http://skia.googlecode.com/svn/trunk@13982 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move gpu conic calculations to GrPathUtilsGravatar commit-bot@chromium.org2013-08-20
| | | | | | | | | | | BUG= R=bsalomon@google.com, jvanverth@google.com Author: egdaniel@google.com Review URL: https://chromiumcodereview.appspot.com/22865023 git-svn-id: http://skia.googlecode.com/svn/trunk@10832 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add direct bezier cubic support for GPU shadersGravatar commit-bot@chromium.org2013-08-20
| | | | | | | | | | | BUG= R=bsalomon@google.com, jvanverth@google.com, robertphillips@google.com Author: egdaniel@google.com Review URL: https://chromiumcodereview.appspot.com/22900007 git-svn-id: http://skia.googlecode.com/svn/trunk@10814 2bbb7eff-a529-9590-31e7-b0007b416f81
* Replace all instances of GrRect with SkRect.Gravatar commit-bot@chromium.org2013-07-17
| | | | | | | | | | | | And remove the typedef in GrRect.h. The same with GrIRect. R=robertphillips@google.com Author: tfarina@chromium.org Review URL: https://chromiumcodereview.appspot.com/19449002 git-svn-id: http://skia.googlecode.com/svn/trunk@10130 2bbb7eff-a529-9590-31e7-b0007b416f81
* Replace GrMatrix with SkMatrix.Gravatar bsalomon@google.com2012-11-01
| | | | | | Review URL: https://codereview.appspot.com/6814067 git-svn-id: http://skia.googlecode.com/svn/trunk@6247 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove GrScalar, replace with SkScalar.Gravatar bsalomon@google.com2012-11-01
| | | | | | Review URL: https://codereview.appspot.com/6812064 git-svn-id: http://skia.googlecode.com/svn/trunk@6243 2bbb7eff-a529-9590-31e7-b0007b416f81
* Preserve convex control point polygon in cubic->quadratic approximationGravatar bsalomon@google.com2012-07-10
| | | | | | | | | | | | GM test modified, will require rebaselining. Review URL: http://codereview.appspot.com/6355088/ git-svn-id: http://skia.googlecode.com/svn/trunk@4518 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove GrPath typedefGravatar bsalomon@google.com2012-04-27
| | | | | | | | Review URL: http://codereview.appspot.com/6128045/ git-svn-id: http://skia.googlecode.com/svn/trunk@3780 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow compiler to optimize applying quadratic UV matrix to vertsGravatar bsalomon@google.com2012-03-15
| | | | | | | | Code Review: http://codereview.appspot.com/5833048/ git-svn-id: http://skia.googlecode.com/svn/trunk@3398 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add convex path renderer (disabled)Gravatar bsalomon@google.com2012-01-17
| | | | | | | | Review URL: http://codereview.appspot.com/5533061/ git-svn-id: http://skia.googlecode.com/svn/trunk@3040 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move gpu/include/* to include/gpu and gpu/src/* to src/gpuGravatar bsalomon@google.com2011-10-12
Review URL: http://codereview.appspot.com/5250070/ git-svn-id: http://skia.googlecode.com/svn/trunk@2471 2bbb7eff-a529-9590-31e7-b0007b416f81