| 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/service/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
| 6 | 6 |
| 7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 return false; | 637 return false; |
| 638 } | 638 } |
| 639 | 639 |
| 640 pending_ = false; | 640 pending_ = false; |
| 641 sync->result = result; | 641 sync->result = result; |
| 642 base::subtle::Release_Store(&sync->process_count, submit_count_); | 642 base::subtle::Release_Store(&sync->process_count, submit_count_); |
| 643 | 643 |
| 644 return true; | 644 return true; |
| 645 } | 645 } |
| 646 | 646 |
| 647 bool QueryManager::Query::UpdateTarget(GLenum target) { |
| 648 switch (target_) { |
| 649 // The boolean occlusion targets are interchangable. |
| 650 case GL_ANY_SAMPLES_PASSED: |
| 651 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: |
| 652 if (target == GL_ANY_SAMPLES_PASSED || |
| 653 target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) { |
| 654 target_ = target; |
| 655 return true; |
| 656 }; |
| 657 return false; |
| 658 // Otherwise target is finalized the first time beginQuery() is called. |
| 659 default: |
| 660 return target_ == target; |
| 661 } |
| 662 } |
| 663 |
| 647 bool QueryManager::ProcessPendingQueries(bool did_finish) { | 664 bool QueryManager::ProcessPendingQueries(bool did_finish) { |
| 648 while (!pending_queries_.empty()) { | 665 while (!pending_queries_.empty()) { |
| 649 Query* query = pending_queries_.front().get(); | 666 Query* query = pending_queries_.front().get(); |
| 650 if (!query->Process(did_finish)) { | 667 if (!query->Process(did_finish)) { |
| 651 return false; | 668 return false; |
| 652 } | 669 } |
| 653 if (query->pending()) { | 670 if (query->pending()) { |
| 654 break; | 671 break; |
| 655 } | 672 } |
| 656 query->RunCallbacks(); | 673 query->RunCallbacks(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { | 764 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { |
| 748 DCHECK(query); | 765 DCHECK(query); |
| 749 if (!RemovePendingQuery(query)) { | 766 if (!RemovePendingQuery(query)) { |
| 750 return false; | 767 return false; |
| 751 } | 768 } |
| 752 return query->End(submit_count); | 769 return query->End(submit_count); |
| 753 } | 770 } |
| 754 | 771 |
| 755 } // namespace gles2 | 772 } // namespace gles2 |
| 756 } // namespace gpu | 773 } // namespace gpu |
| OLD | NEW |