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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 bool AllSamplesPassedQuery::End(base::subtle::Atomic32 submit_count) { | 167 bool AllSamplesPassedQuery::End(base::subtle::Atomic32 submit_count) { |
168 EndQueryHelper(target()); | 168 EndQueryHelper(target()); |
169 return AddToPendingQueue(submit_count); | 169 return AddToPendingQueue(submit_count); |
170 } | 170 } |
171 | 171 |
172 bool AllSamplesPassedQuery::Process(bool did_finish) { | 172 bool AllSamplesPassedQuery::Process(bool did_finish) { |
173 GLuint available = 0; | 173 GLuint available = 0; |
174 glGetQueryObjectuivARB( | 174 glGetQueryObjectuiv( |
175 service_id_, GL_QUERY_RESULT_AVAILABLE_EXT, &available); | 175 service_id_, GL_QUERY_RESULT_AVAILABLE_EXT, &available); |
176 if (!available) { | 176 if (!available) { |
177 return true; | 177 return true; |
178 } | 178 } |
179 GLuint result = 0; | 179 GLuint result = 0; |
180 glGetQueryObjectuivARB( | 180 glGetQueryObjectuiv( |
181 service_id_, GL_QUERY_RESULT_EXT, &result); | 181 service_id_, GL_QUERY_RESULT_EXT, &result); |
182 | 182 |
183 return MarkAsCompleted(result != 0); | 183 return MarkAsCompleted(result != 0); |
184 } | 184 } |
185 | 185 |
186 void AllSamplesPassedQuery::Destroy(bool have_context) { | 186 void AllSamplesPassedQuery::Destroy(bool have_context) { |
187 if (have_context && !IsDeleted()) { | 187 if (have_context && !IsDeleted()) { |
188 glDeleteQueriesARB(1, &service_id_); | 188 glDeleteQueries(1, &service_id_); |
189 MarkAsDeleted(); | 189 MarkAsDeleted(); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 AllSamplesPassedQuery::~AllSamplesPassedQuery() { | 193 AllSamplesPassedQuery::~AllSamplesPassedQuery() { |
194 } | 194 } |
195 | 195 |
196 class CommandsIssuedQuery : public QueryManager::Query { | 196 class CommandsIssuedQuery : public QueryManager::Query { |
197 public: | 197 public: |
198 CommandsIssuedQuery( | 198 CommandsIssuedQuery( |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 this, target, shm_id, shm_offset); | 501 this, target, shm_id, shm_offset); |
502 break; | 502 break; |
503 case GL_GET_ERROR_QUERY_CHROMIUM: | 503 case GL_GET_ERROR_QUERY_CHROMIUM: |
504 query = new GetErrorQuery(this, target, shm_id, shm_offset); | 504 query = new GetErrorQuery(this, target, shm_id, shm_offset); |
505 break; | 505 break; |
506 case GL_COMMANDS_COMPLETED_CHROMIUM: | 506 case GL_COMMANDS_COMPLETED_CHROMIUM: |
507 query = new CommandsCompletedQuery(this, target, shm_id, shm_offset); | 507 query = new CommandsCompletedQuery(this, target, shm_id, shm_offset); |
508 break; | 508 break; |
509 default: { | 509 default: { |
510 GLuint service_id = 0; | 510 GLuint service_id = 0; |
511 glGenQueriesARB(1, &service_id); | 511 glGenQueries(1, &service_id); |
512 DCHECK_NE(0u, service_id); | 512 DCHECK_NE(0u, service_id); |
513 query = new AllSamplesPassedQuery( | 513 query = new AllSamplesPassedQuery( |
514 this, target, shm_id, shm_offset, service_id); | 514 this, target, shm_id, shm_offset, service_id); |
515 break; | 515 break; |
516 } | 516 } |
517 } | 517 } |
518 std::pair<QueryMap::iterator, bool> result = | 518 std::pair<QueryMap::iterator, bool> result = |
519 queries_.insert(std::make_pair(client_id, query)); | 519 queries_.insert(std::make_pair(client_id, query)); |
520 DCHECK(result.second); | 520 DCHECK(result.second); |
521 return query.get(); | 521 return query.get(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 575 } |
576 break; | 576 break; |
577 default: | 577 default: |
578 break; | 578 break; |
579 } | 579 } |
580 return target; | 580 return target; |
581 } | 581 } |
582 | 582 |
583 void QueryManager::BeginQueryHelper(GLenum target, GLuint id) { | 583 void QueryManager::BeginQueryHelper(GLenum target, GLuint id) { |
584 target = AdjustTargetForEmulation(target); | 584 target = AdjustTargetForEmulation(target); |
585 glBeginQueryARB(target, id); | 585 glBeginQuery(target, id); |
586 } | 586 } |
587 | 587 |
588 void QueryManager::EndQueryHelper(GLenum target) { | 588 void QueryManager::EndQueryHelper(GLenum target) { |
589 target = AdjustTargetForEmulation(target); | 589 target = AdjustTargetForEmulation(target); |
590 glEndQueryARB(target); | 590 glEndQuery(target); |
591 } | 591 } |
592 | 592 |
593 QueryManager::Query::Query( | 593 QueryManager::Query::Query( |
594 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset) | 594 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset) |
595 : manager_(manager), | 595 : manager_(manager), |
596 target_(target), | 596 target_(target), |
597 shm_id_(shm_id), | 597 shm_id_(shm_id), |
598 shm_offset_(shm_offset), | 598 shm_offset_(shm_offset), |
599 submit_count_(0), | 599 submit_count_(0), |
600 pending_(false), | 600 pending_(false), |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { | 747 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { |
748 DCHECK(query); | 748 DCHECK(query); |
749 if (!RemovePendingQuery(query)) { | 749 if (!RemovePendingQuery(query)) { |
750 return false; | 750 return false; |
751 } | 751 } |
752 return query->End(submit_count); | 752 return query->End(submit_count); |
753 } | 753 } |
754 | 754 |
755 } // namespace gles2 | 755 } // namespace gles2 |
756 } // namespace gpu | 756 } // namespace gpu |
OLD | NEW |