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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 106623008: gpu: Support parallel active queries in command buffer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gpu: Support parallel active queries in command buffer Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/tests/gl_query_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 724d537d7a7039de659aeba7ab542f7532ed7765..44a09ec8d5fd1c2eb39d6de55c2961d3e7d037a7 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3202,7 +3202,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) {
default_vertex_attrib_manager_ = NULL;
state_.texture_units.clear();
state_.bound_array_buffer = NULL;
- state_.current_query = NULL;
+ state_.current_queries.clear();
framebuffer_state_.bound_read_framebuffer = NULL;
framebuffer_state_.bound_draw_framebuffer = NULL;
state_.bound_renderbuffer = NULL;
@@ -9349,9 +9349,11 @@ void GLES2DecoderImpl::DeleteQueriesEXTHelper(
for (GLsizei ii = 0; ii < n; ++ii) {
QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]);
if (query && !query->IsDeleted()) {
- if (query == state_.current_query.get()) {
- state_.current_query = NULL;
- }
+ ContextState::QueryMap::iterator it =
+ state_.current_queries.find(query->target());
+ if (it != state_.current_queries.end())
+ state_.current_queries.erase(it);
+
query->Destroy(true);
query_manager_->RemoveQuery(client_ids[ii]);
}
@@ -9427,9 +9429,7 @@ error::Error GLES2DecoderImpl::HandleBeginQueryEXT(
break;
}
- // TODO(hubbe): Make it possible to have one query per type running at the
- // same time.
- if (state_.current_query.get()) {
+ if (state_.current_queries.find(target) != state_.current_queries.end()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress");
return error::kNoError;
@@ -9478,7 +9478,7 @@ error::Error GLES2DecoderImpl::HandleBeginQueryEXT(
return error::kOutOfBounds;
}
- state_.current_query = query;
+ state_.current_queries[target] = query;
return error::kNoError;
}
@@ -9486,26 +9486,22 @@ error::Error GLES2DecoderImpl::HandleEndQueryEXT(
uint32 immediate_data_size, const cmds::EndQueryEXT& c) {
GLenum target = static_cast<GLenum>(c.target);
uint32 submit_count = static_cast<GLuint>(c.submit_count);
+ ContextState::QueryMap::iterator it = state_.current_queries.find(target);
- if (!state_.current_query.get()) {
+ if (it == state_.current_queries.end()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glEndQueryEXT", "No active query");
return error::kNoError;
}
- if (state_.current_query->target() != target) {
- LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION,
- "glEndQueryEXT", "target does not match active query");
- return error::kNoError;
- }
- if (!query_manager_->EndQuery(state_.current_query.get(), submit_count)) {
+ QueryManager::Query* query = it->second.get();
+ if (!query_manager_->EndQuery(query, submit_count)) {
return error::kOutOfBounds;
}
query_manager_->ProcessPendingTransferQueries();
- state_.current_query = NULL;
+ state_.current_queries.erase(it);
return error::kNoError;
}
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/tests/gl_query_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698