Commit Graph

50425 Commits

Author SHA1 Message Date
John Stiles
81365aff6e Add as<ExpressionSubclass>() to downcast Expressions more safely.
The as<T>() function asserts that the Expression is of the correct kind
before performing the downcast, and is also generally easier to read
as function calls flow naturally from left-to-right, and C-style casts
don't.

This CL updates several Expression downcasts in SkSL to the as<T>
syntax, but is not intended to exhaustively replace them all (although
that would be ideal). In places where we SkASSERTed the expression's
fKind immediately before a cast, the assert has been removed because it
would be redundant with the behavior of as<T>().

Change-Id: I67e7de2697aee4d9d09e6594a9abc5f2ecacc887
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311114
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-18 14:04:15 +00:00
Robert Phillips
8e54a6e9e1 Enhance assert to dump more information
Hopefully, this will let Chrome track down promiseImage fulfillment
mismatches.

Bug: 1116848
Change-Id: Ia1e5d6f7af4e2808ae4adfad85f4e96c1ea4fbd2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311096
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-18 13:53:25 +00:00
John Stiles
534d79979d Fix constness of ExternalValue* inside ExternalValueReference.
Objects in the symbol table are intentionally constant. However, when
converting "ExternalValue" AST nodes into symbols via symbol table
lookup, IRGenerator::convertIdentifier was casting away constness
because ExternalValueReference held a non-const pointer. Fixing this
involved significant ripple-effect additions of "const" throughout the
ExternalValue class and its subclasses.

These changes generally appear to be benign, but one interesting edge
case is `ExternalValue::write`, which intuitively does not seem to make
sense as a const method. However, invoking `write` should not alter the
ExternalValue object itself; rather, it is intended to alter the
*external value* that is being referenced. (In practice, nothing invokes
write() anyway except for one unit test, which continues to pass.)

This issue was discovered while converting casts to `as<T>()` calls.

Change-Id: I8ff6a477e475833d2a99c72f1c79c766b57767ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311276
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-18 13:44:05 +00:00
Chris Dalton
a8b16365f9 Stop discarding stencil buffers on tilers
Bug: b/160958008
Change-Id: I67851cb4be1a95f9f1d813846f5d4ba4b1535d9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303721
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-18 12:52:35 +00:00
skia-autoroll
f9fb071651 Roll ANGLE from a9b199b05c1f to dceaabb18162 (11 revisions)
a9b199b05c..dceaabb181

2020-08-18 jmadill@chromium.org Vulkan: Clean up ImageHelper barrier functions.
2020-08-18 ynovikov@chromium.org Re-enable a dEQP-EGL test on SwANGLE
2020-08-17 jmadill@chromium.org Vulkan: Minor cleanup to vk_helpers.
2020-08-17 cnorthrop@google.com Capture/Replay: Don't capture unused default uniforms in MEC
2020-08-17 cclao@google.com Vulkan: Add test for RGB texture not break renderpass
2020-08-17 jmadill@chromium.org Update commit ID when the git ref changes.
2020-08-17 cnorthrop@google.com Capture/Replay: Fix 1010102 vertex attrib type name
2020-08-17 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Vulkan-Headers from 6eaf979e7366 to 99638d8d7fc6 (1 revision)
2020-08-17 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Vulkan-ValidationLayers from 1980311465cf to c1db3b8e7960 (1 revision)
2020-08-17 angle-autoroll@skia-public.iam.gserviceaccount.com Roll SPIRV-Tools from b4c4da3e7606 to b8de4f57e983 (4 revisions)
2020-08-17 angle-autoroll@skia-public.iam.gserviceaccount.com Roll glslang from d253278f9865 to 758b30727efc (2 revisions)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/angle-skia-autoroll
Please CC stani@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Release-ANGLE;skia/skia.primary:Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Debug-All-ANGLE
Bug: None
Tbr: stani@google.com
Test: Test: Capture and replay first 1200 frames of COD.Test: Test: MEC capture of COD:Mobile
Change-Id: Ib796dbdba3720707f998177b07523d649c12f955
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310950
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-18 04:49:34 +00:00
skia-autoroll
8b7bbb50b2 Roll SwiftShader from abe07b943855 to 6f74415e2f74 (2 revisions)
https://swiftshader.googlesource.com/SwiftShader.git/+log/abe07b943855..6f74415e2f74

