OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); | 257 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); |
258 // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a | 258 // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a |
259 // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding. | 259 // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding. |
260 // If this stops being true at some point, we should track the current f ramebuffer binding in the DrawingBuffer and restore | 260 // If this stops being true at some point, we should track the current f ramebuffer binding in the DrawingBuffer and restore |
261 // it after attaching the new back buffer here. | 261 // it after attaching the new back buffer here. |
262 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 262 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
263 if (m_multisampleMode == ImplicitResolve) | 263 if (m_multisampleMode == ImplicitResolve) |
264 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COL OR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); | 264 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COL OR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); |
265 else | 265 else |
266 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D, m_colorBuffer.textureId, 0); | 266 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D, m_colorBuffer.textureId, 0); |
267 | |
268 // Explicitly discard framebuffer to save GPU memory bandwidth for tile- based GPU arch. | |
Ken Russell (switch to Gerrit)
2014/10/01 20:40:06
Please test for the presence of this extension in
| |
269 const WGC3Denum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACH MENT, GL_STENCIL_ATTACHMENT}; | |
270 m_context->discardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); | |
267 } else { | 271 } else { |
268 m_context->copyTextureCHROMIUM(GL_TEXTURE_2D, m_colorBuffer.textureId, f rontColorBufferMailbox->textureInfo.textureId, 0, GL_RGBA, GL_UNSIGNED_BYTE); | 272 m_context->copyTextureCHROMIUM(GL_TEXTURE_2D, m_colorBuffer.textureId, f rontColorBufferMailbox->textureInfo.textureId, 0, GL_RGBA, GL_UNSIGNED_BYTE); |
269 } | 273 } |
270 | 274 |
271 if (m_multisampleMode != None && !m_framebufferBinding) | 275 if (m_multisampleMode != None && !m_framebufferBinding) |
272 bind(); | 276 bind(); |
273 else | 277 else |
274 restoreFramebufferBinding(); | 278 restoreFramebufferBinding(); |
275 | 279 |
276 m_contentsChanged = false; | 280 m_contentsChanged = false; |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 1052 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
1049 { | 1053 { |
1050 if (info->imageId) { | 1054 if (info->imageId) { |
1051 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 1055 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
1052 m_context->destroyImageCHROMIUM(info->imageId); | 1056 m_context->destroyImageCHROMIUM(info->imageId); |
1053 info->imageId = 0; | 1057 info->imageId = 0; |
1054 } | 1058 } |
1055 } | 1059 } |
1056 | 1060 |
1057 } // namespace blink | 1061 } // namespace blink |
OLD | NEW |