This website requires JavaScript.
ReeceSX
Explore
Aurora
Register
Sign In
AuroraMiddleware
/
skia2
Watch
1
Star
0
Fork
0
You've already forked skia2
Code
Issues
Pull Requests
Projects
Releases
Wiki
Activity
3744bd6b8d
skia2
/
tests
/
sksl
/
intrinsics
/
Cross.glsl
9 lines
107 B
Plaintext
Raw
Normal View
History
Unescape
Escape
Add tests for SkSL intrinsic functions. This does not give us 100% coverage of intrinsics yet, but it is a pretty good start. Change-Id: I97d49324db1afd9f2975c2eeafbacdead710d4aa Bug: skia:11054 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341977 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-12-09 21:19:37 +00:00
out vec4 sk_FragColor;
in vec2 a;
in vec2 b;
void main() {
Eliminate inliner temporary variables for top-level-exit functions. When we determine that a function only contains a single return statement and it is at the top level (i.e. not inside any scopes), there is no need to create a temporary variable and store the result expression into a variable. Instead, we can directly replace the function-call expression with the return-statement's expression. Unlike my previous solution, this does not require variable declarations to be rewritten. The no-scopes limitation makes it slightly less effective in theory, but in practice we still get almost all of the benefit. The no-scope limitation bites us on structures like @if (true) { return x; } else { return y; } Which will optimize away the if, but leave the scope: { return x; } However, this is not a big deal; the biggest wins are single-line helper functions like `guarded_divide` and `unpremul` which retain the full benefit. Change-Id: I7fbb725e65db021b9795c04c816819669815578f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345167 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-12-17 19:38:56 +00:00
sk_FragColor.x = a.x * b.y - a.y * b.x;
Add tests for SkSL intrinsic functions. This does not give us 100% coverage of intrinsics yet, but it is a pretty good start. Change-Id: I97d49324db1afd9f2975c2eeafbacdead710d4aa Bug: skia:11054 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341977 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-12-09 21:19:37 +00:00
}
Reference in New Issue
Copy Permalink