compare-loop-index-to-uniform.html (1296B)
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>Driver bug - Comparing loop index against uniform in a fragment shader should work</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="fshader" type="x-shader/x-fragment"> 21 precision mediump float; 22 uniform int uCount; 23 24 void main() { 25 float a = 0.0; 26 for (int i = 0; i < 5; ++i) { 27 if (i < uCount) { 28 a += 0.2; 29 } 30 } 31 gl_FragColor = vec4(1.0 - a, a, 0.0, 1.0); 32 } 33 </script> 34 <script type="application/javascript"> 35 "use strict"; 36 description("Comparing loop index to an uniform in a fragment shader should work."); 37 38 GLSLConformanceTester.runRenderTests([ 39 { 40 fShaderId: 'fshader', 41 fShaderSuccess: true, 42 linkSuccess: true, 43 passMsg: 'Compare a loop index to an uniform', 44 uniforms: [{name: "uCount", functionName: "uniform1i", value: 5}] 45 } 46 ]); 47 </script> 48 </body> 49 </html>