empty-declaration.html (3538B)
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 Tests - empty declarations</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="vertexEmptyDeclaration" type="text/something-not-javascript"> 22 // Vertex shader with an empty declaration should succeed. 23 // See shading language grammar rules init_declarator_list and single_declaration 24 // in ESSL specs. 25 // Empty declarations are a side effect of how grammar for structs is defined. 26 void main() { 27 float; 28 gl_Position = vec4(0.0); 29 } 30 </script> 31 <script id="vertexEmptyDeclarationPlus" type="text/something-not-javascript"> 32 // Vertex shader with an empty declaration followed by declarator should succeed. 33 // See shading language grammar rules init_declarator_list and single_declaration 34 // in ESSL specs. 35 void main() { 36 float, a = 0.0; 37 gl_Position = vec4(a); 38 } 39 </script> 40 <script id="vertexEmptyStructDeclarationPlus" type="text/something-not-javascript"> 41 // Vertex shader with an empty declaration followed by declarator should succeed. 42 // See shading language grammar rules init_declarator_list and single_declaration 43 // in ESSL specs. 44 45 struct S { 46 float member; 47 }, a; 48 49 void main() { 50 a.member = 0.0; 51 gl_Position = vec4(a.member); 52 } 53 </script> 54 <script id="vertexEmptyDeclarationInStruct" type="text/something-not-javascript"> 55 // Vertex shader with an empty declaration inside struct should fail. 56 // In-struct declarations have different grammar from declarations outside structs. 57 struct S { 58 float; 59 float a; 60 }; 61 62 void main() { 63 gl_Position = vec4(0.0); 64 } 65 </script> 66 <script id="vertexEmptyDeclarationPlusInStruct" type="text/something-not-javascript"> 67 // Vertex shader with an empty declaration inside struct should fail. 68 // In-struct declarations have different grammar from declarations outside structs. 69 struct S { 70 float, a; 71 float b; 72 }; 73 74 void main() { 75 gl_Position = vec4(0.0); 76 } 77 </script> 78 <script> 79 "use strict"; 80 GLSLConformanceTester.runTests([ 81 { vShaderId: 'vertexEmptyDeclaration', 82 vShaderSuccess: true, 83 linkSuccess: true, 84 passMsg: 'Vertex shader with an empty declaration should succeed' 85 }, 86 { vShaderId: 'vertexEmptyDeclarationPlus', 87 vShaderSuccess: true, 88 linkSuccess: true, 89 passMsg: 'Vertex shader with an empty declaration followed by declarator should succeed' 90 }, 91 { vShaderId: 'vertexEmptyStructDeclarationPlus', 92 vShaderSuccess: true, 93 linkSuccess: true, 94 passMsg: 'Vertex shader with an empty struct declaration followed by declarator should succeed' 95 }, 96 { vShaderId: 'vertexEmptyDeclarationInStruct', 97 vShaderSuccess: false, 98 linkSuccess: false, 99 passMsg: 'Vertex shader with an empty declaration in a struct should fail' 100 }, 101 { vShaderId: 'vertexEmptyDeclarationPlusInStruct', 102 vShaderSuccess: false, 103 linkSuccess: false, 104 passMsg: 'Vertex shader with an empty declaration followed by declarator in a struct should fail' 105 } 106 ]); 107 108 var successfullyParsed = true; 109 </script> 110 </body> 111 </html>