Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 2267423004: [Merge to 2785] Discard correct drawing buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 if (!frontColorBufferMailbox) 275 if (!frontColorBufferMailbox)
276 frontColorBufferMailbox = createNewMailbox(createTextureAndAllocateMemor y(m_size)); 276 frontColorBufferMailbox = createNewMailbox(createTextureAndAllocateMemor y(m_size));
277 277
278 if (m_preserveDrawingBuffer == Discard) { 278 if (m_preserveDrawingBuffer == Discard) {
279 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); 279 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer);
280 attachColorBufferToReadFramebuffer(); 280 attachColorBufferToReadFramebuffer();
281 281
282 if (m_discardFramebufferSupported) { 282 if (m_discardFramebufferSupported) {
283 // Explicitly discard framebuffer to save GPU memory bandwidth for t ile-based GPU arch. 283 // Explicitly discard framebuffer to save GPU memory bandwidth for t ile-based GPU arch.
284 const GLenum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTAC HMENT, GL_STENCIL_ATTACHMENT }; 284 const GLenum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTAC HMENT, GL_STENCIL_ATTACHMENT };
285 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
285 m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); 286 m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments);
286 } 287 }
287 } else { 288 } else {
288 m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailb ox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.inter nalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); 289 m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailb ox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.inter nalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE);
289 } 290 }
290 291
291 restoreFramebufferBindings(); 292 restoreFramebufferBindings();
292 m_contentsChanged = false; 293 m_contentsChanged = false;
293 294
294 m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.text ureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferM ailbox->mailbox.name); 295 m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.text ureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferM ailbox->mailbox.name);
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 1090
1090 void DrawingBuffer::restoreTextureBindings() 1091 void DrawingBuffer::restoreTextureBindings()
1091 { 1092 {
1092 // This class potentially modifies the bindings for GL_TEXTURE_2D and 1093 // This class potentially modifies the bindings for GL_TEXTURE_2D and
1093 // GL_TEXTURE_RECTANGLE. Only GL_TEXTURE_2D needs to be restored since 1094 // GL_TEXTURE_RECTANGLE. Only GL_TEXTURE_2D needs to be restored since
1094 // the public interface for WebGL does not support GL_TEXTURE_RECTANGLE. 1095 // the public interface for WebGL does not support GL_TEXTURE_RECTANGLE.
1095 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); 1096 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding);
1096 } 1097 }
1097 1098
1098 } // namespace blink 1099 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698