Bug 1918529 - fix some subpixel misalignment issues with gfx.webrender.svg-filter...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / misc / ternary-operators-in-global-initializers.html
bloba8fe592ad066ed84e2c3179ea745d3d886dd6fe5
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 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <link rel="stylesheet" href="../../../resources/js-test-style.css" />
11 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
12 <script src="../../../js/js-test-pre.js"></script>
13 <script src="../../../js/webgl-test-utils.js"></script>
14 <script src="../../../js/glsl-conformance-test.js"></script>
15 <title>Ternary Operators in Global Initializers</title>
16 </head>
17 <body>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="fragmentShader" type="text/something-not-javascript">
21 precision mediump float;
22 const $(type) green = $(green);
23 const $(type) black = $(black);
24 $(type) var = (true) ? green : black;
25 void main() {
26 gl_FragColor = $(asVec4);
28 </script>
29 <script>
30 "use strict";
31 description("This test verifies that ternary operators can be used in global initializers.");
32 var tests = [];
33 var wtu = WebGLTestUtils;
34 var typeInfos = [
35 { type: 'float', green: '1.0', black: '0.0', asVec4: 'vec4(0.0,var,0.0,1.0)' },
36 { type: 'vec2', green: 'vec2(0.0,1.0)', black: 'vec2(0.0,0.0)', asVec4: 'vec4(var,0.0,1.0)' },
37 { type: 'vec3', green: 'vec3(0.0,1.0,0.0)', black: 'vec3(0.0,0.0,0.0)', asVec4: 'vec4(var,1.0)' },
38 { type: 'vec4', green: 'vec4(0.0,1.0,0.0,1.0)', black: 'vec4(0.0,0.0,0.0,0.0)', asVec4: 'var' },
39 { type: 'int', green: '1', black: '0', asVec4: 'vec4(0.0,var,0.0,1.0)' },
40 { type: 'ivec2', green: 'ivec2(0,1)', black: 'ivec2(0,0)', asVec4: 'vec4(var,0.0,1.0)' },
41 { type: 'ivec3', green: 'ivec3(0,1,0)', black: 'ivec3(0,0,0)', asVec4: 'vec4(var,1.0)' },
42 { type: 'ivec4', green: 'ivec4(0,1,0,1)', black: 'ivec4(0,0,0,0)', asVec4: 'vec4(var)' },
43 { type: 'bool', green: 'true', black: 'false', asVec4: 'vec4(0.0,var,0.0,1.0)' },
44 { type: 'bvec2', green: 'bvec2(false,true)', black: 'bvec2(false,false)', asVec4: 'vec4(var,0.0,1.0)' },
45 { type: 'bvec3', green: 'bvec3(false,true,false)', black: 'bvec3(false,false,false)', asVec4: 'vec4(var,1.0)' },
46 { type: 'bvec4', green: 'bvec4(false,true,false,true)',black: 'bvec4(false,false,false,false)', asVec4: 'vec4(var)' },
48 typeInfos.forEach(function (typeInfo) {
49 var replaceParams = {
50 type: typeInfo.type,
51 green: typeInfo.green,
52 black: typeInfo.black,
53 asVec4: typeInfo.asVec4,
55 tests.push({
56 fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
57 passMsg: typeInfo.type,
58 fShaderSuccess: true,
59 linkSuccess: true,
60 render: true
61 });
62 });
63 GLSLConformanceTester.runTests(tests);
64 var successfullyParsed = true;
65 </script>
66 </body>
67 </html>