Commit Graph

46 Commits

Author SHA1 Message Date
Stephen White
cc70083fbf GrTessellator (AA): null GrGeometryProcessor crash fix.
Add a null-check on geometry processor creation.

Add a test which exercises it: AA tessellator, with a non-invertible
matrix and a fragment processor which needs local coords (e.g., linear
gradient).

BUG=691902

Change-Id: I005b893aed58d3ad2500c41501045ac94b0b4b95
Reviewed-on: https://skia-review.googlesource.com/8462
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2017-02-15 17:42:26 +00:00
Robert Phillips
77505da160 Remove GrTestTarget
Change-Id: I4d2e1aa54732ff75b44a197255035c0e04548219
Reviewed-on: https://skia-review.googlesource.com/7327
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-01-20 16:47:34 +00:00
Brian Salomon
82f4431915 Make GrPaints move their GrProcessor ownership into GrPipelineBuilder.
This makes GrPaints usable only once. In some places we must make copies in order to issue draws with the same paint state.

Change-Id: Ie816e5185ce93a064111cad64c6880e1e21184c2
Reviewed-on: https://skia-review.googlesource.com/6844
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-11 19:56:48 +00:00
Brian Salomon
a163392978 Revert "Revert "Removing ref counting from GrXPFactory.""
This reverts commit 003312a211.

Change-Id: Ib41065e5c356d1dd99e70fa10611ac6756c2b79d
Reviewed-on: https://skia-review.googlesource.com/6803
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-09 17:21:03 +00:00
Brian Salomon
003312a211 Revert "Removing ref counting from GrXPFactory."
This reverts commit a8f80de2bc.

Reason for revert: nanobench failing on windows bots, possibly others

Change-Id: Iacb8c650064a28654c165665be057377ffb02ba5
Reviewed-on: https://skia-review.googlesource.com/6802
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-01-09 16:08:13 +00:00
Brian Salomon
a8f80de2bc Removing ref counting from GrXPFactory.
All GrXPFactory instances are static constexpr.

Change-Id: If1086b08534166201e53b3fd9379104e361eb5e6
Reviewed-on: https://skia-review.googlesource.com/6701
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-09 15:44:53 +00:00
Brian Salomon
895274391d move src/gpu/batches -> src/gpu/ops
Change-Id: I6410eae41f051ce38bef6f38d670924c3483c325
Reviewed-on: https://skia-review.googlesource.com/6163
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2016-12-16 16:58:24 +00:00
Brian Salomon
0e8fc8b9e6 Relandx2 "Remove antialiasing control from GrPaint."
Fixes a bad merge.

This reverts commit 073285c059.

Change-Id: I5e92339d9b33d3a6dc58b9fcd2a1b3a5684e8f8a
Reviewed-on: https://skia-review.googlesource.com/5774
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-12-09 20:43:41 +00:00
Brian Salomon
073285c059 Revert "Reland "Remove antialiasing control from GrPaint.""
This reverts commit 3944484020.

Reason for revert: Merges badly with a recent change. Will rebase and reland.

Original change's description:
> Reland "Remove antialiasing control from GrPaint."
> 
> This contains fixes for GLPrograms test and mixed samples rendering.
> 
> This reverts commit 419d81eed4.
> 
> BUG=skia:
> 
> Change-Id: If8f002fbfaaaab6d1607403f2b15ccc7f1e17e87
> Reviewed-on: https://skia-review.googlesource.com/5763
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
BUG=skia:
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Iff9657041e28604a845bc5a9acec7c9b248c53bd
Reviewed-on: https://skia-review.googlesource.com/5772
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2016-12-09 20:02:22 +00:00
Brian Salomon
3944484020 Reland "Remove antialiasing control from GrPaint."
This contains fixes for GLPrograms test and mixed samples rendering.

This reverts commit 419d81eed4.

BUG=skia:

Change-Id: If8f002fbfaaaab6d1607403f2b15ccc7f1e17e87
Reviewed-on: https://skia-review.googlesource.com/5763
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2016-12-09 19:56:24 +00:00
Brian Salomon
419d81eed4 Revert "Remove antialiasing control from GrPaint."
This reverts commit 9f549358b3.

Reason for revert: hitting asserts

