Commit Graph

53970 Commits

Author SHA1 Message Date
John Stiles
28054added Optimize ternary tests that check a const variable.
This enables the ternary to be optimized away in code like:
   const bool SHINY = true;
   color = SHINY ? add_shine(x) : x; // to --> `color = add_shine(x);`

Without constant propagation.

Also, I added a unit test for ternary expression simplification; I
wasn't able to find an existing one.

When the optimization flag is disabled, this CL actually removes the
optimization of `true ? x : y` --> `x` entirely; previously, this
substitution would be made regardless of optimization settings.

Change-Id: I93a8b9d4027902d35f8a19cfd6417170b209d056
Bug: skia:11343
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379297
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-05 21:41:05 +00:00
Greg Daniel
3dc6c190da Have GrVkRenderTarget only use GrVkAttachments and not derive from GrVkImage.
This change moves the color and resolve attachments used in a
GrVkRenderTarget to be a GrVkAttachment. These along with the msaa
attachment now mean that GrVkRenderTarget no longer needs to derive from
a GrVkImage.

There are a couple ugly things in this CL since GrVkTexture still is a
GrVkImage since we can't share attachments between GrVkRT and GrVkTex.
But when that gets updated in the follow on CL things will look much nicer.

Bug: skia:10727
Change-Id: I2f12674d7517c6d6dea389e2d1fb7296028bcc85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379576
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-03-05 20:52:15 +00:00
John Stiles
f04e09cd9b Optimize Swizzles inside Swizzle::Make.
Swizzle optimizations now occur at IR generation time. These
optimizations are redundant with the control-flow optimization phase so
they are mostly not visible in our test output, but they do affect DSL
test results. Interestingly, they do improve our test output slightly
as well, for various reasons (e.g. we do not fully optimize lvalues in
the control-flow pass).

Change-Id: I6ebe6d71a5c22d9823b5fa500e43078915cbfb45
Bug: skia:11343
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372257
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-05 20:09:55 +00:00
Brian Salomon
d63638bb7b Copy on write for wrapped backend texture surfaces.
Makes SkImage_Gpu backed by two proxies, an original and a copy. The
image uses the original until a new render task is bound to it at which
point further uses of the image will use the copy. If the image is ever
used off a GrDirectContext we fall over to the copy. If the copy is
never used and never can be used by the next flush then the render
task that populates it is marked "skipped" and we don't perform the
copy.

Bug: skia:11208

Change-Id: Id255f4a733acc608c8a53c1a5633207aeafc404b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366282
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-05 19:50:05 +00:00
Chris Dalton
cad44bcdd2 Use analytic AA in FillRRectOp even if the target has MSAA
Bug: skia:11396
Change-Id: Ia29fd5c9f00006274bb2aa1db96fbad57d858786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380016
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-05 17:28:05 +00:00
Mike Reed
319565ac6e Clean up prev experiment.
- Only need 4 (not 5) samples
- Document some of the math
- Use round of CTM to better match 'brute-force' version

Change-Id: Ibcc8e8eabc10158da8eecaba303385ed79218126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379847
Reviewed-by: Mike Klein <mtklein@google.com>
2021-03-05 15:56:14 +00:00
Peng Huang
a42ed48e84 Fix a double free problem in YCbCrImageGM::createYCbCrImage()
If SkImage::MakeFromTexture() fails, the reelase_ycbcrhelper will
also be called, so ycbcrHelper.release() should be always called.

Change-Id: I104e02155da653bcb465723cbead595f16459fca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379848
Commit-Queue: Peng Huang <penghuang@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-03-05 15:36:25 +00:00
Herb Derby
bf2dd2af49 Reland "rename GrSDFTOptions to GrSDFTControl"
This is a reland of 40a9061203

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Change-Id: Iba0816159a8ef99448a0040c487e56700b96be5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379845
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-05 15:24:35 +00:00
John Stiles
b9e4f649b4 Simplify constructors at IR generation time.
This performs the same simplifications as the control-flow phase, but at
IR generation time. There's no visible difference in the tests (besides
DSL) because these aren't new optimizations; they're just happening
at a different phase of compilation.

