skia2/tests/sksl/intrinsics/FloatBitsToUint.glsl
John Stiles b39236bc0f Add floatBitsToInt family of ES3 intrinsics to SkSL public ES3.
These now have proper testing and compile-time optimization support.

Change-Id: I7978161ec126e1c3096b9ca9dfbb2be7d8ea02f5
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440859
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-20 14:58:44 +00:00

12 lines
556 B
GLSL

out vec4 sk_FragColor;
uniform float testInput;
uniform mat2 testMatrix2x2;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
vec4 input = vec4(testMatrix2x2) * vec4(1.0, 1.0, -1.0, -1.0);
const uvec4 expectedB = uvec4(1065353216u, 1073741824u, 3225419776u, 3229614080u);
return ((floatBitsToUint(input.x) == 1065353216u && floatBitsToUint(input.xy) == uvec2(1065353216u, 1073741824u)) && floatBitsToUint(input.xyz) == uvec3(1065353216u, 1073741824u, 3225419776u)) && floatBitsToUint(input) == expectedB ? colorGreen : colorRed;
}