Commit Graph

2591 Commits

Author SHA1 Message Date
Michael Ludwig
a587865e05 Enable new GrClipStack for flutter
Bug: skia:10205
Change-Id: I4dfb5b69009a41cf44ae1a2a06b71c067071a964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325665
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-13 00:42:53 +00:00
Brian Osman
5d08a27530 Add geometry shader test demonstrating max_vertices/invocations bug
Declaring max_vertices before invocations fails to adjust max_vertices
when invocation support is not present. (It should be 4, not 2 in this
case).

Bug: skia:10827
Change-Id: Ief7af97eabf5414ea8363808fc1ad2e9c480fe10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325664
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-12 21:19:33 +00:00
Michael Ludwig
ab6e62c131 Enable new clip stack for Fuchsia
Bug: skia:10205
Change-Id: I9d9ead1d40c34cd31ce0235e773de20f36f93e32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325816
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-12 20:41:03 +00:00
John Stiles
f972313fa1 Add test for disabling the inliner.
This golden verifies that when the inline threshold is zero, inlining is
not performed.

Change-Id: Icad6e1faed569dd1b2469874be3b9e635ad0b9ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325656
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-10-12 17:14:07 +00:00
Brian Salomon
aa64c352b3 Remove legacy gpu blur util code
TBR:michaelludwig@google.com

Bug: skia:10818
Change-Id: I1326aa017c0ed000efee1b9e0372a12976ba09eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324895
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
2020-10-10 12:52:04 +00:00
John Stiles
13fc260c70 Reject struct vardecls with modifiers.
These aren't allowed in GLSL, and typically don't make sense.

Change-Id: I0afca0df638590466922a809e91ef0be35b13ca8
Bug: skia:10765
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324816
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-10-09 22:34:23 +00:00
John Stiles
6f3015a562 Reland "Add sk_Caps.builtinDeterminantSupport and use it in cross()."
This is a reland of 6bbf026b54

Original change's description:
> Add sk_Caps.builtinDeterminantSupport and use it in cross().
>
> This CL partially relands http://review.skia.org/321790.
>
> Change-Id: I26a1aefda8a01167783e6e7fa15a51aa35ee5d82
> Bug: skia:10819, skia:10810
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323784
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:10819
Bug: skia:10810
Change-Id: I7731f93db07bc917707cbbe1daca2e5ce0f763d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324620
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-10-09 14:45:23 +00:00
John Stiles
eaaa71b705 Add test for sk_Caps.mustGuardDivisionEvenAfterExplicitZeroCheck.
Change-Id: Ib1374e1dce1a654a83813dbe341774bd91729796
Bug: skia:10694, skia:10819
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324356
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-09 13:48:13 +00:00
John Stiles
8f84cee9ab Add test for sk_Caps.inBlendModesFailRandomlyForAllZeroVec.
This CL also alphabetizes the various factories in ShaderCapsFactory.

Change-Id: I0378ceb821678173e72690d5563d2a9a92d90201
Bug: skia:10694, skia:10819
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324257
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-10-09 13:44:43 +00:00
Greg Daniel
c0d6915389 Reland "Rename GrStencilAttachment class to generic GrAttachment"
This is a reland of 6113d50ec4

Original change's description:
> Rename GrStencilAttachment class to generic GrAttachment
>
> Additional this adds a UsageFlags member to the new GrAttachment
> class.
>
> Bug: skia:10727
> Change-Id: Ifc0bfffd959f5fbc46bfcdf269e1b2a933929753
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323107
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:10727
Change-Id: Ie0ff0885e01c9f0666fb0cfaa765e463dcc6d0a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324277
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-10-09 11:59:23 +00:00
Jim Van Verth
2ae1dd93d8 Revert "Add sk_Caps.builtinDeterminantSupport and use it in cross()."
This reverts commit 6bbf026b54.

Reason for revert: Breaking Metal bot.

Original change's description:
> Add sk_Caps.builtinDeterminantSupport and use it in cross().
>
> This CL partially relands http://review.skia.org/321790.
>
> Change-Id: I26a1aefda8a01167783e6e7fa15a51aa35ee5d82
> Bug: skia:10819, skia:10810
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323784
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=csmartdalton@google.com,johnstiles@google.com

Change-Id: I4a6c1a63dc38682dd965f78f0c1da98f35b6dbad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10819
Bug: skia:10810
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324264
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-10-09 00:12:34 +00:00
Jim Van Verth
99b1a8b2f8 Revert "Rename GrStencilAttachment class to generic GrAttachment"
This reverts commit 6113d50ec4.

Reason for revert: Breaking MSAN bot

Original change's description:
> Rename GrStencilAttachment class to generic GrAttachment
>
> Additional this adds a UsageFlags member to the new GrAttachment
> class.
>
> Bug: skia:10727
> Change-Id: Ifc0bfffd959f5fbc46bfcdf269e1b2a933929753
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323107
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com

Change-Id: I2ee2a1fcabd75bc24d3b7c3f76d971a3adb370a3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10727
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324276
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-10-08 23:52:34 +00:00
John Stiles
6bbf026b54 Add sk_Caps.builtinDeterminantSupport and use it in cross().
This CL partially relands http://review.skia.org/321790.

Change-Id: I26a1aefda8a01167783e6e7fa15a51aa35ee5d82
Bug: skia:10819, skia:10810
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323784
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-10-08 22:51:15 +00:00
Michael Ludwig
7d0f853158 Add SkImageFilters::Shader in place of Paint factory
SkImageFilters::Paint did not use every slot of the SkPaint, with only
its color, alpha, color filter, and shader having a meaningful effect on
the image filter result. It was always blended into a transparent dst,
so blend mode wasn't very relevant, and it was always filled to whatever
required geometry, so stroke style, path effect, and mask filters were
ignored or not well specified.

Color, alpha, and color filter can all be combined into an SkShader, so
a more constrained SkImageFilters::Shader provides the same useful
capabilities without as many surprises.

SkImageFilters::Paint still exists, but is deprecated to be removed
once I've confirmed clients aren't depending on it.

Bug: skia:9310
Change-Id: I11a82bda1a5d440726cf4e2b5bfaae4929568679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323680
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-08 22:51:13 +00:00
Greg Daniel
6113d50ec4 Rename GrStencilAttachment class to generic GrAttachment
Additional this adds a UsageFlags member to the new GrAttachment
class.

Bug: skia:10727
Change-Id: Ifc0bfffd959f5fbc46bfcdf269e1b2a933929753
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323107
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-08 19:40:32 +00:00
Robert Phillips
d464feb1fc Rename GrThreadSafeUniquelyKeyedProxyViewCache
Once triangulated paths are added this will no longer just be storing proxy views.

Bug: 1108408
Change-Id: I82fa47b0b85f738d9a25330c29bc2892c9bfeda4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323999
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-08 17:39:12 +00:00
John Stiles
796cdb7839 Use SkTHashMap to implement DefinitionMap.
The benchmarks show a negligible performance decrease over the bespoke
TinyUnorderedMap class, but it's well within the margin of error, and
a real hash map will scale better in pathological cases.

Nanobench: http://screen/537ETJivpGdVJpk

Change-Id: I21279c47742a5dac81d57c7e9f7da4bfc595fdc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323114
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-08 17:18:42 +00:00
Brian Osman
c021360a88 Only include one variable per declaration statement
This removes VarDeclarationsStatement entirely. VarDeclaration instances
appear directly as statements in Programs. SkSL that declares multiple
variables in a single declaration is transformed to represent that as a
series of VarDeclaration statements.

Similarly, global variable declarations are represented by
GlobalVarDeclaration program elements, one per variable.

Bug: skia:10806
Change-Id: Idd8a2d971a8217733ed57f0dd2249d62f2f0e9c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323102
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-07 17:27:01 +00:00
Jim Van Verth
8ffd4d750f Revert "Add a 2d cross product intrinsic to sksl"
This reverts commit 57c37ad0e4.

Reason for revert: Breaking the Mali400 bots.

Original change's description:
> Add a 2d cross product intrinsic to sksl
>
> Change-Id: Iebaf4616665547d6ca4900e1247d5b68e0f3512a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321790
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,csmartdalton@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I3e1aa251e883e3d2a1170b0fc6cdc84ea06e784a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323556
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-10-07 14:35:51 +00:00
Chris Dalton
57c37ad0e4 Add a 2d cross product intrinsic to sksl
Change-Id: Iebaf4616665547d6ca4900e1247d5b68e0f3512a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321790
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-07 08:38:59 +00:00
Mike Klein
56a6120b0f retry³ absl
This merges the two CLs we've been considering,

    1) the first attempt,
       https://skia-review.googlesource.com/c/skia/+/286070;
    2) the roll to latest Abseil LTS branch,
       https://skia-review.googlesource.com/c/skia/+/323076.

