1cb93a386Sopenharmony_ci#include <metal_stdlib> 2cb93a386Sopenharmony_ci#include <simd/simd.h> 3cb93a386Sopenharmony_ciusing namespace metal; 4cb93a386Sopenharmony_cistruct Uniforms { 5cb93a386Sopenharmony_ci half4 testInputs; 6cb93a386Sopenharmony_ci half4 colorGreen; 7cb93a386Sopenharmony_ci half4 colorRed; 8cb93a386Sopenharmony_ci}; 9cb93a386Sopenharmony_cistruct Inputs { 10cb93a386Sopenharmony_ci}; 11cb93a386Sopenharmony_cistruct Outputs { 12cb93a386Sopenharmony_ci half4 sk_FragColor [[color(0)]]; 13cb93a386Sopenharmony_ci}; 14cb93a386Sopenharmony_cifragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 15cb93a386Sopenharmony_ci Outputs _out; 16cb93a386Sopenharmony_ci (void)_out; 17cb93a386Sopenharmony_ci uint4 uintValues = uint4(_uniforms.testInputs * 100.0h + 200.0h); 18cb93a386Sopenharmony_ci uint4 expectedA = uint4(100u, 200u, 275u, 300u); 19cb93a386Sopenharmony_ci const uint4 clampLow = uint4(100u, 0u, 0u, 300u); 20cb93a386Sopenharmony_ci uint4 expectedB = uint4(100u, 200u, 250u, 425u); 21cb93a386Sopenharmony_ci const uint4 clampHigh = uint4(300u, 400u, 250u, 500u); 22cb93a386Sopenharmony_ci _out.sk_FragColor = ((((((((((((((clamp(uintValues.x, 100u, 300u) == expectedA.x && all(clamp(uintValues.xy, 100u, 300u) == expectedA.xy)) && all(clamp(uintValues.xyz, 100u, 300u) == expectedA.xyz)) && all(clamp(uintValues, 100u, 300u) == expectedA)) && 100u == expectedA.x) && all(uint2(100u, 200u) == expectedA.xy)) && all(uint3(100u, 200u, 275u) == expectedA.xyz)) && all(uint4(100u, 200u, 275u, 300u) == expectedA)) && clamp(uintValues.x, 100u, 300u) == expectedB.x) && all(clamp(uintValues.xy, uint2(100u, 0u), uint2(300u, 400u)) == expectedB.xy)) && all(clamp(uintValues.xyz, uint3(100u, 0u, 0u), uint3(300u, 400u, 250u)) == expectedB.xyz)) && all(clamp(uintValues, clampLow, clampHigh) == expectedB)) && 100u == expectedB.x) && all(uint2(100u, 200u) == expectedB.xy)) && all(uint3(100u, 200u, 250u) == expectedB.xyz)) && all(uint4(100u, 200u, 250u, 425u) == expectedB) ? _uniforms.colorGreen : _uniforms.colorRed; 23cb93a386Sopenharmony_ci return _out; 24cb93a386Sopenharmony_ci} 25