| 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();
|
| + 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());
|
| }
|
|
|