Change-Id: I542d34edc05ecf72b7646263f25736a0950c78e7
Reviewed-on: https://skia-review.googlesource.com/5707
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2016-12-08 17:11:46 +00:00
Brian Salomon
9f549358b3 Remove antialiasing control from GrPaint.
This adds an additional param (of new enum type GrAA) to draws that can antialias and a new enum GrAAType to indicate the AA technique (none, fragment shader computed coverage, msaa).

Some GMs change due to this:
1) In some places we weren't disabling MSAA when the draw was supposed to be unantialiased.
2) Some bounding rect draws that use GrFragmentProcessors were unnecessarily turning on antialiasing, by disabling it a very small number of pixel LSBs change.

Change-Id: I7d8d8793dda70bcd373d09055beb9949c1a8a4d0
Reviewed-on: https://skia-review.googlesource.com/5608
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2016-12-08 16:27:44 +00:00
Mike Reed
7d954ad797 remove xfermode from public api
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4020

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Change-Id: I19cd056f2af778f10e8c6c2b7b2735593b43dbac
Reviewed-on: https://skia-review.googlesource.com/4020
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2016-10-28 20:06:17 +00:00
Brian Osman
1105224f97 Rename GrDrawContext to GrRenderTargetContext
This is in preparation for GrTextureContext and GrSurfaceContext

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4030

Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd
Reviewed-on: https://skia-review.googlesource.com/4030
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2016-10-27 19:14:09 +00:00
Brian Osman
777b5633f5 Remove many uses of kSkia8888 and kSkiaGamma8888
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3405

Change-Id: Ie920f4bcbb3dd28114a66f2363643bb10009b840
Reviewed-on: https://skia-review.googlesource.com/3405
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2016-10-14 14:34:28 +00:00
senorblanco
70f5251cc5 Fix assert caused by floating point error in tessellating path renderer.
In rare cases, floating point error causes the tesselator to add the
same Vertex to more than one Poly on the same side. This was not a big
problem when we were allocating new vertices when constructing Polys,
but after https://codereview.chromium.org/2029243002 it causes more serious
issues, since each Edge can only belong to two Polys, and violating this
condition messes up the linked list of Edges used for left & right Polys
and the associated estimated vertex count.

The fix is to simply let the first Poly win, and skip that vertex for
subsequent Polys. Since this only occurs in cases where vertices are very
close to each other, it should have little visual effect.

This is also exercised by Nebraska-StateSeal.svg.

BUG=skia:5636
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2259493002

Review-Url: https://codereview.chromium.org/2259493002
2016-08-17 14:56:22 -07:00
robertphillips
6738c70242 Rename GrContext's newDrawContext & drawContext to makeDrawContext
These both return sk_sp.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2186073002

Review-Url: https://codereview.chromium.org/2186073002
2016-07-27 12:13:51 -07:00
brianosman
dfe4f2e4fe Add SkColorSpace to GrDrawContext
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2164363002

Review-Url: https://codereview.chromium.org/2164363002
2016-07-21 13:28:36 -07:00
robertphillips
3950f0d723 Remove fColor from PathRenderer DrawPathArgs struct
This was getting in the way of other refactorings.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2126083002

Review-Url: https://codereview.chromium.org/2126083002
2016-07-07 07:33:13 -07:00
bsalomon
8acedde597 Use GrShape in GrPathRenderer.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2081383006

Review-Url: https://codereview.chromium.org/2081383006
2016-06-24 10:42:16 -07:00
bungeman
06ca8ec87c sk_sp for Ganesh.
Convert use of GrFragmentProcessor, GrGeometryProcessor, and
GrXPFactory to sk_sp. This clarifies ownership and should
reduce reference count churn by moving ownership.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2041113004

Review-Url: https://codereview.chromium.org/2041113004
2016-06-09 08:01:03 -07:00
robertphillips
976f5f0dc5 Make GrClipMaskManager stateless and push GrPipelineBuilder construction downstack
This will be followed up with a CL to remove the GrRenderTarget from the GrPipelineBuilder.

Split out of:
https://codereview.chromium.org/1988923002/ (Declassify GrClipMaskManager and Remove GrRenderTarget and GrDrawTarget from GrPipelineBuilder)

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2035823002

