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
66c53b9428
skia2
/
tests
/
sksl
/
inliner
/
InlineWithModifiedArgument.glsl
9 lines
107 B
Plaintext
Raw
Normal View
History
Unescape
Escape
Migrate SkSL inliner tests to golden files. Our lack of proper caps-bits controls in skslc affects the outcome of one test: "InlinerWrapsEarlyReturnsWithDoWhileBlock" does not actually emit the do-while block because the standalone caps bits don't enable do-while support. This will be fixed in a followup CL that adds caps-bit support to our tests. A few tests were renamed for consistency, a few were simplified slightly and one test was removed because it was simply redundant (there was a second test that covered the exact same ground as `ForWithReturnInsideCannotBeInlined`). Change-Id: I2e3b97cb3aea331b6d806bdb865aa78c35c7a6b9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316997 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-15 14:10:43 +00:00
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-15 20:09:11 +00:00
out vec4 sk_FragColor;
Migrate SkSL inliner tests to golden files. Our lack of proper caps-bits controls in skslc affects the outcome of one test: "InlinerWrapsEarlyReturnsWithDoWhileBlock" does not actually emit the do-while block because the standalone caps bits don't enable do-while support. This will be fixed in a followup CL that adds caps-bit support to our tests. A few tests were renamed for consistency, a few were simplified slightly and one test was removed because it was simply redundant (there was a second test that covered the exact same ground as `ForWithReturnInsideCannotBeInlined`). Change-Id: I2e3b97cb3aea331b6d806bdb865aa78c35c7a6b9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316997 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-15 14:10:43 +00:00
void main() {
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-15 20:09:11 +00:00
float _1_x = 1.0;
Avoid creating unnecessary scopes during inlining. The additional scopes were harmless, but didn't really add any value. Originally they were used to tightly scope inlined variables, but we now mangle inlined variable names. Change-Id: I7b35e737598036c0b6d3d9f71cbcd4a53d609ce9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344757 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2020-12-15 20:21:03 +00:00
_1_x *= 2.0;
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 = _1_x;
Migrate SkSL inliner tests to golden files. Our lack of proper caps-bits controls in skslc affects the outcome of one test: "InlinerWrapsEarlyReturnsWithDoWhileBlock" does not actually emit the do-while block because the standalone caps bits don't enable do-while support. This will be fixed in a followup CL that adds caps-bit support to our tests. A few tests were renamed for consistency, a few were simplified slightly and one test was removed because it was simply redundant (there was a second test that covered the exact same ground as `ForWithReturnInsideCannotBeInlined`). Change-Id: I2e3b97cb3aea331b6d806bdb865aa78c35c7a6b9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316997 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-15 14:10:43 +00:00
}
Reference in New Issue
Copy Permalink