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

Unified Diff: gpu/command_buffer/client/gles2_implementation.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: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index fbc92d58939c8c39999c73c2d3a23393820a936c..0a5f5fc8ceb616786b783df1899d25f14dce928a 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -2236,8 +2236,7 @@ void GLES2Implementation::ReadPixels(
if (buffer && buffer->shm_id() != -1) {
helper_->ReadPixels(xoffset, yoffset, width, height, format, type,
buffer->shm_id(), buffer->shm_offset(),
- 0, 0);
- buffer->set_transfer_ready_token(helper_->InsertToken());
+ 0, 0, true);
CheckGLError();
}
return;
@@ -2269,7 +2268,8 @@ void GLES2Implementation::ReadPixels(
helper_->ReadPixels(
xoffset, yoffset, width, num_rows, format, type,
buffer.shm_id(), buffer.offset(),
- GetResultShmId(), GetResultShmOffset());
+ GetResultShmId(), GetResultShmOffset(),
+ false);
WaitForCmd();
if (*result != 0) {
// when doing a y-flip we have to iterate through top-to-bottom chunks
@@ -3181,10 +3181,12 @@ void GLES2Implementation::DeleteQueriesEXTHelper(
// TODO(gman): Consider making this faster by putting pending quereies
// on some queue to be removed when they are finished.
+ // TODO(hubbe): Consider using signalQuery callback to delete pending
+ // queries.
bool query_pending = false;
for (GLsizei ii = 0; ii < n; ++ii) {
QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]);
- if (query && query->Pending()) {
+ if (query && !query->CheckResultsAvailable(helper_)) {
query_pending = true;
break;
}
@@ -3192,15 +3194,30 @@ void GLES2Implementation::DeleteQueriesEXTHelper(
if (query_pending) {
WaitForCmd();
+
+ query_pending = false;
+ for (GLsizei ii = 0; ii < n; ++ii) {
+ QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]);
+ if (query && !query->CheckResultsAvailable(helper_)) {
+ query_pending = true;
+ break;
+ }
+ }
+ if (query_pending) {
+ // Some queries may still not be done even after the GPU process
+ // has sent the command to the driver. When this happens we need
+ // to use glFinish() to wait for the query to finish.
+ // Moral of this story: Don't delete pending queries!
+ helper_->Finish();
piman 2013/06/26 22:17:08 Why do we need to do this? DeleteQueries + WaitFor
hubbe 2013/06/28 22:17:49 That does sound perfectly reasonable, but then why
piman 2013/06/28 23:35:46 I think you accidentally a word, and I don't under
hubbe 2013/06/29 00:13:56 Ok, I'm changing it. Seems to work in my tests at
+ WaitForCmd();
+ }
}
for (GLsizei ii = 0; ii < n; ++ii) {
QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]);
- if (query && query->Pending()) {
- if (!query->CheckResultsAvailable(helper_)) {
- // Should only get here on context lost.
- MustBeContextLost();
- }
+ if (query && !query->CheckResultsAvailable(helper_)) {
+ // Should only get here on context lost.
+ MustBeContextLost();
}
query_tracker_->RemoveQuery(queries[ii], helper_->IsContextLost());
}

Powered by Google App Engine
This is Rietveld 408576698