Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / uniforms / query-uniform-blocks-after-shader-detach.html
blob24c7060e5ced1ff603abc35325fd89688234b76e
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>WebGL Uniform Buffers Conformance Tests</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 id="vshader" type="x-shader/x-vertex">#version 300 es
17 in vec4 position;
19 uniform localInputs
21 mat4 projectionModelViewMatrix;
24 void main ()
26 gl_Position = projectionModelViewMatrix * position;
28 </script>
29 <script id="fshader" type="x-shader/x-fragment">#version 300 es
31 out lowp vec4 resultColor;
33 void main()
35 resultColor = vec4(0,1,0,1);
37 </script>
38 </head>
39 <body>
40 <div id="description"></div>
41 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
42 <div id="console"></div>
43 <script>
44 // Adopted from the test case provided in crbug.com/735784
45 "use strict";
46 description("This tests UBO block lookups still work after detaching shaders");
48 debug("");
50 var wtu = WebGLTestUtils;
51 var canvas = document.getElementById("canvas");
52 var gl = wtu.create3DContext(canvas, null, 2);
54 function runTest(gl) {
55 var program = wtu.loadProgramFromScript(gl, "vshader", "fshader");
56 if (!program) {
57 testFailed("Loading program failed");
58 return;
61 var shaders = gl.getAttachedShaders(program);
62 if (!shaders || shaders.length != 2) {
63 testFailed("getAttachedShaders failed");
64 return;
66 gl.detachShader (program, shaders[0]);
67 gl.detachShader (program, shaders[1]);
69 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from set up");
71 var index = gl.getUniformBlockIndex(program, "localInputs");
72 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "No GL error from getUniformBlockIndex");
73 if (index == gl.INVALID_INDEX) {
74 testFailed("getUniformBlockIndex returns INVALID_INDEX");
75 } else {
76 testPassed("getUniformBlockIndex returns valid index");
80 if (!gl) {
81 testFailed("WebGL context does not exist");
82 } else {
83 testPassed("WebGL context exists");
84 runTest(gl);
87 debug("");
88 var successfullyParsed = true;
89 </script>
90 <script src="../../js/js-test-post.js"></script>
92 </body>
93 </html>