Commit Graph

29 Commits

Author SHA1 Message Date
John Stiles
0c4dd7ae3d Add ES3 versions of min/max/mix/clamp to public SkSL.
I've also added a new runtime_intrinsics slide which plots all of the
ES3 section 8.3 intrinsics for testing purposes. We already had SkSL
tests for the ES3 versions of these functions in intrinsics/.

Change-Id: Ie4cec34cacddc26be78dce1e641de8172fcefd99
Bug: skia:12022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441578
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-24 17:14:50 +00:00
John Stiles
6f90c702e6 Improve runtime-intrinsic plotting.
Instead of a series of green dots, we now get a smooth antialiased line.
This is especially useful on high-DPI displays, as previously the green
dots had gaps between them (making the plot appear as a dashed line).

Change-Id: I947e9ec31fafd133a2458bf508102fedd3eaea1a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441577
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-08-24 15:48:17 +00:00
John Stiles
0c12e32fad Reland "Add GM slide for ES3 trig intrinsics."
This reverts commit 282af12ae0.

draw_shader now has a `allowRasterFallback` option and returns an empty
bitmap if no surface can be made.

Original change's description:
> Revert "Add GM slide for ES3 trig intrinsics."
>
> This reverts commit 3cb09c0904.
>
> Reason for revert: Windows ANGLE can fall back to software
>
> Original change's description:
> > Add GM slide for ES3 trig intrinsics.
> >
> > Unlike the other Runtime Effects slides, this only works on GPU, as
> > the ES3 intrinsics aren't implemented in SkVM (today).
> >
> > Change-Id: Icf59e4ed7c1e89aa7b730b43c2fd0fa45d61e71a
> > Bug: skia:12202, skia:12352
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439777
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> TBR=brianosman@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ica2f7af9e479e5cf96603583c6803b646b8dcb4b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:12202, skia:12352
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440558
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:12202, skia:12352
Change-Id: I774635a8b1e526af0be3b68f771496f1cedce13a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440559
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-18 21:42:56 +00:00
John Stiles
282af12ae0 Revert "Add GM slide for ES3 trig intrinsics."
This reverts commit 3cb09c0904.

Reason for revert: Windows ANGLE can fall back to software

Original change's description:
> Add GM slide for ES3 trig intrinsics.
>
> Unlike the other Runtime Effects slides, this only works on GPU, as
> the ES3 intrinsics aren't implemented in SkVM (today).
>
> Change-Id: Icf59e4ed7c1e89aa7b730b43c2fd0fa45d61e71a
> Bug: skia:12202, skia:12352
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439777
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ica2f7af9e479e5cf96603583c6803b646b8dcb4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12202, skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440558
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-18 19:35:19 +00:00
John Stiles
0733d48428 Check for SkSL ES3 capabilities in GrShaderCaps.
This lets us set the minimum bar for SkSL ES3 support in one place,
rather than checking this set of bits in multiple spots.

Change-Id: Icba58d8b6a93626ce2ffbe3c4b846cad4749cab5
Bug: skia:12347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440518
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-18 17:12:12 +00:00
John Stiles
3cb09c0904 Add GM slide for ES3 trig intrinsics.
Unlike the other Runtime Effects slides, this only works on GPU, as
the ES3 intrinsics aren't implemented in SkVM (today).

Change-Id: Icf59e4ed7c1e89aa7b730b43c2fd0fa45d61e71a
Bug: skia:12202, skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439777
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-18 16:22:07 +00:00
Brian Osman
f6123f1dcc Convert some SkRuntimeEffect::Make to use stage-specific factories
The old factory is deprecated. The new ones do stricter checking on the
signature of main and calls to sample, and include checks at effect
creation-time that the SkSL is valid for the requested stage.

