Bug 1918529 - fix some subpixel misalignment issues with gfx.webrender.svg-filter...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / bugs / sampler-array-struct-function-arg.html
blobb39179a186c2ead745cc10cbb73c0f9a45739b36
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 struct containing an array of samplers passed into a user-defined function</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>
19 <canvas id="output" style="border: none;" width="64" height="64"></canvas>
20 <div id="description"></div>
21 <div id="console"></div>
22 <script id="fshaderSampler" type="x-shader/x-fragment">
23 precision mediump float;
25 struct S {
26 sampler2D sam[2];
29 uniform S uni;
31 vec4 useSampler(S arg)
33 return texture2D(arg.sam[0], vec2(0.0, 0.0));
36 void main() {
37 gl_FragColor = vec4(useSampler(uni));
39 </script>
40 <script type="application/javascript">
41 "use strict";
42 description();
44 var wtu = WebGLTestUtils;
45 var canvas = document.getElementById("output");
46 var gl = wtu.create3DContext(canvas);
48 if (!gl) {
49 testFailed("Could not create a GL context.");
50 } else {
51 debug("Drawing with a shader that uses a sampler array in a struct passed into a function.");
52 var program = wtu.setupProgram(
53 gl, [wtu.simpleVertexShader, 'fshaderSampler'], ['a_position'], [0], true);
54 wtu.setupUnitQuad(gl);
56 var tex = gl.createTexture();
57 gl.bindTexture(gl.TEXTURE_2D, tex);
58 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
59 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
60 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
61 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
62 wtu.fillTexture(gl, tex, 1, 1, [0, 255, 0, 255]);
64 wtu.clearAndDrawUnitQuad(gl);
65 wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green");
68 var successfullyParsed = true;
69 </script>
70 <script src="../../../js/js-test-post.js"></script>
71 </body>
72 </html>