OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <title>GPU Feature Testing: WebGL</title> | 5 <title>GPU Feature Testing: WebGL</title> |
6 <script> | 6 <script> |
| 7 var frameCount = 0; |
| 8 var gl = null; |
| 9 |
7 function init() { | 10 function init() { |
8 var canvas = document.createElement("canvas"); | 11 var canvas = document.getElementById("da-canvas"); |
9 if (!canvas) | 12 if (!canvas) |
10 return null; | 13 return; |
11 var context = null; | |
12 try { | 14 try { |
13 context = canvas.getContext("webgl"); | 15 gl = canvas.getContext("webgl"); |
14 } catch(e) {} | 16 } catch(e) {} |
15 if (!context) { | 17 if (!gl) { |
16 try { | 18 try { |
17 context = canvas.getContext("experimental-webgl"); | 19 gl = canvas.getContext("experimental-webgl"); |
18 } catch(e) {} | 20 } catch(e) {} |
19 } | 21 } |
20 return context; | |
21 } | 22 } |
22 | 23 |
23 function runTest() { | 24 function runTest() { |
24 var gl = init(); | 25 init(); |
| 26 if (gl) |
| 27 window.webkitRequestAnimationFrame(draw); |
| 28 else |
| 29 endTest(); |
| 30 } |
| 31 |
| 32 function draw() { |
| 33 frameCount++; |
| 34 gl.viewport(0, 0, 500, 500); |
| 35 gl.clearColor(1.0/frameCount, 0.0, 0.0, 1.0); |
| 36 gl.clear(gl.COLOR_BUFFER_BIT); |
| 37 if (frameCount == 5) { |
| 38 endTest(); |
| 39 } else { |
| 40 window.webkitRequestAnimationFrame(draw); |
| 41 } |
| 42 } |
| 43 |
| 44 function endTest() { |
25 domAutomationController.setAutomationId(1); | 45 domAutomationController.setAutomationId(1); |
26 domAutomationController.send("FINISHED"); | 46 domAutomationController.send("FINISHED"); |
27 } | 47 } |
28 </script> | 48 </script> |
29 </head> | 49 </head> |
30 <body onload="runTest()"> | 50 <body onload="runTest()"> |
31 WebGL should trigger GPU process launch if it is allowed. | 51 WebGL should trigger GPU process launch if it is allowed. |
| 52 <canvas id="da-canvas" width="500" height="500"></canvas> |
32 </body> | 53 </body> |
33 </html> | 54 </html> |
OLD | NEW |