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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 4870 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 break; 4881 break;
4882 case GL_ANY_SAMPLES_PASSED: 4882 case GL_ANY_SAMPLES_PASSED:
4883 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: 4883 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
4884 if (!capabilities_.occlusion_query_boolean) { 4884 if (!capabilities_.occlusion_query_boolean) {
4885 SetGLError( 4885 SetGLError(
4886 GL_INVALID_OPERATION, "glBeginQueryEXT", 4886 GL_INVALID_OPERATION, "glBeginQueryEXT",
4887 "not enabled for occlusion queries"); 4887 "not enabled for occlusion queries");
4888 return; 4888 return;
4889 } 4889 }
4890 break; 4890 break;
4891 // TODO(dyen): Also support GL_TIMESTAMP.
4892 case GL_TIME_ELAPSED_EXT: 4891 case GL_TIME_ELAPSED_EXT:
4893 if (!capabilities_.timer_queries) { 4892 if (!capabilities_.timer_queries) {
4894 SetGLError( 4893 SetGLError(
4895 GL_INVALID_OPERATION, "glBeginQueryEXT", 4894 GL_INVALID_OPERATION, "glBeginQueryEXT",
4896 "not enabled for timing queries"); 4895 "not enabled for timing queries");
4897 return; 4896 return;
4898 } 4897 }
4899 break; 4898 break;
4900 default: 4899 default:
4901 SetGLError( 4900 SetGLError(
4902 GL_INVALID_OPERATION, "glBeginQueryEXT", "unknown query target"); 4901 GL_INVALID_ENUM, "glBeginQueryEXT", "unknown query target");
4903 return; 4902 return;
4904 } 4903 }
4905 4904
4906 // if any outstanding queries INV_OP 4905 // if any outstanding queries INV_OP
4907 if (query_tracker_->GetCurrentQuery(target)) { 4906 if (query_tracker_->GetCurrentQuery(target)) {
4908 SetGLError( 4907 SetGLError(
4909 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); 4908 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress");
4910 return; 4909 return;
4911 } 4910 }
4912 4911
(...skipping 19 matching lines...) Expand all
4932 << GLES2Util::GetStringQueryTarget(target) << ")"); 4931 << GLES2Util::GetStringQueryTarget(target) << ")");
4933 // Don't do anything if the context is lost. 4932 // Don't do anything if the context is lost.
4934 if (helper_->IsContextLost()) { 4933 if (helper_->IsContextLost()) {
4935 return; 4934 return;
4936 } 4935 }
4937 4936
4938 if (query_tracker_->EndQuery(target, this)) 4937 if (query_tracker_->EndQuery(target, this))
4939 CheckGLError(); 4938 CheckGLError();
4940 } 4939 }
4941 4940
4941 void GLES2Implementation::QueryCounterEXT(GLuint id, GLenum target) {
4942 GPU_CLIENT_SINGLE_THREAD_CHECK();
4943 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] QueryCounterEXT("
4944 << id
4945 << ", " << GLES2Util::GetStringQueryTarget(target) << ")");
4946
4947 // Check capabilities
piman 2015/07/16 01:05:52 nit: remove superfluous comment
David Yen 2015/07/16 20:21:12 Done.
4948 switch (target) {
4949 case GL_TIMESTAMP_EXT:
4950 if (!capabilities_.timer_queries) {
4951 SetGLError(
4952 GL_INVALID_OPERATION, "glQueryCounterEXT",
4953 "not enabled for timing queries");
4954 return;
4955 }
4956 break;
4957 default:
4958 SetGLError(
4959 GL_INVALID_ENUM, "glQueryCounterEXT", "unknown query target");
4960 return;
4961 }
4962
4963 // id = 0 INV_OP
piman 2015/07/16 01:05:52 nit: remove superfluous comment
David Yen 2015/07/16 20:21:12 Done.
4964 if (id == 0) {
4965 SetGLError(GL_INVALID_OPERATION, "glQueryCounterEXT", "id is 0");
4966 return;
4967 }
4968
4969 // if not GENned INV_OPERATION
piman 2015/07/16 01:05:52 nit: remove superfluous comment
David Yen 2015/07/16 20:21:12 Done.
4970 if (!query_id_allocator_->InUse(id)) {
4971 SetGLError(GL_INVALID_OPERATION, "glQueryCounterEXT", "invalid id");
4972 return;
4973 }
4974
4975 if (query_tracker_->QueryCounter(id, target, this))
4976 CheckGLError();
4977 }
4978
4942 void GLES2Implementation::GetQueryivEXT( 4979 void GLES2Implementation::GetQueryivEXT(
4943 GLenum target, GLenum pname, GLint* params) { 4980 GLenum target, GLenum pname, GLint* params) {
4944 GPU_CLIENT_SINGLE_THREAD_CHECK(); 4981 GPU_CLIENT_SINGLE_THREAD_CHECK();
4945 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetQueryivEXT(" 4982 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetQueryivEXT("
4946 << GLES2Util::GetStringQueryTarget(target) << ", " 4983 << GLES2Util::GetStringQueryTarget(target) << ", "
4947 << GLES2Util::GetStringQueryParameter(pname) << ", " 4984 << GLES2Util::GetStringQueryParameter(pname) << ", "
4948 << static_cast<const void*>(params) << ")"); 4985 << static_cast<const void*>(params) << ")");
4949 if (pname == GL_QUERY_COUNTER_BITS_EXT) { 4986 if (pname == GL_QUERY_COUNTER_BITS_EXT) {
4950 // We convert all queries to CPU time so we support 64 bits. 4987 // We convert all queries to CPU time so we support 64 bits.
4951 *params = 64; 4988 *params = 64;
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
5994 CheckGLError(); 6031 CheckGLError();
5995 } 6032 }
5996 6033
5997 // Include the auto-generated part of this file. We split this because it means 6034 // Include the auto-generated part of this file. We split this because it means
5998 // we can easily edit the non-auto generated parts right here in this file 6035 // we can easily edit the non-auto generated parts right here in this file
5999 // instead of having to edit some template or the code generator. 6036 // instead of having to edit some template or the code generator.
6000 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6037 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6001 6038
6002 } // namespace gles2 6039 } // namespace gles2
6003 } // namespace gpu 6040 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698