(See also the second attempt,
https://skia-review.googlesource.com/c/skia/+/322976.)

We'll need this working in Google3 or punt like we have for Android.

Bug: skia:10165
Cq-Include-Trybots: luci.skia.skia.primary:Canary-G3
Change-Id: Ifb42c1bb2c5e70848208d17b841cdb67bd36e182
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323158
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-07 01:36:15 +00:00
John Stiles
49a547f7e2 Separate out SymbolTable aliases from regular Symbols.
SymbolTable::addAlias can be used to create a Symbol that's an alias for
an existing symbol, but uses a different name. (e.g. in Runtime Effects,
a `fragmentProcessor` is a `shader` and `float4` is also `vec4`.)

SymbolTable::addWithoutOwnership will now assert if an attempt is made
to add a Symbol with the wrong name. In a followup CL, the name argument
will be removed entirely and it will simply use the Symbol's name.

Change-Id: I9aee7717e2600a6d84ebe4c3ab7fca40229faa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323106
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-10-06 21:00:04 +00:00
Adlai Holler
0ce2c54094 Reland "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
This reverts commit cf43fc6768.

Reason for revert: Fixed g3

Original change's description:
> Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
>
> This reverts commit ff13ffbeac.
>
> Reason for revert: Blink in g3
>
> Original change's description:
> > Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit 89bdc90ac8.
> >
> > Reason for revert: Fix metal
> >
> > Original change's description:
> > > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> > >
> > > This reverts commit d2daa94ede.
> > >
> > > Reason for revert: Metaru
> > >
> > > Original change's description:
> > > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > > >
> > > > Woo!
> > > >
> > > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > > Docs-Preview: https://skia.org/?cl=317436
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Adlai Holler <adlai@google.com>
> > >
> > > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> > >
> > > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > > Reviewed-by: Adlai Holler <adlai@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> >
> > Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> > Docs-Preview: https://skia.org/?cl=318759
> > Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com


Change-Id: I4f01291f4b3bfbb8fd7dd8cf2bf8415430c3392e
Docs-Preview: https://skia.org/?cl=322437
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322437
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-06 18:59:11 +00:00
Mike Klein
3c70f0bf12 Revert "retry retry absl"
This reverts commit 33b42e12ab.

Reason for revert: Google3 roll

Original change's description:
> retry retry absl
>
> Identical to https://skia-review.googlesource.com/c/skia/+/286070.
>
> Bug: skia:10165
> Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Release-All-TSAN,Build-Debian10-Clang-arm64-Debug-Android_ASAN
> Change-Id: I0ec9d5f6875768e665f444e1ada211d3da537678
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322976
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com

Change-Id: I4186e85ede18caebfac59b784700e69bf9401901
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10165
Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Release-All-TSAN
Cq-Include-Trybots: Build-Debian10-Clang-arm64-Debug-Android_ASAN
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323156
Reviewed-by: Mike Klein <mtklein@google.com>
2020-10-06 17:57:47 +00:00
Mike Klein
33b42e12ab retry retry absl
Identical to https://skia-review.googlesource.com/c/skia/+/286070.

Bug: skia:10165
Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Release-All-TSAN,Build-Debian10-Clang-arm64-Debug-Android_ASAN
Change-Id: I0ec9d5f6875768e665f444e1ada211d3da537678
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322976
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-06 16:52:31 +00:00
Mike Klein
2e09693964 find cxxabi headers in Android ASAN builds
This fixes includes like <cxxabi.h> in Android ASAN builds.

Bug: skia:10165
Change-Id: Ieeff45b29cd527dd0a60ed21422378f5aa610cc7
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-arm64-Debug-Android_ASAN,Build-Debian10-Clang-arm-Debug-Android_ASAN
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322906
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-06 16:17:41 +00:00
John Stiles
b16b29a9fe Create TinyUnorderedMap class for small-N data storage.
Our code relies on std::unordered_map for storage of unordered data.
Unfortunately, while unordered_map is algorithmically quite efficient,
in many real-world scenarios--particularly with small amounts of data--
a simple vector with linear search runs rings around it.

This CL doubles the performance of `nanobench -m sksl_large`:
http://screen/7uGYGLCaTtaHU4j

Change-Id: Ia2f6cedfac338876c2da57642e9b34addd85b683
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322320
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-05 14:40:14 +00:00
John Stiles
09b9eade20 Rename BlendOverlap to BlendOverlay.
Just a typo fix.

Change-Id: I2fe1f6ae1c99d7f20a4fa5f49eefea514e224652
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321977
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-02 22:26:15 +00:00
Greg Daniel
0eca74cd2c Move bytesPerPixel query off of GrCaps and add bytesPerBlock query.
Part of this change is to move some of this static format information
off of GrCaps since it is not cap dependent in anyway. This allows us
to the need for caps in many places. Also changes the low level format
query to be based off of bytes per block so it can be shared for
compressed and non compressed formats.

This change will also make it easier to add stencil/depth formats in
follow on change since we don't have to fill in a whole caps
FormatInfo block just so we can get the bytesPerPixel which is all
they need.

Bug: skia:10727
Change-Id: I2e6fdabf3ed699b4145ef9e6f0a73078d32a0444
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321463
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-10-01 20:10:12 +00:00
John Stiles
20e4b9de76 Add unit test for inlining trivial arguments.
Change-Id: I71cefc1ffacd671ede810d9133dfce75cb9f42b4
Bug: skia:10786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320958
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-30 15:20:13 +00:00
Ethan Nicholas
f70f044b36 moved SkSL Constructor's data into IRNode
Change-Id: I9568deca0031d32bc1c6bdf1f11f6da76de6d07f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320075
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-09-29 19:36:38 +00:00
Brian Salomon
c993fe60be Work around python 2 shutil.copy2 date bug
ninja 1.9.0+ exposes a bug in python shutil.copy2 where a copied file's
date is the src's date but rounded. This can cause ninja to think the
copied file is slightly older than the src and trigger unnecessary work
when building.

https://github.com/ninja-build/ninja/issues/1554

Change-Id: I53247453f38a1c98c5d832bdda0f68effbe786c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320261
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-28 20:12:13 +00:00
John Stiles
06febefd7e Add 'tricky' OutParams golden output.
This was adapted from a test in SkSLInterpreterOutParams and presents a
challenging double swizzle.

Change-Id: Icb7b3bbb18d4b3cfa0c26acb524c08812ba88096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319920
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-28 18:52:13 +00:00
Herb Derby
f0b5644e6b introduce SkGlyphRect specialized for union & intersect
SkGlyphRect is a rectangle encoding specialized for
union and intersect. It will be used for calculating
the bounding boxes of glyph runs, and clipping glyphs
for GPU.

Change-Id: Icab826b51dc2254ee4006ada84f7fc09e112a933
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319697
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-09-28 18:31:33 +00:00
John Stiles
68861e3913 Add unit tests for assignment and invalid field access.
Change-Id: I8b755ae0078d6353e24834cd15603091d681114c
Bug: skia:10766
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319698
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-25 21:42:22 +00:00
John Stiles
c14defb8bf Disallow assignment to unfoldable ternaries in SkSL.
GLSL does not support assigning to ternaries, and will fail to compile
and/or generate non-functional shaders if we pass in a shader that tries
to assign into a ternary expression.

If SkSL is able to completely eliminate the ternary (e.g. if it boils
down to a simple `true ? x : y` or `false ? x : y`), SkSL can strip out
the ternary entirely and generate valid GLSL. This case is harmless and
so it is still allowed.

Change-Id: I960f119fb9934f998697634e6c4e519cd77d3780
Bug: skia:10767
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319679
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-25 21:26:40 +00:00
John Stiles
ba38588d88 Remove sk_ClipDistance.
This was unused and did not work on non-GLSL backends.

Change-Id: I6bd314d43cfefa64871b5c0e964b5ae52e494164
Bug: skia:10757
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319778
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-09-25 20:29:10 +00:00
John Stiles
dce4d3e2b1 Migrate setRefKind assignability checker into SkSLAnalysis.
This will allow the inliner to use IsAssignable.

Change-Id: Ic94f71002779b53d0b3dc97f37fbe4bb98b026d8
Bug: skia:10756
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319414
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-25 19:48:39 +00:00
John Stiles
aeae3a58e3 Add golden outputs for the Metal backend.
This CL also updates the blend tests to use sk_FragColor instead of
returning a half4, as the Metal backend assumes that a fragment
processor's `main` will return void and always synthesizes a
`return *_out;` at the end.

(context link:
https://osscs.corp.google.com/android/platform/superproject/+/master:external/skqp/src/sksl/SkSLMetalCodeGenerator.cpp;l=803;drc=842d31b14159626054e01dd32826563a8f4214bf )

BYPASS_INCLUSIVE_LANGUAGE_REASON=see http://b/168134166

Change-Id: I330a456bf25ee72d3a29c59cd624625378ae80a0
Bug: skia:10649, skia:10757, skia:10758, skia:10759, skia:10760, skia:10761, skia:10762
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319409
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-25 17:46:43 +00:00
John Stiles
ab4ab20fcf Migrate most SkSL tests currently in /glsl/ to /shared/.
These tests will also be used for Metal and SPIR-V testing. A small
handful of GLSL-specific stragglers (#version-specific or type-precision
related) will remain in /glsl/.

Change-Id: I7f2b2bd92825c327922c8ce74e438d2daa440dff
Bug: skia:10649
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319408
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-25 17:13:53 +00:00
John Stiles
7e248716e7 Clean up SkSL test compilation in preparation for Metal support.
Now uses a GN template to avoid copy-pasting the same logic for each
type of test we want to perform, and the same file to be compiled in
more than one way at a time via an extra flag to compile_sksl_tests.py.

Change-Id: I8aadedeb140d78d58a345a2bac0da3d9c77e9a19
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319347
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-25 16:44:54 +00:00
Ethan Nicholas
c8d9c8ee34 Revert "Revert "moved BinaryExpression's data into IRNode""
This reverts commit b61c3a9a01.

Change-Id: I42d93bdc6455c8ef941a6cbe1339df2ba916bb3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318697
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-09-24 16:34:23 +00:00
Adlai Holler
cf43fc6768 Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
This reverts commit ff13ffbeac.

Reason for revert: Blink in g3

Original change's description:
> Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
>
> This reverts commit 89bdc90ac8.
>
> Reason for revert: Fix metal
>
> Original change's description:
> > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit d2daa94ede.
> >
> > Reason for revert: Metaru
> >
> > Original change's description:
> > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > >
> > > Woo!
> > >
> > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > Docs-Preview: https://skia.org/?cl=317436
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > Reviewed-by: Adlai Holler <adlai@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
>
> Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> Docs-Preview: https://skia.org/?cl=318759
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com

Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-09-24 11:44:49 +00:00
Jim Van Verth
1b89eb742a Add AMD allocator to D3D12 backend.
Adds base class GrD3DAlloc and GrD3DMemoryAllocator, and a reference
to a GrD3DMemoryAllocator in GrBackendContext and a reference to a
GrD3DAlloc in GrD3DTextureResourceInfo. Internally, we override this
base class to define the AMD memory allocator.

Change-Id: I033924b0247ea330969b1398f25985e7a84aec11
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317243
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-09-23 21:22:52 +00:00
Herb Derby
5d9d837994 error on the side of safety for empty blobs
If the blob is empty, then try to regenerate it. Using
this method caused a slowdown in Skia perf, so we
added an extra check to allow some empty blobs through
for perf performance. The perf problem was caused by
SKPs generate empty blobs because of font mismatches.
Flutter has shown that scaling from very small to
normal size is not correctly handled by the existing
check. This CL favors correctness over optimizing empty
text blob and always regenerates empty blobs.

https://github.com/flutter/flutter/issues/64936

Change-Id: Ib18ecb684b0af5cf6dce274b6dc09a9c61b17c77
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319031
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-09-23 21:18:27 +00:00
Adlai Holler
ff13ffbeac Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
This reverts commit 89bdc90ac8.

Reason for revert: Fix metal

Original change's description:
> Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
>
> This reverts commit d2daa94ede.
>
> Reason for revert: Metaru
>
> Original change's description:
> > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> >
> > Woo!
> >
> > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > Docs-Preview: https://skia.org/?cl=317436
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com


Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
Docs-Preview: https://skia.org/?cl=318759
Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-09-23 21:17:47 +00:00
John Stiles
59b2a92c96 Add new unit tests for SkSL.
These cover:
- Properly configured out-params
- Invalid/non-lvalue out-params, which currently cause an SkSL crash
- Interactions between the inliner and variable swizzles

Change-Id: I4874101236084f273e704d8717149b431d813883
Bug: skia:10753
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319036
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-23 20:30:47 +00:00
Greg Daniel
1d3c8c1a8b Add optional param to setBackendTextureState to return previous state.
Bug: skia:10742
Change-Id: I334e7896d0a1509eb666c46d5731d2573a5c1aba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318698
Reviewed-by: Austin Eng <enga@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-09-23 19:54:59 +00:00
John Stiles
db62d088ef Bring back the harness from SkSLGLSLTest as a testbed for debugging.
The code here is resuscitated from the GLSL testing harness at
http://review.skia.org/317771 . Testing and debugging in dm is simpler
than debugging skslc when we encounter compiler issues.

Change-Id: I492dd0bbd2f0ee0b3b6a1b5253da54d72dc1eb3b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319032
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-23 18:44:47 +00:00
John Stiles
647a9bd7c2 Convert the remaining FP tests to golden outputs.
(Removed one test, SkSLFPSwitchWithMultipleReturnsInside, because it was
redundant with existing tests.)

Change-Id: I1bfc069babdb5eb0cc515f195c3a2e307bb5871a
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319029
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-23 16:21:58 +00:00
Adlai Holler
89bdc90ac8 Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
This reverts commit d2daa94ede.

Reason for revert: Metaru

Original change's description:
> Take GrContext private, GrDDLContext inherit from GrRecordingContext
> 
> Woo!
> 
> Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> Docs-Preview: https://skia.org/?cl=317436
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com

Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-09-22 20:50:01 +00:00
Adlai Holler
d2daa94ede Take GrContext private, GrDDLContext inherit from GrRecordingContext
Woo!

Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
Docs-Preview: https://skia.org/?cl=317436
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-09-22 20:03:19 +00:00
John Stiles
5f35ac9faa Add unit test for swizzling booleans.
This test currently crashes skslc, but will be fixed in the followup CL.

Change-Id: I3683d94a310242e8ca67560296518fd1223b28d0
Bug: oss-fuzz:25781
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318656
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-22 18:47:19 +00:00
John Stiles
371fde549e Rename 'DefaultSettings' golden outputs to 'StandaloneSettings'.
I realized that "DefaultSettings" as a name suffix was unclear, because
"Default" is a different settings mode from skslc running with
--nosettings.
In --nosettings mode, skslc uses "standalone" settings.

Change-Id: I1f5d80df0a21cec55948c4ad146169bcb34f4999
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318210
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-21 22:15:51 +00:00
John Stiles
2b788b11e0 Create golden outputs for SkSL blend functions.
Several blend functions generate a surprisingly large amount of code,
and appear to have opportunities for further optimization. At any rate,
if we make compiler changes that would affect the output of a blend
function, I think we would want to see the changes reflected in our
golden outputs.

Change-Id: Iff612dcd4bad8824b5e6e97413ffce19e5ea1c0e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318336
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-21 21:53:41 +00:00
John Stiles
881a10c6e8 Revert "Add program-settings flag to disable the inliner."
This reverts commit 910845fac1.

Reason for revert: IRGenerator inline change reverted

Original change's description:
> Add program-settings flag to disable the inliner.
>
> Change-Id: I6c4e7f6a2aab6710221029022a3a5f3ec323c5e2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317856
> Commit-Queue: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: Ie38a29495ea8497f9db26d2603df179e696ac5ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317977
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-19 14:13:54 +00:00
John Stiles
ca4d074d54 Fix unit test for InlinerWrapsEarlyReturnsWithDoWhileBlock.
This resolves the following TODO block:
   TODO(johnstiles): the skslc standalone caps bits do not enable
   do-while support, so this test does not actually perform as
   described; the `returny` function is not inlined at all. This will
   be fixed when customizable caps-bit support is added to the golden
   tests.

Change-Id: I3495e4813b9be37264a8fda978453594c1f5fa13
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317859
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-18 21:08:52 +00:00
John Stiles
64fc15a279 Add unit test for a dead do-while loop.
Ideally the optimizer should be able to detect and remove this loop.
This CL establishes a baseline.

Change-Id: I6aba0b52fe49552f170fca25d81c29c515044ef5
Bug: skia:10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317861
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-18 20:57:12 +00:00
John Stiles
910845fac1 Add program-settings flag to disable the inliner.
Change-Id: I6c4e7f6a2aab6710221029022a3a5f3ec323c5e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317856
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-18 20:30:22 +00:00
John Stiles
be0a9ca63d Migrate remaining SkSL GLSL tests to golden outputs.
Change-Id: I72fd3083f75ca5bf74fb2c3b032465864a13aed5
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317771
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-18 19:22:19 +00:00
John Stiles
87e6ccde21 Migrate geometry SkSL tests to golden outputs.
Change-Id: I01c150d6bfcdd1500033521a87c058c7428c3521
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317769
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-18 17:34:22 +00:00
John Stiles
c884631f99 Migrate Derivatives tests to golden outputs.
Change-Id: I35ff25c4cc394c1a4a964207ece87095a9ba84cf
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317767
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-18 17:30:07 +00:00
John Stiles
6798e5d0d1 Migrate SkSL error tests to golden outputs.
Change-Id: Ic8f4730d035981c32b4ddb48e5e919b0396b6d93
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317578
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-18 13:46:17 +00:00
Brian Osman
bf2163f267 SkSL: Only allow bitwise ops on integral types
We were allowing these ops on floating point types. The resulting GLSL
would fail to compile. We also allowed >>= and <<= on vectors (but not
any of the other bitwise ops).

The newly added unit tests were failing (eg, not catching errors). New
results are correct.

Bug: skia:10707
Change-Id: I97b769f1ce59261361109a71061b42dc8ef3c74b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317393
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-09-17 18:12:34 +00:00
John Stiles
6dc5265ae6 Migrate several SkSLFP tests to golden outputs.
Change-Id: I83a38f2c953a560fea3483e95e31df532b90773e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317456
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-17 16:46:18 +00:00
John Stiles
0ed9f31f6a Migrate several GLSL workaround unit tests to golden files.
We now support building an SkSL golden output twice, once honoring the
custom #pragma settings, and once more ignoring the settings. This
allows us to see the output of the workaround technique, alongside the
"default-settings" output which should not contain a workaround.

To implement this, skslc now supports a flag: --[no]settings.
When it's set, /*#pragma settings*/ comments are honored. When it's not
set, skslc ignores the comments. compile_sksl_tests.py passes this flag
along to skslc.

This approach is not strictly limited to workarounds; the
"TypePrecision" GLSL test was also updated to use this technique.

Change-Id: I79204df047b024533ed6bc1f4c088e0e878d5bb1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317246
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-17 16:41:18 +00:00
Mike Klein
dd16cb5974 Add SkVx.h to core.gni
Trying to run Chrome trybots on changes to SkVx.h,
but it's deciding to skip the build...

Change-Id: Ic40cc2eec5db00c4f6eacc72e0e50101a8478e99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317596
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-17 15:46:18 +00:00
Ethan Nicholas
bf66ffbbd4 Reland "Revert "moved BinaryExpression's data into IRNode""
This reverts commit 1d3e0e0054.

Reason for revert: possibly causing https://task-scheduler.skia.org/task/F1DoniJAddPuEkH9ETTE

Original change's description:
> Revert "Revert "moved BinaryExpression's data into IRNode""
> 
> This reverts commit b61c3a9a01.
> 
> Change-Id: I4689e1f4977fab3233ff492cee06fbc301b5c689
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317386
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: Id0f3f211f09fbf31b626c648ed141fc6154a450c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317395
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-09-16 22:39:08 +00:00
John Stiles
72664bede4 Add support for #pragma settings comments in SkSL.
This will allow us to write skslc-based golden tests that deviate from
the standalone skslc settings.

This CL provides six options; more will be added as necessary.
- Default (caps)
- UsesPrecisionModifiers (caps)
- Version110 (caps)
- Version450Core (caps)
- ForceHighPrecision (settings flag bit)
- Sharpen (settings flag bit)

Change-Id: I9b779e039b2f0c0ccf43dca226fb4844aff3526b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317237
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-16 22:19:58 +00:00
Brian Osman
152dfbb9fc Remove "Recompiling..." output when building .fp files
Change-Id: I41402dc04d4388217d7f7cd8de9aff8fbb4a3765
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317391
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-09-16 20:23:08 +00:00
John Stiles
9080540b93 Convert additional GLSL tests to use golden files.
A handful of simplifications were made, but these hew very close to the
original tests and are intended to cover the exact same ground. The
remaining unconverted tests depend on non-default caps bits and will
be updated once caps handling in skslc is fully landed.

Change-Id: I3f3c29bf87f73e501561d7bfcdaabe8acc14b89f
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317390
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-16 20:11:17 +00:00
Ethan Nicholas
1d3e0e0054 Revert "Revert "moved BinaryExpression's data into IRNode""
This reverts commit b61c3a9a01.

Change-Id: I4689e1f4977fab3233ff492cee06fbc301b5c689
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317386
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-09-16 20:01:13 +00:00
Michael Ludwig
395ddc3d51 Reland "Enable novel GrClipStack on bots, disable elsewhere"
This reverts commit f6e0f58b2e.

Reason for revert: benches and tests updated here: https://skia-review.googlesource.com/c/skia/+/317380

Original change's description:
> Revert "Enable novel GrClipStack on bots, disable elsewhere"
> 
> This reverts commit e1ade2ac4a.
> 
> Reason for revert: Need to remove benchmarks that use deprecated SkClipOps first.
> 
> Original change's description:
> > Enable novel GrClipStack on bots, disable elsewhere
> > 
> > As a result of this change, the new GrClipStack will run on all of our
> > default bots. However, the SK_DISABLE_NEW_GR_CLICK_STACK define is used
> > to explicitly disable the clip stack when we build for the Android
> > Framework, Google3, Flutter, and Fuchsia. These projects can have staging
> > controlled from within the skia repo. This CL in chromium also disables
> > the new clip stack: https://chromium-review.googlesource.com/c/chromium/src/+/2412768
> > and must land before this CL does in Skia.
> > 
> > When GrClipStack originally landed, I had it disabled by checking the
> > value of the define SK_USE_NEW_GR_CLICK_STACK for 0 or 1. To be a little
> > simpler, and work with the flutter and fuchsia gn defines, this CL
> > switches GrClipStack control over to SK_DISABLE_NEW_GR_CLICK_STACK and
> > it just checks for whether or not it's defined.
> > 
> > Bug: skia:10205
> > Change-Id: I6b8bd18290844c02839fe99fdf629b48ffd86f27
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317209
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
> 
> Change-Id: I14fddccfdea8e91ebad92e55193b0034f8bb28af
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10205
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317377
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:10205
Change-Id: I1f26496437ed04a79e9c1058428cdc867ae3be39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317385
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-16 19:30:17 +00:00
Ethan Nicholas
b61c3a9a01 Revert "moved BinaryExpression's data into IRNode"
This reverts commit efc8797880.

Reason for revert: breakage due to std::max initializer list

Original change's description:
> moved BinaryExpression's data into IRNode
> 
> This is another step in the process of merging the various IRNodes' data
> into the base class.
> 
> Change-Id: Ide39c240e6178e23bb6fe317dd56addf2ffefcbb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317102
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: Ib8ef629ffa0ff8bb0aeddfa4f42b824e79ce72b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317384
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-09-16 18:33:29 +00:00
John Stiles
7f6378f7f8 Migrate swizzle tests to golden SkSL files.
This simplifies life when revising the swizzle logic.

Change-Id: I7fc63c0cc845c4741c17c82b3078040264b61ba0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317379
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-16 18:16:07 +00:00
Ethan Nicholas
efc8797880 moved BinaryExpression's data into IRNode
This is another step in the process of merging the various IRNodes' data
into the base class.

Change-Id: Ide39c240e6178e23bb6fe317dd56addf2ffefcbb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317102
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-09-16 17:10:17 +00:00
Michael Ludwig
f6e0f58b2e Revert "Enable novel GrClipStack on bots, disable elsewhere"
This reverts commit e1ade2ac4a.

Reason for revert: Need to remove benchmarks that use deprecated SkClipOps first.

Original change's description:
> Enable novel GrClipStack on bots, disable elsewhere
> 
> As a result of this change, the new GrClipStack will run on all of our
> default bots. However, the SK_DISABLE_NEW_GR_CLICK_STACK define is used
> to explicitly disable the clip stack when we build for the Android
> Framework, Google3, Flutter, and Fuchsia. These projects can have staging
> controlled from within the skia repo. This CL in chromium also disables
> the new clip stack: https://chromium-review.googlesource.com/c/chromium/src/+/2412768
> and must land before this CL does in Skia.
> 
> When GrClipStack originally landed, I had it disabled by checking the
> value of the define SK_USE_NEW_GR_CLICK_STACK for 0 or 1. To be a little
> simpler, and work with the flutter and fuchsia gn defines, this CL
> switches GrClipStack control over to SK_DISABLE_NEW_GR_CLICK_STACK and
> it just checks for whether or not it's defined.
> 
> Bug: skia:10205
> Change-Id: I6b8bd18290844c02839fe99fdf629b48ffd86f27
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317209
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com

Change-Id: I14fddccfdea8e91ebad92e55193b0034f8bb28af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10205
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317377
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-16 16:55:49 +00:00
Michael Ludwig
e1ade2ac4a Enable novel GrClipStack on bots, disable elsewhere
As a result of this change, the new GrClipStack will run on all of our
default bots. However, the SK_DISABLE_NEW_GR_CLICK_STACK define is used
to explicitly disable the clip stack when we build for the Android
Framework, Google3, Flutter, and Fuchsia. These projects can have staging
controlled from within the skia repo. This CL in chromium also disables
the new clip stack: https://chromium-review.googlesource.com/c/chromium/src/+/2412768
and must land before this CL does in Skia.

When GrClipStack originally landed, I had it disabled by checking the
value of the define SK_USE_NEW_GR_CLICK_STACK for 0 or 1. To be a little
simpler, and work with the flutter and fuchsia gn defines, this CL
switches GrClipStack control over to SK_DISABLE_NEW_GR_CLICK_STACK and
it just checks for whether or not it's defined.

Bug: skia:10205
Change-Id: I6b8bd18290844c02839fe99fdf629b48ffd86f27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317209
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-16 16:24:57 +00:00
Robert Phillips
26f3aebf01 Add initial GrThreadSafeUniquelyKeyedProxyViewCache implementation
This is by no means perfect or complete but does break up the review.

Bug: 1108408
Change-Id: Ib1826cd40975c7e84b5fdfc16d1ecbec97dab237
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317201
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-16 16:07:27 +00:00
Michael Ludwig
a195d101f9 New GrClipStack supporting only intersect/difference
Overview doc: https://docs.google.com/document/d/1ddIk74A1rL5Kj5kGcnInOYKVAXs3J2IsSgU5BLit0Ng/edit?usp=sharing

This is the new clip stack that will replace GrClipStackClip. The doc
link in the CL description has a much more detailed overview of what the
strategy of the new clip stack is, but at a very high level:

1. Add a temporary #define that lets SkGpuDevice switch between the old
stack and the new stack. For the new GrClipStack, it extends SkBaseDevice
directly and has to implement all of the device clipping virtuals.
   - If you look from patchset 5 and earlier, the define defaults to on
     so I can test it on the bots, etc. but the plan will be for it to
     default to off when this lands so it's only running on unit tests.
     Then in a follow up, I'll turn it on for our bots but keep it off in
     chrome and android. If everything looks good, chrome can then be
     turned on. There is a more extensive migration plan for android
     because of the expanding clip ops, but that is covered at the end of
     the overview doc.

2. GrClipStack manages save/restore logic of the stack and extends GrClip,
so the cpp file also includes code to apply a GrAppliedClip. At the moment
the apply strategy is as close to that in GrReducedClip and
GrClipStackClip as I could make it. Down the road, I think we can explore
other analytic coverage options and a clip atlas that replaces the unified
SW mask.
   - Once GrClipStack is enabled everywhere, it means GrReducedClip and
     GrClipStackClip can be deleted, so I'm not too worried about sharing
     code between the two. A lot is already shared through the use of
     GrSWMaskHelper and GrStencilMaskHelper.
   - SkClipStack and SkClipStackDevice are still used by the PDF and SVG
     backends, so they aren't necessarily deletable.

3. The GrClipStack only handles intersect and difference ops. It
represents all geometric clip operations as an element. The stack itself
is controlled by the "save record", which tracks aggregate bounds, valid
elements, and the non-geometric clip shader.
   - When a new save record is pushed on the stack, older elements are
     inactive. This means they cannot be modified, since they may need to
     be activated again when the current save is popped off the stack.
     However, they can still affect the clip during application.
   - When a new element is pushed on the stack, older elements may be
     invalidated. This means they don't need to be considered any more
     because they are redundant with the new clip shape (e.g. nested round
     rect clips only have to keep the innermost valid).


Bug: skia:10205
Change-Id: I68ccfd414033aa9014b102efaee3ad50a806f793
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308283
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-09-15 19:27:11 +00:00
Mike Klein
6f3ed7f72c unbreak Build-Debian10-Clang-x86-Debug
fuzzers can't build there, but I don't really care.

Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-x86-Debug
Change-Id: Icb729e8802ccd3cdd1e1384d006d46bd7dc2cd08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317150
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-15 16:39:10 +00:00
John Stiles
886b9d477c Create blank SkSL test files for Ninja's benefit.
GN lists both the .cpp and the .h as generated outputs, so if they don't
exist, Ninja assumes we need to rebuild the tests every time we compile.

Change-Id: I37b8b3d9e7aef1b0cb8d5c70530c2542a6c0087a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317108
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-15 16:00:30 +00:00
Brian Osman
d911c91d88 Normalize line endings in SkSL error tests
On Windows, the process output contains CRLF sequences. Calling
splitlines() recognizes those (Python universal line endings), so we get
a list of the output lines. Joining those with '\n' produces a string
that just has LF. (We add another one, so we still end the file with a
newline). Because we've opened the file in binary mode, the resulting
files now look the same, regardless of OS.

Change-Id: I1f032aa6e0f82057f593c25ce0676983733b9e56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317105
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-09-15 15:35:30 +00:00
John Stiles
f2cdf59d58 Migrate SkSL inliner tests to golden files.
Our lack of proper caps-bits controls in skslc affects the outcome of
one test: "InlinerWrapsEarlyReturnsWithDoWhileBlock" does not actually
emit the do-while block because the standalone caps bits don't enable
do-while support. This will be fixed in a followup CL that adds caps-bit
support to our tests.

A few tests were renamed for consistency, a few were simplified slightly
and one test was removed because it was simply redundant (there was a
second test that covered the exact same ground as
`ForWithReturnInsideCannotBeInlined`).

Change-Id: I2e3b97cb3aea331b6d806bdb865aa78c35c7a6b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316997
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-15 15:22:12 +00:00
Kevin Lubick
272e8bcd24 [fuzz] Add libfuzzer binaries to BUILD.gn
For the longest time, the libfuzzer binaries used by oss-fuzz
were just hacked onto the BUILD.gn file. This removes that patch
and makes them buildable from Skia proper.

After this, there should not be any modifications oss-fuzz needs
to do to a Skia checkout before it builds and runs.

Of note, oss-fuzz will define skia_use_libfuzzer_defaults to be
false so it can control those flags with more finesse (e.g.
fuzz with ASAN, fuzz with hong fuzz instead of libfuzzer). I
added on skia_use_libfuzzer_defaults so that a normal developer
gets something that works by default.

Bug: skia:10713
Change-Id: I024f5805060cba8f8560e1c2569b9309fb49a564
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316536
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-09-15 14:52:02 +00:00
John Stiles
8f026259d8 Demonstrate name reuse error in inliner.
The following conditions lead to the error:
- A pair of nested functions, both of which must be inlined.
- Both inlined functions create a variable with the same name.
- The outer function passes its variable to the inner function.
- The initialization of the inner variable uses the value from the outer
  variable.
- The inner function does not mutate the variable, use it as an out-
  parameter, or otherwise cause it to receive a temporary copy.

When all these conditions are met, both variable declarations are
inlined as-is without performing any name salting, because it's
seemingly safe to do so. The name overlap issue is not considered in the
safety checks. Inlined variable declarations are not subject to name
salting but they should be; I suspect other adversarial examples could
be crafted as well where unhandled name overlap leads to errors.

Change-Id: Ia754bee8e45c8a5c7548436594bbf04abc7a8396
Bug: skia:10722
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316945
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-15 13:03:22 +00:00
John Stiles
b0245494c6 Convert several SkSL->GLSL unit tests to golden outputs.
The new test files are intended to be identical to the unit tests in
every meaningful way. (Comments and formatting are not preserved
exactly.) In cases where a unit-test method contained more than one
test, multiple test files were created; in these cases, new names were
invented to match the apparent intent of each invocation.

Followup CLs will continue to migrate additional tests.

Change-Id: I785c6761ba7ee2b25b5ddc0108321734be23b77c
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316678
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-14 22:11:20 +00:00
John Stiles
ea9e7ca1ce Support testing error cases in our SkSL unit test goldens.
Change-Id: I56e19153597e2c4393c5821314b82937828c0d50
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316569
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-14 21:23:07 +00:00
John Stiles
d836f84ab8 Generate SkSL golden output files from test inputs during the build.
Golden SkSL outputs are intended to eventually replace the majority of
our unit tests, since they can automatically update themselves when we
change implementation details of the compiler.

If you change the compiler output without updating the Golden files, the
CheckGeneratedFiles housekeeper will be triggered. Set
`skia_compile_processors` or `skia_compile_sksl_tests` to true in your
GN args to regenerate them.

Almost all of the tests from SkSLFPTests.cpp and SkSLGLSLTests.cpp can
be migrated into separate unit-test .fp/.sksl files in a followup CL.

hcm@ has signed off on removing the copyright boilerplate preamble from
our unit test files.

Change-Id: I9e24a944bbac8f8efd62c92481b022a0b1ecdd0b
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316336
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-14 14:54:12 +00:00
John Stiles
98c1f820d2 Add a new statement type 'InlineMarker' to indicate inlined functions.
This will be leveraged in followup CLs to avoid recursive inlining death
spirals.

Change-Id: Icf99c88c4acaaa766e0dc0971830329e24d70509
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315861
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-09 19:55:27 +00:00
John Stiles
683beccf67 Migrate inliner-related tests to a separate unit-test file.
All tests are now GLSL-based instead of .fp based, for ease of
readability. DEF_TESTs which called test() more than once have been
split up into a separate individual DEF_TEST for each test() call, to
simplify fixups going forward.

Change-Id: I9202e95e9cafff3efc0c32aa3f3ca2eea04719fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314886
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-02 21:31:45 +00:00
Mike Klein
90b027a36b disable -Wpsabi everywhere
We've been stifling this on Clang builds but not GCC,
for no good reason.

Change-Id: I49d6059dcf7547d25ec83c507c92f115ab199b79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314677
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-02 14:46:35 +00:00
John Stiles
44e96bee4b Migrate SkSL Inliner out of IRGenerator and into its own module.
The functional changes needed to make this migration possible have
already been submitted in prior CLs, so although this is large, it is
almost entirely a mechanical migration of code from one file to another.

Change-Id: I54380b52e38ebcec40ffbca7cb254f9655cb1865
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313909
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-31 18:06:56 +00:00
Mike Klein
5c612ade3b create a sample to demonstrate a timing attack
This sample attempts to re-create an image's alpha channel by drawing it
one pixel at a time and timing how long each pixel takes to draw.

The "abc" text should appear twice normally, and the third and fourth
versions are reconstructed from timing, one by timing 1:1 pixel draws,
the other by timing 1x1:1024x1024 upscale into an offscreen.  It's not
meant to be an exact reconstruction, but you can easily see the shapes,
particularly at -O0, -O1, and -Os.  Auto-vectorization from -O2/-O3 do
a good amount to cover up the problem.

The legacy CPU backend is the main place to look.  I haven't been able
to reconstruct any images using SkRasterPipelineBlitter or SkVMBlitter,
and while on the GPU I do see non-random patterns in the timing, it
appears to be the same single pattern across devices, OSes, GPUs, GPU
APIs and content... I assume it's something like our resource caching
policy.

This can't really be a GM, given how it draws non-deterministically.

Bug: chromium:1088224
Change-Id: I2ec79c8dd407ecb104fd9bf0c8039cb6dd1fe436
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313466
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-08-28 16:17:39 +00:00
Brian Salomon
be0e42cb8f New helpers for SkYUVAInfo when used with pixmaps.
SkYUVAPixmapInfo is a SkYUVAInfo with per-plane color types and row
bytes. It describes a set of pixmaps that make up a planar image.
Consolidates validity checks of the SkYUVAInfo with the color types
and row bytes. It can provide SkImageInfos for each plane and also
assist with configuring planes to share a common allocation.

SkYUVAPixmaps is a collection of SkPixmaps that are valid for a
SkYUVAInfo. It can either wrap existing SkPixmaps or allocate and
own the memory. It consolidates validity checking of SkPixmaps with
the SkYUVAInfo. Replaces sk_gpu_test::YUVAPixmaps.

Minor tweaks to SkYUVAInfo naming, parameter order consistency, adds a
hasAlpha() method.

Bug: skia:10632
Change-Id: Ib0f48b8448fff22805fd0c04e07887d0b7338b76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312886
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-08-27 15:39:56 +00:00
Julia Lavrova
1798f4f35c Reland "Reland "ICU: SkShaper (bidi iterator only)""
This reverts commit 03cde5f999.

Reason for revert: Fixing the build

Original change's description:
> Revert "Reland "ICU: SkShaper (bidi iterator only)""
>
> This reverts commit 7bc5542a9e.
>
> Reason for revert: breaking Android roll
>
> Original change's description:
> > Reland "ICU: SkShaper (bidi iterator only)"
> >
> > This reverts commit 73f003acfd.
> >
> > Reason for revert: Fixed the build
> >
> > Original change's description:
> > > Revert "ICU: SkShaper (bidi iterator only)"
> > >
> > > This reverts commit 64e3d040e9.
> > >
> > > Reason for revert: Breaking google3
> > >
> > > Original change's description:
> > > > ICU: SkShaper (bidi iterator only)
> > > >
> > > > Change-Id: I845cc0a962790ce37600f943473f21f619ee029b
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308508
> > > > Reviewed-by: Ben Wagner <bungeman@google.com>
> > > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> > >
> > > TBR=djsollen@google.com,bungeman@google.com,reed@google.com,jlavrova@google.com
> > >
> > > Change-Id: Ib081d97f61e57f74bb9414b3973cca640f3b3929
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309442
> > > Reviewed-by: Julia Lavrova <jlavrova@google.com>
> > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> >
> > TBR=djsollen@google.com,bungeman@google.com,reed@google.com,jlavrova@google.com
> >
> > Change-Id: I2d9c79deaaac97d3e0eb9b39ec9d53815fdb1f59
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310757
> > Reviewed-by: Ben Wagner <bungeman@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> TBR=bungeman@google.com,jlavrova@google.com
>
> Change-Id: I89e80462edf8e014d7ea273885feeca17748a63a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313378
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

TBR=djsollen@google.com,bungeman@google.com,jlavrova@google.com

Change-Id: Idce514c64309e7463fa23425d10f1b13dd9c8d18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313407
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-08-26 17:46:33 +00:00
Greg Daniel
10c4213c22 Remove GrRenderTargetProxyPriv class and setGLRTFBOIDIs0 call.
With the removal of the unused set call, I really don't see a reason to
have the Priv class just for glRTFBOIDIs0 getter. Especially since all
other similar getters related to surface flags are exposed on the main
class. So I've removed the priv class since I don't think it really
adds much to hide such a function from ourselves.

Change-Id: I834fae036b63cc66732d32d7c74b0ed08438f870
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313419
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-08-26 16:34:33 +00:00
Mike Klein
a139788b4c add arm64e slice to arm64 iOS builds
I think this new slice will run on the iPhone11 but
  none of the older iOS devices, including the iPad bots.

Bug: skia:10663
Change-Id: I99edeccdd4adc845d3a79d7960b932bff374e77f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313073
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-08-25 23:25:41 +00:00
Brian Salomon
87d42e5d12 A new way to specify YUVA planar data from SkCodec to SkImage_Lazy
Tunnels through SkImageGenerator as well.

The new SkCodec interface doesn't assume three 8 bit planes.

New SkYUVASpec more clearly defines chroma subsampling and siting of
the planes.

The intent is to use this for other YUVA APIs as well, in particular
SkImage factories in the future.

In this change we convert to the SkYUVASpec to SkYUVASizeInfo
and SkYUVAIndex[4] representation. But the intent is to use
the SkYUVASpec representation throughout the pipeline once
legacy APIs are removed.

orientation GM is replicated to test a variety of chroma
subsampling configs.

Bug: skia:10632

Change-Id: I3fad35752b87cac16c51b24824331f2ae7d458d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309658
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-08-24 14:25:32 +00:00
Tomasz Moniuszko
487d285be9 Remove duplicated header file from sources
It is on skia_sksl_gpu_sources list already.

Bug: skia:10650
Change-Id: I1e4bb0b2346ad8a74ddbdb3d3ff44ea7de6c0cd3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312736
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-24 13:30:32 +00:00
John Stiles
29a803542d Add missing headers to .gn files.
Change-Id: Id2f3ed80c76c4c409afdd2fa86c9b8e7fd1266ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312485
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-08-21 17:27:30 +00:00
Kevin Lubick
204c3be1cd [canvaskit] Remove fringe EGL dependency.
This removes about 5 kb of wasm code size (2 kb gzipped),
20 kb of js code size (4kb gzipped).
I think I can remove getproc (which is a somewhat large
function made up of a lot of string data) with some clever
adjustments of macros in a follow-on CL.

Change-Id: If3a4b30681e13abddea8e84d62297e90316ed7cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311817
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-08-20 14:55:50 +00:00
Mike Klein
853d4ed2ff Revert "remove sksl interpreter guards"
This reverts commit 7f1117e886.

Reason for revert: Seems like Clang gets stuck allocating registers on ARM,

[2477/38027] CXX obj/skia/skia/SkSLByteCode.o
FAILED: obj/skia/skia/SkSLByteCode.o
/b/s/w/ir/cache/goma/client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF...(too long)
fatal error: error in backend: Error while trying to spill LR from class GPR: Cannot scavenge register without an emergency spill slot!
PLEASE submit a bug report to https://crbug.com and run tools/clang/scripts/process_crashreports.py (only works inside Google) which will upload a report and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/skia/ski...(too long)


Original change's description:
> remove sksl interpreter guards
> 
> This is only used by particles, benchmarks, and tests,
> and should be swept away by dead code elimination otherwise.
> 
> Change-Id: I10462d6ae0a08dd8219fc49325160ec6790632af
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311759
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,brianosman@google.com

Change-Id: I1b6370d39285210267425f090235a4d80aebe4fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312034
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-20 00:41:15 +00:00
Mike Klein
7f1117e886 remove sksl interpreter guards
This is only used by particles, benchmarks, and tests,
and should be swept away by dead code elimination otherwise.

Change-Id: I10462d6ae0a08dd8219fc49325160ec6790632af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311759
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-19 14:44:09 +00:00
Ben Wagner
81eabce6a3 SkCustomTypefaceBuilder to set SkFontStyle
Allow the user of SkCustomTypefaceBuilder to set the SkFontStyle of the
resulting SkTypeface. This allows users to build font families.

Fix the Font_flatten test to actually work (instead of relying on the
magic behavior of nullptr for SkTypeface), add a test with the custom
typeface, and reduce the number of times the inner loop runs from
302,400 times to 4,032 times so that the test finishes in a reasonable
amount of time.

Bug: skia:10630
Change-Id: I0b5e939552ee4a9a1249eefbb7a7279a59b38e5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311596
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Xiao Yu <xster@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-19 00:09:55 +00:00
Florin Malita
59a3c3be94 SFML [1] backed for SkAudioPlayer/Linux
For now this relies on system libs and requires explicit opt-in
(skia_use_sfml=true).

[1] https://www.sfml-dev.org/

TBR=
Change-Id: Iff89efdb4494f79530d0d41dee80ff38d4e75671
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310065
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-08-18 17:58:55 +00:00
Mike Klein
13ec544d3f Reland "move conditions for JIT into SkVM.h"
This is a reland of 166cd52cee
with iOS simulator builds disabled.

Original change's description:
> move conditions for JIT into SkVM.h
>
> This makes it easier to keep in sync with the implementation in
> SkVM.cpp, and it's easier to handle here once than in each build system.
>
> Change-Id: I429f90cfc16f35a0d7e0b0fde176bc013aa7db18
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310263
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

Change-Id: I82837c3d959769f26197f2402d3b911e71a35675
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310465
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-14 18:05:45 +00:00
Mike Klein
8b07b9f55a Revert "move conditions for JIT into SkVM.h"
This reverts commit 166cd52cee.

Reason for revert: iOS simulator was on unintentionally

Original change's description:
> move conditions for JIT into SkVM.h
> 
> This makes it easier to keep in sync with the implementation in
> SkVM.cpp, and it's easier to handle here once than in each build system.
> 
> Change-Id: I429f90cfc16f35a0d7e0b0fde176bc013aa7db18
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310263
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

TBR=mtklein@google.com,herb@google.com,reed@google.com

Change-Id: I1ae283be09906603c207079cbf6f1e296a4835f8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310462
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-14 17:24:08 +00:00
Herb Derby
c27d535fc2 benchmark for text vertex fill
Change-Id: If293360e2473be6d316cbfeccf8ec3ebeba2df1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309779
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-14 16:03:57 +00:00
Mike Klein
166cd52cee move conditions for JIT into SkVM.h
This makes it easier to keep in sync with the implementation in
SkVM.cpp, and it's easier to handle here once than in each build system.

Change-Id: I429f90cfc16f35a0d7e0b0fde176bc013aa7db18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310263
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-08-14 15:16:37 +00:00
John Stiles
49a5a189d4 Add missing IR headers to the .gn file.
Change-Id: I7ba287b5d8e34571b5ca3e502413b2aafa27acc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310059
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-08-13 16:54:12 +00:00
Leon Scroggins III
326b98981e Add platform image encoder for using NDK APIs
Bug: skia:10369

Add SkEncodeImageWithNDK, mirroring the CG and WIC versions, for
encoding with the NDK APIs added to R.

Rename SK_ENABLE_NDK_DECODING to SK_ENABLE_NDK_IMAGES and use it for
both encoding and decoding.

Move code for converting to/from NDK types into a common location.

Update encode_platform.cpp to use NDK encoding APIs when available and
to use both types of webp (lossy and lossless). Add tests specifically
for the new implementation.

Update NdkDecodeTest to use ToolUtils::equal_pixels for comparing
pixels.

Change-Id: Ic62f89af27372ccce90b8e028e01c388a135a68c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308800
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-13 15:21:41 +00:00
Mike Reed
8a8be22597 audio player (for mac)
Change-Id: I491df748d22dfa566000c265a61f62f81755e5a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309792
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-13 15:09:32 +00:00
Robert Phillips
089b7c96ca Fix bug in op chaining
I created this problem with my fix to crbug.com/1108475

Bug: 1112259

Change-Id: Ieb001fa61bd9ed68dcae43e7d511b4581f16ef0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308638
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-08-12 19:07:01 +00:00
Jim Van Verth
ef820beade Switch GN defs on Mac and iOS to use frameworks, take 3
Change-Id: I5b06691d4f0383957b4031b3fd3e96bdfad94521
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Flutter
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309665
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-12 17:03:47 +00:00
John Stiles
47b4e22303 Reland "Implement dumpInfo for .fp files."
This is a reland of a1df23c8b7

Original change's description:
> Implement `dumpInfo` for .fp files.
>
> Change-Id: I40f6c1a02e194f090e67a0e3f2d7d83cd2317efd
> Bug: skia:8434
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309139
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Bug: skia:8434
Change-Id: If485635440b800f8a282c871a1c5f2801608d3c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309660
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-08-12 14:26:36 +00:00
Brian Osman
9487e9b2a0 Revert "Implement dumpInfo for .fp files."
This reverts commit a1df23c8b7.

Reason for revert: Needs c++17 library as written

Original change's description:
> Implement `dumpInfo` for .fp files.
> 
> Change-Id: I40f6c1a02e194f090e67a0e3f2d7d83cd2317efd
> Bug: skia:8434
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309139
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,johnstiles@google.com

Change-Id: I09b98e83735bc30ec8a2e313e4b76a9eb6a7631a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8434
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309656
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-12 13:19:48 +00:00
Michael Ludwig
417f3a54fb Apply correct matrix to correct points in GrDashOp
The 'pts' coordinates should be transformed by the view matrix. We could
instead apply the inverse src rotation to ptsRot when determining the
perpendicular and parallel scales, but this is valid and straight
forward.

When determining the device segment lengths in onPrepare, we do need to
transform the ptsRot by fSrcInvRot (which includes the view matrix),
instead of just the view matrix.

This fixes the linked chromium bug, which drew a wider stroked dash
because on a perfect vertical, the rotation to a canonical x-axis
geometry would end up swapping perpendicular and parallel scale factors.

Bug: chromium:1113794
Change-Id: Ibc37f8a24688a76e0d0947b0c53c8bd13cd769cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309443
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-08-12 13:18:16 +00:00
John Stiles
a1df23c8b7 Implement dumpInfo for .fp files.
Change-Id: I40f6c1a02e194f090e67a0e3f2d7d83cd2317efd
Bug: skia:8434
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309139
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-12 13:08:46 +00:00
Michael Ludwig
43d8d23693 Don't over simplify near-colinear vertices
This adds an error variable that keeps track of the total distance from
the simplified line, and includes it when determining if we should
keep the next point. Using a sum of line distance is just a heuristic
but seems to address the current case of over simplification while
allowing us to keep a greedy strategy.

Bug: chromium:1086705
Change-Id: I29e21724db6b30495c2934e376a5e4d787c846a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309328
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-08-11 21:18:58 +00:00
Robert Phillips
5b68ed4c51 Remove GrStyledShape.h from GrSmallPathShapeData.h
This refactoring was requested during an earlier code review.

Change-Id: I93184e2bc936b3c8c69f84e475be2c234845ee81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309120
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-10 19:48:14 +00:00
Robert Phillips
46a324a16c Move GrSmallPathAtlasMgr to its own file and out-line
There are no intentional behavioral changes in this CL. It should
purely be cut, paste, re-shuffle & get re-compiling.

Bug: 1108408
Change-Id: Ic8457d0af76861f2ea881177f2b2c0fe0bf85146
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309040
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-10 18:05:54 +00:00
Brian Osman
dd49617f92 Reland "Untangle dependency cycle in sksl dehydration"
Explanation: The sksl standalone compiler is used to convert the raw
(text) SkSL pre-includes into a "dehydrated" binary format. It also
(previously) depended on those files, as they were #included and used,
unless a special #define was changed. This created a dependency cycle
that we hid from GN (by lying about the outputs of the dehydrate step).
As a result, builds would never reach steady-state, because the compiler
would be rebuilt (due to the newer dehydrated files), and then the
dehydrated files would be rebuilt (due to the newer compiler).

This CL changes the logic so that the standalone compiler always uses
the textual pre-includes, and no longer depends on the dehydrated binary
files. Thus, to make any kind of change to the dehydrated files (whether
due to pre-include changes, or the encoding format itself), you just
need skia_compile_processors enabled. The dependencies are now honestly
communicated to GN, and we reach steady state after one build.

The NOTE above is because GN/ninja cache the dependencies of each
target, and will still think that the SkSLCompiler.obj linked into the
standalone compiler depends on the dehydrated files, at least until one
successful build, when it will realize that's no longer true.

Reland notes:

The bots originally rejected this CL, because SkSLCompiler was
hard-coded to load the text files from a relative path that assumed the
executable was in "<skia_checkout>/out/<some_dir>". That's not true for
bots, and it was fragile, even for users. Now, we use GN to directly
generate sksl_fp.sksl, and copy all of the other pre-includes to the
root out dir (working directory when running skslc). This means we
no longer need to generate the sksl_fp.sksl file into the src tree, and
the compiler can more safely assume that the files will be in the
working directory.

Bug: skia:10571
Change-Id: Id7837a9aba7ee0c3f7fa82eb84f7761e24b9c705
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308896
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-10 15:47:43 +00:00
Brian Osman
a578138567 Revert "Untangle dependency cycle in sksl dehydration"
This reverts commit a1ed0dc9f8.

Reason for revert: Bots will need some guidance to ingest this CL

Original change's description:
> Untangle dependency cycle in sksl dehydration
> 
> NOTE: If you have any out directories with skia_compile_processors
> enabled, you will likely need to run `gn clean <dir>`
> 
> Explanation: The sksl standalone compiler is used to convert the raw
> (text) SkSL pre-includes into a "dehydrated" binary format. It also
> (previously) depended on those files, as they were #included and used,
> unless a special #define was changed. This created a dependency cycle
> that we hid from GN (by lying about the outputs of the dehydrate step).
> As a result, builds would never reach steady-state, because the compiler
> would be rebuilt (due to the newer dehydrated files), and then the
> dehydrated files would be rebuilt (due to the newer compiler).
> 
> This CL changes the logic so that the standalone compiler always uses
> the textual pre-includes, and no longer depends on the dehydrated binary
> files. Thus, to make any kind of change to the dehydrated files (whether
> due to pre-include changes, or the encoding format itself), you just
> need skia_compile_processors enabled. The dependencies are now honestly
> communicated to GN, and we reach steady state after one build.
> 
> The NOTE above is because GN/ninja cache the dependencies of each
> target, and will still think that the SkSLCompiler.obj linked into the
> standalone compiler depends on the dehydrated files, at least until one
> successful build, when it will realize that's no longer true.
> 
> Bug: skia:10571
> Change-Id: I246360cec387b17d017805ed42ab6424329e32e7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308760
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: Id0f3f6e18474f7531b8531cfa481031c26b88d51
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10571
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308802
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-07 21:28:27 +00:00
Brian Osman
a1ed0dc9f8 Untangle dependency cycle in sksl dehydration
NOTE: If you have any out directories with skia_compile_processors
enabled, you will likely need to run `gn clean <dir>`

Explanation: The sksl standalone compiler is used to convert the raw
(text) SkSL pre-includes into a "dehydrated" binary format. It also
(previously) depended on those files, as they were #included and used,
unless a special #define was changed. This created a dependency cycle
that we hid from GN (by lying about the outputs of the dehydrate step).
As a result, builds would never reach steady-state, because the compiler
would be rebuilt (due to the newer dehydrated files), and then the
dehydrated files would be rebuilt (due to the newer compiler).

This CL changes the logic so that the standalone compiler always uses
the textual pre-includes, and no longer depends on the dehydrated binary
files. Thus, to make any kind of change to the dehydrated files (whether
due to pre-include changes, or the encoding format itself), you just
need skia_compile_processors enabled. The dependencies are now honestly
communicated to GN, and we reach steady state after one build.

The NOTE above is because GN/ninja cache the dependencies of each
target, and will still think that the SkSLCompiler.obj linked into the
standalone compiler depends on the dehydrated files, at least until one
successful build, when it will realize that's no longer true.

Bug: skia:10571
Change-Id: I246360cec387b17d017805ed42ab6424329e32e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308760
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-07 20:34:33 +00:00
Mike Klein
045adb564e Revert "Reland "Switch GN defs on Mac and iOS to use frameworks, take 2.""
This reverts commit 943463f60e.

Reason for revert: Flutter

Original change's description:
> Reland "Switch GN defs on Mac and iOS to use frameworks, take 2."
> 
> This is a reland of c5f8e7df81
> 
> Original change's description:
> > Switch GN defs on Mac and iOS to use frameworks, take 2.
> > 
> > GN will be removing support for frameworks in the libs variable, so
> > might as well get ahead of it.
> > 
> > Change-Id: I990ffdb945c85a9868883d0cab1c2bdcdbdf545c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308189
> > Reviewed-by: Mike Klein <mtklein@google.com>
> > Commit-Queue: Jim Van Verth <jvanverth@google.com>
> 
> Change-Id: Ie93c4b6a5e82bd61738367c68c2a2bac7bdf23f1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308199
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=mtklein@google.com,jvanverth@google.com,herb@google.com,senorblanco@google.com

Change-Id: Iee06d5e787643643b0f2b206a7cfa2643de25f8b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308597
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-07 12:26:27 +00:00
Ethan Nicholas
b33fa3f7d2 simplified SkSL REHYDRATE=0
Change-Id: I653716df5e93dc5c520309729712a78e750a2790
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307696
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-08-06 19:14:21 +00:00
Jim Van Verth
943463f60e Reland "Switch GN defs on Mac and iOS to use frameworks, take 2."
This is a reland of c5f8e7df81

Original change's description:
> Switch GN defs on Mac and iOS to use frameworks, take 2.
> 
> GN will be removing support for frameworks in the libs variable, so
> might as well get ahead of it.
> 
> Change-Id: I990ffdb945c85a9868883d0cab1c2bdcdbdf545c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308189
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Change-Id: Ie93c4b6a5e82bd61738367c68c2a2bac7bdf23f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308199
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-06 14:56:36 +00:00
Robert Phillips
34949e35f0 Pull ShapeData into its own header file and rename to GrSmallPathShapeData
This is just a mechanical cut & paste.

When the atlasing is separate from the small path renderer both the
atlas manager and the path renderer need to share these objects.

This is pulled out of the omnibus CL:

https://skia-review.googlesource.com/c/skia/+/307776 (Split the small path renderer into record-time and flush-time pieces)

Change-Id: Ibae9d785fa8a3934fa81f9e98d7e1027d48dc5a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308276
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-06 12:12:16 +00:00
Leon Scroggins III
f21d6b9b71 Reland "Add an SkImageGenerator that uses NDK APIs"
This reverts commit 07438b0cda.

Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: I4ca07d832dbd6a9d8cff0faea975fd70da00718f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308185
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 18:55:30 +00:00
Leon Scroggins
07438b0cda Revert "Add an SkImageGenerator that uses NDK APIs"
This reverts commit cfef980939.

Reason for revert: Breaking Google3 roll

Original change's description:
> Add an SkImageGenerator that uses NDK APIs
> 
> Bug: skia:10369
> Bug: skia:10371
> 
> This will allow Skia clients developing for Android 11+ to rely on
> Android's NDK APIs for decoding, which will allow them to decode
> without including their own decoding libraries (e.g. libjpeg-turbo).
> Using these APIs also provides support for static HEIF images.
> 
> Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
> visually.
> 
> Add tests and a grayscale png.
> 
> Update some test bots running Android R to specify ndk_api so they will
> run the new code.
> 
> Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=djsollen@google.com,mtklein@google.com,scroggo@google.com,brianosman@google.com,reed@google.com

Change-Id: Ifed506a76a0ff5903d101c1bf7330d319b8376a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10369
Bug: skia:10371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308180
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 14:42:51 +00:00
Leon Scroggins III
cfef980939 Add an SkImageGenerator that uses NDK APIs
Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 13:44:39 +00:00
Mike Klein
ed80035850 try always setting fvisibility=hidden
It simplifies things to always build this way, to mimic how we're built
by clients, and to better approximate MSVC defaults.  I'm not sure I
believe my old note about making stack traces worse on Linux.

Change-Id: I0554a58573074fc6ae030fa09e11976a718645b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307834
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-04 18:04:36 +00:00
Corentin Wallez
5619c3af3d GN: Add support for GN's framework variable in the toolchain
This is a recent addition to GN that Dawn takes advantages of but which
Skia's GN toolchain didn't implement yet.

Bug:
Change-Id: I7a592bd4663db5c9726767bedf46c38d9c86ed2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307576
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-03 15:41:37 +00:00
John Stiles
4b9b34558f Migrate GrGetIntelGpuFamily into a cpp file.
Putting the entire body of the function into a header risks an ODR
violation.

Change-Id: I6d32df195049058f781defc2aace23a2bbd66150
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307559
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-08-03 15:36:30 +00:00
John Stiles
1cf1593781 Remove GrTextureGradientColorizer and use GrTextureEffect instead.
Gradient colorizers are now sampled via explicit coordinates instead of
by passing coordinate data in a color channel. This change caused the
GrTextureGradientColorizer to become a no-op/passthrough effect.

Change-Id: I5233c93914716cac186b0ea8f5a3698746a89742
Bug: skia:10548
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307298
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-31 21:29:03 +00:00
Brian Osman
ae94033137 Always write binary (eg, UNIX line endings) to sksl .c.inc files
Prevents spurious diffs when rebuilding on Windows

Change-Id: Id5320e2ef492e7856fe10500ee8a3d19f6726219
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307196
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-31 17:00:03 +00:00
Ethan Nicholas
c18bb51735 SkSL include files are now stored in a binary format
This speeds up compiler construction, because we no longer have to parse
and process a bunch of SkSL source code during startup.

Change-Id: I6d6bd9b5ce78b1661be691708ab84bf399c6df8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305717
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-07-31 13:48:25 +00:00
John Stiles
f8869a24e7 Remove SK_REQUIRE_LOCAL_VAR macro.
The ClangTidy check `bugprone-unused-raii` has been enabled at
review.skia.org/306838; this check provides equivalent protection.

Change-Id: I9f3858bfd2bede107d509a5a206a08293d5f914c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306953
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-31 02:32:01 +00:00
Chris Dalton
078f875477 Rename GrTessellateStroke* -> GrStrokeTessellate* and friends
Almost half the files in src/gpu/tessellate were beginning with
"GrTessellat*". This CL reorders the camel case words for more
efficient tab completion and better grouping of related files.

Bug: skia:10419
Change-Id: I3df0ddbb2367cdbd880807a8aef2dd88ec12f830
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306659
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-07-31 02:24:05 +00:00
Eric Boren
5ba6534884 Change some instances of whitelist/blacklist
Bug: chromium:1101491
Bug: b/161896447

Change-Id: I7e3bf4ed63b2170fb08fe1ec8e7d934e7fcdca7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306644
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
2020-07-30 10:56:03 +00:00
Ben Wagner
57d859edd3 Create a gn link pool which is disabled by default.
The oss-fuzz build of Skia seems to have difficulty when it does too
many linker steps at a time. Ninja will generally not launch new build
steps if the load is too high, but the oss-fuzz builder machines are
slow enough that the load doesn't seem to rise fast enough to prevent
too many linkers from be started at a time.

By default this change does not request a linker pool at all and the
user must request one by setting the link_pool_depth. Negative values
disable the linker pool, zero sets the number to the number of cpus, and
positive values set the pool size. This should allow for some
experimentation while testing what pool size is appropriate for the fuzz
builders while not changing current default behavior.

Bug: oss-fuzz:23438,oss-fuzz:24345
Change-Id: Iba62adac3bea4d968441aa08e33918b5ae962c7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306646
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-29 20:28:40 +00:00
Stephen White
5e454f8359 Fix MSVC build.
Use $shell prefix invoking python for cp.py.

Change-Id: Ic4b40337255a91fe6f9729eb58ecb6d47c559001
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306334
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-29 18:35:28 +00:00
Brian Salomon
f7f5433a45 Remove GrSurfacePriv and GrRenderTargetPriv
No longer needed as GrSurface and GrRenderTarget are private.

Change-Id: I2ec653b2d9daa115233bb7eaa1f2b7f880772c0a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305730
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-28 13:52:07 +00:00
John Stiles
9d5461f368 Add missing #includes for referenced types, and missing headers in GN.
These missing items were discovered when attempting a refactor.

Change-Id: Ibf905dacba14ebf5d3174f11c557741c7ab7848f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306061
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-27 21:00:55 +00:00
Jim Van Verth
711b0397d7 Reland "Make GrRingBuffer more generic so it can be used over all backends"
This is a reland of b6d4ad92ad

Original change's description:
> Make GrRingBuffer more generic so it can be used over all backends
> 
> * Removes the spinlock (should no longer be necessary)
> * Uses GrGpuBuffer and creation through GrResourceProvider
>   instead of internal native creation
> * Changes the SubmitData to pass up all buffers used over a given submit
> so the backend can track that better
> 
> Bug: skia:10530
> Change-Id: I0d3a686b950dd5cb5f720f827b573238386b9524
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305567
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Bug: skia:10530
Change-Id: If75ef583fbed65617cd5be56ee40c937e7325b21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305722
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-24 20:05:40 +00:00
Mike Klein
d26b3e2d51 rename tools/xsan.blacklist
No real way around using -fsanitize-blacklist,
but we can change the rest.

Bug: 1101491
Change-Id: I3ec84bd2911b6cf6e77eac1c9d565a398bfcde77
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305754
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-24 18:12:31 +00:00
Brian Salomon
e888fb2bc6 Remove GrYUVProvider.
This abstraction had one subclass. That subclass was used only as
an implementation detail of SkImage_Lazy. Move the functionality
into SkImage_Lazy.

Change-Id: Icd8754114dc33ae957e542b372086e8caa0408a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305724
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-24 17:06:29 +00:00
Jim Van Verth
c8bc99ff6a Revert "Make GrRingBuffer more generic so it can be used over all backends"
This reverts commit b6d4ad92ad.

Reason for revert: Breaking the bots

Original change's description:
> Make GrRingBuffer more generic so it can be used over all backends
> 
> * Removes the spinlock (should no longer be necessary)
> * Uses GrGpuBuffer and creation through GrResourceProvider
>   instead of internal native creation
> * Changes the SubmitData to pass up all buffers used over a given submit
> so the backend can track that better
> 
> Bug: skia:10530
> Change-Id: I0d3a686b950dd5cb5f720f827b573238386b9524
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305567
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=egdaniel@google.com,jvanverth@google.com

Change-Id: Ief7df521f66e85d9bfb85508e5a5f8223d7d6725
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10530
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305720
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-24 14:49:11 +00:00
John Stiles
f743d4eb53 Rename Xfermode fragment processor to Blend.
Change-Id: Iaa0829d72d0da1469df2da23102ff0e3572b641b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305556
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-24 13:34:00 +00:00
Brian Salomon
4cfae3bc24 Remove GrTexturePriv
This existed because GrTexture used to be public.

Change-Id: I5e507084ae12058a20481b517b9130b41c793d29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305521
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-24 13:26:07 +00:00
Jim Van Verth
b6d4ad92ad Make GrRingBuffer more generic so it can be used over all backends
* Removes the spinlock (should no longer be necessary)
* Uses GrGpuBuffer and creation through GrResourceProvider
  instead of internal native creation
* Changes the SubmitData to pass up all buffers used over a given submit
so the backend can track that better

Bug: skia:10530
Change-Id: I0d3a686b950dd5cb5f720f827b573238386b9524
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305567
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-24 13:21:02 +00:00
Chris Dalton
f617b4d9c2 Rename GrStrokeGeometry -> GrStrokePatchBuilder
Bug: skia:10419
Change-Id: Iffd139c2d489deb9d57fa860c20158ee398b7c11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305561
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-07-24 04:39:57 +00:00
Brian Salomon
4739b1d353 Pass -Wno-psabi to clang
Change-Id: Ia6f93673de9b4cb76c4b0655c55b374aef362cfa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305405
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-23 00:27:02 +00:00
Michael Ludwig
cc848b59f8 Rename GrTAllocator to GrTBlockList
GrTAllocator implies relatively limited use cases, while GrTBlockLinkedList
helps clarify the underlying data structure (and its associated advantages
and disadvantages). I am not beholden to the name, so am happy to have
a discussion on alternatives like GrTLinkedList or GrTBlockList or
GrTBlockArray.

Change-Id: I5b10801d8593991d5e804c4074a81efb1dd110ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304396
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-22 21:58:31 +00:00
Tyler Denniston
324578b553 Add toy stroker sample
I figure we can use this as an area for prototyping new/different
stroker ideas.

Currently the sample does line segments with butt caps. Miter joins
aren't correct, as it's not adding the inner loop geometry that
SkPathStroker does.  On the sample slide, any red pixels are ones that
Skia filled but the toy stroker didn't.

Change-Id: Iea5eb320d88dd1dc5c60fbb2a997f56eec4f4f1f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303588
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-07-21 20:04:58 +00:00
Robert Phillips
07531a0f97 Switch the DDLRecorder over to holding a GrRecordingContext ...
and related changes. This is another CL in the series that is replacing
GrContext with the GrDirectContext/GrRecordingContext pair.

Change-Id: Id0a3cfd5a5f92f7680d9c58f3a1753322311221c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302637
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-15 23:17:03 +00:00
Greg Daniel
a58db7f87e Add GrStagingBufferManager and use GrGpuBuffers to manage caching.
With this change if a backend Gr*Gpu wants to using staging buffers
they just add a generic GrStagingBufferManager member object. This
object can be used to get slices of upload buffers. Then they just need
to implement the virtual for taking ownership of buffers during submit.

We rely on our GrResourceCache to handle caching and reuse of these
buffers.

This change allows us to remove all other virtuals on GrGpu around
managing staging buffers.

Change-Id: I5db9a3c52133978ea89d6c0de440f434fbf91a51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300226
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Stephen White <senorblanco@google.com>
2020-07-15 14:17:50 +00:00
Mike Reed
13711ebe68 rename SkMipMap to SkMipmap
Change-Id: I1fa8a0482a717847236a30b4851061f4074b7755
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302644
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-15 13:26:13 +00:00
Brian Salomon
f990b6ab4a Remove GrTextureProducer::DetermineDomainMode.
We now rely on GrTextureEffect and GrBicbicEffect
to determine if shader-based tiling is required.

GrTextureProducer is still responsible for noticing that
the proxy is approximate because GrTextureEffect doesn't
consider that in its basic Make() factory (as opposed to
MakeSubset()).

Change-Id: I8e1aeb9edbcfa73ea0bf80b5256ee1ca21fe9c81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301985
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-14 16:48:46 +00:00
John Stiles
6e9ead9166 Revert "Remove custom SkSort algorithms."
This reverts commit 70474c1cb0.

Reason for revert: bot build failure

Original change's description:
> Remove custom SkSort algorithms.
> 
> SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
> The difference is small on randomized inputs, but quite significant for
> semi-ordered inputs (forward/backward/repeated). There doesn't seem to
> to be any compelling advantage to SkTQSort.
> 
> Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u
> 
> (These performance numbers are from an optimized build my local machine;
> it's possible that we might see different results on the test bots.)
> 
> Change-Id: Iaf19563041547eae7de2953be249129108f093b1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com

Change-Id: I1126dd4cda95716dac225ad32d5b0e5cf3f09421
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302447
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-14 00:25:05 +00:00
John Stiles
70474c1cb0 Remove custom SkSort algorithms.
SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
The difference is small on randomized inputs, but quite significant for
semi-ordered inputs (forward/backward/repeated). There doesn't seem to
to be any compelling advantage to SkTQSort.

Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u

(These performance numbers are from an optimized build my local machine;
it's possible that we might see different results on the test bots.)

Change-Id: Iaf19563041547eae7de2953be249129108f093b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-13 23:35:20 +00:00
John Stiles
85894305bf Replace ModulateRGBA effect with Xfermode using modulate blend.
This reduces our code size by reusing existing components to perform
the same blend, and generates a shader that should be conceptually
equivalent (although it gives the inliner a bit more work to do).

Change-Id: Ie2203f7613503476fa9d045aba58d9ef39f3ea26
Bug: skia:10457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302264
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-13 16:16:50 +00:00
John Stiles
7bf2600475 Replace ModulateAlpha effect with Xfermode using src-in blend.
This reduces our code size by reusing existing components to perform
the same blend, and generates a shader that should be conceptually
equivalent (although it gives the inliner a bit more work to do).

Change-Id: Ie81e8b82d9b9c441533760d4e9f7e149bc0d969d
Bug: skia:10457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302262
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-13 16:12:50 +00:00
John Stiles
7c1967700b Split GrConstColorProcessor into three separate .fp effects.
ConstColorProcessor contained three separate InputModes with their own
unique behaviors, but every (non-test) call site simply hardcoded one of
the InputModes.

This change also allows the actual const-color processor to remove the
inputFP entirely; it is never sampled.

The GM slide has been split into three separate slides as well.

Change-Id: I2b77f4eab4d655f06e3704fb6fde8d4f8c70a075
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301987
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-13 15:07:12 +00:00
Adlai Holler
872a32c58d Add an arg to SkImage::makeSubset to take a direct context
This is part of a larger effort to force users to provide a context
when manipulating GPU images which may be shared, instead of having
images themselves retain powerful context pointers.

Chrome flag landed in Chrome CL 2292800

Bug: skia:10466
Change-Id: Ic530a2c5eb1f4399db899d243ea944760fdf2055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300707
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-13 14:55:47 +00:00
John Stiles
8c7c709aaa Convert GLHighContrastFilterEffect to an .fp file.
The fuzzer detected a bug in our handling of null child processors.
Rather than attempt to further tweak a hand-rolled effect, it seemed
more productive to convert it into a full-fledged .fp file. This
provides a very high degree of confidence that the basics are done
properly, for a relatively low amount of effort.

Contrast calculation has also been optimized slightly. The original
shader calculated (1+c/1-c) separately for every pixel. This is now done
once, in Make(). Also, if contrast adjustment is set to zero, the
contrast block is fully omitted.

Change-Id: I2af4708536b249e03c3ebede9b10fc1125eadb7b
Bug: oss-fuzz:24039
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301942
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-10 20:54:33 +00:00
Mike Klein
2b54e8352a add vtune support back
I spent a little time working on adding the --dylib JIT
mode to Windows where we'd shell out to Clang to make a .dll,
but then I remembered this VTune JIT API.

That dylib approach is nice for working with a wide range
of tools (perf, Instruments, gdb, etc.), but when your only
need is Vtune, this API is actually the best option.  You
get your profiler aware of your JIT'd code with way less
overhead than the shell-then-dlopen approach.

If we need to expand to more tools I'll go make the dylib
mode work, but I think this is good enough to make me happy
on Windows for now.

This should look really similar to
https://skia-review.googlesource.com/c/skia/+/255124.

Change-Id: I9e283cdf9bdfeb11c647a2315a7916dc68ef73c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301935
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-10 19:14:49 +00:00
John Stiles
a9c9b53007 Convert the arithmetic runtime effect to a regular .fp effect.
The .fp effect has support for passing values to a child processor.
Runtime effects do not support passing a color to a processor, which is
needed to properly implement `ArithmeticImageFilterImpl` without relying
on multiple `addColorFragmentProcesor` calls and/or `RunInSeries`.

Change-Id: I47446897f857ce849a8e734ab81ee7aec80734e7
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301657
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-10 18:42:39 +00:00
Mike Reed
f8a6b5b4b0 Impl SkFilterOptions for raster-images
Maintains the old and new code-paths:
- if the shader was made with explicit filteroptions, use those
- if not, infer the filteroptions from the filterquality enum
  (and the legacy heuristics of sniffing/snapping the ctm)

In either case, the bulk of the onProgram() is shared, driving off
the (possibly computed locally) filteroptions.

bench looks sort like we expect:

    509.28  	filteroptions_sampling_0_mipmap_0	8888
    495.76  	filteroptions_sampling_0_mipmap_1	8888
    642.52  	filteroptions_sampling_0_mipmap_2	8888

    942.40  	filteroptions_sampling_1_mipmap_0	8888
    976.94  	filteroptions_sampling_1_mipmap_1	8888
   1686.34  	filteroptions_sampling_1_mipmap_2	8888

Bug: skia:10344
Change-Id: I77a79f79f640986fdd6b14f163c1a03462c55dc0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297561
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-10 13:08:33 +00:00
Brian Osman
89d33d0a25 Remove GrCCFillGeometryBench
Not important, and the constructors for these six benchmarks were
allocating a total of 3 GB of RAM.

Change-Id: I03db4d21fe9755902e1b642eb2b6315f697b955e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301656
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-07-09 21:31:03 +00:00
Jim Van Verth
d342cc9df1 Add indirect draws to D3D.
Adds GrD3D12CommandSignature, needed to pass to ExecuteIndirect().

Change-Id: I24aa395d710414eba0464aa4e2cb0a87721bcb12
Bug: skia:10482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301378
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-09 21:21:12 +00:00
John Stiles
53ee0fcac7 Convert the dither runtime effect into a regular .fp effect.
This was previously implemented as a runtime effect in order to dogfood
runtime effects when they were new. However, runtime effects do not
support passing a color to a FP via `sample(fp, inputColor)`, which
is needed to properly implement SkPaintToGrPaint.

Change-Id: Ic826860ab06038f13633be677d79a9138d41db85
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301547
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-09 20:05:22 +00:00
Herb Derby
60a4986d4c Remove GrTextTarget and GrRenderTargetContext::TextTarget
Change-Id: I501f2fc365c0d2f2faff6ffaf4ad09635e4c3cdf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301452
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-09 19:34:20 +00:00
Michael Ludwig
362245e6ed Remove unused GrTRecorder
Change-Id: I9fa9f8785f48e884cf296a638347003d1687e7c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301536
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-09 16:13:20 +00:00
Brian Osman
9cf98dcb49 Remove GrCoordTransform entirely
Bug: skia:10416
Change-Id: I0ca7535a0e6507e6b2a9f4682788826972c5f3b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300296
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-07 20:06:04 +00:00
Chris Dalton
b750806543 Combine GrTessellateStrokeOps when possible
Bug: skia:10419
Change-Id: Ifd93b6cd8acffa78675b3e45134dfa52062b4f7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300102
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-07-06 17:17:02 +00:00
Jim Van Verth
eba2958922 Revert "Switch GN defs on Mac and iOS to use frameworks instead of libs."
This reverts commit c61e35dbc6.

Reason for revert: Breaking builds

Original change's description:
> Switch GN defs on Mac and iOS to use frameworks instead of libs.
> 
> GN will be removing support for frameworks in the libs variable, so
> might as well get ahead of it.
> 
> Change-Id: I67b118457721975ac2408308438d71172be66592
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300181
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,jvanverth@google.com

Change-Id: I7b81a92a67181e08ee57bcb184768794281cd37a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300228
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-07-01 19:53:47 +00:00
Jim Van Verth
c61e35dbc6 Switch GN defs on Mac and iOS to use frameworks instead of libs.
GN will be removing support for frameworks in the libs variable, so
might as well get ahead of it.

Change-Id: I67b118457721975ac2408308438d71172be66592
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300181
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-01 18:55:05 +00:00
Robert Phillips
b7bfbc299a Move GrRecordingContext.h and GrDirectContext.h into include/gpu
External clients will need access to these classes once GrContext
goes away.

This is a purely mechanical CL.

Bug: skia:10441
Change-Id: I7ffeb29d88bcc0f012412fba911e8362d046e24a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300206
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-01 17:32:14 +00:00
Brian Osman
1298bc46ac Change SampleMatrix to SampleUsage
It now tracks all sample calls of a child (matrix, explicit coords,
pass through). There is now just one registerChild() call, and the
sampling pattern of that child is fully determined by the SampleUsage
parameter.

Change-Id: Iaadcd325fca64a59f24192aadd06923c66362181
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299875
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-01 16:37:43 +00:00
Mike Klein
511cf4fca7 start on windows jit support
- Replacement for in-memory JIT mmap,mprotect,munmap.

  - dylib feature disabled (for now, but could be done
    with LoadLibrary/GetProcAddress)

  - Mostly share impl with __x86_64__, but with enter
    and exit updated for the MS ABI.

I "rediscovered" along the way that r12 has the same low three
bits as rsp, and that means the assembler needs to handle it
specially in at least one place it's not today.  No big deal;
we can easily avoid using r12.  GP registers are all statically
allocated.  Left a warning and a TODO.

Still need to investigate 17 GMs that are triggering asserts.

Change-Id: I0f543b0efab968e805e89dcf1f068eac1cafea38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298530
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-06-30 19:07:19 +00:00
John Stiles
09dbeff19a Update SkModeColorFilter to support an input FP.
This change relies on the Xfermode updates in the prior CL
(http://review.skia.org/299703) to render properly, and requires
slightly different blending behavior in the compose FP which
necessitated a new ComposeBehavior enum.

Eventually we would like to settle on a universal ComposeBehavior which
works well for all call sites, but that will be its own fairly
disruptive change. This work will be tracked at skia:10457.

Change-Id: I3cc0ea5e016fbef82bc63d653d60d0505efaa66f
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298821
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-30 18:50:02 +00:00
Chris Dalton
1c62a7b034 Implement stroking with GPU tessellation
Bootstraps tessellated stroking using GrStrokeGeometry mostly as
written. Strokes get decomposed into tessellation patches that
represent either a "cubic" (single stroked bezier curve with butt
caps) or a "join". The patches get drawn directly to the canvas
without any intermediate stencil steps. For the first revision, only
opaque, constant-color strokes are supported.

Bug: skia:10419
Change-Id: I601289189b93ebdf2f1efecd08628a6e0d9acb01
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299142
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-06-30 16:19:36 +00:00
Robert Phillips
ad2484520d Make the GrDirectContext a thing and move it to include/private
This is somewhat of a departure from the original context refactoring
plan (i.e., keep GrLegacyDirectContext hidden and switch GrContext over
to be the GrDirectContext at some point). Having a GrDirectContext
earlier will allow us to change some important signatures earlier
(e.g., asDirectContext) and, hopefully, clarify some of the confusion
about the context class hierarchy.

Additionally, this will let us make onGpuSetup take a direct context -
clarifying its purpose vis a vis onDraw (which now takes a recording
context).

Change-Id: I8298a0649bc95843d20bee33ba7fe1d7e73bb839
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299768
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-30 14:57:24 +00:00
Ben Wagner
41abd4f5cc Remove SkWhitelistTypefaces.
This was originally added to reduce the size of the large skp set by
reducing the number of fonts fully serialized. At the time all fonts
were fully serialized into all skps. Oddly enough this was actually a
blacklist of fonts which should never be fully serialized. The list was
easy to get out of date (it needed to be regenerated whenever the
container the Chromium html to skp conversion ran in was updated) and
unclear how to use well (the user would need to replay the skps in said
container to get mostly correct playback).

Since that time, it is now possible for the user to specify how to
serialize typefaces. In addition, further flexibility is now provided
though serialization and deserialization procs provided to the recorder
so that the user can have even greater control over individual
recordings, so if this is needed again there are cleaner ways to write
it without globals. Also, Cluster Telemetry doesn't really capture skps
this way anymore so this code isn't really being used.

In the future should such a mechanism be required, it would probably be
best to first create a base image of fonts to use as system fonts and
then set up the container which captures the skps to use exactly those
system fonts. Then all system fonts can avoid serialization and the font
collection and setup (or possibly just base container) can be shared for
playback.

Change-Id: I27412a8fd35b89af293b4151ea8cecc2b1bc7226
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299838
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-30 14:54:53 +00:00
Michael Ludwig
8f3a83671a Write SkSL visitor pattern and consolidate sampling analysis
Besides moving the existing coord-overrides and sample matrix merging
logic on to a shared visitor pattern, this updates the sample coord
reference detection to actually look for references to that built-in.

Previously, we only had this behavior in the CPP code generator. The
.h generator just did a string search for sk_TransformedCoords2D, and
runtime effects just looked at the main signature. Now, the .h generator
is more robust, and runtime effects that declare the main coords parameter
but never use it will not be marked as using the sample coords directly.

Change-Id: I802d610dbda512cf3823c58f349307b3926aa58f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-30 14:04:23 +00:00
Ben Wagner
8c3daeb5d2 Allow fontmgr factory to depend on fontmgrs.
In 75626e4b1a "Regularize selection of fontmgr." a clever change was
made which allowed the skia_fontmgr_factory to be specified as a source
file to allow the user to specify which factory to use. Unfortunately
this implies that the Skia target which uses this source does not know
which other targets (like fontmgr targets) to depend on. A factory
target must generally depend on the target which provides the widget the
factory makes.

This change puts all the current factories into targets of their own so
that they can depend on whatever they need. The skia_fontmgr_factory is
now the name of a target which is the sole public member of the
:fontmgr_factory target. Users can now specify a particular fontmgr
target to build into Skia as the default instead of simply specifying a
source file.

The fontmgr_fontconfig target now also properly publicly depends on the
fontconfig target since it has a public header which includes
fontconfig.h.

Bug: b/160133836
Change-Id: I212d842b8e07c4e99ab53e32310642d18eeb7cb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299677
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-29 21:03:04 +00:00
Robert Phillips
c7ed7e6fde Revert "Add storage on the surface for its last render task"
This reverts commit ca5b36c474.

Reason for revert: This may be blocking the Chrome roll

Original change's description:
> Add storage on the surface for its last render task
> 
> Let's land this and see if it gets us back to baseline on the
> lastRenderTask regression from the bug. If it doesn't, we'll revert it
> since the extra complexity won't have been worth it.
> 
> Bug: skia:10372
> Change-Id: I9d5ae93435b833d575afdc7f219dc8e7c453c92b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297836
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

TBR=robertphillips@google.com,adlai@google.com

Change-Id: Id418d042d1123d946cd99b7b1ba438211cb628ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10372
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299763
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-29 20:05:06 +00:00
Adlai Holler
ca5b36c474 Add storage on the surface for its last render task
Let's land this and see if it gets us back to baseline on the
lastRenderTask regression from the bug. If it doesn't, we'll revert it
since the extra complexity won't have been worth it.

Bug: skia:10372
Change-Id: I9d5ae93435b833d575afdc7f219dc8e7c453c92b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297836
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-06-29 16:10:46 +00:00
Florin Malita
fa78f3b1cb Fix is_clang python3 encoding errors
python 2.7 subprocess.check_output:

  "Run command with arguments and return its output as a byte string."

python 3 ubprocess.check_output:

  "By default, this function will return the data as encoded bytes."

Using a 'b' prefix seems to cover both cases.

Change-Id: Ie2d90bc93d0e98a723a262fae63fe538137812c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299382
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-26 18:41:00 +00:00
Brian Salomon
63a0a758ce Reland "Add async rescale and read APIs to SkImage."
This reverts commit 1caf3789f8.

Makes the image GMs detect an abandoned context just like the surface
GMs.

Bug: skia:10431
Change-Id: I56a3631a75e6b0383f96a73f461cfa314ee29afa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299379
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-26 18:17:21 +00:00
Brian Salomon
1caf3789f8 Revert "Add async rescale and read APIs to SkImage."
This reverts commit 7ac9b5fdb6.

Reason for revert: abandon context bots breaking

Original change's description:
> Add async rescale and read APIs to SkImage.
> 
> These function the same as the already existing
> SkSurface APIs.
> 
> Bug: skia:10431
> 
> Change-Id: I4f1e842d8d4b72ee27bae5f8a85e499e130d420c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299281
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com

Change-Id: I351795274245fc9f553cd210d82178f497f22660
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10431
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-26 17:13:22 +00:00
Brian Salomon
7ac9b5fdb6 Add async rescale and read APIs to SkImage.
These function the same as the already existing
SkSurface APIs.

Bug: skia:10431

Change-Id: I4f1e842d8d4b72ee27bae5f8a85e499e130d420c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299281
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-26 15:25:10 +00:00
Jim Van Verth
c1a67b5b15 Implement Direct3D semaphores
Change-Id: Iadfa14965bbe11cfea556ade5d46e264f0ace61a
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298752
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-06-25 20:07:21 +00:00
Adlai Holler
6c9bb62a28 Have the drawing manager ref & unref DDLs on playback
Change-Id: I95f6dbfed9bb3ce75ecb260137d11b72e3953d75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298820
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-06-25 17:38:01 +00:00
Brian Osman
061a5cf82a Move SkSLSampleMatrix to include/private
Switch it to use std::string (not SkSL::String). Along these lines,
remove SkSL::String's operator SkString, and instead add an explicit
SkString constructor from std::string.

Other changes aren't strictly necessary, but I wanted to clean up some
of the other SkSL vs. Skia code barriers. VS (since 2015) has had
vsnprintf that conforms to the C99 standard, the only difference with
_vsnprintf is a different (nonstandard) return value for overflowing
calls. Remove the special-case (the only use of SKSL_BUILD_FOR_WIN).

Change-Id: I8826af10c8e78a8d935c601d00b8ae9ba0640041
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298816
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-25 15:53:33 +00:00
Michael Ludwig
e88320baec Update how sample(matrix) calls are invoked in SkSL
This removes the kMixed type of SkSL::SampleMatrix. All analysis of FP
sampling due to parent-child relationships is tracked in flags on
GrFragmentProcessor now.

The sample strategy is tracked as follows:
- An FP marks itself as using the local coordinate builtin directly (automatically done for .fp code based on reference to sk_TransformedCoords2D[0]).
- This state propagates up the parent towards the root, marking FPs as using coordinates indirectly. We stop the propagation when we hit a parent FP that explicitly samples the child because it becomes the source of the child's coordinates.
   - If that parent references its local coordinates directly, that kicks off its own upwards propagation.
- Being sampled explicitly propagates down to all children, and effectively disables vertex-shader evaluation of transforms.
   - A variable matrix automatically marks this flag as well, since it's essentially a shortcut to (matrix expression) * coords.
- The matrix type also propagates down, but right now that's only for whether or not there's perspective.
   - This doesn't affect FS coord evaluation since each FP applies its action independently.
   - But for VS-promoted transforms, the child's varying may inherit perspective (or other more general matrix types) from the parent and switch from a float2 to a float3.
- A SampleMatrix no longer tracks a base or owner, GrFragmentProcessor exposes its parent FP. An FP's sample matrix is always owned by its immediate parent.
   - This means that you can have a hierarchy from root to leaf like: [uniform, none, none, uses local coords], and that leaf will have a SampleMatrix of kNone type. However, because of parent tracking, the coordinate generation can walk up to the root and detect the proper transform expression it needs to produce, and automatically de-duplicate across children.

Currently, all FP's that are explicitly sampled have a signature of (color, float2 coord). FP's that don't use local coords, or whose coords are promoted to a varying have a signature of (color).
   - In this case, the shader builder either updates args.fLocalCoords to point to the varying directly, or adds a float2 local to the function body that includes the perspective divide.

GrFragmentProcessor automatically pretends it has an identity coord transform if the FP is marked as referencing the local coord builtin. This allows these FPs to still be processed as part of GrGLSLGeometryProcessor::collectTransforms, but removes the need for FP implementations to declare an identity GrCoordTransform.
   - To test this theory, GrTextureEffect and GrSkSLFP no longer have coord transforms explicitly.
   - Later CLs can trivially remove them from a lot of the other effects.
   - The coord generation should not change because it detects in both cases that the coord transform matrices were identity.

GrGLSLGeometryProcessor's collectTransforms and emitTransformCode has been completely overhauled to recurse up an FP's parent pointers and collect the expressions that affect the result. It de-duplicates expressions between siblings, and is able to produce a single varying for the base local coord (either when there are no intervening transforms, or the root FP needs an explicit coordinate to start off with).


This also adds the fp_sample_chaining GM from Brian, with a few more configurations to fill out the cells.

Bug: skia:10396
Change-Id: I86acc0c34c9f29d6371b34370bee9a18c2acf1c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297868
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-25 14:48:34 +00:00
Brian Salomon
24069ebd23 Add GrContext::oomed() and implement for GL and VK.
Surfaces to client whether GrContext has seen a GL_OUT_MEMORY,
VK_ERROR_OUT_OF_HOST_MEMORY, or VK_ERROR_OUT_OF_DEVICE_MEMORY error.

Bug: chromium:1093997
Change-Id: I8e9799a0f7d8a74df056629d7d1d07c0d0a0fe30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298216
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-24 16:04:06 +00:00
Mike Reed
22f246f5ad add simple pathbuilder
88.26 ?	makepath_arrays_reserve	nonrendering
    235.97  	makepath_detach_reserve	nonrendering
    274.56  	makepath_snapshot_reserve	nonrendering
    537.61  	makepath_path_reserve	nonrendering
    472.98  	makepath_detach_noreserve	nonrendering
    482.56  	makepath_snapshot_noreserve	nonrendering
    750.83 ?	makepath_path_noreserve	nonrendering

Bug: skia:9000
Change-Id: I346537e899b08946c5778042a021f464006b029c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209403
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-06-24 01:50:30 +00:00
John Stiles
dc3b8f94f5 Revert "Enable _LIBCPP_DEBUG in Clang for non-Xcode-based debug builds."
This reverts commit 9eb89bac85.

Reason for revert: Repeated Android trybot failures

Encountering ASAN failures of the form:

=================================================================
==10276==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0xc3d2c5c0 in thread T5
    #0 0xf0e43b58  (/system/lib/libclang_rt.asan-arm-android.so+0xbeb58)
    #1 0xb2157736  (/data/local/tmp/dm+0x2df4736)
    #2 0xb0de3b3c  (/data/local/tmp/dm+0x1a80b3c)
    #3 0xb0e0d036  (/data/local/tmp/dm+0x1aaa036)
    #4 0xb0e0983e  (/data/local/tmp/dm+0x1aa683e)
    #5 0xb0e093ba  (/data/local/tmp/dm+0x1aa63ba)
    #6 0xb0e0cf6a  (/data/local/tmp/dm+0x1aa9f6a)
    #7 0xb0e09ca8  (/data/local/tmp/dm+0x1aa6ca8)
    #8 0xb0e09420  (/data/local/tmp/dm+0x1aa6420)
    #9 0xb0e0cf6a  (/data/local/tmp/dm+0x1aa9f6a)
    #10 0xb0e0983e  (/data/local/tmp/dm+0x1aa683e)
    #11 0xb0e14416  (/data/local/tmp/dm+0x1ab1416)
    #12 0xb0e259a6  (/data/local/tmp/dm+0x1ac29a6)
    #13 0xb0dcd37e  (/data/local/tmp/dm+0x1a6a37e)
    #14 0xb0dcc004  (/data/local/tmp/dm+0x1a69004)
    #15 0xb02030ec  (/data/local/tmp/dm+0xea00ec)
    #16 0xaff381a8  (/data/local/tmp/dm+0xbd51a8)
    #17 0xaff1eade  (/data/local/tmp/dm+0xbbbade)
    #18 0xaff255f4  (/data/local/tmp/dm+0xbc25f4)
    #19 0xb0bea1e4  (/data/local/tmp/dm+0x18871e4)
    #20 0xb0a46c30  (/data/local/tmp/dm+0x16e3c30)
    #21 0xb0a45c9e  (/data/local/tmp/dm+0x16e2c9e)
    #22 0xb0a467b0  (/data/local/tmp/dm+0x16e37b0)
    #23 0xf0e2cf8c  (/system/lib/libclang_rt.asan-arm-android.so+0xa7f8c)
    #24 0xf0c6f502  (/system/lib/libc.so+0x63502)
    #25 0xf0c29f26  (/system/lib/libc.so+0x1df26)

Address 0xc3d2c5c0 is a wild pointer.
SUMMARY: AddressSanitizer: bad-free (/system/lib/libclang_rt.asan-arm-android.so+0xbeb58) 
Thread T5 created by T0 here:
    #0 0xf0e2cdc8  (/system/lib/libclang_rt.asan-arm-android.so+0xa7dc8)
    #1 0xb0a4651a  (/data/local/tmp/dm+0x16e351a)

==10276==ABORTING

Caught signal 6 [Aborted] (173MB RAM, peak 180MB), was running:
	unit test  Codec_PngRoundTrip
	unit test  AAClip
	unit test  Codec_Dimensions
	unit test  Codec_raw
	unit test  crbug_ossfuzz_21688_interfaceblock
	unit test  crbug_ossfuzz_21688_interfaceblock

Caught signal 6 [Aborted] (173MB RAM, peak 180MB), was running:
	unit test  Codec_PngRoundTrip
	unit test  AAClip
	unit test  Codec_Dimensions
	unit test  Codec_raw
	unit test  crbug_ossfuzz_21688_interfaceblock
Likely culprit:
	unit test  crbug_ossfuzz_21688_interfaceblock
+ >/data/local/tmp/rc 
+ echo 1



Original change's description:
> Enable _LIBCPP_DEBUG in Clang for non-Xcode-based debug builds.
> 
> Unlike _GLIBCXX_DEBUG, this is meant to not break the ABI.
> The libc++ bundled with Xcode does not contain debug symbols so we need
> to disable these checks on Mac/iOS.
> 
> Change-Id: Ie4f18e247db9c405b2ce45f388c41dcac8104815
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297874
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,bsalomon@google.com,johnstiles@google.com

Change-Id: I3f717de26428abf9cb26f983b1e82379924419c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297840
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-20 14:32:09 +00:00
John Stiles
9eb89bac85 Enable _LIBCPP_DEBUG in Clang for non-Xcode-based debug builds.
Unlike _GLIBCXX_DEBUG, this is meant to not break the ABI.
The libc++ bundled with Xcode does not contain debug symbols so we need
to disable these checks on Mac/iOS.

Change-Id: Ie4f18e247db9c405b2ce45f388c41dcac8104815
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297874
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-20 00:51:02 +00:00
Mike Klein
29cb9f9478 decouple werror and -isystem in third_party
Some users of Skia want to build these with -I instead of -isystem, and
until now we've piggybacked it on werror, but it's still kind of
annoying to see warnings even if they're not fatal.

Change-Id: I5a349b2571adc2f94c75dc17317666ddc2dec373
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297788
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-06-19 21:59:35 +00:00
Chris Bracken
72f403c343 Use Mac font manager for both iOS and macOS
If skia_use_fonthost_mac is set, use SkFontMgr_mac_ct_factory.cpp on
both macOS and iOS. Previously, this was only used on macOS, causing iOS
Flutter builds to default to SkFontMgr_empty_factory.cpp on that
platform.

Patch that introduced the Flutter iOS issue:
https://skia-review.googlesource.com/c/skia/+/295437

Change-Id: If2f1e7db47a55245de6c2658ad564e79134d3e7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297194
Commit-Queue: Chris Bracken <cbracken@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-17 21:50:10 +00:00
Florin Malita
4190f27b41 Fix SkParse::FindNamedColor OOB
Plus some minor cleanup and asserts.

Bug: oss-fuzz:23395

Change-Id: I667bee2d7f21864defe2fd97df9eb4e99d69d9ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296451
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-06-17 14:23:14 +00:00
John Stiles
2518f546e3 Enable implicit-fallthrough warnings on Clang.
Change-Id: I5c1e6d8fd52ecfe628a78569b4665a64e1499fa5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296938
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-17 13:02:13 +00:00
Chris Dalton
de980231f6 Add a test for wide butt caps
This tests the case where the stroke has butt caps and its width
significantly larger than the path itself. There seems to be some
uncertainty over what should actually be drawn in some of these cases,
as evidenced by the variable results from different path renderers
here.

Change-Id: I5b62ec446bfbba73d09ddb4eac710e338bedfc6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296114
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-16 23:00:33 +00:00
Herb Derby
a08bde606a GrTextContext::Options -> GrSDFTOptions
Rename GrTextContext::Options to GrSDFTOptions. Remove GrTextContext.

TBR=reed@google.com

Change-Id: Ic89966cfe630cc6ee757977a6d63ae1da9e39ef0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296176
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-15 17:14:04 +00:00
Greg Daniel
01f278c834 Better handle backendFormat to CompressionType.
We also fix getReadSwizzle with this change.

Change-Id: I1989d8347dc97d7a4c75aa9094a0146419c6d8fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295819
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-12 21:47:14 +00:00
Adlai Holler
1bdbe55135 Cache last-accessed entry in lastRenderTask table.
This table is really hot during drawing and we saw a regression when
it was introduced. This change provides wins locally but I don't have
the regressed hardware handy.

Additionally, we change from SkGoodHash to the MixCheap function used by
some other small tables in the library.

Bug: skia:10372
Change-Id: Ic2dfbf41649515245e82cbcc9765cb29270eb5cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295878
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-12 16:11:19 +00:00
John Stiles
796e7022ee Reland "Fetch clang-format automatically when compiling .fp files."
This is a reland of a25422faa4

Original change's description:
> Fetch clang-format automatically when compiling .fp files.
>
> On a freshly fetched repo, setting `skia_compile_processors = true` will
> fail to compile because clang-format is missing from the bin directory.
> This CL automatically runs fetch-clang-format for you when clang-format
> is absent.
>
> Change-Id: Ieeb359176072e92ca235316c820310333732f608
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Change-Id: Ib397716771f742f192ebd6ed7ec0a9915b2400c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295956
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-12 13:21:41 +00:00
Chris Dalton
f26e596822 Duplicate ccpr/GrCCStrokeGeometry to tessellate/GrStrokeGeometry
CCPR stroking is not enabled by default and will eventually be
removed. This CL is a step toward migrating it to an MSAA version.

Change-Id: I565bea1c91c51bcd1ea3766aee6e4702adf3b09e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295608
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-06-11 21:59:23 +00:00
Robert Phillips
de2bca28cb Add new GM to exercise Vulkan YCbCr images
This will also expose the Vulkan precompilation path to immutable samplers.

Change-Id: Ida31bd70455299fbcc8f4d728aa15179f7685311
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295799
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-11 20:58:16 +00:00
John Stiles
21bbfc6c2d Revert "Fetch clang-format automatically when compiling .fp files."
This reverts commit a25422faa4.

Reason for revert: breaks Windows build

Original change's description:
> Fetch clang-format automatically when compiling .fp files.
> 
> On a freshly fetched repo, setting `skia_compile_processors = true` will
> fail to compile because clang-format is missing from the bin directory.
> This CL automatically runs fetch-clang-format for you when clang-format
> is absent.
> 
> Change-Id: Ieeb359176072e92ca235316c820310333732f608
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=mtklein@google.com,johnstiles@google.com

Change-Id: If6412e74a16aa515c223d5d4f326780c8a69766f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295832
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-11 20:36:05 +00:00
Ben Wagner
ee2ffc3b43 Delete .a file before writing static library.
The ar utility only adds symbols. As a result removed symbols are
sometimes still present in later builds, leading to great confusion.
Delete the .a file before recreating it with ar.

This is similar to what Chromium currently does in gcc_toolchain.gni.
However, we cannot always just use 'rm' because of the build for Android
on Windows, so this introduces 'rm.py' which is just like 'cp.py' but
without the copy part.

Bug: skia:10363
Change-Id: Icc0c3d18dab1e48ccfec47386662c7b4d2dc8811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295569
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-11 17:19:23 +00:00
John Stiles
a25422faa4 Fetch clang-format automatically when compiling .fp files.
On a freshly fetched repo, setting `skia_compile_processors = true` will
fail to compile because clang-format is missing from the bin directory.
This CL automatically runs fetch-clang-format for you when clang-format
is absent.

Change-Id: Ieeb359176072e92ca235316c820310333732f608
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-11 17:19:22 +00:00
Ben Wagner
75626e4b1a Regularize selection of fontmgr.
Change-Id: Id7c51504450c1c7c9421eba3838bd6bc3440ca4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295437
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-11 12:28:03 +00:00
Brian Osman
ff7bee9817 Remove SkReader32, and some API from SkWriter32
After removing all unused API from SkReader32, it only had a handful
of functions, and it was (rightly) only used by SkReadBuffer. Remove
the temptation to use it by just folding it into SkReadBuffer.

SkWriter32 had some unnecessary functions as well (only used in unit
tests), so those are gone. There is still a strange relationship:
SkWriteBuffer is just an interface - SkReadBuffer is actually the
complement of SkBinaryWriteBuffer/SkWriter32. Those two classes produce
data in the exact same format, but with slightly different interfaces.
(The choice about which one is used is mostly about high-level
serialization vs. low-level helpers).

Change-Id: I1e823755febecd2e053ea732b21295d8f4d9d832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295557
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-10 16:45:56 +00:00
Ben Wagner
771d3a214e Revert "Delete .a file before writing static library."
This reverts commit 3b035e0417.

Reason for revert: Build-Win-Clang-arm64-Release-Android runs on
                   Windows and uses llvm-ar.

Original change's description:
> Delete .a file before writing static library.
> 
> The ar utility only adds symbols. As a result removed symbols are
> sometimes still present in later builds, leading to great confusion.
> Delete the .a file before recreating it with ar.
> 
> This is similar to what Chromium currently does in gcc_toolchain.gni.
> 
> Bug: skia:10363
> Change-Id: I133deb6da570ca38a539b4f0bb486b61d6a664bf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295217
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=mtklein@google.com,bungeman@google.com

Change-Id: I02ba93ce26eedb2b2362e96d2ebfcacbfb8e0902
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10363
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295445
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-10 13:44:39 +00:00
Ben Wagner
3b035e0417 Delete .a file before writing static library.
The ar utility only adds symbols. As a result removed symbols are
sometimes still present in later builds, leading to great confusion.
Delete the .a file before recreating it with ar.

This is similar to what Chromium currently does in gcc_toolchain.gni.

Bug: skia:10363
Change-Id: I133deb6da570ca38a539b4f0bb486b61d6a664bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295217
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-10 13:25:05 +00:00
Jim Van Verth
f43da14878 Add D3D descriptor tables and bind to command list.
This CL adds a new descriptor heap manager that handles creation of
descriptor tables, or ranges of shader-visible descriptors. These
are used to set the descriptors that match the setup of the root
signature. Data from non-shader-visible descriptors are copied into
these tables, and then they are bound to the command list.

Change-Id: Ia9fc24cae602244525a196025c044df3c2435d9f
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294300
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-06-10 01:05:03 +00:00
Chris Dalton
392fa03a1b Add an interactive sample that fits cubics to circular arcs
Fits a cubic to an arc on the unit circle using the following
constraints:

  1) The endpoints and tangent directions at the endpoints must match
     the arc.
  2) The cubic must be symmetric (length(p1 - p0) == length(p3 - p2)).
  3) The height of the cubic must match the height of the arc.

Using the above constraints, we arrive at the following formula for the
control length (c) (i.e., lengths of (p1 - p0) and (p3 - p2)):

  d = x0*x1 + y0*y1
  c = (sqrt(1 + d) * kM + kA) * rsqrt(1 - d)

(Where x0,y0,x1,y1 are the endpoints, kM = -4/3, and kA = 4/3 * sqrt(2).)

The sample also comes with a root finder that finds the max error value
of the curve, which ends up serving as a semi-formal proof that:

  1) Max error always occurs at T=0.21132486540519, regardless of
     endpoints.
  2) Error is reduced by exactly 64x each time we halve the arc angle