2020-08-17 amaiorano@google.com Update README to add details on Vulkan and less about GLES
2020-08-17 capn@google.com Don't rely on VectorType::get() default parameter

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/swiftshader-skia-autoroll
Please CC stani@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Test-Debian10-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader
Bug: None
Tbr: stani@google.com
Change-Id: Ib97e95f7d5fa8babfc7e272eb910dbe3c917cf57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310948
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-18 04:45:34 +00:00
skia-autoroll
e5be0fa645 Roll Chromium from 39dd8685cfa7 to 06c431ffe930 (443 revisions)
39dd8685cf..06c431ffe9

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/chromium-skia-autoroll
Please CC stani@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Perf-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-CommandBuffer;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-CommandBuffer
Tbr: stani@google.com
Change-Id: Ice2e4acc822fdd6d43614e67f9f3b202529ae234
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311256
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-18 04:35:04 +00:00
skia-autoroll
688e0966cb Roll dawn from 5e9b29fab92d to d95180deded1 (3 revisions)
https://dawn.googlesource.com/dawn.git/+log/5e9b29fab92d..d95180deded1

2020-08-17 rharrison@chromium.org Roll 4 dependencies
2020-08-17 enga@chromium.org D3D12: only lazy clear OutputAttachment textures with render target ops
2020-08-17 bryan.bernhart@intel.com Pool sub-allocated resource heaps.

Also rolling transitive DEPS:
  https://chromium.googlesource.com/external/github.com/KhronosGroup/glslang from d253278f9865 to f257e0ea6b9a
  https://chromium.googlesource.com/external/github.com/google/shaderc from ffd805115ed6 to 21b36f736809

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dawn-skia-autoroll
Please CC cwallez@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn
Bug: None
Tbr: cwallez@google.com
Change-Id: Ia00c6bfd8b74e0745a9bd31db702c9fd18bbea81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310949
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-18 04:29:34 +00:00
Mike Reed
e9d783c4d2 use pathbuilder
Change-Id: I4b40107b45cd829595e89d75e19fd063acee4221
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311106
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-17 22:05:00 +00:00
Kevin Lubick
f5931f3399 [infra] Update go to 1.15
Change-Id: Id934558f413f0931282931764bd93d3c22c38115
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311101
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2020-08-17 18:07:57 +00:00
Brian Osman
b65dc4a374 SkSL: Disallow swizzles that *only* contain '0' or '1' components
These are very easy to mis-read, and they don't make much sense.
Swizzles should refer to the base expression at least once.

Change-Id: I4c2740c7439a11b51b2eb41263c6435e3aefad35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310376
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-08-17 17:49:09 +00:00
Robert Phillips
37e6f530dc Remove some (presumably) unneeded calls to textureParamsModified in GrGLGpu
Just wrapping the backend texture shouldn't invalidate any parameters.

Change-Id: I02859e519b2c8e9612533b2230da753d5fff97b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261084
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-08-17 16:14:29 +00:00
John Stiles
ce1d885a57 Update the Gradient documentation.
Since this doc was written, we've made several changes to how gradients
work under the hood:

- Colorizers receive the t interpolant via explicit-coordinate sampling,
  not via sk_InColor
- Unused components passed to the colorizer are guaranteed to be zero
  instead of potentially arbitrary values
- We no longer have a dedicated colorizer that is responsible for
  sampling a generated texture map; GrTextureEffect is used directly
- Rewrote the section about how layout processors encode their return
  value to hopefully be more clear to a reader unfamiliar with gradients

Change-Id: I037b5718c9f67a1bece96a9b6a4daea79ccdcd80
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311076
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-17 15:57:21 +00:00
Ethan Nicholas
63d7ee398a SkSL now detects modifiers used in incorrect contexts
Change-Id: I3847a17450c3185284961f35064c4f225aeb8b61
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308769
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
2020-08-17 15:40:19 +00:00
Nigel Tao
5cfa7194d5 Drop support for Wuffs v0.2
We now only support Wuffs v0.3.

Change-Id: Iaace012977ab88922ccdf2a929dc4c809bbb4047
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311016
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-08-17 14:42:09 +00:00
John Stiles
fdbd50a8dc Simplify SkSL::String by removing unused parts.
- reset, findLastOf: these were entirely unused
- find: already existed in C++11's std::string, can just be inherited
- defaulted constructors: in C++11, these can be inherited directly from
  std::string via 'using'

Change-Id: I1772ef04e49ab905aaada2ec38c1abeb9a8e26bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311039
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-17 14:21:09 +00:00
Mike Reed
15a5403cd3 Migrate to using SkPathBuilder
Change-Id: I86a75670d7b919313747175ca3e49ef7472061fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310977
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-17 14:17:49 +00:00
Robert Phillips
6704bc87d2 Better encapsulate the GrDrawOpAtlas w/in the GrSmallPathAtlasMgr
This brings the GrSmallPathAtlasMgr into closer correspondence with
the GrAtlasMgr.

