Bug 1918529 - fix some subpixel misalignment issues with gfx.webrender.svg-filter...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / misc / shader-with-global-variable-precision-mismatch.html
blob6303915f30ddc49ce869146e5ef763658d3dba60
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>WebGL GLSL Conformance Tests</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="fshaderWithMediumpGlobal" type="text/something-not-javascript">
22 // There is no default float precision in fragment shaders, so specify mediump.
23 precision mediump float;
25 uniform vec4 foo;
27 void main()
29 gl_FragColor = foo;
31 </script>
32 <script id="fshaderWithMediumpGlobalInt" type="text/something-not-javascript">
33 // Default precision for int in fragment shaders is mediump.
34 uniform int foo;
36 void main()
38 gl_FragColor = vec4(foo, 0, 0, 1);
40 </script>
41 <script id="fshaderWithMediumpGlobalStruct" type="text/something-not-javascript">
42 // There is no default float precision in fragment shaders, so specify mediump.
43 precision mediump float;
45 struct foo
47 vec4 bar;
50 uniform foo baz;
52 void main()
54 gl_FragColor = baz.bar;
56 </script>
57 <script id="vshaderWithHighpGlobal" type="x-shader/x-vertex">
58 // Default precision for vertex shaders is highp.
59 uniform vec4 foo;
61 void main() {
62 gl_Position = foo;
64 </script>
65 <script id="vshaderWithHighpGlobalInt" type="x-shader/x-vertex">
66 // Default precision for int in vertex shaders is highp.
67 uniform int foo;
69 void main() {
70 gl_Position = vec4(foo, 0, 0, 1);
72 </script>
73 <script id="vshaderWithHighpGlobalStruct" type="x-shader/x-vertex">
74 // Default precision for vertex shaders is highp.
75 struct foo
77 vec4 bar;
80 uniform foo baz;
82 void main()
84 gl_Position = baz.bar;
86 </script>
87 <script>
88 "use strict";
89 description("Checks shaders with global variables and precision qualifier mismatch.");
91 var wtu = WebGLTestUtils;
93 var glslTests = [];
95 glslTests.push({
96 vShaderId: 'vshaderWithHighpGlobal',
97 vShaderSuccess: true,
98 fShaderId: 'fshaderWithMediumpGlobal',
99 fShaderSuccess: true,
100 linkSuccess: false,
101 passMsg: "mismatching precision for uniforms causes link error (as expected)",
104 glslTests.push({
105 vShaderId: 'vshaderWithHighpGlobalInt',
106 vShaderSuccess: true,
107 fShaderId: 'fshaderWithMediumpGlobalInt',
108 fShaderSuccess: true,
109 linkSuccess: false,
110 passMsg: "mismatching precision for int uniforms with default precision causes link error (as expected)",
113 glslTests.push({
114 vShaderId: 'vshaderWithHighpGlobalStruct',
115 vShaderSuccess: true,
116 fShaderId: 'fshaderWithMediumpGlobalStruct',
117 fShaderSuccess: true,
118 linkSuccess: false,
119 passMsg: "mismatching precision for structure uniforms causes link error (as expected)",
122 GLSLConformanceTester.runTests(glslTests);
124 debug("");
125 var successfullyParsed = true;
126 </script>
127 </body>
128 </html>