Commit Graph

122 Commits

Author SHA1 Message Date
Ethan Nicholas
ae9633b352 add SkSL support for mix, cross, and dot
Bug: skia:
Change-Id: Ic6c16f363c5f2aedaf1aee9b3b8ee23e37ea24e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215448
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-05-24 17:17:27 +00:00
Brian Osman
07c117b6f8 Support larger compound types in the interpreter
Field access and array indexing are supported, including
dynamic indices. Larger types (> 4 slots) can be used as
lvalues, rvalues, etc.

Change-Id: I9bb4ed850be4259c05c8952c6c0a17b71f813772
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214443
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2019-05-23 20:19:30 +00:00
Brian Osman
c51d791ab9 Interpreter: Fix scalar -> vector constructors
We were never replicating scalar values when constructing vector types
from a single argument.

Change-Id: I5bdeeb91f5a10c151b18561de6c275f2db2898fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215526
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2019-05-23 14:51:58 +00:00
Ethan Nicholas
82162eead5 SkSL interpreter intrinsics
Bug: skia:
Change-Id: I418fb05444f9c1ee076ace41a24072c4a5e7ef6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214691
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-05-21 20:38:20 +00:00
Ethan Nicholas
9e6a39356e support for SkSL interpreter external function calls
Bug: skia:
Change-Id: Ie8c873bf7fc795567ad812f56c37bee4c06213bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214307
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-05-20 13:49:56 +00:00
Mike Klein
b6a6f0829e disassemble on unit test failure
Change-Id: I072f5d72f64eb683cc90c2890313ee289487cff3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214403
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2019-05-17 20:36:48 +00:00
Brian Osman
f3fa60010e Implement postfix ++/--, and use the correct 1 for floats
Change-Id: I0e6e8205998f3058cb59e279704e23989bccc66b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214192
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-17 19:01:05 +00:00
Brian Osman
4e93feba40 Interpreter: Implement ternary operator
Change-Id: If05661224d4a53e1854180d9b280ebb7a7ac2793
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214191
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-17 14:29:23 +00:00
Brian Osman
1091f02b40 Interpreter: Change all Load/Store ops to use immediate indices
Avoids the need for a PushImmediate (which usually also required
a Nop for alignment) on every load/store. And it makes the codegen
for local vs. global identical, which simplifies the byte-code
generator in a few spots.

This means that places previously using DupDown now need something that
dupes the *top* N elements of the stack. Just use Vector + Dup, and
remove the (now unused) DupDown instruction.

Also add/implement kStoreSwizzleGlobal, which was the last missing
load/store op (and add a test case).

Change-Id: Id450272c11f4f1842c9d57bc5114e7f81e9e926e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214062
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-16 14:19:51 +00:00
Ethan Nicholas
91164d1c01 added external value support to SkSL interpreter
Bug: skia:
Change-Id: I1806e1f6abaef322ecd3ba0d9bfaa9d7ca7a44c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212983
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-05-15 20:05:45 +00:00
Brian Osman
b745129ceb Interpreter: Implement/fix vectorized load/store of globals
Also has swizzled loads of globals. Swizzle stores are still broken.

Change-Id: I0c01a309592c0aa460e1459de2636a2e1ef2ee6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213830
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-15 17:40:45 +00:00
Brian Osman
226668a146 Add support for calling functions within the interpreter
Change-Id: Id009aa32faa40e9847dcf3668f1fd15e8b95dc56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213134
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-15 13:36:16 +00:00
Brian Osman
4167215daf Fix stack indexing bug in vectorized unsigned -> float conversion
Also add a test of all three conversions (scalar & vector).

Change-Id: I1671e992760ad538304d2602e37cd9792a49e9cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213660
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-14 18:09:50 +00:00
Brian Osman
44d44761c7 Interpreter: Fix bool literals
Change-Id: I0cf8e12d5ddb9b89aff39f484d8a017f61e4a20f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213465
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-13 18:54:16 +00:00
Brian Osman
d369a5e9cf Add setInputs to SkSL::Interpreter
Allows updating the global inputs of a cached Interpreter object.

Change-Id: I626e63294a441a7f52ae484755c99f5d04bb614f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212980
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-09 17:46:41 +00:00
Brian Osman
3b41bafc2c Add support for float remainder to interpreter
Change-Id: I267c99c8c36b1d39abe9cf196996db43edb2b839
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212721
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-08 14:13:06 +00:00
Ethan Nicholas
354ecf3693 fixed SkSL interpreter negate op
Bug: skia:
Change-Id: I76ff729a887948119ec1ef58221433a6d91e98a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212484
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-05-07 20:49:21 +00:00
Ethan Nicholas
444aa12c84 fixed SkSL interpreter test
Bug: skia:
Change-Id: I8ddb017994cd9e4ad01163da07888c431a5b1276
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212416
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-05-07 19:27:20 +00:00
Ethan Nicholas
dfcad064e9 more SkSL interpreter performance work
Bug: skia:
Change-Id: I21da1f1473fb73e8ba1371e7301f3fff2e33e8cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212199
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-05-07 17:29:50 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Ethan Nicholas
746035afeb added support for interpreting generic SkSL functions
Bug: skia:
Change-Id: I575b91c654393cc6cfedea617852598e8595d5ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209809
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-23 18:46:36 +00:00
Ethan Nicholas
0e9401dafe Initial checkin of new SkSL interpreter.
Not quite feature complete yet, but at a point where it's worth checking
in.

Bug: skia:
Change-Id: I21141d30e8582a79e94450d84e56bacc067249e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201685
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-21 15:41:10 +00:00