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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 9448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9459 return error::kNoError; | 9459 return error::kNoError; |
9460 } | 9460 } |
9461 | 9461 |
9462 bool GLES2DecoderImpl::GenQueriesEXTHelper( | 9462 bool GLES2DecoderImpl::GenQueriesEXTHelper( |
9463 GLsizei n, const GLuint* client_ids) { | 9463 GLsizei n, const GLuint* client_ids) { |
9464 for (GLsizei ii = 0; ii < n; ++ii) { | 9464 for (GLsizei ii = 0; ii < n; ++ii) { |
9465 if (query_manager_->GetQuery(client_ids[ii])) { | 9465 if (query_manager_->GetQuery(client_ids[ii])) { |
9466 return false; | 9466 return false; |
9467 } | 9467 } |
9468 } | 9468 } |
9469 query_manager_->GenQueries(n, client_ids); | |
9469 // NOTE: We don't generate Query objects here. Only in BeginQueryEXT | 9470 // NOTE: We don't generate Query objects here. Only in BeginQueryEXT |
piman
2014/04/22 00:37:31
Please remove comment that is now invalid
rptr
2014/04/22 05:43:18
Done.
| |
9470 return true; | 9471 return true; |
9471 } | 9472 } |
9472 | 9473 |
9473 void GLES2DecoderImpl::DeleteQueriesEXTHelper( | 9474 void GLES2DecoderImpl::DeleteQueriesEXTHelper( |
9474 GLsizei n, const GLuint* client_ids) { | 9475 GLsizei n, const GLuint* client_ids) { |
9475 for (GLsizei ii = 0; ii < n; ++ii) { | 9476 for (GLsizei ii = 0; ii < n; ++ii) { |
9476 QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); | 9477 QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); |
9477 if (query && !query->IsDeleted()) { | 9478 if (query && !query->IsDeleted()) { |
9478 ContextState::QueryMap::iterator it = | 9479 ContextState::QueryMap::iterator it = |
9479 state_.current_queries.find(query->target()); | 9480 state_.current_queries.find(query->target()); |
9480 if (it != state_.current_queries.end()) | 9481 if (it != state_.current_queries.end()) |
9481 state_.current_queries.erase(it); | 9482 state_.current_queries.erase(it); |
9482 | 9483 |
9483 query->Destroy(true); | 9484 query->Destroy(true); |
9484 query_manager_->RemoveQuery(client_ids[ii]); | 9485 query_manager_->RemoveQuery(client_ids[ii]); |
piman
2014/04/22 00:37:31
This should be called regardless of whether query
rptr
2014/04/22 05:43:18
Done.
| |
9485 } | 9486 } |
9486 } | 9487 } |
9487 } | 9488 } |
9488 | 9489 |
9489 bool GLES2DecoderImpl::ProcessPendingQueries() { | 9490 bool GLES2DecoderImpl::ProcessPendingQueries() { |
9490 if (query_manager_.get() == NULL) { | 9491 if (query_manager_.get() == NULL) { |
9491 return false; | 9492 return false; |
9492 } | 9493 } |
9493 if (!query_manager_->ProcessPendingQueries()) { | 9494 if (!query_manager_->ProcessPendingQueries()) { |
9494 current_decoder_error_ = error::kOutOfBounds; | 9495 current_decoder_error_ = error::kOutOfBounds; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9569 return error::kNoError; | 9570 return error::kNoError; |
9570 } | 9571 } |
9571 | 9572 |
9572 if (client_id == 0) { | 9573 if (client_id == 0) { |
9573 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0"); | 9574 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0"); |
9574 return error::kNoError; | 9575 return error::kNoError; |
9575 } | 9576 } |
9576 | 9577 |
9577 QueryManager::Query* query = query_manager_->GetQuery(client_id); | 9578 QueryManager::Query* query = query_manager_->GetQuery(client_id); |
9578 if (!query) { | 9579 if (!query) { |
9579 // TODO(gman): Decide if we need this check. | 9580 if (!query_manager_->IsValidQuery(client_id)) { |
9580 // | 9581 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
9581 // Checks id was made by glGenQueries | 9582 "glBeginQueryEXT", |
9582 // | 9583 "id not made by glGenQueriesEXT"); |
9583 // From the POV of OpenGL ES 2.0 you need to call glGenQueriesEXT | 9584 return error::kNoError; |
9584 // for all Query ids but from the POV of the command buffer service maybe | 9585 } |
9585 // you don't. | |
9586 // | |
9587 // The client can enforce this. I don't think the service cares. | |
9588 // | |
9589 // IdAllocatorInterface* id_allocator = | |
9590 // group_->GetIdAllocator(id_namespaces::kQueries); | |
9591 // if (!id_allocator->InUse(client_id)) { | |
rptr
2014/04/19 11:48:45
id_allocator->InUse(client_id) won't work as we ha
| |
9592 // LOCAL_SET_GL_ERROR( | |
9593 // GL_INVALID_OPERATION, | |
9594 // "glBeginQueryEXT", "id not made by glGenQueriesEXT"); | |
9595 // return error::kNoError; | |
9596 // } | |
9597 query = query_manager_->CreateQuery( | 9586 query = query_manager_->CreateQuery( |
9598 target, client_id, sync_shm_id, sync_shm_offset); | 9587 target, client_id, sync_shm_id, sync_shm_offset); |
9599 } | 9588 } |
9600 | 9589 |
9601 if (query->target() != target) { | 9590 if (query->target() != target) { |
9602 LOCAL_SET_GL_ERROR( | 9591 LOCAL_SET_GL_ERROR( |
9603 GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match"); | 9592 GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match"); |
9604 return error::kNoError; | 9593 return error::kNoError; |
9605 } else if (query->shm_id() != sync_shm_id || | 9594 } else if (query->shm_id() != sync_shm_id || |
9606 query->shm_offset() != sync_shm_offset) { | 9595 query->shm_offset() != sync_shm_offset) { |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10750 } | 10739 } |
10751 } | 10740 } |
10752 | 10741 |
10753 // Include the auto-generated part of this file. We split this because it means | 10742 // Include the auto-generated part of this file. We split this because it means |
10754 // we can easily edit the non-auto generated parts right here in this file | 10743 // we can easily edit the non-auto generated parts right here in this file |
10755 // instead of having to edit some template or the code generator. | 10744 // instead of having to edit some template or the code generator. |
10756 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10745 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10757 | 10746 |
10758 } // namespace gles2 | 10747 } // namespace gles2 |
10759 } // namespace gpu | 10748 } // namespace gpu |
OLD | NEW |