blob: 181711f6852c8f9b1b7366127a7a1a534867c98a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
</head>
<body>
<pre id=e_out></pre>
<script>
ok = window.ok || function(e, s) {
e_out.textContent += `\n${!e ? 'FAIL' : 'pass'}: ${s}`;
};
// -
// Bug 1778144
const canvas = document.createElement("canvas")
const gl = canvas.getContext("webgl")
program = gl.createProgram()
vertex = gl.createShader(gl.VERTEX_SHADER)
gl.shaderSource(vertex, `\
precision highp float;
attribute vec4 a_vec4;
uniform bool u_bool;
uniform bvec2 u_bvec2;
uniform bvec3 u_bvec3;
uniform bvec4 u_bvec4;
varying vec2 v_vec2;
void main() {
gl_Position.x += float(a_vec4.x);
if (u_bool || u_bvec2.x || u_bvec3.x || u_bvec4.x) {
}
}
`)
gl.compileShader(vertex)
gl.attachShader(program, vertex)
fragment = gl.createShader(gl.FRAGMENT_SHADER)
gl.shaderSource(fragment, `\
precision highp float;
varying vec2 v_vec2;
uniform sampler2D u_sampler2d;
void main() {
gl_FragColor = texture2D(u_sampler2d, v_vec2);
}
`)
gl.compileShader(fragment)
gl.attachShader(program, fragment)
gl.linkProgram(program)
gl.useProgram(program)
const begin = performance.now();
gl.drawArrays(gl.POINTS, 1659036386, 1)
let err = gl.getError();
ok(err == gl.OUT_OF_MEMORY || !err, `err: ${err}`);
const elapsed_ms = performance.now() - begin;
ok(elapsed_ms < 1000, `elapsed_ms:${elapsed_ms} < 1000`);
// -
// Let's be kind and kill this now-gpu-memory-heavy context.
gl.getExtension('WEBGL_lose_context').loseContext();
err = gl.getError();
ok(err == gl.CONTEXT_LOST_WEBGL, `err:${err} == gl.CONTEXT_LOST_WEBGL`);
// -
ok(true, 'done');
</script>
</body>
</html>
|