It also centralizes where we update the GrSmallPathShapeData's
atlas information.

Change-Id: I892be262a85b3878dbd7f71b0503208943203d46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310476
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-17 14:15:59 +00:00
Derek Sollenberger
866d2894eb Add android:exported values to all SkQP activities.
This fixes an issue on newer versions of Android where activities
with intent filters need to specify whether or not they are exported
in order to successfully complete installation on a test device.

Bug: b/163792247
Test: successful install on device with AOSP build
Change-Id: Iddeb27af55245e926dbf43c03ab48b257461188d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309980
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2020-08-17 13:33:09 +00:00
skia-autoroll
c4245f475b Roll ANGLE from eb85c0213d43 to a9b199b05c1f (12 revisions)
eb85c0213d..a9b199b05c

2020-08-17 cnorthrop@google.com Capture/Replay: Add ability to override entry points
2020-08-14 jmadill@chromium.org D3D: disable to translate uniform block to StructuredBuffer
2020-08-14 jmadill@chromium.org Reduce spam in native perf tests.
2020-08-14 jmadill@chromium.org Vulkan: Switch buffer barrier check.
2020-08-14 nguyenmh@google.com Add unittests of ANGLE commit message format check
2020-08-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Vulkan-Loader from 61bf3be73c1e to 527e67e9d933 (1 revision)
2020-08-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Vulkan-ValidationLayers from 6b0de7007af5 to 1980311465cf (2 revisions)
2020-08-14 msisov@igalia.com X11 and Ozone: fix compilation of tests.
2020-08-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from cda86eff6461 to abe07b943855 (1 revision)
2020-08-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll SPIRV-Tools from df859f77dab3 to b4c4da3e7606 (2 revisions)
2020-08-14 ynovikov@chromium.org Create dummy DEPS entry for Chromium.
2020-08-14 ynovikov@chromium.org Reenable AttributeLayout end2end tests on Linux SwANGLE

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/angle-skia-autoroll
Please CC stani@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Release-ANGLE;skia/skia.primary:Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Debug-All-ANGLE
Bug: chromium:1085700,chromium:1112112
Tbr: stani@google.com
Test: Test: Capture and play back first 1200 frames of COD.
Change-Id: I9d496392e0c1668a7d347fae3c7583d903deddf7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310998
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-17 04:45:39 +00:00
skia-autoroll
fc225ed21e Roll Chromium from 00c099ff627a to 39dd8685cfa7 (521 revisions)
00c099ff62..39dd8685cf

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/chromium-skia-autoroll
Please CC stani@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Perf-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-CommandBuffer;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-CommandBuffer
Tbr: stani@google.com
Change-Id: Icf5c5d85dc597fc7535f9655eb1686580b4a6d76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310996
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-17 04:40:39 +00:00
skia-autoroll
d882e93e41 Roll dawn from d315022be5b7 to 5e9b29fab92d (3 revisions)
https://dawn.googlesource.com/dawn.git/+log/d315022be5b7..5e9b29fab92d

2020-08-14 enga@chromium.org Fix ASSERT in WindowsDebugLogger
2020-08-14 enga@chromium.org end2end_tests: Forward Windows debug messages to stderr
2020-08-14 cwallez@chromium.org Remove deprecated wgpu::BufferCopyView members

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dawn-skia-autoroll
Please CC cwallez@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn
Bug: None
Tbr: cwallez@google.com
Change-Id: I189e000ba90520c4ce4ae7fafa65ebccb27c10ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310997
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-08-17 04:29:39 +00:00
Herb Derby
7491e8b30f inline routine small routines
Inline small routines from the AtlasLocator.

With these routines inlined, the benchmark drops from 402ns -> 302ns.
Over the past couple of CL the total drop is 502ns -> 302ns.

Change-Id: I7de899c20dc6759db1b70c036e319a56da44a13b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310758
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-08-16 16:40:38 +00:00
John Stiles
a008b0fa8b Enable ClangTidy check readability-redundant-smartptr-get.
To my surprise, this even works with homegrown smart pointers (such as
SkTLazy).

https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html

Find and remove redundant calls to smart pointer’s .get() method.

Examples:

  ptr.get()->Foo()  ==>  ptr->Foo()
  *ptr.get()  ==>  *ptr
  *ptr->get()  ==>  **ptr
  if (ptr.get() == nullptr) ... => if (ptr == nullptr) ...

