14c3175d7a
The test has been improved and now covers a variety of values. Because this intrinsic has side-effects (an out-param), we do not support optimizing it or treating it as a constant-expression. The modf documentation doesn't mention anything about constant- expression support or lack thereof. Experimentally, modf is also not treated as a constant-expression by Apple GLSL or glslang: http://screen/4RWwYKr6vCjxCPQ http://screen/45ttDTVAFGDRyxP Change-Id: I15bb1de80e90fa97ddf8e9d3803352603b9608d0 Bug: skia:12202 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446396 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
21 lines
936 B
Plaintext
21 lines
936 B
Plaintext
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main(float2 coords) {
|
|
float4 value = float4(2.5, -2.5, 8, -0.125);
|
|
const float4 expectedWhole = float4(2, -2, 8, 0);
|
|
const float4 expectedFraction = float4(0.5, -0.5, 0, -0.125);
|
|
bool4 ok = bool4(false);
|
|
float4 whole, fraction;
|
|
|
|
fraction.x = modf(value.x, whole.x);
|
|
ok.x = whole.x == expectedWhole.x && fraction.x == expectedFraction.x;
|
|
fraction.xy = modf(value.xy, whole.xy);
|
|
ok.y = whole.xy == expectedWhole.xy && fraction.xy == expectedFraction.xy;
|
|
fraction.xyz = modf(value.xyz, whole.xyz);
|
|
ok.z = whole.xyz == expectedWhole.xyz && fraction.xyz == expectedFraction.xyz;
|
|
fraction.xyzw = modf(value.xyzw, whole.xyzw);
|
|
ok.w = whole.xyzw == expectedWhole.xyzw && fraction.xyzw == expectedFraction.xyzw;
|
|
|
|
return all(ok) ? colorGreen : colorRed;
|
|
}
|