| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 |
| 3 <!-- READ BEFORE UPDATING: |
| 4 If this test is updated make sure to increment the "revision" value of the |
| 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure |
| 6 that the baseline images are regenerated on the next run. |
| 7 --> |
| 8 |
| 9 <html> |
| 10 <head> |
| 11 <title>WebGL 2.0 Test: BlitFramebuffer to default back buffer with no alpha</tit
le> |
| 12 <style type="text/css"> |
| 13 .nomargin { |
| 14 margin: 0px auto; |
| 15 } |
| 16 </style> |
| 17 |
| 18 <script src="pixel_webgl2_util.js"></script> |
| 19 |
| 20 <script> |
| 21 'use strict'; |
| 22 function main() |
| 23 { |
| 24 let gl = initGL(document.getElementById("c"), false, false); |
| 25 |
| 26 // Assume a square framebuffer. Doesn't need to match the size of the canvas,
necessarily. |
| 27 let sz = 200; |
| 28 |
| 29 // Create a framebuffer with a 4x multisampled RGBA8 renderbuffer. |
| 30 // Assume this is a commonly supported configuration. |
| 31 let rb = gl.createRenderbuffer(); |
| 32 gl.bindRenderbuffer(gl.RENDERBUFFER, rb); |
| 33 gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 4, gl.RGBA8, sz, sz); |
| 34 |
| 35 // Create a framebuffer. |
| 36 let fb = gl.createFramebuffer(); |
| 37 gl.bindFramebuffer(gl.FRAMEBUFFER, fb); |
| 38 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFF
ER, rb); |
| 39 |
| 40 // Check for completeness. |
| 41 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE) { |
| 42 if (window.domAutomationController) { |
| 43 domAutomationController.setAutomationId(1); |
| 44 domAutomationController.send("FAILED"); |
| 45 } |
| 46 return; |
| 47 } |
| 48 |
| 49 // Clear to transparent green. |
| 50 gl.clearColor(0.0, 1.0, 0.0, 0.0); |
| 51 gl.clear(gl.COLOR_BUFFER_BIT); |
| 52 |
| 53 // Unbind draw framebuffer. Read framebuffer is now user framebuffer; |
| 54 // draw framebuffer is default framebuffer. |
| 55 gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); |
| 56 |
| 57 // Blit from user framebuffer to default framebuffer. |
| 58 gl.blitFramebuffer(0, 0, sz, sz, 0, 0, sz, sz, gl.COLOR_BUFFER_BIT, gl.NEAREST
); |
| 59 |
| 60 let err = gl.getError(); |
| 61 if (err != gl.NO_ERROR) { |
| 62 if (window.domAutomationController) { |
| 63 domAutomationController.setAutomationId(1); |
| 64 domAutomationController.send("FAILED"); |
| 65 } |
| 66 } |
| 67 |
| 68 // Wait a few frames, and have the harness take a pixel snapshot. |
| 69 waitAndSignalHarness(); |
| 70 } |
| 71 </script> |
| 72 </head> |
| 73 <body onload="main()"> |
| 74 <div style="position:absolute; top:0px; left:0px"> |
| 75 <canvas id="c" width="200" height="200" class="nomargin"></canvas> |
| 76 </div> |
| 77 </body> |
| 78 </html> |
| OLD | NEW |