Change-Id: I8ff541e0229656b4d8e875c8053a7e6138302547
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310976
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-16 15:56:48 +00:00
John Stiles
c1c3c6d70d Enable ClangTidy flag bugprone-suspicious-string-compare.
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-string-compare.html

Find suspicious usage of runtime string comparison functions.
This check is valid in C and C++.

Checks for calls with implicit comparator and proposed to
explicitly add it:

  if (strcmp(...))       // Implicitly compare to zero
  if (!strcmp(...))      // Won't warn
  if (strcmp(...) != 0)  // Won't warn

Checks that compare function results (i,e, strcmp) are compared to valid
constant. The resulting value is

  <  0    when lower than,
  >  0    when greater than,
  == 0    when equals.

A common mistake is to compare the result to 1 or -1:

  if (strcmp(...) == -1)  // Incorrect usage of the returned value.

Additionally, the check warns if the results value is implicitly cast
to a suspicious non-integer type. It’s happening when the returned
value is used in a wrong context:

  if (strcmp(...) < 0.)  // Incorrect usage of the returned value.

Change-Id: I001b88d06cc4f3eb5846103885be675f9b78e126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310761
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-16 03:54:08 +00:00
Brian Osman
d4a040e8b2 Remove obsolete support for sk_InColor in GrSkSLFP
There is no way to get a variable with that builtin identifier (it's
going away entirely soon), so no need for the protocol to send it to
the FP.

Bug: skia:10619
Change-Id: Icd1744d8573ded2a6fdf3c1901f46df0c91aab14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310760
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-15 20:04:47 +00:00
Jim Van Verth
939cc7a630 Some fixes for Flutter memory issues.
Now that we're using GrBuffers for uploads, we need to match the size
of the upload buffer a little better to avoid wasting memory, so this
switches to a using either a power-of-two size, or the midpoint between
two powers-of-two.

Also, the mechanism of adding the staging buffers to the current
command buffer was not being invoked when calling submit for a cross-
context texture. Switching to submitToGpu() should handle this.

Change-Id: I8e0e5ae7e4dd00b5969d5e5554e3a2bff5758e81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310339
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-08-14 23:04:46 +00:00
Jim Van Verth
e0da379fb7 Check for work completion before purging resources.
Change-Id: I17653e036ceb5f505284ae64cf6918b3bd2e02ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310762
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-14 21:26:26 +00:00
John Stiles
4e54367db3 Fix SkSL constant propagation within nested casts.
Previously, the inner type was ignored.

Change-Id: I51d251fc38358ef889b5a3f85d5f2d23bd8cf4c5
Bug: skia:10615
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310657
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-08-14 21:18:56 +00:00
Herb Derby
43f49b4d52 static routines for direct map vertices
Split out the non-color-no-clip case for future specialization. This
routine will handle the vast majority of the glyph drawing. Split out
the generalized case too.

This change alone has a 20% improvement for performance due to fewer
register spills.

Change-Id: I89650c29ca273ac6e30266c2419029a7f177b029
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310516
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-14 20:11:15 +00:00
Herb Derby
e2ba971324 signal no clipping required
The original code had the fill vertex method handling the clip, but
each glyph was clipped individually. Signal no clipping at all is need
when the sub run is entirely enclosed in the clip rect.

Change-Id: Ifc7174fe7af967c9ab7240b2c7e2c0b062d7e259
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310556
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-08-14 19:02:55 +00:00
Greg Daniel
9a18b08981 Add support for vulkan non coherent advanced blends.
There are basically 3 parts to this change.
1) Implement GrVkGpu::xferBarrier virtual
2) Plumbing the need of an xferBarrier from ProgramInfo when getting a
render pass.
3) Tracking the need for an xferBarrier on GrOpsTask via
GrProcessorSet::Analysis

Bug: skia:10409
Change-Id: I6ab8f36719b3a4db576535eb6ed1c579ae34b7a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310439
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-14 18:50:35 +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
Greg Daniel
ed629c191d Support making a VkRenderPasses with self dependencies.
The self dependencies allow us to use xfer barriers for advanced blends.
If we don't have the advanced blend extension the self dependency render
passes will also have an input attachment on them which can be used to
read the dst value in the shader.

Also has some renaming of previously plumbed values to better match what
we are doing.

Bug: skia:10409
Change-Id: I3b343064627921b8dc3debeeb6869b0f4b2dcc42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310337
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-08-14 17:35:29 +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
John Stiles
03add801fe Improve unit tests for switch-case and enum error handling.
These tests verify that switches and enums only work with constant
integral values. Floats or uniforms should be rejected with an easy-to-
understand error message.

