Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / extensions / promoted-extensions-in-shaders.html
blobb2b4d1257f2ab7f6b7fb8d1704dd2bd65f30cf3a
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>Extensions promoted to core should not be possible to use in shaders</title>
12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
13 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
14 <script src="../../js/js-test-pre.js"></script>
15 <script src="../../js/webgl-test-utils.js"></script>
16 <script src="../../js/glsl-conformance-test.js"></script>
17 </head>
18 <body>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script id="fragShaderRequire" type="x-shader/x-fragment">
22 #extension $(ext) : require
23 precision mediump float;
24 void main() {
25 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
27 </script>
28 <script id="fragShaderIfdef" type="x-shader/x-fragment">
29 precision mediump float;
30 void main() {
31 #ifdef $(ext)
32 gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
33 #else
34 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
35 #endif
37 </script>
38 <script id="fragShader300Require" type="x-shader/x-fragment">#version 300 es
39 #extension $(ext) : require
40 precision mediump float;
41 out vec4 my_FragColor;
42 void main() {
43 my_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
45 </script>
46 <script id="fragShader300Ifdef" type="x-shader/x-fragment">#version 300 es
47 precision mediump float;
48 out vec4 my_FragColor;
49 void main() {
50 #ifdef $(ext)
51 my_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
52 #else
53 my_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
54 #endif
56 </script>
57 <script type="application/javascript">
58 "use strict";
59 description();
61 var wtu = WebGLTestUtils;
63 var shaderTemplateRequire = wtu.getScript('fragShaderRequire');
64 var shaderTemplate300Require = wtu.getScript('fragShader300Require');
65 var shaderTemplateIfdef = wtu.getScript('fragShaderIfdef');
66 var shaderTemplate300Ifdef = wtu.getScript('fragShader300Ifdef');
68 var extensions = [
69 'GL_EXT_draw_buffers',
70 'GL_EXT_frag_depth',
71 'GL_EXT_shader_texture_lod',
72 'GL_OES_standard_derivatives'
75 var tests = [];
77 for (var i = 0; i < extensions.length; ++i) {
78 var shaderSrcRequire = wtu.replaceParams(shaderTemplateRequire, {'ext': extensions[i]});
79 tests.push({
80 fShaderSource: shaderSrcRequire,
81 fShaderSuccess: false,
82 linkSuccess: false,
83 passMsg: "ESSL 1.00 Fragment shader that requires " + extensions[i] + " should not compile."
84 });
85 var shaderSrc300Require = wtu.replaceParams(shaderTemplate300Require, {'ext': extensions[i]});
86 tests.push({
87 fShaderSource: shaderSrc300Require,
88 fShaderSuccess: false,
89 linkSuccess: false,
90 passMsg: "ESSL 3.00 Fragment shader that requires " + extensions[i] + " should not compile."
91 });
93 var shaderSrcIfdef = wtu.replaceParams(shaderTemplateIfdef, {'ext': extensions[i]});
94 tests.push({
95 fShaderSource: shaderSrcIfdef,
96 fShaderSuccess: true,
97 linkSuccess: true,
98 render: true,
99 passMsg: extensions[i] + " should not be defined in ESSL 1.00 fragment shader."
101 var shaderSrc300Ifdef = wtu.replaceParams(shaderTemplate300Ifdef, {'ext': extensions[i]});
102 tests.push({
103 fShaderSource: shaderSrc300Ifdef,
104 fShaderSuccess: true,
105 linkSuccess: true,
106 render: true,
107 passMsg: extensions[i] + " should not be defined in ESSL 3.00 fragment shader."
111 GLSLConformanceTester.runTests(tests, 2);
112 var successfullyParsed = true;
113 </script>
114 </body>
115 </html>