nested-sequence-operator.html (1411B)
1 <!-- 2 Copyright (c) 2019 The Khronos Group Inc. 3 Use of this source code is governed by an MIT-style license that can be 4 found in the LICENSE.txt file. 5 --> 6 7 <!DOCTYPE html> 8 <html> 9 <head> 10 <meta charset="utf-8"> 11 <title>Nested sequence operator</title> 12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/> 13 <script src="../../../js/js-test-pre.js"></script> 14 <script src="../../../js/webgl-test-utils.js"></script> 15 <script src="../../../js/glsl-conformance-test.js"></script> 16 </head> 17 <body> 18 <div id="description"></div> 19 <div id="console"></div> 20 <script id="fshaderNestedSequenceOperator" type="x-shader/x-fragment"> 21 precision mediump float; 22 // Note that keep_flop_positive is expected to keep its default value false. 23 uniform bool keep_flop_positive; 24 float flop; 25 void main() 26 { 27 flop = -1.0, 28 (flop *= -1.0, 29 keep_flop_positive ? 0.0 : flop *= -1.0), 30 gl_FragColor = vec4(0, -flop, 0, 1); 31 } 32 </script> 33 <script type="text/javascript"> 34 "use strict"; 35 description("Test a nested sequence operator with a ternary operator inside. The ternary operator needs to be converted into an if statement on a HLSL based WebGL backend, which makes this case tricky."); 36 37 GLSLConformanceTester.runRenderTests([ 38 { 39 fShaderId: 'fshaderNestedSequenceOperator', 40 fShaderSuccess: true, 41 linkSuccess: true, 42 passMsg: "Nested sequence operator is evaluated in the expected order." 43 } 44 ]); 45 </script> 46 </body> 47 </html>