Bug: skia:11813
Change-Id: Ibd15a6f90e74bdc9c2352d3dc61b6682f626f413
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397477
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-21 16:19:57 +00:00
Brian Osman
358858fe4c Fix bots that don't like std::is_integral_v
Change-Id: I37202f26bd1d990f80528f490ccd7e99cbc2139f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392056
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-01 18:49:43 +00:00
Brian Osman
d18967c67d Add integer uniforms to runtime effects
Bug: skia:11803
Change-Id: I925f14be282b96355721986de6049090b35adf3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391856
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-04-01 17:20:03 +00:00
John Stiles
f1107ebd01 Update intrinsic tests to floor(vec) and ceil(vec).
This might help us narrow down misbehavior on older Intel GPUs when
running on ANGLE + DX9.

Change-Id: I32bfb1e5cfbaa6a8b8c1e197b806073a4cd717bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362416
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 21:42:58 +00:00
Mike Reed
34a0c97f5e don't use drawBitmap
Bug: skia:11216
Change-Id: I89a40e330f27f30c461f2b6012bf26c082b66094
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359076
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-26 02:24:21 +00:00
Brian Osman
3b2fac6899 Reland "SkRuntimeEffect: Test matrix inverse() intrinsic"
This reverts commit 72bd9e8664.

Bug: skia:10913
Bug: skia:11133
Change-Id: Id822569166c7c2d53c3af5685550ae00c0dcfe01
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349058
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-05 20:29:45 +00:00
Brian Osman
72bd9e8664 Revert "SkRuntimeEffect: Test matrix inverse() intrinsic"
This reverts commit 9f2e5036db.

Reason for revert: Mali-400 Internal Compiler Error.

Original change's description:
> SkRuntimeEffect: Test matrix inverse() intrinsic
>
> Bug: skia:10913
> Change-Id: I9f0a79f9d706eb2c0c8381088f0caf19940589ff
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347957
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

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

Change-Id: I5b69bf9b0bfd36a7e1e15062b4388f0c6e263a39
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10913
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348891
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-12-30 18:12:40 +00:00
Brian Osman
9f2e5036db SkRuntimeEffect: Test matrix inverse() intrinsic
Bug: skia:10913
Change-Id: I9f0a79f9d706eb2c0c8381088f0caf19940589ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347957
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-12-30 14:57:29 +00:00
Brian Osman
93aed9ac05 SkRuntimeEffect: Implement and test matrixCompMult intrinsic
Bug: skia:10913
Change-Id: I430e5eb3fecb0f15775db03699819194d44271b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347958
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-12-30 14:08:49 +00:00
Brian Osman
791f8d8c3b Code cleanup in runtimeintrinsics.cpp GMs
Add some helper functions to reduce copy-paste, make column advance
automatic, etc.

Change-Id: I65c7ed1b7b1b357017e79e14b211686584ed3b7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348186
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-12-29 22:37:43 +00:00
Brian Osman
30b6729352 Add/test integer versions of vector-relational intrinsics
These are part of the GLSL ES 1.0 spec.

Bug: skia:10913
Change-Id: I61bfcadc92209fb3a6aa07b3d6ad579460ad2ecd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347049
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-12-28 15:46:51 +00:00
Mike Reed
ac9f0c9e27 Bitmap.asImage()
... and lots and lots of IWYU

Change-Id: Ie5157dcdd2e6d29b95c71b39153278ab48ef4eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-23 15:54:57 +00:00
Ethan Nicholas
1ad5445100 Revert "Add integer relational ops to sksl_public."
This reverts commit b476981949.

Reason for revert: https://logs.chromium.org/logs/skia/507fb79e5cf79811/+/steps/dm/0/stdout

Original change's description:
> Add integer relational ops to sksl_public.
>
> These aren't implemented yet in the software rasterizer, but work
> properly on GPU and serve as a good end-to-end test for skia:10999.
>
> Change-Id: I1dac66cd5762ebde828e819c1b6890016599672e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344036
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: Ic9ace24c3f0ea764b2720bffa50792a136d452ef
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344558
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-12-15 15:07:31 +00:00
John Stiles
b476981949 Add integer relational ops to sksl_public.
These aren't implemented yet in the software rasterizer, but work
properly on GPU and serve as a good end-to-end test for skia:10999.

