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.
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>
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;
25 gl_FragColor = vec4(
0.0,
1.0,
0.0,
1.0);
28 <script id=
"fragShaderIfdef" type=
"x-shader/x-fragment">
29 precision mediump float;
32 gl_FragColor = vec4(
1.0,
0.0,
0.0,
1.0);
34 gl_FragColor = vec4(
0.0,
1.0,
0.0,
1.0);
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;
43 my_FragColor = vec4(
0.0,
1.0,
0.0,
1.0);
46 <script id=
"fragShader300Ifdef" type=
"x-shader/x-fragment">#version
300 es
47 precision mediump float;
48 out vec4 my_FragColor;
51 my_FragColor = vec4(
1.0,
0.0,
0.0,
1.0);
53 my_FragColor = vec4(
0.0,
1.0,
0.0,
1.0);
57 <script type=
"application/javascript">
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');
69 'GL_EXT_draw_buffers',
71 'GL_EXT_shader_texture_lod',
72 'GL_OES_standard_derivatives'
77 for (var i =
0; i < extensions.length; ++i) {
78 var shaderSrcRequire = wtu.replaceParams(shaderTemplateRequire, {'ext': extensions[i]});
80 fShaderSource: shaderSrcRequire,
81 fShaderSuccess: false,
83 passMsg:
"ESSL 1.00 Fragment shader that requires " + extensions[i] +
" should not compile."
85 var shaderSrc300Require = wtu.replaceParams(shaderTemplate300Require, {'ext': extensions[i]});
87 fShaderSource: shaderSrc300Require,
88 fShaderSuccess: false,
90 passMsg:
"ESSL 3.00 Fragment shader that requires " + extensions[i] +
" should not compile."
93 var shaderSrcIfdef = wtu.replaceParams(shaderTemplateIfdef, {'ext': extensions[i]});
95 fShaderSource: shaderSrcIfdef,
99 passMsg: extensions[i] +
" should not be defined in ESSL 1.00 fragment shader."
101 var shaderSrc300Ifdef = wtu.replaceParams(shaderTemplate300Ifdef, {'ext': extensions[i]});
103 fShaderSource: shaderSrc300Ifdef,
104 fShaderSuccess: true,
107 passMsg: extensions[i] +
" should not be defined in ESSL 3.00 fragment shader."
111 GLSLConformanceTester.runTests(tests,
2);
112 var successfullyParsed = true;