Commit Graph

8469 Commits

Author SHA1 Message Date
Brian Salomon
f625e4ce45 Revert "Use ManagedBackendTexture in place of TestUtils backend texture helpers."
This reverts commit 5ee0556048.

Reason for revert: breaking bots

Original change's description:
> Use ManagedBackendTexture in place of TestUtils backend texture helpers.
>
> Unify on a single family of helpers for making backend textures.
>
> Stresses callback systems in more tests by avoiding artificial
> flush/submit/syncs.
>
> some misc test cleanup along the way.
>
> Change-Id: Ia692e8927ba97b391ee77ea06ebf437a555617b2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324710
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

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

Change-Id: I7d4fc9412c870ae13f7498671379b871dbf5a6c4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325619
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-12 16:19:49 +00:00
John Stiles
0f37907ac7 Undo call-count fix for intrinsic functions.
This CL is conceptually a revert of http://review.skia.org/320258,
although the code has changed shape a bit since that CL was landed.

This fix was too aggressive, and can lead to functions being dead-
stripped while they still have an active reference.

Change-Id: I6ce8b0ad9cc2a42e8be8cb10d3a8219149eca6aa
Bug: skia:10776
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325462
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-10-12 15:58:27 +00:00
Brian Salomon
5ee0556048 Use ManagedBackendTexture in place of TestUtils backend texture helpers.
Unify on a single family of helpers for making backend textures.

Stresses callback systems in more tests by avoiding artificial
flush/submit/syncs.

some misc test cleanup along the way.

Change-Id: Ia692e8927ba97b391ee77ea06ebf437a555617b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324710
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-10-12 15:28:52 +00:00
Matthew Leibowitz
07055b5e25 Parse out the orientation in the SubIFD of EXIF
Orientation information is sometimes stored in
the SubIFD section of EXIF, so read that. This is
just a matter of searching for the SubIFD offset
value in the EXIF tags and then parsing the
values from there onwards. The data format is
the same as the EXIF data.

The images are not under any copyright as I made
them up locally specifically for these tests.

Bug: skia:10799

Change-Id: I5384ffc1c4a9a0c7d3fc8510ef4da2f278cb8b97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323217
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-10-12 13:50:27 +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
Brian Salomon
60003f776a Use BackendSurfaceFactory in Vk protected unit tests.
Automatically handles cleanup of backend objects.

Removes use case of MakeFromBackendTextureAsRenderTarget.

Bug: skia:9832
Change-Id: I27c2b4cae713bd605a662d38b797fd25c1add98e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324119
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-09 17:54:03 +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
Brian Salomon
f9b0042423 Expose ManagedBackendTexture from BackendTextureImageFactory.
Add helper to create self-managed BackendTexture-backed SkSurface for
tests using MBET.

GrGpu::createTestingOnlyBackendRenderTarget supports protected.

Make SkSurfaceCharacterization tests use self-managed SkSurface
factories and a use case of MakeFromBackendTextureAsRenderTarget is
removed.

Use self-managed BackendTexture-backed SkSurface factory in DM sinks and
in fm.

Bug: skia:9832

Change-Id: I0c1dc49697f8b3c942864e18b9112a3552f431ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323559
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-08 20:35:32 +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
Stephen White
e895cdc716 Dawn: implement mipmap generation.
Dawn does not support automatic mipmap generation, so use mip-to-mip
downsampling.

Change-Id: I71e1808d78f45eee68df7f124100f5b563f29da3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319736
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@google.com>
2020-10-08 18:50:02 +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
9c0b79a354 Implement assignment and copy-construction for SkTHashSet/Map.
This will enable us to use SkTHashMap to store our definition maps.

Change-Id: I6017dfa71e1c5e68a20c97e955bb3d3abf347f0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323891
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-10-08 16:05:52 +00:00
Robert Phillips
fde67e4997 Add HW-filtered masks to thread-safe cache
Bug: 1108408
Change-Id: Iace1cea1c79a1f505a5b4da3a4d4c1a713e142ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323505
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-08 13:03:18 +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
John Stiles
f41762a5da Remove accidentally repeated bit-index expression.
Also, remove unused #include of SkBitSet.

Change-Id: Ib1b903f78e835a75c8ba88ac35bfa270df7bc0e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322681
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-07 17:20:01 +00:00
Robert Phillips
b1807129a6 Centralize CreateLazyView helper in GrThreadSafeUniquelyKeyedProxyViewCache
We'll also be needing this helper for HW-generated blur mask caching

