Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / texture-offset-non-constant-offset.html
blob8fd483140db113519bc6c91c77de62f0182138f7
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 non-constant offset 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 ivec2 offset = ivec2(0);
29 my_FragColor = textureOffset(u_sampler, u_texCoord, offset);
31 </script>
32 <script id="fshaderTextureProjOffset" type="x-shader/x-fragment">#version 300 es
33 precision mediump float;
35 out vec4 my_FragColor;
36 uniform sampler2D u_sampler;
37 uniform vec4 u_texCoord;
39 void main() {
40 ivec2 offset = ivec2(0);
41 my_FragColor = textureProjOffset(u_sampler, u_texCoord, offset);
43 </script>
44 <script id="fshaderTextureLodOffset" type="x-shader/x-fragment">#version 300 es
45 precision mediump float;
47 out vec4 my_FragColor;
48 uniform sampler2D u_sampler;
49 uniform vec2 u_texCoord;
50 uniform float u_lod;
52 void main() {
53 ivec2 offset = ivec2(0);
54 my_FragColor = textureLodOffset(u_sampler, u_texCoord, u_lod, offset);
56 </script>
57 <script id="fshaderTextureProjLodOffset" type="x-shader/x-fragment">#version 300 es
58 precision mediump float;
60 out vec4 my_FragColor;
61 uniform sampler2D u_sampler;
62 uniform vec4 u_texCoord;
63 uniform float u_lod;
65 void main() {
66 ivec2 offset = ivec2(0);
67 my_FragColor = textureProjLodOffset(u_sampler, u_texCoord, u_lod, offset);
69 </script>
70 <script id="fshaderTextureGradOffset" type="x-shader/x-fragment">#version 300 es
71 precision mediump float;
73 out vec4 my_FragColor;
74 uniform sampler2D u_sampler;
75 uniform vec2 u_texCoord;
76 uniform vec2 u_dPdx;
77 uniform vec2 u_dPdy;
79 void main() {
80 ivec2 offset = ivec2(0);
81 my_FragColor = textureGradOffset(u_sampler, u_texCoord, u_dPdx, u_dPdy, offset);
83 </script>
84 <script id="fshaderTextureProjGradOffset" type="x-shader/x-fragment">#version 300 es
85 precision mediump float;
87 out vec4 my_FragColor;
88 uniform sampler2D u_sampler;
89 uniform vec4 u_texCoord;
90 uniform vec2 u_dPdx;
91 uniform vec2 u_dPdy;
93 void main() {
94 ivec2 offset = ivec2(0);
95 my_FragColor = textureProjGradOffset(u_sampler, u_texCoord, u_dPdx, u_dPdy, offset);
97 </script>
98 <script id="fshaderTexelFetchOffset" type="x-shader/x-fragment">#version 300 es
99 precision mediump float;
101 out vec4 my_FragColor;
102 uniform sampler2D u_sampler;
103 uniform vec2 u_texCoord;
104 uniform vec2 u_lod;
106 void main() {
107 ivec2 offset = ivec2(0);
108 my_FragColor = texelFetchOffset(u_sampler, ivec2(u_texCoord), int(u_lod), offset);
110 </script>
111 <script type="application/javascript">
112 "use strict";
113 description("A non-constant offset is not valid in texture offset functions.");
115 var wtu = WebGLTestUtils;
117 var shaderTextureOffsetSrc = wtu.getScript('fshaderTextureOffset');
118 var shaderTextureLodOffsetSrc = wtu.getScript('fshaderTextureLodOffset');
119 var shaderTextureGradOffsetSrc = wtu.getScript('fshaderTextureGradOffset');
120 var shaderTextureProjOffsetSrc = wtu.getScript('fshaderTextureProjOffset');
121 var shaderTextureProjLodOffsetSrc = wtu.getScript('fshaderTextureProjLodOffset');
122 var shaderTextureProjGradOffsetSrc = wtu.getScript('fshaderTextureProjGradOffset');
123 var shaderTexelFetchOffsetSrc = wtu.getScript('fshaderTexelFetchOffset');
125 var gl = wtu.create3DContext(undefined, undefined, 2);
127 if (!gl) {
128 testFailed("Unable to initialize WebGL 2.0 context.");
129 } else {
130 GLSLConformanceTester.runTests([
132 fShaderSource: shaderTextureOffsetSrc,
133 fShaderSuccess: false,
134 passMsg: 'textureOffset with non-constant offset is invalid'
137 fShaderSource: shaderTextureLodOffsetSrc,
138 fShaderSuccess: false,
139 passMsg: 'textureLodOffset with non-constant offset is invalid'
142 fShaderSource: shaderTextureGradOffsetSrc,
143 fShaderSuccess: false,
144 passMsg: 'textureGradOffset with non-constant offset is invalid'
147 fShaderSource: shaderTextureProjOffsetSrc,
148 fShaderSuccess: false,
149 passMsg: 'textureProjOffset with non-constant offset is invalid'
152 fShaderSource: shaderTextureProjLodOffsetSrc,
153 fShaderSuccess: false,
154 passMsg: 'textureProjLodOffset with non-constant offset is invalid'
157 fShaderSource: shaderTextureProjGradOffsetSrc,
158 fShaderSuccess: false,
159 passMsg: 'textureProjGradOffset with non-constant offset is invalid'
162 fShaderSource: shaderTexelFetchOffsetSrc,
163 fShaderSuccess: false,
164 passMsg: 'texelFetchOffset with non-constant offset is invalid'
166 ], 2);
168 </script>
169 </body>
170 </html>