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>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
21 mat4 projectionModelViewMatrix;
26 gl_Position = projectionModelViewMatrix * position;
29 <script id=
"fshader" type=
"x-shader/x-fragment">#version
300 es
31 out lowp vec4 resultColor;
35 resultColor = vec4(
0,
1,
0,
1);
40 <div id=
"description"></div>
41 <canvas id=
"canvas" style=
"width: 50px; height: 50px;"> </canvas>
42 <div id=
"console"></div>
44 // Adopted from the test case provided in crbug.com/735784
46 description("This tests UBO block lookups still work after detaching shaders");
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");
57 testFailed("Loading program failed");
61 var shaders
= gl
.getAttachedShaders(program
);
62 if (!shaders
|| shaders
.length
!= 2) {
63 testFailed("getAttachedShaders failed");
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");
76 testPassed("getUniformBlockIndex returns valid index");
81 testFailed("WebGL context does not exist");
83 testPassed("WebGL context exists");
88 var successfullyParsed
= true;
90 <script src=
"../../js/js-test-post.js"></script>