Change-Id: I29ad60dda06743d79f71275c38ffdd97261159ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295303
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-09 23:04:03 +00:00
Mike Klein
45f36b5b55 ignore SK_DISABLE_READBUFFER
Its effect is small and we want to rely on SkReadBuffer being available.

Size changes:

    - canvaskit uncompressed: 6,864,481 --> 6,864,481  (  no change  )
    - canvaskit   compressed: 2,667,117 --> 2,667,117  (  no change  )
    -   pathkit uncompressed:   329,187 -->   330,679  (+ 1.5K, +0.5%)
    -   pathkit   compressed:   134,158 -->   134,672  (+ 0.5K, +0.4%)
    -   flutter             : 1,302,108 --> 1,322,568  (+20.0K, +1.6%)

The Flutter change is the biggest mystery, as bloaty only pegs
SkReadBuffer as 3.9K.  The rest must come from other files including
SkReadBuffer.h not being able to see and inline away SkReadBuffer
routines?  Feels like SK_DISABLE_EFFECT_DESERIALIZATION isn't trimming
enough?

PS 4-6 have an idea to push SK_DISABLE_EFFECT_DESERIALIZATION further.

Change-Id: Ifda3ccb82dd0636cfed6bb826fb185a7bca2cbe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295061
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-09 16:16:57 +00:00
John Stiles
fe64410954 Remove PremulInput and GrPremulInputFragmentProcessor.fp from Skia.
This FP was unused and not referenced anywhere in the codebase.

