Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / canvas / test / webgl-mochitest / test_noprog_draw.html
blob37def57fcaa4dbcf519dc168ed2ddb624939b321
1 <!DOCTYPE HTML>
2 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
4 <title>WebGL test: Drawing with a null program</title>
6 <script src="/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
8 <script src="driver-info.js"></script>
9 <script src="webgl-util.js"></script>
12 <script id="vs" type="x-shader/x-vertex">
14 void main(void) {
15 gl_PointSize = 16.0;
16 gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
19 </script>
20 <script id="fs" type="x-shader/x-fragment">
22 precision mediump float;
24 void main(void) {
25 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
28 </script>
29 <body>
30 <canvas id="c" width="64" height="64"></canvas>
31 <script>
33 // Give ourselves a scope to return early from:
34 (function() {
35 var gl = c.getContext('webgl');
36 if (!gl) {
37 todo(false, 'WebGL is unavailable.');
38 return;
41 gl.disable(gl.DEPTH_TEST);
43 var prog = WebGLUtil.createProgramByIds(gl, 'vs', 'fs');
44 if (!prog) {
45 ok(false, 'Program linking should succeed.');
46 return;
49 function checkGLError(func, info, refValue) {
50 if (!refValue)
51 refValue = 0;
53 var error = gl.getError();
54 func(error == refValue,
55 '[' + info + '] gl.getError should be 0x' + refValue.toString(16) +
56 ', was 0x' + error.toString(16) + '.');
59 // Start drawing
60 checkGLError(ok, 'after setup');
62 gl.useProgram(prog);
63 gl.drawArrays(gl.POINTS, 0, 1);
64 checkGLError(ok, 'after non-null-program DrawArrays');
66 gl.useProgram(null);
67 gl.drawArrays(gl.POINTS, 0, 1);
68 checkGLError(ok, 'after null-program DrawArrays', gl.INVALID_OPERATION);
70 ok(true, 'Test complete.');
71 })();
73 </script>