Commit Graph

8380 Commits

Author SHA1 Message Date
Robert Phillips
c2fe1644db Add time-based purging to the GrThreadSafeUniquelyKeyedProxyViewCache
Bug: 1108408
Change-Id: I7dd4a3b1b20f3267903dd7f303a2d639b562d84a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318761
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-23 13:07:50 +00:00
Michael Ludwig
462bdfc06e Allow non-AA clip rects to be scissor only even on MSAA targets
This appears to fix the performance regressions seen on a number of webpage
SKPs for vkmsaa8 and glmsaa targets on devices that can't disable multisampling.

Bug: skia:10730
Change-Id: I2c10a78cfe864f987b7f17eb69eb2e1712ca0676
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317772
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-23 13:05:00 +00:00
John Stiles
d4867c94be Add rc accessor method to SkMatrix.
FP gencode reads back matrix values in its dumpInfo method using rc().
This worked for SkM44; now it will work for SkMatrix as well.

Change-Id: I4efc7018529bd3c84aacc073fad2bfca7e12c517
Bug: skia:10748
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318756
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-22 21:32:20 +00:00
John Stiles
544a32ff23 Promote bool(k) to true/false during constant propagation.
Cleaned up some nearby code while implementing this fix as well.

Change-Id: Ic084451f0d9fc12169e1720a8889a290249eb5e9
Bug: skia:10750
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318796
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-22 21:18:49 +00:00
John Stiles
9878d9e62f Fix nondeterminism when copying intrinsic functions.
Previously, we copied intrinsic functions in a totally arbitrary order;
it used an unordered_set of pointers, so it could be affected by
switching standard libraries OR by malloc nondeterminism. (Surprisingly,
it was fairly consistent in practice on OS X/Linux.) This CL sorts the
intrinsic functions into a consistent order before copying them.

Change-Id: If90342bb77a9ae237a3ce91be3a9847311a722c4
Bug: skia:10749
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318700
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-22 20:20:19 +00:00
Robert Phillips
331699c9ea Yet more GrThreadSafeUniquelyKeyedProxyViewCache purging tests
This CL also renames dropAllUniqueRefs

Bug: 1108408
Change-Id: Ic39ccfc5efafd60d53524562dd308102fb134d94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318737
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-22 20:02:40 +00:00
Robert Phillips
c61c895393 Fix a GrThreadSafeUniquelyKeyedProxyViewCache test
I broke this when I switched over to the SkTDynamicHash

Bug: 1108408
Change-Id: I906b41330440d084ba2e97c0162af38a79da0529
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318696
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-22 19:08:49 +00:00
John Stiles
d0e4840b11 Fix crash when swizzling a bvec with constant 0/1s.
Code like
  bool4 result = val.xy01;

Will now be converted to:
  bvec4 result = bvec4(val.xy, bool(0), bool(1));

Previously it tried to do this, but there isn't an implicit conversion
from int to bool, so it was silently failing and adding nulls into the
constructor:
  bvec4 result = bvec4(val.xy, $coerceToBool(0), $coerceToBool(1));

This CL also cleans up some related code that I was checking while
trying to understand the nature of the error.

Change-Id: I5b7d96760a03170ff78b46251c4182cc4e89836f
Bug: oss-fuzz:25781
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318636
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-22 19:08:42 +00:00
John Stiles
5f35ac9faa Add unit test for swizzling booleans.
This test currently crashes skslc, but will be fixed in the followup CL.

Change-Id: I3683d94a310242e8ca67560296518fd1223b28d0
Bug: oss-fuzz:25781
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318656
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-22 18:47:19 +00:00
Robert Phillips
187b04b357 Increase testing of GrThreadSafeUniquelyKeyedProxyViewCache wrt GrResourceCache purging
Bug: 1108408
Change-Id: I2d6f89ce71b8d94be22b1ff38b9e205df94ca765
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318205
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-09-22 16:54:39 +00:00
John Stiles
a9be76de8b Reduce the number of inliner temporaries by swizzling.
Ideally the inliner would be smart enough to avoid creating a temporary
at all just for a swizzle, but a good first step is to create fewer of
them.