Bug: 1108408
Change-Id: I60d91ae8864239f0cf68830d0a5b4266d27545d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323109
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-07 15:09:20 +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
Robert Phillips
6e17ffe829 Add customData capability to the thread-safe proxy cache ...
and begin using it for cached SW-generated blur masks.

This is needed to begin mixing and matching HW & SW-generated blur
masks since they have different draw-rects.

It will also be useful if/when we add support for triangulated paths
to the thread-safe cache.

Bug: 1108408
Change-Id: I085ad1127dc2deb98b35d704b06e50b27c72fd1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322657
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-07 14:18:00 +00:00
John Stiles
8354e9b8f6 Fix data() method and add unit test.
I wrote code that called SkAutoTArray::data() and discovered that it
was broken, but not generating compile errors because it's part of a
template and never instantiated anywhere else. I fixed the
implementation and added it to our container unit test to prevent later
regression. This revealed another issue, that "containers in
SkTemplates.h [should] all have a consistent api", according to
test_container_apis. However, data() was never added to the non-array
container APIs. So I added data() to the other containers as well.

Change-Id: I52532c91fdab3fc8c4539053ba8420815b7b0ee5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323276
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-07 13:46:50 +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
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
Brian Salomon
72c7b98ae3 Start removal of tool usage of SkSurface::MakeFromBackendTextureAsRenderTarget.
Adds a new helper that creates a GrBackendRenderTarget using
GrGpu and then wraps it in a SkSurface. Uses the SkSurface
release proc to delete the BERT using GrGpu.

Upgrades GrGpu::createTestingOnlyBackendRenderTarget to create MSAA
buffers.

Updates many tests/tool to call sites to use the helper instead of
SkSurface::MakeFromBackendTextureAsRenderTarget.

Adds syncToCpu bool to SkSurface:: and GrContext::flushAndSubmit.

Bug: skia:9832

Change-Id: I73a8f0ce09dc6523729af0814464c6b6657fda06
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293683
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-10-06 16:32:11 +00:00
Ben Wagner
59637dd6f9 Add SkTypeface::getPostScriptName.
Bug: skia:10234
Change-Id: Idfa1261e36174a4b4223b8eb62c872448fc58b14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322680
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-06 15:35:06 +00:00
Herb Derby
d6cfe72549 Add flag to switch op allocation to new
Added a flag to switch from using the memory pool to
using new and delete for GrOp allocation.

Just add the following to your gn args.
extra_cflags = [
    "-DGR_OP_ALLOCATE_USE_NEW",
]

Change-Id: Icea4a6df047cff2cd5e50032f0bd4b714a5740d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322625
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-06 15:19:06 +00:00
Michael Ludwig
d30e9efdab Use preservesAxisAlignment instead of scaleTranslate for clip simplification
This lets more matrix types pre-convert rects and rrects to device space.
Since the clip geometry isn't itself shaded, we can apply the matrix
without worrying about preserving local vs. device coordinates.

Bug: skia:10730
Change-Id: I61ae3e13eec66f0e5eb83a6504dcb8004620b151
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320222
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-05 20:43:20 +00:00
Ben Wagner
ae4bb98f13 Reland "Remove use of legacy display globals."
This is a reland of c1916c34fe

As it turns out, benches are not always given a canvas.

Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

Change-Id: I61a2ac058fafc99653e3304876cf4b97350dac8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322490
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-05 19:13:58 +00:00
Nigel Tao
bf4605ffc3 Have SkWuffsCodec use PIXEL_BLEND__SRC_OVER
This takes the "one pass" code path more often, using less memory, as it
does not have to allocate an intermediate width*height pixel buffer.

Wuffs v0.2 did not support SRC_OVER, only SRC, but Wuffs v0.3 does.

The gif-transparent-index.gif test file comes from the
test/data/artificial directory of the github.com/google/wuffs
repository. It was programmatically generated.

The new GifTest.cpp test passes with skia_use_wuffs true or false, with
or without the SkWuffsCodec.cpp change.

Change-Id: I46fb4c849319fbefc39f331416a8b7d3836093ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320116
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-10-05 18:24:48 +00:00
Jim Van Verth
bd0881cb58 Revert "Remove use of legacy display globals."
This reverts commit c1916c34fe.

Reason for revert: Bots unhappy

Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=djsollen@google.com,bungeman@google.com,herb@google.com,reed@google.com

