OLD | NEW |
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> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
7 | 7 |
8 #include "../client/query_tracker.h" | 8 #include "../client/query_tracker.h" |
9 | 9 |
10 #include "../client/atomicops.h" | 10 #include "../client/atomicops.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 switch (target()) { | 77 switch (target()) { |
78 case GL_GET_ERROR_QUERY_CHROMIUM: | 78 case GL_GET_ERROR_QUERY_CHROMIUM: |
79 // To nothing on begin for error queries. | 79 // To nothing on begin for error queries. |
80 break; | 80 break; |
81 case GL_LATENCY_QUERY_CHROMIUM: | 81 case GL_LATENCY_QUERY_CHROMIUM: |
82 client_begin_time_us_ = MicrosecondsSinceOriginOfTime(); | 82 client_begin_time_us_ = MicrosecondsSinceOriginOfTime(); |
83 // tell service about id, shared memory and count | 83 // tell service about id, shared memory and count |
84 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); | 84 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); |
85 break; | 85 break; |
| 86 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM: |
| 87 // tell service about id, shared memory and count |
| 88 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); |
| 89 break; |
86 default: | 90 default: |
87 // tell service about id, shared memory and count | 91 // tell service about id, shared memory and count |
88 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); | 92 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); |
89 break; | 93 break; |
90 } | 94 } |
91 } | 95 } |
92 | 96 |
93 void QueryTracker::Query::End(GLES2Implementation* gl) { | 97 void QueryTracker::Query::End(GLES2Implementation* gl) { |
94 switch (target()) { | 98 switch (target()) { |
95 case GL_GET_ERROR_QUERY_CHROMIUM: { | 99 case GL_GET_ERROR_QUERY_CHROMIUM: { |
(...skipping 28 matching lines...) Expand all Loading... |
124 switch (target()) { | 128 switch (target()) { |
125 case GL_COMMANDS_ISSUED_CHROMIUM: | 129 case GL_COMMANDS_ISSUED_CHROMIUM: |
126 result_ = std::min(info_.sync->result, | 130 result_ = std::min(info_.sync->result, |
127 static_cast<uint64>(0xFFFFFFFFL)); | 131 static_cast<uint64>(0xFFFFFFFFL)); |
128 break; | 132 break; |
129 case GL_LATENCY_QUERY_CHROMIUM: | 133 case GL_LATENCY_QUERY_CHROMIUM: |
130 GPU_DCHECK(info_.sync->result >= client_begin_time_us_); | 134 GPU_DCHECK(info_.sync->result >= client_begin_time_us_); |
131 result_ = std::min(info_.sync->result - client_begin_time_us_, | 135 result_ = std::min(info_.sync->result - client_begin_time_us_, |
132 static_cast<uint64>(0xFFFFFFFFL)); | 136 static_cast<uint64>(0xFFFFFFFFL)); |
133 break; | 137 break; |
| 138 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM: |
| 139 result_ = info_.sync->result; |
| 140 break; |
134 default: | 141 default: |
135 result_ = info_.sync->result; | 142 result_ = info_.sync->result; |
136 break; | 143 break; |
137 } | 144 } |
138 state_ = kComplete; | 145 state_ = kComplete; |
139 } else { | 146 } else { |
140 if (!flushed_) { | 147 if (!flushed_) { |
141 // TODO(gman): We could reduce the number of flushes by having a | 148 // TODO(gman): We could reduce the number of flushes by having a |
142 // flush count, recording that count at the time we insert the | 149 // flush count, recording that count at the time we insert the |
143 // EndQuery command and then only flushing here if we've have not | 150 // EndQuery command and then only flushing here if we've have not |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 Query* query = it->second; | 199 Query* query = it->second; |
193 GPU_DCHECK(context_lost || !query->Pending()); | 200 GPU_DCHECK(context_lost || !query->Pending()); |
194 query_sync_manager_.Free(query->info_); | 201 query_sync_manager_.Free(query->info_); |
195 queries_.erase(it); | 202 queries_.erase(it); |
196 delete query; | 203 delete query; |
197 } | 204 } |
198 } | 205 } |
199 | 206 |
200 } // namespace gles2 | 207 } // namespace gles2 |
201 } // namespace gpu | 208 } // namespace gpu |
OLD | NEW |