Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / vector-dynamic-indexing-nv-driver-bug.html
blob767bfd915dda2b8d5040f8068808b1df1ad1faa4
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 dynamic vector and matrix indexing 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="fshaderLValueVectorBeingIndexedHasSideEffects" type="x-shader/x-fragment">#version 300 es
21 precision mediump float;
23 out vec4 my_FragColor;
25 uniform int u_zero;
27 int sideEffectCounter = 0;
29 int funcWithSideEffects() {
30 sideEffectCounter++;
31 return 1;
34 void main() {
35 vec4 V[2];
36 V[0] = vec4(1.0, 2.0, 3.0, 4.0);
37 V[1] = vec4(5.0, 6.0, 7.0, 8.0);
38 // In case this is broken down to two expressions where one reads V[funcWithSideEffects()]
39 // and another writes it, it needs to be made sure that funcWithSideEffects() only gets called once.
40 V[funcWithSideEffects()][u_zero + 1]++;
41 vec4 expectedV0 = vec4(1.0, 2.0, 3.0, 4.0);
42 vec4 expectedV1 = vec4(5.0, 7.0, 7.0, 8.0);
43 float f = 1.0 - distance(V[0], expectedV0) - distance(V[1], expectedV1);
44 if (sideEffectCounter != 1) {
45 f = 0.0;
47 my_FragColor = vec4(1.0 - f, f, 0.0, 1.0);
49 </script>
50 <script type="application/javascript">
51 "use strict";
52 description("Dynamic indexing of vectors and matrices should work.");
54 debug("This test exposes a NVidia driver bug on Linux");
56 GLSLConformanceTester.runRenderTests([
58 fShaderId: 'fshaderLValueVectorBeingIndexedHasSideEffects',
59 fShaderSuccess: true,
60 linkSuccess: true,
61 passMsg: 'Index a vector expression that itself has side effects, in an l-value'
63 ], 2);
64 </script>
65 </body>
66 </html>