content/canvas/test/webgl-conformance/conformance/glsl/misc/shader-with-comma-conditional-assignment.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!--
michael@0 2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
michael@0 3 Use of this source code is governed by a BSD-style license that can be
michael@0 4 found in the LICENSE file.
michael@0 5 -->
michael@0 6 <!DOCTYPE html>
michael@0 7 <html>
michael@0 8 <head>
michael@0 9 <meta charset="utf-8">
michael@0 10 <title>WebGL GLSL Conformance Tests</title>
michael@0 11 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
michael@0 12 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
michael@0 13 <script src="../../../resources/js-test-pre.js"></script>
michael@0 14 <script src="../../resources/webgl-test-utils.js"></script>
michael@0 15 <script src="../../resources/glsl-conformance-test.js"></script>
michael@0 16 </head>
michael@0 17 <body>
michael@0 18 <div id="description"></div>
michael@0 19 <div id="console"></div>
michael@0 20 <script id="fragmentShaderAGreaterThanBCheckR" type="text/something-not-javascript">
michael@0 21 // fragment shader with for scoping should succeed
michael@0 22 precision mediump float;
michael@0 23 void main() {
michael@0 24 float a = 3.0;
michael@0 25 float b = 2.0;
michael@0 26 float r = 0.0;
michael@0 27 float r0 = 0.5;
michael@0 28 float r1 = 1.0;
michael@0 29 float ab = a > b ? (r = r0, a) : (r = r1, b);
michael@0 30 // Output green if successful, red if not.
michael@0 31 gl_FragColor = ((r == r0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 32 }
michael@0 33 </script>
michael@0 34 <script id="fragmentShaderAGreaterThanBCheckAB" type="text/something-not-javascript">
michael@0 35 // fragment shader with for scoping should succeed
michael@0 36 precision mediump float;
michael@0 37 void main() {
michael@0 38 float a = 3.0;
michael@0 39 float b = 2.0;
michael@0 40 float r = 0.0;
michael@0 41 float r0 = 0.5;
michael@0 42 float r1 = 1.0;
michael@0 43 float ab = a > b ? (r = r0, a) : (r = r1, b);
michael@0 44 // Output green if successful, red if not.
michael@0 45 gl_FragColor = ((ab == a) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 46 }
michael@0 47 </script>
michael@0 48 <script id="fragmentShaderAGreaterThanBCheckT0" type="text/something-not-javascript">
michael@0 49 // fragment shader with for scoping should succeed
michael@0 50 precision mediump float;
michael@0 51 void main() {
michael@0 52 float a = 3.0;
michael@0 53 float b = 2.0;
michael@0 54 float t0 = 0.0;
michael@0 55 float t1 = 0.0;
michael@0 56 float r0 = 0.5;
michael@0 57 float r1 = 1.0;
michael@0 58 float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
michael@0 59 // Output green if successful, red if not.
michael@0 60 gl_FragColor = ((t0 == r0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 61 }
michael@0 62 </script>
michael@0 63 <script id="fragmentShaderAGreaterThanBCheckT1" type="text/something-not-javascript">
michael@0 64 // fragment shader with for scoping should succeed
michael@0 65 precision mediump float;
michael@0 66 void main() {
michael@0 67 float a = 3.0;
michael@0 68 float b = 2.0;
michael@0 69 float t0 = 0.0;
michael@0 70 float t1 = 0.0;
michael@0 71 float r0 = 0.5;
michael@0 72 float r1 = 1.0;
michael@0 73 float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
michael@0 74 // Output green if successful, red if not.
michael@0 75 gl_FragColor = ((t1 == 0.0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 76 }
michael@0 77 </script>
michael@0 78 <script id="fragmentShaderBGreaterThanACheckR" type="text/something-not-javascript">
michael@0 79 // fragment shader with for scoping should succeed
michael@0 80 precision mediump float;
michael@0 81 void main() {
michael@0 82 float a = 2.0;
michael@0 83 float b = 3.0;
michael@0 84 float r = 0.0;
michael@0 85 float r0 = 0.5;
michael@0 86 float r1 = 1.0;
michael@0 87 float ab = a > b ? (r = r0, a) : (r = r1, b);
michael@0 88 // Output green if successful, red if not.
michael@0 89 gl_FragColor = ((r == r1) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 90 }
michael@0 91 </script>
michael@0 92 <script id="fragmentShaderBGreaterThanACheckAB" type="text/something-not-javascript">
michael@0 93 // fragment shader with for scoping should succeed
michael@0 94 precision mediump float;
michael@0 95 void main() {
michael@0 96 float a = 2.0;
michael@0 97 float b = 3.0;
michael@0 98 float r = 0.0;
michael@0 99 float r0 = 0.5;
michael@0 100 float r1 = 1.0;
michael@0 101 float ab = a > b ? (r = r0, a) : (r = r1, b);
michael@0 102 // Output green if successful, red if not.
michael@0 103 gl_FragColor = ((ab == b) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 104 }
michael@0 105 </script>
michael@0 106 <script id="fragmentShaderBGreaterThanACheckT0" type="text/something-not-javascript">
michael@0 107 // fragment shader with for scoping should succeed
michael@0 108 precision mediump float;
michael@0 109 void main() {
michael@0 110 float a = 2.0;
michael@0 111 float b = 3.0;
michael@0 112 float t0 = 0.0;
michael@0 113 float t1 = 0.0;
michael@0 114 float r0 = 0.5;
michael@0 115 float r1 = 1.0;
michael@0 116 float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
michael@0 117 // Output green if successful, red if not.
michael@0 118 gl_FragColor = ((t0 == 0.0) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 119 }
michael@0 120 </script>
michael@0 121 <script id="fragmentShaderBGreaterThanACheckT1" type="text/something-not-javascript">
michael@0 122 // fragment shader with for scoping should succeed
michael@0 123 precision mediump float;
michael@0 124 void main() {
michael@0 125 float a = 2.0;
michael@0 126 float b = 3.0;
michael@0 127 float t0 = 0.0;
michael@0 128 float t1 = 0.0;
michael@0 129 float r0 = 0.5;
michael@0 130 float r1 = 1.0;
michael@0 131 float ab = a > b ? (t0 = r0, a) : (t1 = r1, b);
michael@0 132 // Output green if successful, red if not.
michael@0 133 gl_FragColor = ((t1 == r1) ? vec4(0,1,0,1) : vec4(1,0,0,1));
michael@0 134 }
michael@0 135 </script>
michael@0 136 <script>
michael@0 137 GLSLConformanceTester.runRenderTests([
michael@0 138 { vShaderId: undefined,
michael@0 139 vShaderSuccess: true,
michael@0 140 fShaderId: 'fragmentShaderAGreaterThanBCheckR',
michael@0 141 fShaderSuccess: true,
michael@0 142 linkSuccess: true,
michael@0 143 passMsg: "comma based conditional assignment works",
michael@0 144 },
michael@0 145 { vShaderId: undefined,
michael@0 146 vShaderSuccess: true,
michael@0 147 fShaderId: 'fragmentShaderAGreaterThanBCheckAB',
michael@0 148 fShaderSuccess: true,
michael@0 149 linkSuccess: true,
michael@0 150 passMsg: "comma based conditional assignment works",
michael@0 151 },
michael@0 152 { vShaderId: undefined,
michael@0 153 vShaderSuccess: true,
michael@0 154 fShaderId: 'fragmentShaderAGreaterThanBCheckT0',
michael@0 155 fShaderSuccess: true,
michael@0 156 linkSuccess: true,
michael@0 157 passMsg: "comma based conditional assignment works",
michael@0 158 },
michael@0 159 { vShaderId: undefined,
michael@0 160 vShaderSuccess: true,
michael@0 161 fShaderId: 'fragmentShaderAGreaterThanBCheckT1',
michael@0 162 fShaderSuccess: true,
michael@0 163 linkSuccess: true,
michael@0 164 passMsg: "comma based conditional assignment works",
michael@0 165 },
michael@0 166 { vShaderId: undefined,
michael@0 167 vShaderSuccess: true,
michael@0 168 fShaderId: 'fragmentShaderBGreaterThanACheckR',
michael@0 169 fShaderSuccess: true,
michael@0 170 linkSuccess: true,
michael@0 171 passMsg: "comma based conditional assignment works",
michael@0 172 },
michael@0 173 { vShaderId: undefined,
michael@0 174 vShaderSuccess: true,
michael@0 175 fShaderId: 'fragmentShaderBGreaterThanACheckAB',
michael@0 176 fShaderSuccess: true,
michael@0 177 linkSuccess: true,
michael@0 178 passMsg: "comma based conditional assignment works",
michael@0 179 },
michael@0 180 { vShaderId: undefined,
michael@0 181 vShaderSuccess: true,
michael@0 182 fShaderId: 'fragmentShaderBGreaterThanACheckT0',
michael@0 183 fShaderSuccess: true,
michael@0 184 linkSuccess: true,
michael@0 185 passMsg: "comma based conditional assignment works",
michael@0 186 },
michael@0 187 { vShaderId: undefined,
michael@0 188 vShaderSuccess: true,
michael@0 189 fShaderId: 'fragmentShaderBGreaterThanACheckT1',
michael@0 190 fShaderSuccess: true,
michael@0 191 linkSuccess: true,
michael@0 192 passMsg: "comma based conditional assignment works",
michael@0 193 }
michael@0 194 ]);
michael@0 195 successfullyParsed = true;
michael@0 196 </script>
michael@0 197 </body>
michael@0 198 </html>
michael@0 199
michael@0 200

mercurial