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

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

Issue 614883002: Use glDiscardFramebuffer to save memory bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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