skia2/resources/sksl/intrinsics/Refract.sksl
John Stiles f47cfa8be5 Implement compile-time optimization for refract().
$genType refract($genType I, $genType N, float eta);
$genHType refract($genHType I, $genHType N, half eta);

The half form of refract was originally taking a `float eta` in our
headers, which seems wrong (and causes the DSL to break unless you add
casts). I've corrected the headers to use `half eta`.

Change-Id: I74b9ac330e0f7e99622d19cf7365aaa4cc910e57
Bug: skia:12034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412664
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-26 19:55:39 +00:00

11 lines
345 B
Plaintext

uniform half a, b, c;
uniform half4 d, e;
void main() {
sk_FragColor.x = refract(a, b, c);
sk_FragColor = refract(d, e, c);
sk_FragColor.xy = refract(half2(1,0), half2(0,1), 0.5);
sk_FragColor.xyz = refract(half3(1,0,0), half3(0,0,1), 0.5);
sk_FragColor.xyzw = refract(half4(1,0,0,0), half4(0,0,0,1), 0.5);
}