Change-Id: I26d241167b0e690b23f8f4370339714783c8d6fd
Bug: skia:11343
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371482
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>
2021-03-05 15:07:35 +00:00
John Stiles
0404933136 Remove CFG-based check for missing value-returns.
This check is redundant; we now determine this at function finalization
time (http://review.skia.org/379056) and error out before this check
can be reached.

Change-Id: I1706adb90435b430883d7d1ab44cb5dc98fccd8c
Bug: skia:11377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379836
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-05 15:04:06 +00:00
John Stiles
532138cea7 Restore 'medPrecision' label in ellipse effect FP.
This was removed in http://review.skia.org/377842 to allow compilation
without control-flow analysis. We now support const bools in @if
statements (as of http://review.skia.org/379063) and can relax this
restriction a bit.

Change-Id: If3e8018c599d765075568a90af94fb4e4cb25118
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379797
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-05 14:00:15 +00:00
Mike Reed
48bfa48809 Revert "cache the creation of one GrAtlasTextOp"
This reverts commit 4b1fb7ca90.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> cache the creation of one GrAtlasTextOp
>
> GrAtlasTextOp has a high probability of being merged with the
> previous op. This cache keeps using the same op to merge with
> keeping memory warm.
>
> This show about 5.75% improvement in skpbench on desk_nytimes.
>
> When compiling for ios 9 or earlier, this optimization is
> disabled.
>
> Change-Id: I13ccbef6dcd4b9d82103bf20bba7d94f3e4fb6f4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376718
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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

Change-Id: I2def6e1043dcca2fd41c40facd20b4d18971ed17
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379840
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:15:53 +00:00
Mike Reed
9edff53a73 Revert "rename GrSDFTOptions to GrSDFTControl"
This reverts commit 40a9061203.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I0483cbada23c76bdd5ccdb51936bb20a819343cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379839
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:15:22 +00:00
Mike Reed
606a9ab831 Revert "add noexcept to GrAtlasTextOp delete"
This reverts commit 6ba242d2a2.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> add noexcept to GrAtlasTextOp delete
>
> Change-Id: Icb2d8ce9ac75454b89342aa737d563cf45eaba3e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379756
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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

Change-Id: Ib42e19110c1221157d4245233f09a18401bd4f7d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379838
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:14:44 +00:00
skia-autoroll
994a571fc7 Roll Dawn from 637d947937b7 to 95034f6528d4 (8 revisions)
https://dawn.googlesource.com/dawn.git/+log/637d947937b7..95034f6528d4

2021-03-05 bclayton@google.com Enable the BoundArrayAccessors tint transform
2021-03-05 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from e18a18bc1c71 to f9f48c60f700 (8 revisions)
2021-03-04 cwallez@chromium.org Rename Buffer/TextureCopyView to ImageCopyBuffer/Texture.
2021-03-04 cwallez@chromium.org DEPS: Make everything gated on dawn_standalone
2021-03-04 cwallez@chromium.org Make Extent3D::width non-optional.
2021-03-04 enga@chromium.org Statically link the dawn_end2end_tests
2021-03-04 bclayton@google.com ShaderModule: Use tint::diag::List::str()
2021-03-04 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from ec44eef965b6 to e18a18bc1c71 (2 revisions)

Also rolling transitive DEPS:
  https://dawn.googlesource.com/tint from ec44eef965b6 to f9f48c60f700

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 rharrison@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: rharrison@google.com
Change-Id: I1c5082b209bcb06fb0ff0ff6289f6b2a5a89409a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379936
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-03-05 07:10:54 +00:00
skia-autoroll
d42fe062d0 Roll ANGLE from 90db604919ba to fe2efefac498 (14 revisions)
90db604919..fe2efefac4

2021-03-04 m.maiya@samsung.com Add FramebufferAttachmentPerfTest
2021-03-04 enga@chromium.org Revert "Add support for Linux GPU info with Vulkan backend"
2021-03-04 m.maiya@samsung.com Vulkan: Unmap buffer when adding to mBufferFreeList
2021-03-04 natsu@google.com Vulkan: Enable EGL_ANDROID_recordable for EGL configs on SwiftShader
2021-03-04 jmadill@chromium.org infra/config: Rename console/list views.
2021-03-04 syoussefi@chromium.org Translator: Rename GLSL to SPIR-V in Vulkan and Metal output
2021-03-04 ynovikov@chromium.org Suppress UNINSTANTIATED_PARAMETERIZED_TEST failures on Ozone
2021-03-04 xiaoxuan.liu@arm.com Add support for Linux GPU info with Vulkan backend
2021-03-04 lexa.knyazev@gmail.com Partially upgrade codegen to Python 3
2021-03-04 ynovikov@chromium.org Replace Win x64 dEQP GPU.FYI bots with chromium.angle bots
2021-03-04 angle-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 106e01583a3a to 084529f3a9b9 (1 revision)
2021-03-04 angle-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from 6c3f8d8c39b9 to c0db6ae3d87d (6 revisions)
2021-03-04 syoussefi@chromium.org Vulkan: Fix overlay graph widgets
2021-03-04 syoussefi@chromium.org Vulkan: Fix Overlay for prerotation

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
Tbr: stani@google.com
Test: Test: `cts -m CtsMediaTestCases` on Cuttlefish w/ SwANGLE
Change-Id: Ib5cf22d2c0dfbd5d2eecf53adfdc843df2e646dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379937
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-03-05 05:16:54 +00:00
skia-autoroll
324e08346c Roll SwiftShader from 084529f3a9b9 to 6846389f25ca (1 revision)
https://swiftshader.googlesource.com/SwiftShader.git/+log/084529f3a9b9..6846389f25ca

2021-03-04 srisser@google.com Implement VK_KHR_timeline_semaphore

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: Icebcd2e5cf3721eeba88cb79100e0ec72cf8eafd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379956
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-03-05 04:53:54 +00:00
Mike Reed
3b58d38966 Upscaling demo
Change-Id: I22f26ff2a618f95f6f4f9ab0962a3fede509f1e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379837
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-05 02:30:49 +00:00
Herb Derby
6ba242d2a2 add noexcept to GrAtlasTextOp delete
Change-Id: Icb2d8ce9ac75454b89342aa737d563cf45eaba3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379756
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-04 23:55:49 +00:00
Brian Osman
c8d836f176 Fix copy-paste error in prim-proc attribute key generation
Change-Id: I40844d08af9b027a2d6095d485537dad802a92c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379796
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-04 22:53:25 +00:00
John Stiles
b3dcbb12ef Detect functions that fail to return a value, without using CFG.
This check now runs at function finalization time, before constant
propagation has occurred; this affected the "DeadIfStatement" test.

Our detection isn't smart enough to realize that a loop will run zero
times, so it treats `for` and `while` loops as always running at least
once. This isn't strictly correct, but it actually mirrors how the CFG
implementation works anyway. The only downside is that we would not flag
code like `for (i=0; i<0; ++i) { return x; }` as an error.

Change-Id: I5e43a6ee3a3993045559f0fb0646d36112543a94
Bug: skia:11377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379056
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-04 22:47:05 +00:00
Ethan Nicholas
daed2592bb Made SkSL DSL into public API
In addition to the unsurprising changes to eliminate references to
src/, we also had to tighten up some C++17-isms as they are not
permitted in public headers.

Change-Id: Ie5005a33d7a135e69fb66beca5e7a5f960dbd453
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378496
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-04 21:03:58 +00:00
Mike Reed
ff83dda8cd Cache image behind picture-shader
PictureShader = picture + tiling + depth/colorspace + filtering [+ scale]

Today we cache the imageshader that is used to rendering. However, the
key for that cache is the pictureshader's ID itself... which means if
we have several, all using the same picture (but maybe diff tiling) we
would create dup cache entries.

Idea:
1. only cache the image (rastered picture), not an imageShader
2. key the cache on the picture's ID, not the shader's

Several implications of this:

1. Should get more cache reuse, since we don't care about the
shader's ID (which is just wrapping a picture+tiling, etc.)

2. We also eliminate the indirection of creating a PictureImage. Instead
we're creating real (pixel) images, and caching those. This removes one
extra layer of "cache".


Idea: when we cache something for pict
Change-Id: I51cf4e9bff3c91ce1872876597d3d565039d8c7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377844
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-03-04 20:48:30 +00:00
Brian Osman
3316796acb Cleanup and reorganize GrProgramDesc::Build and key layout
Move all of the processor-specific information into functions, rather
than splitting it between the calling and called code.

Stop putting the size of the key into the key. This was an attempt to
avoid collisions (I assume), but felt odd. Instead, add a few important
bits to more reliably protect against collisions, like # of vertex
attributes, # of child FPs, etc.

Important: Stop calling visitTextureEffects to put fp sampler info in
the key. That function visits the entire fp *tree*, so we were adding
sampler information in large FP trees many times. Instead, just add the
sampler information when the specific fp we're emitting is a texture
effect.

Finally, change addString to appendComment, to make it clear that it
doesn't impact the actual key at all.

Bug: skia:11372
Change-Id: Ibf10db1165b27857e5e5e712db538749b41883a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379736
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-04 20:47:31 +00:00
John Stiles
9b660ef638 Reformat generated files with bin-packing off.
Housekeeper-PerCommit-GeneratedFiles has been complaining due to
http://review.skia.org/379656

Change-Id: Id6689261b6e1fbb444730babd52ccfcbd9929e21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379738
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-04 20:47:06 +00:00
Herb Derby
40a9061203 rename GrSDFTOptions to GrSDFTControl
Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-04 19:49:10 +00:00
Herb Derby
4b1fb7ca90 cache the creation of one GrAtlasTextOp
GrAtlasTextOp has a high probability of being merged with the
previous op. This cache keeps using the same op to merge with
keeping memory warm.

This show about 5.75% improvement in skpbench on desk_nytimes.

When compiling for ios 9 or earlier, this optimization is
disabled.

Change-Id: I13ccbef6dcd4b9d82103bf20bba7d94f3e4fb6f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376718
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-04 18:45:59 +00:00
Mike Klein
b2045a3461 make runtime effect caching opt-in and private
We don't need to force public API users into using our cache; they can
cache on their own however they like.  We also don't need to force
internal users to cache, though I suspect most will want to.

I've kept deserialization using the cache, since that's an API users
can't reasonably cache themselves.  Though that's another area to expand
into, hooks for serialization and deserialization, that sort of thing.

Change-Id: I1496b193576b68c88be1dccd30d971cced54b340
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379599
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-03-04 18:24:30 +00:00
Brian Salomon
be2bc7c0e3 no more bin packing in .clang-format
Change-Id: I24324d4478c10c868b27e7375520c7cb3b06d21d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379656
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-04 17:22:50 +00:00
John Stiles
2b6ec98a82 Disallow unscoped for blocks which declare a variable.
This should be legal, and we support this, but some versions of Android
do not: http://screen/3bkQewHF3xUMn5v There's no point in allowing
these shaders to exist; they can't compile on real-world clients, and
these vardecls are borderline meaningless (as the variables being
declared aren't reachable by any other statements).

Change-Id: Ie1351933c90caee9124eeab8983364ec030b2653
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379584
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-04 17:04:40 +00:00
Brian Osman
ef3725fa6e Remove a level of indirection with GrProcessorKeyBuilder
Bug: skia:11372
Change-Id: Icb36f665ae9ce39b32d7626b3114c3303923f33e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379583
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-04 16:58:50 +00:00
John Stiles
03467a53e6 Revert "Disable control-flow analysis in SkSL. (Performance experiment)"
This reverts commit 50b1b2b90d.

Reason for revert: ending experiment

Original change's description:
> Disable control-flow analysis in SkSL. (Performance experiment)
>
> This CL will be used to test for potential performance regressions (or
> improvements?) that we might incur by disabling this optimization pass.
>
> It will be reverted in ~1 day.
>
> Change-Id: I775cdb0c95df81fa25ebbd66e4ff01f64c660f68
> Bug: skia:11319
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378456
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: Ie385a82db237ff5651348d82b9651f8ba09375b9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379581
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-04 15:20:09 +00:00
John Stiles
a0e56e3647 Allow ProgramVisitor::visitStatement to receive SwitchCase statements.
The original dispatched all the SwitchCase statements from within the
Switch handler. This splits it apart, so that individual SwitchCases can
be handled in a ProgramVisitor subclass' `visitStatement`. No existing
Analysis passes look for SwitchCase statements (they weren't sent!) so
this is currently a no-op change. This functionality will be used in a
followup CL.

Change-Id: I4c18cf4f67130df7e37a4d78a7d1d584764d75ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378780
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-04 15:14:29 +00:00
Brian Osman
48d7f7ca20 Add new style key information to several core effects
Covers some common geometry processors, texture effect, etc.

This also rearranges how fp keys are arranged in the overall key. We no
longer include the key size as part of the key - this made no sense.
Instead, we explicitly include the number of children. We also put all
data for one fp before any children, so the tree can be reconstructed
more-or-less top-down.

Finally, added an "addBool" helper that reads nicer than addBits(1)
everywhere.

Bug: skia:11372
Change-Id: I4e35257fb5923d88fe6d7522109a0b3f4c4017d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379059
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-04 14:49:07 +00:00
Robert Phillips
962708fbb9 GrGlGpu::ProgramCache no longer holds a GrGlGpu back pointer
In the threaded compilation world, the GrUtilityContext active on
a given thread will have to be passed in to the cache.

Change-Id: Id4f59b2e710080ab808275aeb2ffbcab38b3eadc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379061
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-03-04 14:29:57 +00:00
Mike Reed
b9bd12d6f8 Clarify how we decide the bitdepth for picture-shader
Change-Id: I6dafe3ec3cac988fd1bc6f97e2c0fc5c251a2d15
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379296
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-03-04 14:28:16 +00:00
Adlai Holler
55aaefe687 Reland "Support sharing promise images between DDLs"
This reverts commit 38b9a4bc3e.

Reason for revert: Fixed ASAN, TSAN, and other bugs via other CLs.

Original change's description:
> Revert "Support sharing promise images between DDLs"
>
> This reverts commit 07e11d48cb.
>
> Reason for revert: Broke DDL3_ASAN and DDL3_TSAN
>
> Original change's description:
> > Support sharing promise images between DDLs
> >
> > - Migrate our code to SkImage::MakePromiseTexture
> > - Have DDLTileHelper share one SKP and one set of promise images across all tiles.
> > - Disallow on-the-fly allocation of mips for promise textures.
> >
> > Bug: skia:10286
> > Change-Id: Ie35976958454fc520f3c9d860e6285441260c9f7
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291938
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: I939b14875d1a20e4a92eab94680adcfe9596ad81
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10286
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375738
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>


Bug: skia:10286
Change-Id: Ibfd7dfcd72f10a4e29a87fa8c610f2dfd018e0db
Cq-Include-Trybots: luci.skia.skia.primary:Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-DDL3_ASAN,Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-DDL3_TSAN
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375739
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2021-03-04 13:10:37 +00:00
skia-autoroll
4b9f428b12 Roll ANGLE from 1de8b5a697e7 to 90db604919ba (11 revisions)
1de8b5a697..90db604919

2021-03-03 syoussefi@chromium.org Vulkan: Workaround Overlay draw issue on Android
2021-03-03 senorblanco@chromium.org Fix for readPixels() to PBO fast path.
2021-03-03 cnorthrop@google.com Tests: Add Rope Hero: Vice Town trace
2021-03-03 penghuang@chromium.org Workaround a GL_OES_depth32 bug on Android emulator
2021-03-03 lexa.knyazev@gmail.com Update DEP actions for Python 3
2021-03-03 cnorthrop@google.com Tests: Skip car_parking_multiplayer on Nvidia
2021-03-03 syoussefi@chromium.org Overlay: Widget for vk::DynamicBuffer allocations
2021-03-03 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Chromium from 2a5fa9108962 to 143c12daa39f (878 revisions)
2021-03-03 jonahr@google.com Skip TransformFeedbackTest.MultiContext on Metal
2021-03-03 cnorthrop@google.com Tests: Add Talking Tom Hero Dash trace
2021-03-03 angle-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from 64e40ae7572f to 6c3f8d8c39b9 (7 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
Tbr: stani@google.com
Test: Test: angle_perftests --gtest_filter="*car_parking_multiplayer*"Test: Test: angle_perftests --gtest_filter="*rope_hero_vice_town*"Test: Test: angle_perftests --gtest_filter="*talking_tom_hero_dash*"
Change-Id: I6c1296fa95190f34d3deec978f3fe025460f34a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379360
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-03-04 05:24:56 +00:00
skia-autoroll
21c8ad62cd Roll Dawn from f9d75ead9e2d to 637d947937b7 (4 revisions)
https://dawn.googlesource.com/dawn.git/+log/f9d75ead9e2d..637d947937b7

2021-03-03 senorblanco@chromium.org Roll third_party/angle/ 0e11e49d1..d8557cc88 (25 commits)
2021-03-03 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from e879143801a1 to ec44eef965b6 (5 revisions)
2021-03-03 rafael.cintron@microsoft.com Protect Texture::DestroyImpl against multiple calls for D3D12
2021-03-03 enga@chromium.org Add XlibXcbFunctions to the CMake build

Also rolling transitive DEPS:
  https://dawn.googlesource.com/tint from e879143801a1 to ec44eef965b6

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 rharrison@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: rharrison@google.com
Change-Id: I3f534115974387c37916fefaf69dcb01576a9419
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379376
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-03-04 05:02:57 +00:00
skia-autoroll
f3a46451ad Roll SwiftShader from 106e01583a3a to 084529f3a9b9 (1 revision)
https://swiftshader.googlesource.com/SwiftShader.git/+log/106e01583a3a..084529f3a9b9

2021-03-03 venni.ihanakangas@siru.fi Add support for internal error status checking in regres

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: I4f61af1f42bcdca000aab2eb29d48c62bb7843b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379359
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-03-04 04:55:26 +00:00
Adlai Holler
4db5726495 Bail if context creation fails in FuzzDDLThreadingGL
Bug: oss-fuzz:31634
Change-Id: I9717d04d391c584f28d415fa728c7296edb91723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379038
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2021-03-04 03:50:26 +00:00
Herb Derby
e4ef35caa1 add matrix compare to text blob key
In multi-threaded use, the cache would return a blob with direct
sub runs without comparing matrices. If two direct blobs have
different matrices, then they are incompatible. The original
code would find that the blob did not exist in the cache.
It would then make a new blob and insert it into the cache.
During that time, a different thread would create an
incompatible blob and insert it into the cache. The original
thread would insert the new blob into the cache, but the cache
finding an existing blob would return the incompatible blob.

The solution was to make the matrix, and drawing type part of
the key. Now, only compatible blobs are returned from the cache.

Change-Id: I318c756f07c84dd48b353b25639f9dcbe80c7b4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377976
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-03 22:25:56 +00:00
John Stiles
4633c9149b # Enter a description of the change.
Reland "Migrate if-statement simplifyStatement logic to IfStatement::Make."

This reverts commit 7e685f0377.

Reason for revert: fixed SkSLBench perf test

Original change's description:
> Revert "Migrate if-statement simplifyStatement logic to IfStatement::Make."
>
> This reverts commit e4da7b672f.
>
> Reason for revert: breaks SkSLBench perf test
>
> Original change's description:
> > Migrate if-statement simplifyStatement logic to IfStatement::Make.
> >
> > This performs essentially the same simplifications as before, just at
> > a different phase of compilation.
> >
> > Change-Id: Ia88df6857d4089962505cd1281798fda74fd0b02
> > Bug: skia:11343, skia:11319
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376177
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I0051188ffe69426904066eb60a932435efdc2af8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11343
> Bug: skia:11319
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379062
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:11343
Bug: skia:11319
Change-Id: I74cc3295004133e9fdcf16e388106eb83603f526
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379063
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-03 22:21:36 +00:00
John Stiles
50b1b2b90d Disable control-flow analysis in SkSL. (Performance experiment)
This CL will be used to test for potential performance regressions (or
improvements?) that we might incur by disabling this optimization pass.

It will be reverted in ~1 day.

Change-Id: I775cdb0c95df81fa25ebbd66e4ff01f64c660f68
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378456
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-03-03 22:08:56 +00:00
Jim Van Verth
84ded4d46c Implement GrMtlGpu::compile().
Revises how we build/find GrMtlPipelineStates to no longer be dependent
on GrRenderTarget.

Change-Id: I54abcc3a28505ae4ef6e1944f839fbe78d28cf7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379058
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-03-03 20:50:39 +00:00
John Stiles
7e685f0377 Revert "Migrate if-statement simplifyStatement logic to IfStatement::Make."
This reverts commit e4da7b672f.

Reason for revert: breaks SkSLBench perf test

Original change's description:
> Migrate if-statement simplifyStatement logic to IfStatement::Make.
>
> This performs essentially the same simplifications as before, just at
> a different phase of compilation.
>
> Change-Id: Ia88df6857d4089962505cd1281798fda74fd0b02
> Bug: skia:11343, skia:11319
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376177
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I0051188ffe69426904066eb60a932435efdc2af8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11343
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379062
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-03 20:50:37 +00:00
Brian Osman
4c5943781e Emit new style key information in generated effects
All layout(key) fields include the field name meta-data, and use as few
bits as possible.

Bug: skia:11372
Change-Id: Ie12b3e0d01148457e5ea078cbf7d0a4bff35302e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378596
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-03 20:39:36 +00:00
Brian Osman
9e1ef99d1e fm: Make --writeShaders dump fragment, vertex, and key files
Bug: skia:11372
Change-Id: Ib764b8d995655317e8968e57b1ea0528339d430b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379060
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-03 20:10:06 +00:00
Mike Klein
dc41f59b3d update FM service account
We're not compiling, so definitely don't need that, right?
I do eventually want to upload from these tasks to Gold.

Change-Id: Ia6bac7e38c6a264f2f93cebd9746e4aaed9f4b5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379003
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2021-03-03 20:01:39 +00:00
Brian Osman
db6ad656ee Add Enum::foreach(), change EnumValue to return SKSL_INT
This gives a nicer interface (name + SKSL_INT) to getting all the values
of an enum (rather than iterating over the symbol table). Will be used
in a follow-up CL.

Change-Id: I1c104623bd06f770c57b88ca9996d3e8c87a3ca7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379057
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-03-03 19:29:36 +00:00