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

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

Issue 1233233002: Added support for TimeStamp queries using QueryCounterEXT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test Created 5 years, 5 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 <cmath> 10 #include <cmath>
(...skipping 11614 matching lines...) Expand 10 before | Expand all | Expand 10 after
11625 // TODO(dyen): Also support GL_TIMESTAMP. 11625 // TODO(dyen): Also support GL_TIMESTAMP.
11626 if (!query_manager_->GPUTimingAvailable()) { 11626 if (!query_manager_->GPUTimingAvailable()) {
11627 LOCAL_SET_GL_ERROR( 11627 LOCAL_SET_GL_ERROR(
11628 GL_INVALID_OPERATION, "glBeginQueryEXT", 11628 GL_INVALID_OPERATION, "glBeginQueryEXT",
11629 "not enabled for timing queries"); 11629 "not enabled for timing queries");
11630 return error::kNoError; 11630 return error::kNoError;
11631 } 11631 }
11632 break; 11632 break;
11633 default: 11633 default:
11634 LOCAL_SET_GL_ERROR( 11634 LOCAL_SET_GL_ERROR(
11635 GL_INVALID_OPERATION, "glBeginQueryEXT", 11635 GL_INVALID_ENUM, "glBeginQueryEXT",
11636 "unknown query target"); 11636 "unknown query target");
11637 return error::kNoError; 11637 return error::kNoError;
11638 } 11638 }
11639 11639
11640 if (state_.current_queries.find(target) != state_.current_queries.end()) { 11640 if (state_.current_queries.find(target) != state_.current_queries.end()) {
11641 LOCAL_SET_GL_ERROR( 11641 LOCAL_SET_GL_ERROR(
11642 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); 11642 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress");
11643 return error::kNoError; 11643 return error::kNoError;
11644 } 11644 }
11645 11645
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
11696 if (!query_manager_->EndQuery(query, submit_count)) { 11696 if (!query_manager_->EndQuery(query, submit_count)) {
11697 return error::kOutOfBounds; 11697 return error::kOutOfBounds;
11698 } 11698 }
11699 11699
11700 query_manager_->ProcessPendingTransferQueries(); 11700 query_manager_->ProcessPendingTransferQueries();
11701 11701
11702 state_.current_queries.erase(it); 11702 state_.current_queries.erase(it);
11703 return error::kNoError; 11703 return error::kNoError;
11704 } 11704 }
11705 11705
11706 error::Error GLES2DecoderImpl::HandleQueryCounterEXT(uint32 immediate_data_size,
11707 const void* cmd_data) {
11708 const gles2::cmds::QueryCounterEXT& c =
11709 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data);
11710 GLuint client_id = static_cast<GLuint>(c.id);
11711 GLenum target = static_cast<GLenum>(c.target);
11712 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id);
11713 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset);
11714 uint32 submit_count = static_cast<GLuint>(c.submit_count);
11715
11716 switch (target) {
11717 case GL_TIMESTAMP:
11718 // TODO(dyen): Also support GL_TIMESTAMP.
piman 2015/07/16 01:05:53 nit: wrong comment?
David Yen 2015/07/16 20:21:12 Done.
11719 if (!query_manager_->GPUTimingAvailable()) {
11720 LOCAL_SET_GL_ERROR(
11721 GL_INVALID_OPERATION, "glQueryCounterEXT",
11722 "not enabled for timing queries");
11723 return error::kNoError;
11724 }
11725 break;
11726 default:
11727 LOCAL_SET_GL_ERROR(
11728 GL_INVALID_ENUM, "glQueryCounterEXT",
11729 "unknown query target");
11730 return error::kNoError;
11731 }
11732
11733 QueryManager::Query* query = query_manager_->GetQuery(client_id);
11734 if (!query) {
11735 if (!query_manager_->IsValidQuery(client_id)) {
11736 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
11737 "glQueryCounterEXT",
11738 "id not made by glGenQueriesEXT");
11739 return error::kNoError;
11740 }
11741 query = query_manager_->CreateQuery(
11742 target, client_id, sync_shm_id, sync_shm_offset);
11743 }
11744 if (!query_manager_->QueryCounter(query, submit_count)) {
11745 return error::kOutOfBounds;
11746 }
11747
11748 return error::kNoError;
11749 }
11750
11706 bool GLES2DecoderImpl::GenVertexArraysOESHelper( 11751 bool GLES2DecoderImpl::GenVertexArraysOESHelper(
11707 GLsizei n, const GLuint* client_ids) { 11752 GLsizei n, const GLuint* client_ids) {
11708 for (GLsizei ii = 0; ii < n; ++ii) { 11753 for (GLsizei ii = 0; ii < n; ++ii) {
11709 if (GetVertexAttribManager(client_ids[ii])) { 11754 if (GetVertexAttribManager(client_ids[ii])) {
11710 return false; 11755 return false;
11711 } 11756 }
11712 } 11757 }
11713 11758
11714 if (!features().native_vertex_array_object) { 11759 if (!features().native_vertex_array_object) {
11715 // Emulated VAO 11760 // Emulated VAO
(...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
14341 return error::kNoError; 14386 return error::kNoError;
14342 } 14387 }
14343 14388
14344 // Include the auto-generated part of this file. We split this because it means 14389 // Include the auto-generated part of this file. We split this because it means
14345 // we can easily edit the non-auto generated parts right here in this file 14390 // we can easily edit the non-auto generated parts right here in this file
14346 // instead of having to edit some template or the code generator. 14391 // instead of having to edit some template or the code generator.
14347 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 14392 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
14348 14393
14349 } // namespace gles2 14394 } // namespace gles2
14350 } // namespace gpu 14395 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698