Change-Id: Icd6f86c294237488f7923dc787bb64a5f99bd0ac
Bug: skia:10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318213
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-22 15:43:19 +00:00
John Stiles
1a49a5334c Restructure blend functions to allow for smarter inlining.
Early returns can cause the inliner to generate suboptimal code. We
control our built-ins, so let's avoid them where we can.

Patterns like this challenge the inliner:
    if (x) return y;
    return z;

But this can be replaced by equivalent code that inlines better:
    return x ? y : z;

Or, if a ternary can't be used, this also does a better job:
    if (x) return y;
    else return z;

In several cases, this allows the inliner to avoid generating a
do-while(false) block for control flow.

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

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

Change-Id: Iff612dcd4bad8824b5e6e97413ffce19e5ea1c0e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318336
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-21 21:53:41 +00:00
Greg Daniel
9a48697bd7 Allow client to pass in VK_IMAGE_LAYOUT_UNDEFINED into mutable state change requests.
Passing in VK_IMAGE_LAYOUT_UNDEFINED will tell Skia to not update the
layout when doing the state change.

Bug: skia:10742
Change-Id: Ic59b7c95d3a73e29dcd6eec16a2fd138e1a1d95f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318204
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-09-21 20:38:42 +00:00
Adlai Holler
d8ca58a332 Remove SkCanvas::getGrContext & GrRecordingContext::backdoor
These are no longer needed now that we've migrated away.

Change-Id: Id308af7d40ffe0d539a3c6fd201220d145080928
Docs-Preview: https://skia.org/?cl=317281
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android,Canary-G3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317281
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-09-21 16:46:21 +00:00
Brian Salomon
32d41b7e45 Stop building GL backend on Android Vulkan builders
Should reduce build time and avoid running GL unit tests redundantly
on Vulkan bots.

Change-Id: I67379e6820dab2f038175a825ee1461086a2da84

Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_Vulkan
Change-Id: I67379e6820dab2f038175a825ee1461086a2da84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318196
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-21 14:54:00 +00:00
Robert Phillips
4559368cc4 Add MRU to GrThreadSafeUniquelyKeyedProxyViewCache
Bug: 1108408
Change-Id: I54ae1512340408e61c2fb2f408b006d6f7697cf7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317860
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-21 13:31:40 +00:00
John Stiles
046828f239 Fix generated file.
This wasn't rolled back automatically by the revert at
http://review.skia.org/317976, because this unit test did not exist yet
when that CL was submitted.

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

Reason for revert: IRGenerator inline change reverted

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

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

Change-Id: Ie38a29495ea8497f9db26d2603df179e696ac5ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317977
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-19 14:13:54 +00:00
John Stiles
941fc7174f Revert "Remove inliner from IR generation stage."
This reverts commit 21d7778cb5.

Reason for revert: Pinpoint absolutely hates this change

Original change's description:
> Remove inliner from IR generation stage.
> 
> There is no need to inline code during IR generation, as the optimizer
> can now handle this.
> 
> Change-Id: If272bfb98e945a75ec91fb4aa026e5631ac51b5b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315971
> Commit-Queue: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

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

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

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

Change-Id: I6aba0b52fe49552f170fca25d81c29c515044ef5
Bug: skia:10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317861
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-18 20:57:12 +00:00
John Stiles
910845fac1 Add program-settings flag to disable the inliner.
Change-Id: I6c4e7f6a2aab6710221029022a3a5f3ec323c5e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317856
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-18 20:30:22 +00:00
Robert Phillips
f3e2b3cba3 Switch the thread-safe proxy cache over to using an arena for its entries
Bug: 1108408
Change-Id: Ib0260f72be3ac04fc1cf82c857bf4e99ec4ea239
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317770
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-18 19:42:32 +00:00
John Stiles
be0a9ca63d Migrate remaining SkSL GLSL tests to golden outputs.
Change-Id: I72fd3083f75ca5bf74fb2c3b032465864a13aed5
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317771
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-18 19:22:19 +00:00
John Stiles
21d7778cb5 Remove inliner from IR generation stage.
There is no need to inline code during IR generation, as the optimizer
can now handle this.

