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

Unified Diff: cc/output/gl_renderer.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: fix cc_unittests 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
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index ad6d3428de8f18c670386d80224c902fc696508f..ad013650468802f884df33f9fb06510abb2bfa9b 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -2301,6 +2301,14 @@ void GLRenderer::DoGetFramebufferPixels(
NULL,
GL_STREAM_READ));
+ WebKit::WebGLId query = 0;
+ if (is_async) {
+ query = context_->createQueryEXT();
+ GLC(context_, context_->beginQueryEXT(
+ GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM,
+ query));
+ }
+
GLC(context_,
context_->readPixels(window_rect.x(),
window_rect.y(),
@@ -2326,6 +2334,7 @@ void GLRenderer::DoGetFramebufferPixels(
base::Unretained(this),
cleanup_callback,
buffer,
+ query,
dest_pixels,
window_rect.size());
// Save the finished_callback so it can be cancelled.
@@ -2336,10 +2345,11 @@ void GLRenderer::DoGetFramebufferPixels(
pending_async_read_pixels_.front()->buffer = buffer;
if (is_async) {
- unsigned sync_point = context_->insertSyncPoint();
- SyncPointHelper::SignalSyncPoint(
+ GLC(context_, context_->endQueryEXT(
+ GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM));
+ SyncPointHelper::SignalQuery(
context_,
- sync_point,
+ query,
finished_callback);
} else {
resource_provider_->Finish();
@@ -2352,10 +2362,15 @@ void GLRenderer::DoGetFramebufferPixels(
void GLRenderer::FinishedReadback(
const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback,
unsigned source_buffer,
+ unsigned query,
uint8* dest_pixels,
gfx::Size size) {
DCHECK(!pending_async_read_pixels_.empty());
+ if (query != 0) {
+ GLC(context_, context_->deleteQueryEXT(query));
+ }
+
PendingAsyncReadPixels* current_read = pending_async_read_pixels_.back();
// Make sure we service the readbacks in order.
DCHECK_EQ(source_buffer, current_read->buffer);
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698