Review-Url: https://codereview.chromium.org/2035823002
2016-06-03 10:59:20 -07:00
robertphillips
87f15c8ff1 Retract GrRenderTarget from GrTestTarget
Split out of: https://codereview.chromium.org/1988923002/ (Declassify GrClipMaskManager and Remove GrRenderTarget and GrDrawTarget from GrPipelineBuilder)

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=2004433002

Review-Url: https://codereview.chromium.org/2004433002
2016-05-20 11:14:33 -07:00
cdalton
846c051a48 Convert GrClip to an abstract base class
Converts GrClip to an abstract base class and adds a "GrFixedClip"
implementation. GrFixedClip denotes a clip implemented with fixed-
function hardware. GrFixedClip allows us to remove the stateful
"fClipMode" member from GrClipMaskManager, and in the future will
be able to nicely encapsulate window rectangles.

After this change GrClipMaskManager is just a wrapper around
GrDrawTarget. We may want to consider removing it altogether.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1971343002

Review-Url: https://codereview.chromium.org/1971343002
2016-05-13 10:25:00 -07:00
cdalton
862cff30ea Remove clip from GrPipelineBuilder
This eliminates a copy and will allow us to make the GrClip class
virutal.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1966903004

Review-Url: https://codereview.chromium.org/1966903004
2016-05-12 15:09:48 -07:00
bsalomon
8b7451aaf6 Turn ContextInfos returned by GrContextFactory into structs.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1966013002

Review-Url: https://codereview.chromium.org/1966013002
2016-05-11 06:33:06 -07:00
bsalomon
6663acff01 Replace GrStrokeInfo with GrStyle.
A side effect is that arbitrary path effects can no be pushed deeper into the Ganesh flow for paths. They may be applied by path renderers.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1957363002

Committed: https://skia.googlesource.com/skia/+/33595bdf4b64a745f6340338d307e806e96c587f

