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

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: Removed GetQueryivEXT test with QueryCounter 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 11604 matching lines...) Expand 10 before | Expand all | Expand 10 after
11615 case GL_ANY_SAMPLES_PASSED: 11615 case GL_ANY_SAMPLES_PASSED:
11616 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: 11616 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
11617 if (!features().occlusion_query_boolean) { 11617 if (!features().occlusion_query_boolean) {
11618 LOCAL_SET_GL_ERROR( 11618 LOCAL_SET_GL_ERROR(
11619 GL_INVALID_OPERATION, "glBeginQueryEXT", 11619 GL_INVALID_OPERATION, "glBeginQueryEXT",
11620 "not enabled for occlusion queries"); 11620 "not enabled for occlusion queries");
11621 return error::kNoError; 11621 return error::kNoError;
11622 } 11622 }
11623 break; 11623 break;
11624 case GL_TIME_ELAPSED: 11624 case GL_TIME_ELAPSED:
11625 // TODO(dyen): Also support GL_TIMESTAMP.
11626 if (!query_manager_->GPUTimingAvailable()) { 11625 if (!query_manager_->GPUTimingAvailable()) {
11627 LOCAL_SET_GL_ERROR( 11626 LOCAL_SET_GL_ERROR(
11628 GL_INVALID_OPERATION, "glBeginQueryEXT", 11627 GL_INVALID_OPERATION, "glBeginQueryEXT",
11629 "not enabled for timing queries"); 11628 "not enabled for timing queries");
11630 return error::kNoError; 11629 return error::kNoError;
11631 } 11630 }
11632 break; 11631 break;
11633 default: 11632 default:
11634 LOCAL_SET_GL_ERROR( 11633 LOCAL_SET_GL_ERROR(
11635 GL_INVALID_OPERATION, "glBeginQueryEXT", 11634 GL_INVALID_ENUM, "glBeginQueryEXT",
11636 "unknown query target"); 11635 "unknown query target");
11637 return error::kNoError; 11636 return error::kNoError;
11638 } 11637 }
11639 11638
11640 if (state_.current_queries.find(target) != state_.current_queries.end()) { 11639 if (state_.current_queries.find(target) != state_.current_queries.end()) {
11641 LOCAL_SET_GL_ERROR( 11640 LOCAL_SET_GL_ERROR(
11642 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); 11641 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress");
11643 return error::kNoError; 11642 return error::kNoError;
11644 } 11643 }
11645 11644
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
11696 if (!query_manager_->EndQuery(query, submit_count)) { 11695 if (!query_manager_->EndQuery(query, submit_count)) {
11697 return error::kOutOfBounds; 11696 return error::kOutOfBounds;
11698 } 11697 }
11699 11698
11700 query_manager_->ProcessPendingTransferQueries(); 11699 query_manager_->ProcessPendingTransferQueries();
11701 11700
11702 state_.current_queries.erase(it); 11701 state_.current_queries.erase(it);
11703 return error::kNoError; 11702 return error::kNoError;
11704 } 11703 }
11705 11704
11705 error::Error GLES2DecoderImpl::HandleQueryCounterEXT(uint32 immediate_data_size,
11706 const void* cmd_data) {
11707 const gles2::cmds::QueryCounterEXT& c =
11708 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data);
11709 GLuint client_id = static_cast<GLuint>(c.id);
11710 GLenum target = static_cast<GLenum>(c.target);
11711 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id);
11712 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset);
11713 uint32 submit_count = static_cast<GLuint>(c.submit_count);
11714
11715 switch (target) {
11716 case GL_TIMESTAMP:
11717 if (!query_manager_->GPUTimingAvailable()) {
11718 LOCAL_SET_GL_ERROR(
11719 GL_INVALID_OPERATION, "glQueryCounterEXT",
11720 "not enabled for timing queries");
11721 return error::kNoError;
11722 }
11723 break;
11724 default:
11725 LOCAL_SET_GL_ERROR(
11726 GL_INVALID_ENUM, "glQueryCounterEXT",
11727 "unknown query target");
11728 return error::kNoError;
11729 }
11730
11731 QueryManager::Query* query = query_manager_->GetQuery(client_id);
11732 if (!query) {
11733 if (!query_manager_->IsValidQuery(client_id)) {
11734 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
11735 "glQueryCounterEXT",
11736 "id not made by glGenQueriesEXT");
11737 return error::kNoError;
11738 }
11739 query = query_manager_->CreateQuery(
11740 target, client_id, sync_shm_id, sync_shm_offset);
11741 }
11742 if (!query_manager_->QueryCounter(query, submit_count)) {
11743 return error::kOutOfBounds;
11744 }
11745
11746 return error::kNoError;
11747 }
11748
11706 bool GLES2DecoderImpl::GenVertexArraysOESHelper( 11749 bool GLES2DecoderImpl::GenVertexArraysOESHelper(
11707 GLsizei n, const GLuint* client_ids) { 11750 GLsizei n, const GLuint* client_ids) {
11708 for (GLsizei ii = 0; ii < n; ++ii) { 11751 for (GLsizei ii = 0; ii < n; ++ii) {
11709 if (GetVertexAttribManager(client_ids[ii])) { 11752 if (GetVertexAttribManager(client_ids[ii])) {
11710 return false; 11753 return false;
11711 } 11754 }
11712 } 11755 }
11713 11756
11714 if (!features().native_vertex_array_object) { 11757 if (!features().native_vertex_array_object) {
11715 // Emulated VAO 11758 // Emulated VAO
(...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
14341 return error::kNoError; 14384 return error::kNoError;
14342 } 14385 }
14343 14386
14344 // Include the auto-generated part of this file. We split this because it means 14387 // 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 14388 // 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. 14389 // instead of having to edit some template or the code generator.
14347 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 14390 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
14348 14391
14349 } // namespace gles2 14392 } // namespace gles2
14350 } // namespace gpu 14393 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_ids_autogen.h ('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