Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 226483003: Flag INV_OP during BeginQuery if id is not obtained from GenQueriesEXT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments + nits. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // NOTE: We don't generate Query objects here. Only in BeginQueryEXT 9469 query_manager_->GenQueries(n, client_ids);
9470 return true; 9470 return true;
9471 } 9471 }
9472 9472
9473 void GLES2DecoderImpl::DeleteQueriesEXTHelper( 9473 void GLES2DecoderImpl::DeleteQueriesEXTHelper(
9474 GLsizei n, const GLuint* client_ids) { 9474 GLsizei n, const GLuint* client_ids) {
9475 for (GLsizei ii = 0; ii < n; ++ii) { 9475 for (GLsizei ii = 0; ii < n; ++ii) {
9476 QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); 9476 QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]);
9477 if (query && !query->IsDeleted()) { 9477 if (query && !query->IsDeleted()) {
9478 ContextState::QueryMap::iterator it = 9478 ContextState::QueryMap::iterator it =
9479 state_.current_queries.find(query->target()); 9479 state_.current_queries.find(query->target());
9480 if (it != state_.current_queries.end()) 9480 if (it != state_.current_queries.end())
9481 state_.current_queries.erase(it); 9481 state_.current_queries.erase(it);
9482 9482
9483 query->Destroy(true); 9483 query->Destroy(true);
9484 query_manager_->RemoveQuery(client_ids[ii]);
9485 } 9484 }
9485 query_manager_->RemoveQuery(client_ids[ii]);
9486 } 9486 }
9487 } 9487 }
9488 9488
9489 bool GLES2DecoderImpl::ProcessPendingQueries() { 9489 bool GLES2DecoderImpl::ProcessPendingQueries() {
9490 if (query_manager_.get() == NULL) { 9490 if (query_manager_.get() == NULL) {
9491 return false; 9491 return false;
9492 } 9492 }
9493 if (!query_manager_->ProcessPendingQueries()) { 9493 if (!query_manager_->ProcessPendingQueries()) {
9494 current_decoder_error_ = error::kOutOfBounds; 9494 current_decoder_error_ = error::kOutOfBounds;
9495 } 9495 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
9569 return error::kNoError; 9569 return error::kNoError;
9570 } 9570 }
9571 9571
9572 if (client_id == 0) { 9572 if (client_id == 0) {
9573 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0"); 9573 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0");
9574 return error::kNoError; 9574 return error::kNoError;
9575 } 9575 }
9576 9576
9577 QueryManager::Query* query = query_manager_->GetQuery(client_id); 9577 QueryManager::Query* query = query_manager_->GetQuery(client_id);
9578 if (!query) { 9578 if (!query) {
9579 // TODO(gman): Decide if we need this check. 9579 if (!query_manager_->IsValidQuery(client_id)) {
9580 // 9580 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
9581 // Checks id was made by glGenQueries 9581 "glBeginQueryEXT",
9582 // 9582 "id not made by glGenQueriesEXT");
9583 // From the POV of OpenGL ES 2.0 you need to call glGenQueriesEXT 9583 return error::kNoError;
9584 // for all Query ids but from the POV of the command buffer service maybe 9584 }
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)) {
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( 9585 query = query_manager_->CreateQuery(
9598 target, client_id, sync_shm_id, sync_shm_offset); 9586 target, client_id, sync_shm_id, sync_shm_offset);
9599 } 9587 }
9600 9588
9601 if (query->target() != target) { 9589 if (query->target() != target) {
9602 LOCAL_SET_GL_ERROR( 9590 LOCAL_SET_GL_ERROR(
9603 GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match"); 9591 GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match");
9604 return error::kNoError; 9592 return error::kNoError;
9605 } else if (query->shm_id() != sync_shm_id || 9593 } else if (query->shm_id() != sync_shm_id ||
9606 query->shm_offset() != sync_shm_offset) { 9594 query->shm_offset() != sync_shm_offset) {
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
10750 } 10738 }
10751 } 10739 }
10752 10740
10753 // Include the auto-generated part of this file. We split this because it means 10741 // 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 10742 // 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. 10743 // instead of having to edit some template or the code generator.
10756 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10744 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10757 10745
10758 } // namespace gles2 10746 } // namespace gles2
10759 } // namespace gpu 10747 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698