| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 gl->helper()->EndQueryEXT(target(), submit_count()); | 105 gl->helper()->EndQueryEXT(target(), submit_count()); |
| 106 MarkAsPending(gl->helper()->InsertToken()); | 106 MarkAsPending(gl->helper()->InsertToken()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool QueryTracker::Query::CheckResultsAvailable( | 109 bool QueryTracker::Query::CheckResultsAvailable( |
| 110 CommandBufferHelper* helper) { | 110 CommandBufferHelper* helper) { |
| 111 if (Pending()) { | 111 if (Pending()) { |
| 112 if (info_.sync->process_count == submit_count_) { | 112 if (info_.sync->process_count == submit_count_ || |
| 113 helper->IsContextLost()) { |
| 113 // Need a MemoryBarrier here so that sync->result read after | 114 // Need a MemoryBarrier here so that sync->result read after |
| 114 // sync->process_count. | 115 // sync->process_count. |
| 115 gpu::MemoryBarrier(); | 116 gpu::MemoryBarrier(); |
| 116 result_ = info_.sync->result; | 117 result_ = info_.sync->result; |
| 117 state_ = kComplete; | 118 state_ = kComplete; |
| 118 } else { | 119 } else { |
| 119 if (!flushed_) { | 120 if (!flushed_) { |
| 120 // TODO(gman): We could reduce the number of flushes by having a | 121 // TODO(gman): We could reduce the number of flushes by having a |
| 121 // flush count, recording that count at the time we insert the | 122 // flush count, recording that count at the time we insert the |
| 122 // EndQuery command and then only flushing here if we've have not | 123 // 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... |
| 171 Query* query = it->second; | 172 Query* query = it->second; |
| 172 GPU_DCHECK(context_lost || !query->Pending()); | 173 GPU_DCHECK(context_lost || !query->Pending()); |
| 173 query_sync_manager_.Free(query->info_); | 174 query_sync_manager_.Free(query->info_); |
| 174 queries_.erase(it); | 175 queries_.erase(it); |
| 175 delete query; | 176 delete query; |
| 176 } | 177 } |
| 177 } | 178 } |
| 178 | 179 |
| 179 } // namespace gles2 | 180 } // namespace gles2 |
| 180 } // namespace gpu | 181 } // namespace gpu |
| OLD | NEW |