Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / texture-offset-uniform-texture-coordinate.html
blob56caf47f46bca152e19f8beedfa2e38dc29b7c58
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 texture offset with uniform texture coordinates 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="fshaderTextureOffset" type="x-shader/x-fragment">#version 300 es
21 precision mediump float;
23 out vec4 my_FragColor;
24 uniform sampler2D u_sampler;
25 uniform vec2 u_texCoord;
27 void main() {
28 my_FragColor = textureOffset(u_sampler, u_texCoord, ivec2(0, 1));
30 </script>
31 <script id="fshaderTextureProjOffset" type="x-shader/x-fragment">#version 300 es
32 precision mediump float;
34 out vec4 my_FragColor;
35 uniform sampler2D u_sampler;
36 uniform vec4 u_texCoord;
38 void main() {
39 my_FragColor = textureProjOffset(u_sampler, u_texCoord, ivec2(0, 1));
41 </script>
42 <script id="fshaderTextureLodOffset" type="x-shader/x-fragment">#version 300 es
43 precision mediump float;
45 out vec4 my_FragColor;
46 uniform sampler2D u_sampler;
47 uniform vec2 u_texCoord;
48 uniform float u_lod;
50 void main() {
51 my_FragColor = textureLodOffset(u_sampler, u_texCoord, u_lod, ivec2(0, 1));
53 </script>
54 <script id="fshaderTextureProjLodOffset" type="x-shader/x-fragment">#version 300 es
55 precision mediump float;
57 out vec4 my_FragColor;
58 uniform sampler2D u_sampler;
59 uniform vec4 u_texCoord;
60 uniform float u_lod;
62 void main() {
63 my_FragColor = textureProjLodOffset(u_sampler, u_texCoord, u_lod, ivec2(0, 1));
65 </script>
66 <script id="fshaderTextureGradOffset" type="x-shader/x-fragment">#version 300 es
67 precision mediump float;
69 out vec4 my_FragColor;
70 uniform sampler2D u_sampler;
71 uniform vec2 u_texCoord;
72 uniform vec2 u_dPdx;
73 uniform vec2 u_dPdy;
75 void main() {
76 my_FragColor = textureGradOffset(u_sampler, u_texCoord, u_dPdx, u_dPdy, ivec2(0, 1));
78 </script>
79 <script id="fshaderTextureProjGradOffset" type="x-shader/x-fragment">#version 300 es
80 precision mediump float;
82 out vec4 my_FragColor;
83 uniform sampler2D u_sampler;
84 uniform vec4 u_texCoord;
85 uniform vec2 u_dPdx;
86 uniform vec2 u_dPdy;
88 void main() {
89 my_FragColor = textureProjGradOffset(u_sampler, u_texCoord, u_dPdx, u_dPdy, ivec2(0, 1));
91 </script>
92 <script id="fshaderTexelFetchOffset" type="x-shader/x-fragment">#version 300 es
93 precision mediump float;
95 out vec4 my_FragColor;
96 uniform sampler2D u_sampler;
97 uniform vec2 u_texCoord;
98 uniform vec2 u_lod;
100 void main() {
101 my_FragColor = texelFetchOffset(u_sampler, ivec2(u_texCoord), int(u_lod), ivec2(0, 1));
103 </script>
104 <script type="application/javascript">
105 "use strict";
106 description("Texture coordinates expressed as uniform variable should not crash in texture offset functions.");
108 var wtu = WebGLTestUtils;
110 var shaderTextureOffsetSrc = wtu.getScript('fshaderTextureOffset');
111 var shaderTextureLodOffsetSrc = wtu.getScript('fshaderTextureLodOffset');
112 var shaderTextureGradOffsetSrc = wtu.getScript('fshaderTextureGradOffset');
113 var shaderTextureProjOffsetSrc = wtu.getScript('fshaderTextureProjOffset');
114 var shaderTextureProjLodOffsetSrc = wtu.getScript('fshaderTextureProjLodOffset');
115 var shaderTextureProjGradOffsetSrc = wtu.getScript('fshaderTextureProjGradOffset');
116 var shaderTexelFetchOffsetSrc = wtu.getScript('fshaderTexelFetchOffset');
118 var gl = wtu.create3DContext(undefined, undefined, 2);
120 if (!gl) {
121 testFailed("Unable to initialize WebGL 2.0 context.");
122 } else {
123 GLSLConformanceTester.runTests([
125 fShaderSource: shaderTextureOffsetSrc,
126 fShaderSuccess: true,
127 linkSuccess: true,
128 passMsg: 'textureOffset with uniform texture coordinates should not crash'
131 fShaderSource: shaderTextureLodOffsetSrc,
132 fShaderSuccess: true,
133 linkSuccess: true,
134 passMsg: 'textureLodOffset with uniform texture coordinates should not crash'
137 fShaderSource: shaderTextureGradOffsetSrc,
138 fShaderSuccess: true,
139 linkSuccess: true,
140 passMsg: 'textureGradOffset with uniform texture coordinates should not crash'
143 fShaderSource: shaderTextureProjOffsetSrc,
144 fShaderSuccess: true,
145 linkSuccess: true,
146 passMsg: 'textureProjOffset with uniform texture coordinates should not crash'
149 fShaderSource: shaderTextureProjLodOffsetSrc,
150 fShaderSuccess: true,
151 linkSuccess: true,
152 passMsg: 'textureProjLodOffset with uniform texture coordinates should not crash'
155 fShaderSource: shaderTextureProjGradOffsetSrc,
156 fShaderSuccess: true,
157 linkSuccess: true,
158 passMsg: 'textureProjGradOffset with uniform texture coordinates should not crash'
161 fShaderSource: shaderTexelFetchOffsetSrc,
162 fShaderSuccess: true,
163 linkSuccess: true,
164 passMsg: 'texelFetchOffset with uniform texture coordinates should not crash'
166 ], 2);
168 </script>
169 </body>
170 </html>