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

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

Issue 2145093003: Discard correct drawing buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove comments Created 4 years, 5 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (!frontColorBufferMailbox) 281 if (!frontColorBufferMailbox)
282 frontColorBufferMailbox = createNewMailbox(createTextureAndAllocateMemor y(m_size)); 282 frontColorBufferMailbox = createNewMailbox(createTextureAndAllocateMemor y(m_size));
283 283
284 if (m_preserveDrawingBuffer == Discard) { 284 if (m_preserveDrawingBuffer == Discard) {
285 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); 285 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer);
286 attachColorBufferToReadFramebuffer(); 286 attachColorBufferToReadFramebuffer();
287 287
288 if (m_discardFramebufferSupported) { 288 if (m_discardFramebufferSupported) {
289 // Explicitly discard framebuffer to save GPU memory bandwidth for t ile-based GPU arch. 289 // Explicitly discard framebuffer to save GPU memory bandwidth for t ile-based GPU arch.
290 const GLenum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTAC HMENT, GL_STENCIL_ATTACHMENT }; 290 const GLenum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTAC HMENT, GL_STENCIL_ATTACHMENT };
291 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
291 m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); 292 m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments);
292 } 293 }
293 } else { 294 } else {
294 m_gl->CopySubTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMa ilbox->textureInfo.textureId, 295 m_gl->CopySubTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMa ilbox->textureInfo.textureId,
295 0, 0, 0, 0, m_size.width(), m_size.height(), GL_FALSE, GL_FALSE, GL_ FALSE); 296 0, 0, 0, 0, m_size.width(), m_size.height(), GL_FALSE, GL_FALSE, GL_ FALSE);
296 } 297 }
297 298
298 restoreFramebufferBindings(); 299 restoreFramebufferBindings();
299 m_contentsChanged = false; 300 m_contentsChanged = false;
300 301
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1108
1108 void DrawingBuffer::restoreTextureBindings() 1109 void DrawingBuffer::restoreTextureBindings()
1109 { 1110 {
1110 // This class potentially modifies the bindings for GL_TEXTURE_2D and 1111 // This class potentially modifies the bindings for GL_TEXTURE_2D and
1111 // GL_TEXTURE_RECTANGLE. Only GL_TEXTURE_2D needs to be restored since 1112 // GL_TEXTURE_RECTANGLE. Only GL_TEXTURE_2D needs to be restored since
1112 // the public interface for WebGL does not support GL_TEXTURE_RECTANGLE. 1113 // the public interface for WebGL does not support GL_TEXTURE_RECTANGLE.
1113 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); 1114 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding);
1114 } 1115 }
1115 1116
1116 } // namespace blink 1117 } // 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