Review-Url: https://codereview.chromium.org/1957363002
2016-05-10 09:14:17 -07:00
bsalomon
85d9667f59 Revert of Replace GrStrokeInfo with GrStyle. (patchset #4 id:160001 of https://codereview.chromium.org/1957363002/ )
Reason for revert:
Breaking some bots

Original issue's description:
> Replace GrStrokeInfo with GrStyle.
>
> A side effect is that arbitrary path effects can no be pushed deeper into the Ganesh flow for paths. They may be applied by path renderers.
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1957363002
>
> Committed: https://skia.googlesource.com/skia/+/33595bdf4b64a745f6340338d307e806e96c587f

TBR=egdaniel@google.com,robertphillips@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/1967513002
2016-05-10 06:19:21 -07:00
bsalomon
33595bdf4b Replace GrStrokeInfo with GrStyle.
A side effect is that arbitrary path effects can no be pushed deeper into the Ganesh flow for paths. They may be applied by path renderers.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1957363002

Review-Url: https://codereview.chromium.org/1957363002
2016-05-10 05:57:27 -07:00
bsalomon
fda880710c Convert some unit tests from running on GL contexts to running on all contexts
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1873313002

Review URL: https://codereview.chromium.org/1873313002
2016-04-11 14:40:50 -07:00
bsalomon
758586c7f1 Make existing unit tests only run on GL contexts
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1869503002

Review URL: https://codereview.chromium.org/1869503002
2016-04-06 14:02:39 -07:00
bsalomon
f2f1c17e33 One signature for creating unit tests that run on premade GrContexts
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1860593002

Review URL: https://codereview.chromium.org/1860593002
2016-04-05 12:59:06 -07:00
kkinnunen
546eb5c57a Initialize glGen* call id args to zero
Initialize glGenTexture, glGenBuffer call id buffer items to zero before
calls. Otherwise it's not easy to check if the call succeeded or not.

Assert the rule in debug gl context.

Make TesselatingPathRendererTests use debug gl context. It exercises
some of the GenBuffers call sites.

Review URL: https://codereview.chromium.org/1514033002
2015-12-11 00:05:34 -08:00
kkinnunen
1530283c48 Generate list of GPU contexts outside tests
Use DEF_GPUTEST_FOR_*_CONTEXT macros to obtain the
test GPU context.

Makes changing the context -related classes easier,
since not all tests need to be changed.

BUG=skia:2992

Review URL: https://codereview.chromium.org/1448873002
2015-12-01 04:35:26 -08:00
egdaniel
c4b72720e7 Don't create a GXPFactory when blend is SrcOver
BUG=skia:

Review URL: https://codereview.chromium.org/1471053002
2015-11-23 13:20:42 -08:00
robertphillips
504ce5dc77 Optionally pass rendertarget to getTestTarget
This shouldn't really make any difference but allocating and holding on to a GrRenderTarget for each test target generates image differences for Mali GPUs. This CL allows an existing render target to be used for the test target.

TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1447113002
2015-11-16 11:02:05 -08:00
joshualitt
6335a72976 Move PathRenderers to batches folder
BUG=skia:

Review URL: https://codereview.chromium.org/1306143005
2015-09-01 06:50:55 -07:00
halcanary
96fcdcc219 Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
2015-08-27 07:41:16 -07:00
bsalomon
eae6200acb Some cleanup in GrTextureProvider and GrResourceProvider.
Review URL: https://codereview.chromium.org/1261643004
2015-07-31 13:59:31 -07:00
bsalomon
0aff2fa82a Also provides the ResourceProvider to onDrawPath which allows the DF PR to no longer require access to GrContext.
Review URL: https://codereview.chromium.org/1265763002
2015-07-31 06:48:27 -07:00
bsalomon
d309e7aa0e This replaces the texture creation/caching functions on GrContext with a GrTextureProvider interface. The goal is to pass this narrowly focused object in places that currently take a GrContext but don't need and shouldn't use its other methods. It also has an extended private interface for interacting with non-texture resource types.
Review URL: https://codereview.chromium.org/1107973004
2015-04-30 14:18:54 -07:00
kkinnunen
1899651ffc Extract gpu line dashing to GrDashLinePathRenderer
Move line dashing logic from GrContext::drawPath to
GrDashLinePathRenderer. This makes it possible to let path renderers render arbitrary dashed paths.

End goal is to implement dashing in GrStencilAndCoverPathRenderer.

Review URL: https://codereview.chromium.org/1100073003
2015-04-26 23:18:50 -07:00
senorblanco
c8e934007a Yet more ASAN fixes.
More nullptr checks for factories I have added.
Other checks more Yoda-like I have made. (Skia style this is.)

BUG=skia:

Review URL: https://codereview.chromium.org/1086393004
2015-04-21 07:20:36 -07:00
senorblanco
0e95b116fc Speculative fix for ASAN build.
Check for NULL GrContext in TessellatingPathRendererTests.
Also fix an upload nag (no #includes before GPU #ifdef).

TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1097943004
2015-04-20 15:00:06 -07:00
senorblanco
a2b6d28755 Fix for out-of-bounds intersection (found by fuzzer).
Sometimes, the intersection returned by check_intersection() is
out-of-bounds for both edges (above both tops or below both bottoms)
due to floating-point inaccuracy. This causes split_edge() to create a
tiny negative-length edge on one side (which would then assert).
Although we could safely remove this assert and allow the negative
length edge to be removed, it's faster/safer to simply avoid its
creation in the first place by adjusting one edge to the other edge's
endpoint.

Added a new unit test to exercise this case.

Review URL: https://codereview.chromium.org/968993002
2015-03-02 09:34:13 -08:00
senorblanco
d6ed19cc75 Tessellating GPU path renderer.
This path renderer converts paths to linear contours, resolves intersections via Bentley-Ottman, implements a trapezoidal decomposition a la Fournier and Montuno to produce triangles, and renders those with a single draw call. It does not currently do antialiasing, so it must be used in conjunction with multisampling.

A fair amount of the code is to handle floating point edge cases in intersections. Rather than perform exact computations (which would require arbitrary precision arithmetic), we reconnect the mesh to reflect the intersection points. For example, intersections can occur above the current vertex, and force edges to be merged into the current vertex, requiring a restart of the intersections. Splitting edges for intersections can also force them to merge with formerly-distinct edges in the same polygon, or to violate the ordering of the active edge list, or the active edge state of split edges.

BUG=skia:

Review URL: https://codereview.chromium.org/855513004
2015-02-26 06:58:17 -08:00