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

Unified Diff: content/common/gpu/client/gl_helper.cc

Issue 16831004: Perform glReadPixels with PBOs in the gpu, if PBOs are available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, did not mean to upload license.py Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/gl_helper.cc
diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc
index 2ce57d9170115575ee0303764637d9aec07998b6..52c39d6d0de32acaad617599cdc1892708106316 100644
--- a/content/common/gpu/client/gl_helper.cc
+++ b/content/common/gpu/client/gl_helper.cc
@@ -193,7 +193,8 @@ class GLHelper::CopyTextureToImpl :
row_stride_bytes(row_stride_bytes_),
pixels(pixels_),
callback(callback_),
- buffer(0) {
+ buffer(0),
+ query(0) {
}
gfx::Size size;
@@ -202,6 +203,7 @@ class GLHelper::CopyTextureToImpl :
unsigned char* pixels;
base::Callback<void(bool)> callback;
GLuint buffer;
+ WebKit::WebGLId query;
};
// A readback pipeline that also converts the data to YUV before
@@ -382,10 +384,14 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync(
context_->readPixels(0, 0, dst_size.width(), dst_size.height(),
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ request->query = context_->createQueryEXT();
+ context_->beginQueryEXT(GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM,
+ request->query);
piman 2013/06/26 22:17:08 Don't you want to beginQuery before readPixels?
hubbe 2013/06/28 22:17:49 Done.
context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
- cc::SyncPointHelper::SignalSyncPoint(
+ context_->endQueryEXT(GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM);
+ cc::SyncPointHelper::SignalQuery(
context_,
- context_->insertSyncPoint(),
+ request->query,
base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request));
}
@@ -498,10 +504,15 @@ void GLHelper::CopyTextureToImpl::ReadbackDone(Request* request) {
void GLHelper::CopyTextureToImpl::FinishRequest(Request* request,
bool result) {
+ TRACE_EVENT0("mirror", "GLHelper::CopyTextureToImpl::FinishRequest");
DCHECK(request_queue_.front() == request);
request_queue_.pop();
request->callback.Run(result);
ScopedFlush flush(context_);
+ if (request->query != 0) {
+ context_->deleteQueryEXT(request->query);
+ request->query = 0;
+ }
if (request->buffer != 0) {
context_->deleteBuffer(request->buffer);
request->buffer = 0;

Powered by Google App Engine
This is Rietveld 408576698