OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <html> | |
3 <head> | |
4 <title>GPU Memory Test: Use N MB of GPU Memory with 3D CSS</title> | |
5 <style> | |
6 .block { | |
7 background: #FF0000; | |
8 font-size: 150px; | |
9 height: 512px; | |
10 position: absolute; | |
11 width: 512px; | |
12 | |
13 } | |
14 .perspective | |
15 { | |
16 border: 1px solid black; | |
17 height: 512px; | |
18 text-align: center; | |
19 width: 512px; | |
20 -webkit-perspective: 600px; | |
21 -webkit-perspective-origin: center center; | |
22 -webkit-transform-style: preserve-3d; | |
23 } | |
24 </style> | |
25 <script type="text/javascript"> | |
26 // Generate n 3D CSS elements that are each about 1 MB in size | |
nduca
2013/01/05 05:14:42
how about splitting this patch up into a few patch
ccameron
2013/01/07 21:36:34
This I feel strongly about.
I had considered doin
| |
27 function useGpuMemory(mb_to_use) { | |
28 n = mb_to_use; | |
29 var blocks = document.getElementById("blocks"); | |
30 var blockArray = document.getElementsByClassName("block"); | |
31 for (var i = 0; i < n; i++) { | |
32 var block = document.createElement("div"); | |
33 block.className = "block"; | |
34 block.style.WebkitTransform = "rotateZ(" + i + "deg) translate3d(" + i + "px , " + i + "px, " + 2*(i-n+1) + "px)"; | |
nduca
2013/01/05 05:14:42
is the rotation important?
is there a simpler cas
ccameron
2013/01/07 21:36:34
Importantly, the test does verify that these pages
| |
35 block.style.zIndex = -i; | |
nduca
2013/01/05 05:14:42
is the backward zIndex ordering important?
ccameron
2013/01/07 21:36:34
Nope, that was a mistake -- I'd meant translate3d.
| |
36 var r = 16 + 240 * (i % 2); | |
37 var g = 16; | |
38 var b = 255 - i; | |
39 block.style.background = "#" + r.toString(16) + g.toString(16) + b.toString( 16); | |
40 block.innerHTML = i; | |
nduca
2013/01/05 05:14:42
prefer
block.textContent = i;
unless you're inser
ccameron
2013/01/07 21:36:34
Fixed.
| |
41 blocks.appendChild(block); | |
42 } | |
43 | |
44 // Signal back to the test runner that we're done allocating memory. | |
45 domAutomationController.send("DONE"); | |
46 } | |
47 </script> | |
48 </head> | |
49 <body> | |
50 <div id="blocks" class="perspective"/> | |
51 </body> | |
52 </html> | |
OLD | NEW |