| 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 "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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 MarkAsActive(); | 168 MarkAsActive(); |
| 169 flush_count_ = gl->helper()->flush_generation(); | 169 flush_count_ = gl->helper()->flush_generation(); |
| 170 gl->helper()->QueryCounterEXT(id(), target(), shm_id(), shm_offset(), | 170 gl->helper()->QueryCounterEXT(id(), target(), shm_id(), shm_offset(), |
| 171 submit_count()); | 171 submit_count()); |
| 172 MarkAsPending(gl->helper()->InsertToken()); | 172 MarkAsPending(gl->helper()->InsertToken()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool QueryTracker::Query::CheckResultsAvailable( | 175 bool QueryTracker::Query::CheckResultsAvailable( |
| 176 CommandBufferHelper* helper) { | 176 CommandBufferHelper* helper) { |
| 177 if (Pending()) { | 177 if (Pending()) { |
| 178 if (base::subtle::Acquire_Load(&info_.sync->process_count) == | 178 bool processed_all = |
| 179 submit_count_ || | 179 base::subtle::Acquire_Load(&info_.sync->process_count) == submit_count_; |
| 180 helper->IsContextLost()) { | 180 // We check lost on the command buffer itself here instead of checking the |
| 181 // GLES2Implementation because the GLES2Implementation will not hear about |
| 182 // the loss until we exit out of this call stack (to avoid re-entrancy), and |
| 183 // we need be able to enter kComplete state on context loss. |
| 184 // TODO(danakj): If GLES2Implementation can handle being notified of loss |
| 185 // re-entrantly (without calling its clients re-entrantly), then we could |
| 186 // call GLES2Implementation::GetGraphicsResetStatusKHR() here and remove |
| 187 // this method from CommandBufferHelper. |
| 188 if (processed_all || helper->IsContextLost()) { |
| 181 switch (target()) { | 189 switch (target()) { |
| 182 case GL_COMMANDS_ISSUED_CHROMIUM: | 190 case GL_COMMANDS_ISSUED_CHROMIUM: |
| 183 result_ = info_.sync->result; | 191 result_ = info_.sync->result; |
| 184 break; | 192 break; |
| 185 case GL_LATENCY_QUERY_CHROMIUM: | 193 case GL_LATENCY_QUERY_CHROMIUM: |
| 186 // Disabled DCHECK because of http://crbug.com/419236. | 194 // Disabled DCHECK because of http://crbug.com/419236. |
| 187 //DCHECK(info_.sync->result >= client_begin_time_us_); | 195 //DCHECK(info_.sync->result >= client_begin_time_us_); |
| 188 result_ = info_.sync->result - client_begin_time_us_; | 196 result_ = info_.sync->result - client_begin_time_us_; |
| 189 break; | 197 break; |
| 190 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: | 198 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 if (local_disjoint_count_ != disjoint_count) { | 393 if (local_disjoint_count_ != disjoint_count) { |
| 386 local_disjoint_count_ = disjoint_count; | 394 local_disjoint_count_ = disjoint_count; |
| 387 return true; | 395 return true; |
| 388 } | 396 } |
| 389 } | 397 } |
| 390 return false; | 398 return false; |
| 391 } | 399 } |
| 392 | 400 |
| 393 } // namespace gles2 | 401 } // namespace gles2 |
| 394 } // namespace gpu | 402 } // namespace gpu |
| OLD | NEW |