Change-Id: I365d2b1d19241a90130bc1b59663651817966f63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322400
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-10-05 16:34:15 +00:00
Ben Wagner
c1916c34fe Remove use of legacy display globals.
In the ongoing effort to remove the display globals from Skia, allow
their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
in a normal Skia build and remove all use from Skia code.

Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-05 15:53:10 +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
John Stiles
2d7973afc2 Factor out Inliner candidate list assembly into its own function.
This greatly improves the output from a profiler. It makes it much
easier to determine how much time is spent in searching for candidates,
versus actually inlining them.

It also improves the code readability somewhat by breaking a large
monolithic function into several smaller functions.

Change-Id: I1b3ef6ddbe46af60e673f37ded766f8077ed6b03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321376
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-10-02 20:39:24 +00:00
Brian Osman
034f78a466 Detect non-2D textures in MetalCodeGenerator and fail cleanly
We were letting this get further, then asserting.

Bug: skia:10797
Change-Id: Iff6fe43aa32450b5a517c94773031d593f1f62a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321794
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-02 20:36:04 +00:00
Robert Phillips
326f1d702b Accumulated non-substantive changes
Change-Id: I0c6f48da9acefcdd954c9b1b54501ef48465e537
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310980
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-02 12:59:54 +00:00
Herb Derby
a80ce1a36d remove SkMakeSpan use ctor parameter deduction
Change-Id: I3a1b12f7eb906fe105eb7e9f6bc10e3745f61528
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320264
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-10-02 01:41:03 +00:00
Brian Osman
8e2ef02855 Support variables in the intrinsic map, clone them into Programs
As a first step, convert sksl_pipeline.sksl to an IntrinsicMap (rather
than inherited element list). This makes the new code operate on
sk_FragCoord (which was previously being shared by all runtime effect
programs).

The new unit test angered TSAN, and now runs without complaint.

Also finish converting the .fp intrinsics over, so those don't need an
inherited element list either. And while doing that, refactor that
parsing to match all of the others. FP was uniquely implementing
processIncludeFile itself, rather than reusing the pattern of other
pre-include parsing.

The meat of the CL is the subtle changes in Compiler, and the logic in
cloneBuiltinVariables. Note that we need to clone the global variable
declaration element (because one of the goals is to get rid of shared
and inherited program elements), but also the variable itself (and the
new copy needs to live in the program's symbol table).

Bug: skia:10589
Bug: skia:10679
Bug: skia:10680
Change-Id: Ied352f8434dac2b8eacb4e515b014b6af7b57d20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319023
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-01 20:30:33 +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
Brian Salomon
8e0aa441a5 Get GrBackendRenderTarget's sample count from MtlTexture.
Instead of being passed separately.

Check sample count in various onWrap methods in GrMtlGpu.

Bug: skia:9832


Cq-Include-Trybots: luci.skia.skia.primary:Test-iOS-Clang-iPhone8-GPU-AppleA11-arm64-Release-All-Metal,Test-iOS-Clang-iPhone7-GPU-PowerVRGT7600-arm64-Release-All-Metal,Test-iOS-Clang-iPadPro-GPU-PowerVRGT7800-arm64-Release-All-Metal,Test-iOS-Clang-iPhone11-GPU-AppleA13-arm64-Release-All-Metal,Test-iOS-Clang-iPhone6-GPU-PowerVRGX6450-arm64-Release-All-Metal,Test-Mac10.15-Clang-MacBookAir7.2-GPU-IntelHD6000-x86_64-Release-All-Metal
Change-Id: If5813db95b07f5d272e80920486f461cc5a587fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320956
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-30 20:40:33 +00:00
John Stiles
80ccdbd869 Inline trivial single-argument constructors directly.
We don't need to create a temporary variable for expressions like
`half3(x)`.

Change-Id: Ie0fa6a6dfb3d77d4372f96c676d3081f7e278852
Bug: skia:10786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320960
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-30 17:06:14 +00:00
Robert Phillips
aac5728a82 Make GrRRectBlurEffect use the thread-safe uniquely-keyed view cache (take 2)
This yields a ~8% performance improvement on OOP-R/DDL-like rendering of the simpleblurroundrect GM.

Bug: 1108408
Change-Id: I710c75b73a395b2280abf0c5af528e0f6731326d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311720
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320917
2020-09-30 15:54:43 +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
John Stiles
44733aa1e2 Avoid creating temporary variables for nested trivial cases.
For instance, `foo[0].x` is now considered trivial to inline. It
combines two trivial cases: array-indexing by an int literal, and a
swizzle.

Change-Id: Ibb3ca1f324bbee0e9b3556e66644923fc9e0cf45
Bug: skia:10786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320768
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-30 13:31:37 +00:00