Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / forward-declaration.html
blobb3afcb846da69f61f05f3b67e477fe64569a4e14
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 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>GLSL 3.00 forward declaration 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="vertexShaderForwardDecl" type="x-shader/x-vertex">#version 300 es
21 precision mediump float;
23 // Forward declaration. Breaks on Pixel C due to flattening of
24 // precision qualifiers. It seems the GLSL compiler can't handle the
25 // precision qualifier on the return value.
26 float identity(float val);
28 float identity(float val) {
29 return val;
32 void main(void) {
33 gl_Position = vec4(identity(1.0), 0.0, 0.0, 1.0);
35 </script>
36 <script id="vertexShader" type="x-shader/x-vertex">#version 300 es
37 void main(void) {
38 gl_Position = vec4(1.0, 0.0, 0.0, 1.0);
40 </script>
41 <script id="fragmentShader" type="x-shader/x-fragment">#version 300 es
42 precision mediump float;
44 out vec4 my_FragColor;
45 void main(void) {
46 my_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
48 </script>
49 <script id="fragmentShaderForwardDecl" type="x-shader/x-fragment">#version 300 es
50 precision mediump float;
52 // Forward declaration. Breaks on Pixel C due to flattening of
53 // precision qualifiers. It seems the GLSL compiler can't handle the
54 // precision qualifier on the return value.
55 float identity(float val);
57 float identity(float val) {
58 return val;
61 out vec4 my_FragColor;
62 void main(void) {
63 my_FragColor = vec4(0.0, identity(1.0), 0.0, 1.0);
65 </script>
66 <script type="application/javascript">
67 "use strict";
68 description("Forward declarations of functions should succeed.");
70 GLSLConformanceTester.runTests([
72 vShaderId: "vertexShaderForwardDecl",
73 vShaderSuccess: true,
74 fShaderId: "fragmentShader",
75 fShaderSuccess: true,
76 linkSuccess: true,
77 passMsg: "vertex shader with forward declaration must pass",
80 vShaderId: "vertexShader",
81 vShaderSuccess: true,
82 fShaderId: "fragmentShaderForwardDecl",
83 fShaderSuccess: true,
84 linkSuccess: true,
85 passMsg: "fragment shader with forward declaration must pass",
87 ], 2);
88 </script>
89 </body>
90 </html>