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

Side by Side Diff: gpu/command_buffer/client/query_tracker.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, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/client/query_tracker.h" 5 #include "gpu/command_buffer/client/query_tracker.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 switch (target()) { 106 switch (target()) {
107 case GL_GET_ERROR_QUERY_CHROMIUM: 107 case GL_GET_ERROR_QUERY_CHROMIUM:
108 // To nothing on begin for error queries. 108 // To nothing on begin for error queries.
109 break; 109 break;
110 case GL_LATENCY_QUERY_CHROMIUM: 110 case GL_LATENCY_QUERY_CHROMIUM:
111 client_begin_time_us_ = MicrosecondsSinceOriginOfTime(); 111 client_begin_time_us_ = MicrosecondsSinceOriginOfTime();
112 // tell service about id, shared memory and count 112 // tell service about id, shared memory and count
113 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); 113 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
114 break; 114 break;
115 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM: 115 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM:
116 // tell service about id, shared memory and count 116 case GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM:
117 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
118 break;
119 default: 117 default:
120 // tell service about id, shared memory and count 118 // tell service about id, shared memory and count
121 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); 119 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
122 break; 120 break;
123 } 121 }
124 } 122 }
125 123
126 void QueryTracker::Query::End(GLES2Implementation* gl) { 124 void QueryTracker::Query::End(GLES2Implementation* gl) {
127 switch (target()) { 125 switch (target()) {
128 case GL_GET_ERROR_QUERY_CHROMIUM: { 126 case GL_GET_ERROR_QUERY_CHROMIUM: {
(...skipping 29 matching lines...) Expand all
158 case GL_COMMANDS_ISSUED_CHROMIUM: 156 case GL_COMMANDS_ISSUED_CHROMIUM:
159 result_ = std::min(info_.sync->result, 157 result_ = std::min(info_.sync->result,
160 static_cast<uint64>(0xFFFFFFFFL)); 158 static_cast<uint64>(0xFFFFFFFFL));
161 break; 159 break;
162 case GL_LATENCY_QUERY_CHROMIUM: 160 case GL_LATENCY_QUERY_CHROMIUM:
163 GPU_DCHECK(info_.sync->result >= client_begin_time_us_); 161 GPU_DCHECK(info_.sync->result >= client_begin_time_us_);
164 result_ = std::min(info_.sync->result - client_begin_time_us_, 162 result_ = std::min(info_.sync->result - client_begin_time_us_,
165 static_cast<uint64>(0xFFFFFFFFL)); 163 static_cast<uint64>(0xFFFFFFFFL));
166 break; 164 break;
167 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM: 165 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM:
168 result_ = info_.sync->result; 166 case GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM:
169 break;
170 default: 167 default:
171 result_ = info_.sync->result; 168 result_ = info_.sync->result;
172 break; 169 break;
173 } 170 }
174 state_ = kComplete; 171 state_ = kComplete;
175 } else { 172 } else {
176 if (!flushed_) { 173 if (!flushed_) {
177 // TODO(gman): We could reduce the number of flushes by having a 174 // TODO(gman): We could reduce the number of flushes by having a
178 // flush count, recording that count at the time we insert the 175 // flush count, recording that count at the time we insert the
179 // EndQuery command and then only flushing here if we've have not 176 // EndQuery command and then only flushing here if we've have not
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 delete query; 229 delete query;
233 } 230 }
234 } 231 }
235 232
236 void QueryTracker::Shrink() { 233 void QueryTracker::Shrink() {
237 query_sync_manager_.Shrink(); 234 query_sync_manager_.Shrink();
238 } 235 }
239 236
240 } // namespace gles2 237 } // namespace gles2
241 } // namespace gpu 238 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | gpu/command_buffer/common/gles2_cmd_format_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698