5 <script src='/tests/SimpleTest/SimpleTest.js'
></script>
10 ok
= window
.ok
|| function(e
, s
) {
11 e_out
.textContent
+= `\n${!e ? 'FAIL' : 'pass'}: ${s}`;
17 const canvas
= document
.createElement("canvas")
18 const gl
= canvas
.getContext("webgl")
19 program
= gl
.createProgram()
20 vertex
= gl
.createShader(gl
.VERTEX_SHADER
)
21 gl
.shaderSource(vertex
, `\
22 precision highp float;
23 attribute vec4 a_vec4;
25 uniform bvec2 u_bvec2;
26 uniform bvec3 u_bvec3;
27 uniform bvec4 u_bvec4;
30 gl_Position.x += float(a_vec4.x);
31 if (u_bool || u_bvec2.x || u_bvec3.x || u_bvec4.x) {
35 gl
.compileShader(vertex
)
36 gl
.attachShader(program
, vertex
)
37 fragment
= gl
.createShader(gl
.FRAGMENT_SHADER
)
38 gl
.shaderSource(fragment
, `\
39 precision highp float;
41 uniform sampler2D u_sampler2d;
43 gl_FragColor = texture2D(u_sampler2d, v_vec2);
46 gl
.compileShader(fragment
)
47 gl
.attachShader(program
, fragment
)
48 gl
.linkProgram(program
)
49 gl
.useProgram(program
)
50 const begin
= performance
.now();
51 gl
.drawArrays(gl
.POINTS
, 1659036386, 1)
53 let err
= gl
.getError();
54 ok(err
== gl
.OUT_OF_MEMORY
|| !err
, `err: ${err}`);
56 const elapsed_ms
= performance
.now() - begin
;
57 ok(elapsed_ms
< 1000, `elapsed_ms:${elapsed_ms} < 1000`);
61 // Let's be kind and kill this now-gpu-memory-heavy context.
62 gl
.getExtension('WEBGL_lose_context').loseContext();
64 ok(err
== gl
.CONTEXT_LOST_WEBGL
, `err:${err} == gl.CONTEXT_LOST_WEBGL`);