skia2/tests/sksl/intrinsics/Refract.glsl
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

15 lines
377 B
GLSL

out vec4 sk_FragColor;
uniform float a;
uniform float b;
uniform float c;
uniform vec4 d;
uniform vec4 e;
void main() {
sk_FragColor.x = refract(a, b, c);
sk_FragColor = refract(d, e, c);
sk_FragColor.xy = vec2(0.5, -0.86602538824081421);
sk_FragColor.xyz = vec3(0.5, 0.0, -0.86602538824081421);
sk_FragColor = vec4(0.5, 0.0, 0.0, -0.86602538824081421);
}