Change-Id: I27f963d7c26382101b585f356a75d84cef5ab237
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295080
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-08 21:04:46 +00:00
Florin Malita
26ae40f668 Reland "[skrive] Initial parser plumbing"
This reverts commit e923ae1be4.


Original change's description:
> Revert "[skrive] Initial parser plumbing"
> 
> This reverts commit 00a96f2c99.
> 
> Reason for revert: breaking wuffs 
> 
> Original change's description:
> > [skrive] Initial parser plumbing
> > 
> > TBR=
> > Change-Id: If96d81840b5bb3bc8c6e26f8aacca4d9dd8896e3
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293677
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> 
> TBR=fmalita@chromium.org,reed@google.com
> 
> Change-Id: I63258d560cc8ee8d069e6417d987342a74a3f0c2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295001
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: I0a671bb7476ee92c365fbea1f156c73c6954fe40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295003
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-06-08 16:38:59 +00:00
Florin Malita
e923ae1be4 Revert "[skrive] Initial parser plumbing"
This reverts commit 00a96f2c99.

Reason for revert: breaking wuffs 

Original change's description:
> [skrive] Initial parser plumbing
> 
> TBR=
> Change-Id: If96d81840b5bb3bc8c6e26f8aacca4d9dd8896e3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293677
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I63258d560cc8ee8d069e6417d987342a74a3f0c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295001
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-06-08 15:22:15 +00:00
Florin Malita
00a96f2c99 [skrive] Initial parser plumbing
TBR=
Change-Id: If96d81840b5bb3bc8c6e26f8aacca4d9dd8896e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293677
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-06-08 14:23:34 +00:00
Michael Ludwig
9cced93b7a Handle color and stencil clears in GrClearOp
With prior changes, it became "clear" that GrClearOp and
GrClearStencilClipOp behaved very similarly, except that the stencil
op did not have any onCombine logic.

