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

Side by Side Diff: gpu/command_buffer/client/query_tracker.cc

Issue 1233233002: Added support for TimeStamp queries using QueryCounterEXT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed GetQueryivEXT test with QueryCounter Created 5 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
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return; 159 return;
160 } 160 }
161 } 161 }
162 } 162 }
163 } 163 }
164 flush_count_ = gl->helper()->flush_generation(); 164 flush_count_ = gl->helper()->flush_generation();
165 gl->helper()->EndQueryEXT(target(), submit_count()); 165 gl->helper()->EndQueryEXT(target(), submit_count());
166 MarkAsPending(gl->helper()->InsertToken()); 166 MarkAsPending(gl->helper()->InsertToken());
167 } 167 }
168 168
169 void QueryTracker::Query::QueryCounter(GLES2Implementation* gl) {
170 MarkAsActive();
171 flush_count_ = gl->helper()->flush_generation();
172 gl->helper()->QueryCounterEXT(target(), id(), shm_id(), shm_offset(),
173 submit_count());
174 MarkAsPending(gl->helper()->InsertToken());
175 }
176
169 bool QueryTracker::Query::CheckResultsAvailable( 177 bool QueryTracker::Query::CheckResultsAvailable(
170 CommandBufferHelper* helper) { 178 CommandBufferHelper* helper) {
171 if (Pending()) { 179 if (Pending()) {
172 if (base::subtle::Acquire_Load(&info_.sync->process_count) == 180 if (base::subtle::Acquire_Load(&info_.sync->process_count) ==
173 submit_count_ || 181 submit_count_ ||
174 helper->IsContextLost()) { 182 helper->IsContextLost()) {
175 switch (target()) { 183 switch (target()) {
176 case GL_COMMANDS_ISSUED_CHROMIUM: 184 case GL_COMMANDS_ISSUED_CHROMIUM:
177 result_ = info_.sync->result; 185 result_ = info_.sync->result;
178 break; 186 break;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 gl->SetGLError(GL_INVALID_OPERATION, 325 gl->SetGLError(GL_INVALID_OPERATION,
318 "glEndQueryEXT", "no active query"); 326 "glEndQueryEXT", "no active query");
319 return false; 327 return false;
320 } 328 }
321 329
322 target_it->second->End(gl); 330 target_it->second->End(gl);
323 current_queries_.erase(target_it); 331 current_queries_.erase(target_it);
324 return true; 332 return true;
325 } 333 }
326 334
335 bool QueryTracker::QueryCounter(GLuint id, GLenum target,
336 GLES2Implementation* gl) {
337 QueryTracker::Query* query = GetQuery(id);
338 if (!query) {
339 query = CreateQuery(id, target);
340 if (!query) {
341 gl->SetGLError(GL_OUT_OF_MEMORY,
342 "glQueryCounterEXT",
343 "transfer buffer allocation failed");
344 return false;
345 }
346 } else if (query->target() != target) {
347 gl->SetGLError(GL_INVALID_OPERATION,
348 "glQueryCounterEXT",
349 "target does not match");
350 return false;
351 }
352
353 query->QueryCounter(gl);
354 return true;
355 }
356
327 } // namespace gles2 357 } // namespace gles2
328 } // namespace gpu 358 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/query_tracker.h ('k') | gpu/command_buffer/client/query_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698