local-variable-shadowing-outer-function.html (1495B)
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>WebGL GLSL Conformance Test - Local Variable Shadowing Outer Function</title> 12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/> 13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> 14 <script src="../../../js/js-test-pre.js"></script> 15 <script src="../../../js/webgl-test-utils.js"></script> 16 <script src="../../../js/glsl-conformance-test.js"></script> 17 </head> 18 <body> 19 <div id="description"></div> 20 <div id="console"></div> 21 <script id="vertexShader" type="text/something-not-javascript"> 22 // vertex shader must succeed 23 attribute vec3 vertex; 24 varying float interp; 25 void main() { 26 interp = vertex.x; 27 gl_Position = vec4(vertex, 1.0); 28 } 29 </script> 30 <script id="fragmentShader" type="text/something-not-javascript"> 31 // local variable shadowing outer function definition must succeed 32 precision mediump float; 33 34 varying float interp; 35 36 float rsquared(float radius) 37 { 38 return radius * radius; 39 } 40 41 void some_computation(float radius, out float bsdf) { 42 bsdf = 0.0; 43 float rsquared = rsquared(radius); 44 bsdf += rsquared; 45 } 46 47 void main() { 48 float comp; 49 some_computation(interp, comp); 50 gl_FragColor = vec4(comp, 0.0, 0.0, 1.0); 51 } 52 </script> 53 <script> 54 "use strict"; 55 GLSLConformanceTester.runTest(); 56 var successfullyParsed = true; 57 </script> 58 </body> 59 </html>