Change-Id: If272bfb98e945a75ec91fb4aa026e5631ac51b5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315971
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-18 18:41:08 +00:00
Robert Phillips
752f7e1692 Actually test the direct-context's thread-safe proxy cache
This CL:
  connects the tests to the live cache
  switches the cache over to using an SkTDynamicHash

Bug: 1108408
Change-Id: I1876baf13a8d12a1ec398f49e2b2d51f434d6d0e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317764
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-18 18:00:08 +00:00
John Stiles
87e6ccde21 Migrate geometry SkSL tests to golden outputs.
Change-Id: I01c150d6bfcdd1500033521a87c058c7428c3521
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317769
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-18 17:34:22 +00:00
John Stiles
c884631f99 Migrate Derivatives tests to golden outputs.
Change-Id: I35ff25c4cc394c1a4a964207ece87095a9ba84cf
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317767
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-18 17:30:07 +00:00
Chris Dalton
fd53e6355c Lift SkMeasureAngleInsideVectors and SkFindBisector to public SkGeometry API
Also improves SkChopCubicAtMidtangent robustness in degenerate cases.

Bug: skia:10419
Change-Id: I54a1187ce4286ee87c2e5230082844a303830bf4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317165
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-09-18 17:29:18 +00:00
Chris Dalton
34c5052657 Don't simplify a stroked shape if it isn't closed
A stroke that starts and ends at the same point is not the same as a
stroke with an explicit close.

Bug: skia:10419
Change-Id: Ibd8b6cd4ba04b2b9acf3dee6d01ad88ba6ba7071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317650
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-09-18 16:20:59 +00:00
John Stiles
6798e5d0d1 Migrate SkSL error tests to golden outputs.
Change-Id: Ic8f4730d035981c32b4ddb48e5e919b0396b6d93
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317578
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-18 13:46:17 +00:00
Mike Reed
b4aa639f23 Refactor API for mipmap-builder,
now the builder returns the new image.

Change-Id: Ie56256390b96d3fdbe39f89784276947047df656
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316442
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-09-17 21:46:44 +00:00
John Stiles
27f189fa4f Allow constant propagation of unary negation.
The copy_constant function did not expect to see a prefix expression.

Change-Id: Id2beb64b8d65f6b35cd68306452104ba28f56f2b
Bug: skia:10734
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317616
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-17 21:10:34 +00:00
Brian Osman
bf2163f267 SkSL: Only allow bitwise ops on integral types
We were allowing these ops on floating point types. The resulting GLSL
would fail to compile. We also allowed >>= and <<= on vectors (but not
any of the other bitwise ops).

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

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

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

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

Change-Id: I79204df047b024533ed6bc1f4c088e0e878d5bb1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317246
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-17 16:41:18 +00:00
John Stiles
72664bede4 Add support for #pragma settings comments in SkSL.
This will allow us to write skslc-based golden tests that deviate from
the standalone skslc settings.

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

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

Change-Id: I3f3c29bf87f73e501561d7bfcdaabe8acc14b89f
Bug: skia:10694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317390
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-16 20:11:17 +00:00
John Stiles
6e49a372de Avoid redundant zeros and ones in swizzle constructor.
Bug: skia:10721
Change-Id: Ib9e51b736bafb6e4493db4f50e9835fbd86c415d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317247
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-16 19:10:37 +00:00
Michael Ludwig
e4b79699ef Use SkClipOp::kIntersect instead of kReplace_ClipOp
This fixes the perf bot crashes from https://skia-review.googlesource.com/c/skia/+/317209
and removes a few other instances of kReplace_ClipOp that are equivalent to the
still supported SkClipOp::kIntersect op. Other than the benchmark case, the GPU
clip stack wasn't hitting these cases but they do need to be updated when the deprecated
ops are fully removed.

At this point, the remaining uses of deprecated clip ops are all in unit tests that
specifically test a clip stack (raster, conservative, or skclipstack) that specifically
supports expanded clip ops and the tests are testing those operations. They can remain
until we remove full support.

Bug: skia:10208
Change-Id: I5703bf43fd41b6addf329190a70c5429d5971240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317380
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-16 18:37:37 +00:00
John Stiles
7f6378f7f8 Migrate swizzle tests to golden SkSL files.
This simplifies life when revising the swizzle logic.

