varying-struct-inline-definition.html (1372B)
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>GLSL varying struct with inline definition test</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="vshader" type="x-shader/x-vertex">#version 300 es 21 22 in vec4 vPosition; 23 24 flat out struct S { 25 int field; 26 } v_s; 27 28 void main() { 29 v_s.field = 1; 30 gl_Position = vPosition; 31 } 32 </script> 33 <script id="fshader" type="x-shader/x-fragment">#version 300 es 34 precision highp float; 35 36 flat in struct S { 37 int field; 38 } v_s; 39 40 out vec4 my_FragColor; 41 42 void main() { 43 my_FragColor = vec4(1 - v_s.field, v_s.field, 0, 1); 44 } 45 </script> 46 <script type="application/javascript"> 47 "use strict"; 48 description(); 49 50 GLSLConformanceTester.runRenderTests([ 51 { 52 vShaderId: 'vshader', 53 vShaderSuccess: true, 54 fShaderId: 'fshader', 55 fShaderSuccess: true, 56 linkSuccess: true, 57 passMsg: 'Vertex output struct / fragment input struct with an inline definition should compile and link' 58 } 59 ], 2); 60 </script> 61 </body> 62 </html>