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

Unified Diff: cc/resource_provider.cc

Issue 11428127: cc: Avoid unnecessary flush when releasing a pixel buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resource_provider.cc
diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc
index 9f208af335811554168e1213c6c903810362df6a..0e710da8cabf6a248d2203ec86416a03bcfddc97 100644
--- a/cc/resource_provider.cc
+++ b/cc/resource_provider.cc
@@ -686,11 +686,10 @@ void ResourceProvider::acquirePixelBuffer(ResourceId id)
DCHECK(!resource->exported);
if (resource->glId) {
- if (resource->glPixelBufferId)
- return;
WebGraphicsContext3D* context3d = m_context->context3D();
DCHECK(context3d);
- resource->glPixelBufferId = context3d->createBuffer();
+ if (!resource->glPixelBufferId)
+ resource->glPixelBufferId = context3d->createBuffer();
context3d->bindBuffer(
GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
resource->glPixelBufferId);
@@ -721,12 +720,18 @@ void ResourceProvider::releasePixelBuffer(ResourceId id)
DCHECK(!resource->exported);
if (resource->glId) {
- if (!resource->glPixelBufferId)
- return;
+ DCHECK(resource->glPixelBufferId);
WebGraphicsContext3D* context3d = m_context->context3D();
DCHECK(context3d);
- context3d->deleteBuffer(resource->glPixelBufferId);
- resource->glPixelBufferId = 0;
+ context3d->bindBuffer(
+ GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
+ resource->glPixelBufferId);
+ context3d->bufferData(
+ GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
+ 0,
+ NULL,
+ GL_DYNAMIC_DRAW);
+ context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
}
if (resource->pixels) {
« 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