Change-Id: I7fc63c0cc845c4741c17c82b3078040264b61ba0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317379
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-16 18:16:07 +00:00
Mike Klein
63620fdf63 add another q14x2 test
I suspected this wouldn't work, but turns out it's fine.

Change-Id: I91042d458804f3a6af29389de5e6622a39cf23e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317309
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-16 16:17:47 +00:00
Robert Phillips
26f3aebf01 Add initial GrThreadSafeUniquelyKeyedProxyViewCache implementation
This is by no means perfect or complete but does break up the review.

Bug: 1108408
Change-Id: Ib1826cd40975c7e84b5fdfc16d1ecbec97dab237
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317201
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-16 16:07:27 +00:00
Brian Osman
2564767d24 Move constant swizzle handling into the IR generator
SkSL::Swizzle objects never represent constant swizzles - they are
directly converted to IR that represents a small sub-tree, up to the
most complex case of:

    Swizzle(Constructor(Swizzle(BaseVector), Literals, ...))

GLSL was the only backend that handled arbitrary complex swizzles
correctly in all cases - this change basically moves that logic into the
IR generator, subsumes the (similar) handling of scalar swizzles that
was there, and simplifies the algorithm so that it's all procedural (not
hard-coded based on bit-patterns).

Bug: skia:10721
Change-Id: Iac96a26da517a7b1bdc9905cc38ad727fb68af12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317238
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-09-16 15:27:41 +00:00
John Stiles
db42bf2140 Align default values of GrShaderCaps with StandaloneShaderCaps.
`fBuiltinFMASupport` is now true on both, and
`fUsesPrecisionModifiers` is now false. Other mismatching flags exist,
but they are non-trivial to synchronize as they are tied to extension
strings.

This will help our skslc-based unit tests generate the same results as
our C++ unit tests did, but should not affect real-world results as
these defaults will all be overwritten in a non-testing scenario.

In practice, the `fUsesPrecisionModifiers` change is responsible for all
of the diffs below. The other flags did not change the results of any of
the currently-ported tests.

Change-Id: Ieb056d852b027fa87c56fd89f971a77a10a8a124
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317204
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-16 15:16:37 +00:00
Mike Klein
d9c55ce8ed disable show-your-work bit of test
It shifts a negative number left,
which UBSAN reminds us is not allowed in C++.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SkVM_ASAN
Change-Id: I955d53b677f605b3a0f6e2bd31b16e2cc2f64ac5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317260
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-16 01:14:51 +00:00
Mike Klein
9791e50e3d impl q14x2 ops in interpreter
These tests cover all the new Q14x2 ops.
As usual, left myself a few TODOs...

While working on this, I uncovered a little subtly about the blend
instructions we use to implement Op::select... unlike the platonic

    (cond & true_val) | (~cond & false_val)

the hardware istructions are not bitwise!  Each of the fancy blend
instructions like vblendvps or vpblendvb has a fundamental granularity
larger than a bit (4 bytes for vblendvps, 1 byte for vpblendvb).  If
you're using a mask with a granularity of say, 2 bytes, you need to be
using something with equally fine granularity --- bitwise is ok,
bytewise is ok, 2-byte-wise is ok, but 4-byte-wise isn't.

Took a quick survey, and the Op::select we're using for x86 and ARM
JITs are both bytewise, so I think they're fine.  Would have to think
a bit about LLVM, but these unit tests should at least fire if it were
wrong.  The skvx if_then_else() I've been using in the interpreter has
been 4-byte-wise, but I'm refining that down to 1-byte-wise with
https://skia-review.googlesource.com/c/skia/+/317170.

Change-Id: I09cbc8b91cdb9e50088ee4f6ddf202faa1bf2cb1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317159
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-15 21:55:31 +00:00
Michael Ludwig
1cf303fa5a Fully disable CCPR for unit test
If CCPR was enabled on the CLI, it would still be seen for the unit
test. This makes sure CCPR is fully disabled, in addition to the old
setting for disabling other path renderers.

The unit test needs CCPR disabled so that it tests SW mask generation
when CCPR is not available.

Change-Id: I3f728705238121fc179ffd9985f14edad3f8d96e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317236
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-09-15 21:20:51 +00:00