Change-Id: I1dac66cd5762ebde828e819c1b6890016599672e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344036
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-12-15 14:43:59 +00:00
Brian Osman
540c13a791 Test & implement "vector relational intrinsics"
Add missing "not" intrinsic to SPIR-V, and several relational/logical
opcodes to runtime effect's skvm converter.

Bug: skia:10913
Change-Id: Ic349d491d980d0018134801260073414485f9059
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339316
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-12-01 16:10:43 +00:00
Brian Osman
9ba7a24bdd Reland "SkSL: Test/implement "geometric" intrinsics"
This is a reland of 0d5d956f7b

Original change's description:
> SkSL: Test/implement "geometric" intrinsics
>
> Bug: skia:10913
> Change-Id: Ie82354b05db141c8ab90b1a615ddfada4f71a98b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335049
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

Bug: skia:10913
Change-Id: I103dd2efbbab0efeac2be786d7e8f913d5c4b22a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338158
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-24 21:29:56 +00:00
John Stiles
0dd83e165a Revert "SkSL: Test/implement "geometric" intrinsics"
This reverts commit 0d5d956f7b.

Reason for revert: doesn't compile on Metal, breaks tree

Original change's description:
> SkSL: Test/implement "geometric" intrinsics
>
> Bug: skia:10913
> Change-Id: Ie82354b05db141c8ab90b1a615ddfada4f71a98b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335049
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

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

Change-Id: I3a44eaf7bafe2fa2d185186c48c39b61116dd2fe
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10913
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337186
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-11-20 22:17:38 +00:00
Brian Osman
0d5d956f7b SkSL: Test/implement "geometric" intrinsics
Bug: skia:10913
Change-Id: Ie82354b05db141c8ab90b1a615ddfada4f71a98b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335049
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-20 19:30:47 +00:00
Brian Osman
5035b8f92a Minor cleanup in the intrinsics GMs
- Renamed do_unary() to plot(). Originally intended to do higher
  dimension functions differently, but the 1D plot by varying some
  parameters is easier to look at and reason about, so all plots will
  follow this model.
- Added an optional label for the expressions that are getting really
  long. "smoothstep" was already overflowing, and the final wave of
  intrinsics (geometry and vector comparison) are going to all be long.

Bug: skia:10913
Change-Id: I69086152718c43e602755ddc9017b2a73fec5038
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335583
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-17 15:49:43 +00:00
Brian Osman
5160aada22 Test and implement all "common" intrinsics (GLSL ES Sec. 8.3)
Bug: skia:10913
Change-Id: I845bfad9ef57b57f09bdf96e74dcdab86300b34d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334877
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-11-16 17:25:48 +00:00
Brian Osman
8f6d4d369c Test & implement exponential intrinsics
Bug: skia:10913
Change-Id: Id9f2b14ca7443b3375036d588849bc9a20d76e40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334156
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-11-12 17:50:19 +00:00
Brian Osman
24000785e5 Implement two-argument atan in public SkSL, improve GM
This completes all of the "Angle and Trigonometry Functions"
Made the graphs larger in the GM, and laid them out to make better use
of space. Also changed how the shaders are assembled to support
two-argument functions (at least partially).

Bug: skia:10913
Change-Id: I3ae6288f76fb9b3200c843595b065a6afbf92230
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334416
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-11-12 17:22:39 +00:00
Brian Osman
3a004dfd91 GM to test (almost) all SkSL Angle/Trigonometric intrinsics
This doesn't include the two-argument version of atan, but covers all
other intrinsics from section 8.1 of the GLES Shading Language 1.00
spec.

Several needed additional plumbing for the CPU backend, but all now
appear correct across CPU and GPU.

Bug: skia:10913

Change-Id: I9933ad549b9914d94c9973c702a06bb177be31b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334103
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-11-11 20:37:15 +00:00