This just combines them in to a single clear op that will call the
render pass's clear and stencil clear functions as needed. I also
implemented combine logic to apply color and stencil clears in a single
op if the scissor state was compatible (although there's no render pass
API to combine the two clears into a single GPU function).

Change-Id: I8aa749fe64cc487d187854fd0acf6b03b86f1356
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290822
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-06-08 14:05:16 +00:00
Ben Wagner
0ef90dd5e9 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: Iac548f9fd920c426ea5c6dcdefe8da0a9b89ec90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294714
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-06 04:06:32 +00:00
Mike Klein
bb5b2a17c2 Revert "Split out coretext fontmgr factory."
This reverts commit 2c628340f4.

Reason for revert: ios-simulator chrome bot:

FAILED: obj/skia/x64/skia_unittests 
TOOL_VERSION=1591394828 ../../build/toolchain/mac/linker_driver.py -Wcrl,strippath,/opt/s/w/ir/cache/xcode_ios_11e146.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip ../../third_party/llvm-build/Release+Asserts/bin/clang++ -B /opt/s/w/ir/cache/xcode_ios_11e146.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/  -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker obj/skia/skia_unittests.xcent -Wl,-fatal_warnings -arch x86_64 -Werror -nostdlib++ -isysroot sdk/xcode_links/iPhoneSimulator13.4.sdk -mios-simulator-version-min=12.0 -Wl,-ObjC -o "obj/skia/x64/skia_unittests" -Wl,-filelist,"obj/skia/x64/skia_unittests.rsp" -framework UIKit  -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework UIKit -framework Security
Undefined symbols for architecture x86_64:
  "SkCTFontGetSmoothBehavior()", referenced from:
      SkTypeface_Mac::onFilterRec(SkScalerContextRec*) const in libskia.a(SkFontHost_mac.o)
      SkScalerContext_Mac::generateImage(SkGlyph const&) in libskia.a(SkFontHost_mac.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Original change's description:
> Split out coretext fontmgr factory.
> 
> There can be only one SkFontMgr::Factory, so each should go in its own
> translation unit. In addition, the name SkFontHost_mac is now rather out
> of date and should now be SkFontMgr_mac_ct. Since the additional burden
> of additional build changes after the first is minimal, also split out
> SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
> SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
> which are replacing it. Once references to it are removed from all
> builds it can be removed.
> 
> This is intended to be a reorganization without much code change. Most
> changes are simple renaming of functions which are now shared between
> translation units. However, there are a few behavior changes here.
>   * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
>   * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
>   * SkFontMgr_New_CoreText takes a CTFontCollectionRef.
> 
> Change-Id: I897f69f2f5ea06819f5daa964c09cdd36490af85
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704

TBR=mtklein@google.com,bungeman@google.com

Change-Id: I5abeb7598c7f533477b4a4af5b568f7cbe6e8644
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294734
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-05 23:16:49 +00:00
Ben Wagner
2c628340f4 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: I897f69f2f5ea06819f5daa964c09cdd36490af85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704
2020-06-05 21:40:46 +00:00
Mike Klein
6f56f2ed3f port skx opts to old style
Change-Id: I364365455cc3580f38ddd189f00050ea9e2238a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294565
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-06-05 20:35:08 +00:00
Ben Wagner
aa10dfeec9 Revert "Split out coretext fontmgr factory."
This reverts commit 5c14d63297.

Reason for revert: chromium 'analyze' doesn't do a good job

Original change's description:
> Split out coretext fontmgr factory.
> 
> There can be only one SkFontMgr::Factory, so each should go in its own
> translation unit. In addition, the name SkFontHost_mac is now rather out
> of date and should now be SkFontMgr_mac_ct. Since the additional burden
> of additional build changes after the first is minimal, also split out
> SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
> SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
> which are replacing it. Once references to it are removed from all
> builds it can be removed.
> 
> This is intended to be a reorganization without much code change. Most
> changes are simple renaming of functions which are now shared between
> translation units. However, there are a few behavior changes here.
>   * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
>   * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
>   * SkFontMgr_New_CoreText takes a CTFontCollectionRef.
> 
> Change-Id: Iaf58a0371667f266ada20c918941fab6bc27d9df
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=mtklein@google.com,bungeman@google.com

Change-Id: I469084efbfc71bba60e5fbfb4eb7152d57324d0c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294703
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-05 20:32:52 +00:00
Ben Wagner
5c14d63297 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: Iaf58a0371667f266ada20c918941fab6bc27d9df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-05 19:22:38 +00:00
Mike Klein
ad56c4c143 add structure for normal SKX opts
My experience porting the old opts over to the current SKX opts setup
was so bad that I don't want to try any more, and think it's probably
safer to port the SKX code to the old setup.

Need to hook up dependents (Chromium and Google3 I think) before we can
move the actual SXK opts code over.

Change-Id: Ibb8bc4a083cb104cd39f27cbfbc16e9eedd9bd46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294495
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-05 13:48:39 +00:00
John Stiles
eed56f0fe5 Update GrFragmentProcessor::SwizzleOutput to use a child FP.
We are updating FPs to receive their input via a child FP where
possible, instead of relying on the input color.

This CL also adds a GM test for SwizzleOutput, since this did not appear
to be covered by existing unit tests.

Change-Id: I3d8176395bb42eab7ff471c9137597402b5b3a69
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293884
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-06-04 17:31:46 +00:00
Ben Wagner
d13487e71b Regularize SkFontMgr for CoreText build.
Move SkFontHost_mac.cpp into an 'optional' like the other fontmgr build
rules. This allows building with other fontmgrs on Mac and makes the lib
dependencies explicit. In the future this helps with splitting the out
the default factory.

Change-Id: Iecef9e428acb69f89b54afa00b4e779f5858c61a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294076
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-04 16:45:09 +00:00
Mike Klein
1faaa97f80 Revert "apply SkOpts_skx approach to SkOpts_hsw"
This reverts commit 08a39c2b5f.

Reason for revert: Flutter roll?

Original change's description:
> apply SkOpts_skx approach to SkOpts_hsw
> 
> Very slightly different build flags, switching from -march=haswell to
> -mavx2 -mfma -mf16c, but there are no diffs.
> 
> Left some TODOs for the next ones, but _hsw being so common I figured
> I'd do this one stand alone and make sure it shakes down before doing
> the rest.
> 
> clang-cl (but not clang) barfs when we've got a lambda using an AVX
> intrinsic inside a templated static helper function. Luckily they're
> all non-type template parameters, so we can just pass them as normal
> arguments, and it'll optimize the same as the templated code anyway.
> 
> This was weird, but since we're covering almost all the SkFoo_opts.h
> headers with HSW here, I don't anticipate this being a problem in the
> future.  (And I'm sure I'll never look back on this statement as naive.)
> 
> Change-Id: I2f84db356cafa5e158bcc3724fb1c3f58aca7f1e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293599
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,herb@google.com,reed@google.com

Change-Id: If3a75158d6e017f180d9e38d9ba296a0d72e1384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294281
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-04 14:20:36 +00:00
Mike Klein
7f5b734505 Revert "finish new-style opts"
This reverts commit 4272d071d9.

Reason for revert: Flutter roll?

Original change's description:
> finish new-style opts
> 
> Nothing super interesting.
> 
> SkOpts_crc32.cpp is worth looking at
> as the only non-x86 code.
> 
> I marked a few places I think we can
> trim to save code size as follow ups.
> 
> Change-Id: Ifdc8f4d1495ff56df5d2cdde39f7e9a6ac2b1277
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294019
> Auto-Submit: Mike Klein <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

TBR=mtklein@google.com,herb@google.com

Change-Id: Idbb914788489bdc5941f7fed23bf26d35d90dca4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294280
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-04 14:20:17 +00:00
Herb Derby
64aa5138c7 Remove SkAtlasTextTarget
I can find no references to SkAtlasTextTarget in AOSP or in Chromium.
With google3 CL/314226466 there are no more uses in Google3.

Change-Id: I60b5f06fc17c0e4f8d008886c96645475e3d48e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293839
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-06-04 03:52:35 +00:00
Mike Klein
4272d071d9 finish new-style opts
Nothing super interesting.

SkOpts_crc32.cpp is worth looking at
as the only non-x86 code.

I marked a few places I think we can
trim to save code size as follow ups.

Change-Id: Ifdc8f4d1495ff56df5d2cdde39f7e9a6ac2b1277
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294019
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-06-04 03:51:45 +00:00
Mike Klein
08a39c2b5f apply SkOpts_skx approach to SkOpts_hsw
Very slightly different build flags, switching from -march=haswell to
-mavx2 -mfma -mf16c, but there are no diffs.

Left some TODOs for the next ones, but _hsw being so common I figured
I'd do this one stand alone and make sure it shakes down before doing
the rest.

clang-cl (but not clang) barfs when we've got a lambda using an AVX
intrinsic inside a templated static helper function. Luckily they're
all non-type template parameters, so we can just pass them as normal
arguments, and it'll optimize the same as the templated code anyway.

This was weird, but since we're covering almost all the SkFoo_opts.h
headers with HSW here, I don't anticipate this being a problem in the
future.  (And I'm sure I'll never look back on this statement as naive.)

Change-Id: I2f84db356cafa5e158bcc3724fb1c3f58aca7f1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293599
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-03 21:34:05 +00:00
Mike Reed
579c295b6b Android test to depend on icu and harfbuzz.
Enable shaper and paragraph tests to run on Android builds.

Change-Id: Ib1685653ac4432a04998aed56dc76b9020253e75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293244
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-02 21:26:25 +00:00
Mike Klein
77a233283c does -fms-compatibility-version=19 still matter?
Change-Id: Ifb47c6be05bffad4a42030f4375dcbe0fe313ae0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293656
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-02 18:41:44 +00:00
Mike Klein
fdd542f807 roll clang_win
I was hoping this might fix the issues I'm seeing in the dependent CL.
It doesn't, but it's probably worth rolling every few months anyway.

Change-Id: I6d748d9e1a5bf908df78e989a624f2dccb1bd189
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293604
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-02 17:41:34 +00:00
John Stiles
f10581872c Add headers to SkSL GN file.
This makes it easier to work with SkSL files when using an IDE.

Change-Id: I30665478a9cde63b4c9ba7e5a9948e9647f7ef81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293571
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-02 17:28:24 +00:00
Leon Scroggins III
1adcac52d6 Remove transform_scanline from SkWebpEncoder
Bug: skia:10178

These functions can be performed generically using SkRasterPipeline
or skcms. Further, the reason we used a function pointer anyway was
so that we could call the same function on each row separately. But
libwebp's API doesn't let us do a single row at a time anyway.
Simplify this method by using readPixels when necessary and
skipping conversion entirely when possible.

Add support for encoding from unpremul 4444. It is simpler to support
it, and it's not obvious why we didn't support it before.

Keep the behavior of not supporting A8, and apply the same to the
other alpha-only formats. Note that we could support encoding such an
image to alpha, r=0, g=0, b=0, but I'd rather leave adding that
feature to a separate change, which enables it for all encoders (and
accounts for the internal use of PNGs as a round-trip for
kAlpha_8_SkColorType).

Add GMs to test the newly supported SkColorTypes.

Change-Id: I4d86c5621792fb6dc3cb68b736a1eb35d577e3a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292962
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-02 15:37:29 +00:00
Mike Klein
89c909efee Wsign-conversion for public headers
This is an Android request for our public headers,
much like warning about unused parameters.  See bug.

In general I've made two kinds of source changes:

   1) more commonly, explicitly cast to the type which
      is being implicitly cast to at head;

   2) less commonly, flip signedness of a value we're
      storing to match how it's used more smoothly.

Much of this is self inflicted inconsistent use of size_t, unsigned,
int, int32_t, uint32_t, etc.  SkTArray is particularly tricky because
of its std::vector half-compatibility.  E.g. resize() takes size_t,
but operator[] takes int.    ¯\_(ツ)_/¯

Bug: skia:9847
Change-Id: I64626a529e1662b3d3020bc03d477fc641eda544
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293436
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-02 12:34:54 +00:00
Jim Van Verth
3eadce263c Create ring buffer for managing D3D uniforms.
* Adds a base class for the ring buffer (to be used by Metal as well),
  which tracks the current available space. APIs will need to
  implement creation of the buffer in the subclass.
* The API implementation will need to store SubmitData on command buffer
  submit, and then pass it to finishSubmit when the command buffer
  finishes.

Change-Id: I4cc5e4a72d259ee9d15dac0e964819d4562da3d7
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291936
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-06-01 20:38:40 +00:00
Brian Osman
273944ac7c Convert GrMatrixEffect to pure CPP/H
Prelude to adding situational optimizations

Change-Id: Ie7994a87380ba6135398c9a1d4b26cea6bf32fa8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292972
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-01 14:33:57 +00:00