Change-Id: Ib634cb1ca1734a4b66ba53a3476e9ee539a63e3e
Bug: oss-fuzz:24889, skia:10615
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310396
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-08-14 17:10:15 +00:00
Nathaniel Nifong
00bb722628 missed minification bug
Check SKP file version, return error string to JS caller

Change-Id: I063920259e3ead102a4c7173d7015ff98992bbf2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310338
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-08-14 17:06:05 +00:00
Mike Klein
01d0161863 byte code instructions can fit in a byte
This isn't particularly important.  It just struck me that if we're
going to be byte-thrifty, might as well go all the way.

Change-Id: I4d137731ac06643c50e6bc66cc4654abad732cea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310325
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-14 16:46:15 +00:00
Mike Klein
5778078440 clean up stray #undef
There was a time when we used to #define VECTOR(...) to make
it easy to add opcodes, but not since

    https://skia-review.googlesource.com/c/skia/+/299682

Oddly we never #undef'd VECTOR_MATRIX.

Change-Id: I4a68d29a0ee6c34ee421e1bc4e76155d110de6fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310324
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-14 16:42:35 +00:00
Greg Daniel
1247867d86 Remove ability to add waitOp to GrOpsTask.
This isn't used anywhere since we no have GrWaitRenderTask.

Change-Id: I31e5f89fabf547346886edba5db1fac819096146
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310377
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-08-14 16:37:25 +00:00
Jim Van Verth
a496e3ff07 Fix MetalWindowContext::swapBuffers.
It looks like we were expecting the drawable to be retained outside
of swapBuffers(), which isn't always the case. Move the release
to the end of the method to retain locally until we're done with it.

Bug: skia:10597
Change-Id: Ieff6a3add0554b5b221700aff88fefd7c8502f41
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309724
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-14 16:22:48 +00:00
Brian Osman
3e3db6c9a6 Make switch case handling safer
It's possible to construct a case value expression that's a compile time
constant, but fails to produce a value from getConstantInt. MSAN noticed
us using the uninitialized integer. It's now initialized, but also never
used in the failure case: We make getConstantInt return status, and give
better error messages in the two places it's used.

Bug: oss-fuzz:24889
Change-Id: I88e4e5b7bd1caeea1cf53f9b1d6f345dd8a5326f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310296
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2020-08-14 16:18:30 +00:00
John Stiles
fe0de30a87 Enable ClangTidy check modernize-use-nullptr.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html

The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.

Change-Id: Iaea2d843154c70e49d62affdc5dceb3bca8c1089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310297
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-14 16:14:30 +00:00
Adlai Holler
356bcb644c Remove SK_IMAGE_MAKE_COLOR_TYPE_AND_SPACE_USE_SOURCE_CONTEXT
This staging flag is no longer used by Chrome.

Bug: skia:104662
Change-Id: Ib788b3bb4a975e496d72729fa47fb52952ab6a12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310336
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-14 16:05:49 +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
Brian Osman
020dc5aa90 Move init code from pipeline stage generator to GrSkSLFP
Having the logic to emit, parse, and re-emit this boilerplate spread
across the generator and FP was unnecessary. Having it emitted directly
is simpler, and will allow some flexibility when we change the signature
of runtime effect SkSL.

Change-Id: I7ebd5e62bfe1e41035c4fb9efadb427be915b9f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310158
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-14 15:47:09 +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
Nathaniel Nifong
17fd901d93 Check SKP file version, return error string to JS caller
bug:skia:10579

Change-Id: I1419febc4846e33bce293e14a4666337d7965305
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310108
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-08-14 15:14:47 +00:00
Robert Phillips
2bfee21d94 Require a direct context to precompile a DDL's programs
Change-Id: I0c16c1cb2181a22ec0339d993a031d0fef0fc276
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310068
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-14 14:35:41 +00:00
John Stiles
dfded1b0a2 Describe the Skia 'onMethodName' pattern.
This pattern is used frequently throughout the codebase but seems fairly
unique to Skia. It can be misleading if you haven't seen it before.
(In particular, the `onXxxxx` naming scheme is sometimes used to
indicate message-passing or event-handling, but that's not how it is
used in Skia.)

Change-Id: I73c5f7874bc51f8fde07baa8ef6a0e47c102302a
No-Try: true
Docs-Preview: https://skia.org/?cl=310159
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310159
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-14 14:21:28 +00:00