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>Negative tests for writting to a shader input with interpolation qualifier
</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>
22 According to ESSL 3.00.6 section 4.3.4:
23 "Variables declared as in or centroid in may not be written to during shader execution.",
24 these tests ensure that a compile error is generated when using a shader input with interpolation qualifier as l-value.
26 <script type=
"application/javascript">
30 var vertexShaderTemplate = [
32 '$(InterpolationQualifier) out float v_float_varying;',
35 ' v_float_varying =
1.0;',
36 ' gl_Position = vec4(
0.0,
0.0,
0.0,
1.0);',
40 var fragmentShaderTemplate = [
42 'precision mediump float;',
43 '$(InterpolationQualifier) in float v_float_varying;',
47 ' v_float_varying =
1.0;',
48 ' my_color = vec4(
1.0,
0.0,
0.0, v_float_varying);',
52 var errorMessageTemplate =
"Writting to shader inputs with '$(InterpolationQualifier)' qualifier must fail";
56 InterpolationQualifier: 'flat'
59 InterpolationQualifier: 'smooth'
62 InterpolationQualifier: 'centroid'
66 var wtu = WebGLTestUtils;
69 for (var i =
0; i < testDataList.length; ++i) {
71 vShaderSource: wtu.replaceParams(vertexShaderTemplate, testDataList[i]),
73 fShaderSource: wtu.replaceParams(fragmentShaderTemplate, testDataList[i]),
74 fShaderSuccess: false,
76 passMsg: wtu.replaceParams(errorMessageTemplate, testDataList[i])
80 GLSLConformanceTester.runTests(tests,
2);