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

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

Issue 10577037: Add GL_CHROMIUM_get_error_query (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « gpu/command_buffer/client/query_tracker.h ('k') | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h>
7
5 #include "../client/query_tracker.h" 8 #include "../client/query_tracker.h"
6 9
7 #include "../client/atomicops.h" 10 #include "../client/atomicops.h"
8 #include "../client/cmd_buffer_helper.h" 11 #include "../client/gles2_cmd_helper.h"
12 #include "../client/gles2_implementation.h"
9 #include "../client/mapped_memory.h" 13 #include "../client/mapped_memory.h"
10 14
11 namespace gpu { 15 namespace gpu {
12 namespace gles2 { 16 namespace gles2 {
13 17
14 QuerySyncManager::QuerySyncManager(MappedMemoryManager* manager) 18 QuerySyncManager::QuerySyncManager(MappedMemoryManager* manager)
15 : mapped_memory_(manager) { 19 : mapped_memory_(manager) {
16 GPU_DCHECK(manager); 20 GPU_DCHECK(manager);
17 } 21 }
18 22
(...skipping 25 matching lines...) Expand all
44 *info = free_queries_.front(); 48 *info = free_queries_.front();
45 info->sync->Reset(); 49 info->sync->Reset();
46 free_queries_.pop(); 50 free_queries_.pop();
47 return true; 51 return true;
48 } 52 }
49 53
50 void QuerySyncManager::Free(const QuerySyncManager::QueryInfo& info) { 54 void QuerySyncManager::Free(const QuerySyncManager::QueryInfo& info) {
51 free_queries_.push(info); 55 free_queries_.push(info);
52 } 56 }
53 57
58 void QueryTracker::Query::Begin(GLES2Implementation* gl) {
59 // init memory, inc count
60 MarkAsActive();
61
62 switch (target()) {
63 case GL_GET_ERROR_QUERY_CHROMIUM:
64 // To nothing on begin for error queries.
65 break;
66 default:
67 // tell service about id, shared memory and count
68 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
69 break;
70 }
71 }
72
73 void QueryTracker::Query::End(GLES2Implementation* gl) {
74 switch (target()) {
75 case GL_GET_ERROR_QUERY_CHROMIUM: {
76 GLenum error = gl->GetClientSideGLError();
77 if (error == GL_NO_ERROR) {
78 // There was no error so start the query on the serivce.
79 // it will end immediately.
80 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
81 } else {
82 // There's on error on the client, no need to bother the service.
apatrick_chromium 2012/07/09 19:27:51 There's on error -> There's an error
83 // just set the query as completed and return the error.
84 if (error != GL_NO_ERROR) {
85 state_ = kComplete;
86 result_ = error;
87 return;
88 }
89 }
90 }
91 }
92 gl->helper()->EndQueryEXT(target(), submit_count());
93 MarkAsPending(gl->helper()->InsertToken());
94 }
95
54 bool QueryTracker::Query::CheckResultsAvailable( 96 bool QueryTracker::Query::CheckResultsAvailable(
55 CommandBufferHelper* helper) { 97 CommandBufferHelper* helper) {
56 if (Pending()) { 98 if (Pending()) {
57 if (info_.sync->process_count == submit_count_) { 99 if (info_.sync->process_count == submit_count_) {
58 // Need a MemoryBarrier here so that sync->result read after 100 // Need a MemoryBarrier here so that sync->result read after
59 // sync->process_count. 101 // sync->process_count.
60 gpu::MemoryBarrier(); 102 gpu::MemoryBarrier();
61 result_ = info_.sync->result; 103 result_ = info_.sync->result;
62 state_ = kComplete; 104 state_ = kComplete;
63 } else { 105 } else {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 GPU_DCHECK(!query->Pending()); 158 GPU_DCHECK(!query->Pending());
117 query_sync_manager_.Free(query->info_); 159 query_sync_manager_.Free(query->info_);
118 queries_.erase(it); 160 queries_.erase(it);
119 delete query; 161 delete query;
120 } 162 }
121 } 163 }
122 164
123 } // namespace gles2 165 } // namespace gles2
124 } // namespace gpu 166 } // namespace gpu
125 167
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/query_tracker.h ('k') | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698