diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 06:03:03 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 06:03:03 +0000 |
commit | 8ffc2594e4d449f4a8861cee3071c4afbacd9f20 (patch) | |
tree | d27a77a7e4e094551d01dad7d56b03ce09e22355 | |
parent | da56a47ab4279016cd690e576bee1d81d414aac5 (diff) | |
download | chromium_src-8ffc2594e4d449f4a8861cee3071c4afbacd9f20.zip chromium_src-8ffc2594e4d449f4a8861cee3071c4afbacd9f20.tar.gz chromium_src-8ffc2594e4d449f4a8861cee3071c4afbacd9f20.tar.bz2 |
Add check for single threaded access to GLES2Implementation
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/8879062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114370 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | gpu/command_buffer/client/gles2_implementation.cc | 63 | ||||
-rwxr-xr-x[-rw-r--r--] | gpu/command_buffer/client/gles2_implementation.h | 16 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation_autogen.h | 115 |
4 files changed, 207 insertions, 3 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index bdbd683..ece3ddc 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -2369,6 +2369,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") self.WriteClientGLCallLog(func, file) func.WriteDestinationInitalizationValidation(file) for arg in func.GetOriginalArgs(): @@ -2793,6 +2794,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): @@ -2871,7 +2873,8 @@ class GENnHandler(TypeHandler): self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) - code = """ id_handlers_[id_namespaces::k%(resource_type)s]-> + code = """ GPU_CLIENT_SINGLE_THREAD_CHECK(); + id_handlers_[id_namespaces::k%(resource_type)s]-> MakeIds(0, %(args)s); helper_->%(name)sImmediate(%(args)s); %(log_code)s @@ -3086,6 +3089,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): @@ -3116,6 +3120,7 @@ class DeleteHandler(TypeHandler): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): @@ -3235,6 +3240,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs) { 'count_name': func.GetOriginalArgs()[0].name, } file.Write("%(return_type)s %(name)s(%(typed_args)s) {\n" % args) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({ @@ -3402,6 +3408,7 @@ class GETnHandler(TypeHandler): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): @@ -3592,6 +3599,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) last_arg_name = func.GetLastOriginalArg().name @@ -3815,6 +3823,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) last_arg_name = func.GetLastOriginalArg().name @@ -4204,6 +4213,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgsBadSharedMemoryId) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + file.Write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") func.WriteDestinationInitalizationValidation(file) self.WriteClientGLCallLog(func, file) file.Write(" typedef %s::Result Result;\n" % func.name) @@ -4243,7 +4253,9 @@ class STRnHandler(TypeHandler): def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" - code_1 = "%(return_type)s %(func_name)s(%(args)s) {\n" + code_1 = """%(return_type)s %(func_name)s(%(args)s) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); +""" code_2 = """ GPU_CLIENT_LOG("[" << this << "] gl%(func_name)s" << "(" << %(arg0)s << ", " << %(arg1)s << ", " diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 6f00feb..15f6bfb 100644..100755 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -603,6 +603,18 @@ const size_t GLES2Implementation::kMaxSizeOfSimpleResult; COMPILE_ASSERT(gpu::kInvalidResource == 0, INVALID_RESOURCE_NOT_0_AS_GL_EXPECTS); +GLES2Implementation::SingleThreadChecker::SingleThreadChecker( + GLES2Implementation* gles2_implementation) + : gles2_implementation_(gles2_implementation) { + GPU_CHECK_EQ(0, gles2_implementation_->use_count_); + ++gles2_implementation_->use_count_; +} + +GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { + --gles2_implementation_->use_count_; + GPU_CHECK_EQ(0, gles2_implementation_->use_count_); +} + GLES2Implementation::GLES2Implementation( GLES2CmdHelper* helper, size_t transfer_buffer_size, @@ -633,7 +645,8 @@ GLES2Implementation::GLES2Implementation( error_bits_(0), debug_(false), sharing_resources_(share_resources), - bind_generates_resource_(bind_generates_resource) { + bind_generates_resource_(bind_generates_resource), + use_count_(0) { GPU_CLIENT_LOG_CODE_BLOCK({ debug_ = CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableGPUClientLogging); @@ -767,6 +780,7 @@ bool GLES2Implementation::IsAnglePackReverseRowOrderAvailable() { } GLenum GLES2Implementation::GetError() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetError()"); GLenum err = GetGLError(); GPU_CLIENT_LOG("returned " << GLES2Util::GetStringError(err)); @@ -1005,6 +1019,7 @@ bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { void GLES2Implementation::DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDrawElements(" << GLES2Util::GetStringDrawMode(mode) << ", " << count << ", " @@ -1057,6 +1072,7 @@ void GLES2Implementation::DrawElements( } void GLES2Implementation::Flush() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glFlush()"); // Insert the cmd to call glFlush helper_->Flush(); @@ -1066,6 +1082,7 @@ void GLES2Implementation::Flush() { } void GLES2Implementation::Finish() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glFinish()"); TRACE_EVENT0("gpu", "GLES2::Finish"); // Insert the cmd to call glFinish @@ -1077,6 +1094,7 @@ void GLES2Implementation::Finish() { } void GLES2Implementation::SwapBuffers() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); // TODO(piman): Strictly speaking we'd want to insert the token after the // swap, but the state update with the updated token might not have happened @@ -1185,6 +1203,7 @@ void GLES2Implementation::RegisterSharedIdsCHROMIUM( void GLES2Implementation::BindAttribLocation( GLuint program, GLuint index, const char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBindAttribLocation(" << program << ", " << index << ", " << name << ")"); SetBucketAsString(kResultBucketId, name); @@ -1194,6 +1213,7 @@ void GLES2Implementation::BindAttribLocation( void GLES2Implementation::GetVertexAttribPointerv( GLuint index, GLenum pname, void** ptr) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribPointer(" << index << ", " << GLES2Util::GetStringVertexPointer(pname) << ", " << static_cast<void*>(ptr) << ")"); @@ -1259,6 +1279,7 @@ GLint GLES2Implementation::GetAttribLocationHelper( GLint GLES2Implementation::GetAttribLocation( GLuint program, const char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetAttribLocation(" << program << ", " << name << ")"); TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); @@ -1282,6 +1303,7 @@ GLint GLES2Implementation::GetUniformLocationHelper( GLint GLES2Implementation::GetUniformLocation( GLuint program, const char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetUniformLocation(" << program << ", " << name << ")"); TRACE_EVENT0("gpu", "GLES2::GetUniformLocation"); @@ -1296,6 +1318,7 @@ bool GLES2Implementation::GetProgramivHelper( } void GLES2Implementation::LinkProgram(GLuint program) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glLinkProgram(" << program << ")"); helper_->LinkProgram(program); program_info_manager_->CreateInfo(program); @@ -1304,6 +1327,7 @@ void GLES2Implementation::LinkProgram(GLuint program) { void GLES2Implementation::ShaderBinary( GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glShaderBinary(" << n << ", " << static_cast<const void*>(shaders) << ", " << GLES2Util::GetStringEnum(binaryformat) << ", " @@ -1336,6 +1360,7 @@ void GLES2Implementation::ShaderBinary( } void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glPixelStorei(" << GLES2Util::GetStringPixelStore(pname) << ", " << param << ")"); @@ -1363,6 +1388,7 @@ void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { void GLES2Implementation::VertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttribPointer(" << index << ", " << size << ", " @@ -1387,6 +1413,7 @@ void GLES2Implementation::VertexAttribPointer( void GLES2Implementation::ShaderSource( GLuint shader, GLsizei count, const char** source, const GLint* length) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glShaderSource(" << shader << ", " << count << ", " << static_cast<const void*>(source) << ", " @@ -1456,6 +1483,7 @@ void GLES2Implementation::ShaderSource( void GLES2Implementation::BufferData( GLenum target, GLsizeiptr size, const void* data, GLenum usage) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBufferData(" << GLES2Util::GetStringBufferTarget(target) << ", " << size << ", " @@ -1484,6 +1512,7 @@ void GLES2Implementation::BufferData( void GLES2Implementation::BufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBufferSubData(" << GLES2Util::GetStringBufferTarget(target) << ", " << offset << ", " << size << ", " @@ -1517,6 +1546,7 @@ void GLES2Implementation::BufferSubData( void GLES2Implementation::CompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const void* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCompressedTexImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " @@ -1543,6 +1573,7 @@ void GLES2Implementation::CompressedTexImage2D( void GLES2Implementation::CompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const void* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCompressedTexSubImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " @@ -1607,6 +1638,7 @@ void GLES2Implementation::TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " @@ -1661,6 +1693,7 @@ void GLES2Implementation::TexImage2D( void GLES2Implementation::TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexSubImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " @@ -1808,6 +1841,7 @@ bool GLES2Implementation::GetActiveAttribHelper( void GLES2Implementation::GetActiveAttrib( GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetActiveAttrib(" << program << ", " << index << ", " << bufsize << ", " << static_cast<const void*>(length) << ", " @@ -1874,6 +1908,7 @@ bool GLES2Implementation::GetActiveUniformHelper( void GLES2Implementation::GetActiveUniform( GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetActiveUniform(" << program << ", " << index << ", " << bufsize << ", " << static_cast<const void*>(length) << ", " @@ -1902,6 +1937,7 @@ void GLES2Implementation::GetActiveUniform( void GLES2Implementation::GetAttachedShaders( GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetAttachedShaders(" << program << ", " << maxcount << ", " << static_cast<const void*>(count) << ", " @@ -1937,6 +1973,7 @@ void GLES2Implementation::GetAttachedShaders( void GLES2Implementation::GetShaderPrecisionFormat( GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetShaderPrecisionFormat(" << GLES2Util::GetStringShaderType(shadertype) << ", " << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " @@ -1964,6 +2001,7 @@ void GLES2Implementation::GetShaderPrecisionFormat( } const GLubyte* GLES2Implementation::GetString(GLenum name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetString(" << GLES2Util::GetStringStringType(name) << ")"); const char* result = NULL; @@ -2011,6 +2049,7 @@ const GLubyte* GLES2Implementation::GetString(GLenum name) { void GLES2Implementation::GetUniformfv( GLuint program, GLint location, GLfloat* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetUniformfv(" << program << ", " << location << ", " << static_cast<const void*>(params) << ")"); @@ -2031,6 +2070,7 @@ void GLES2Implementation::GetUniformfv( void GLES2Implementation::GetUniformiv( GLuint program, GLint location, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetUniformiv(" << program << ", " << location << ", " << static_cast<const void*>(params) << ")"); @@ -2052,6 +2092,7 @@ void GLES2Implementation::GetUniformiv( void GLES2Implementation::ReadPixels( GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glReadPixels(" << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " @@ -2189,6 +2230,7 @@ void GLES2Implementation::ReadPixels( } void GLES2Implementation::ActiveTexture(GLenum texture) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glActiveTexture(" << GLES2Util::GetStringEnum(texture) << ")"); GLuint texture_index = texture - GL_TEXTURE0; @@ -2364,6 +2406,7 @@ void GLES2Implementation::DeleteTexturesHelper( } void GLES2Implementation::DisableVertexAttribArray(GLuint index) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG( "[" << this << "] glDisableVertexAttribArray(" << index << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) @@ -2373,6 +2416,7 @@ void GLES2Implementation::DisableVertexAttribArray(GLuint index) { } void GLES2Implementation::EnableVertexAttribArray(GLuint index) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glEnableVertexAttribArray(" << index << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) client_side_buffer_helper_->SetAttribEnable(index, true); @@ -2381,6 +2425,7 @@ void GLES2Implementation::EnableVertexAttribArray(GLuint index) { } void GLES2Implementation::DrawArrays(GLenum mode, GLint first, GLsizei count) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDrawArrays(" << GLES2Util::GetStringDrawMode(mode) << ", " << first << ", " << count << ")"); @@ -2445,6 +2490,7 @@ bool GLES2Implementation::GetVertexAttribHelper( void GLES2Implementation::GetVertexAttribfv( GLuint index, GLenum pname, GLfloat* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribfv(" << index << ", " << GLES2Util::GetStringVertexAttribute(pname) << ", " @@ -2473,6 +2519,7 @@ void GLES2Implementation::GetVertexAttribfv( void GLES2Implementation::GetVertexAttribiv( GLuint index, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribiv(" << index << ", " << GLES2Util::GetStringVertexAttribute(pname) << ", " @@ -2501,6 +2548,7 @@ void GLES2Implementation::GetVertexAttribiv( GLboolean GLES2Implementation::EnableFeatureCHROMIUM( const char* feature) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glEnableFeatureCHROMIUM(" << feature << ")"); TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); @@ -2518,6 +2566,7 @@ GLboolean GLES2Implementation::EnableFeatureCHROMIUM( void* GLES2Implementation::MapBufferSubDataCHROMIUM( GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glMapBufferSubDataCHROMIUM(" << target << ", " << offset << ", " << size << ", " << GLES2Util::GetStringEnum(access) << ")"); @@ -2550,6 +2599,7 @@ void* GLES2Implementation::MapBufferSubDataCHROMIUM( } void GLES2Implementation::UnmapBufferSubDataCHROMIUM(const void* mem) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG( "[" << this << "] glUnmapBufferSubDataCHROMIUM(" << mem << ")"); MappedBufferMap::iterator it = mapped_buffers_.find(mem); @@ -2576,6 +2626,7 @@ void* GLES2Implementation::MapTexSubImage2DCHROMIUM( GLenum format, GLenum type, GLenum access) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glMapTexSubImage2DCHROMIUM(" << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " @@ -2620,6 +2671,7 @@ void* GLES2Implementation::MapTexSubImage2DCHROMIUM( } void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG( "[" << this << "] glUnmapTexSubImage2DCHROMIUM(" << mem << ")"); MappedTextureMap::iterator it = mapped_textures_.find(mem); @@ -2638,12 +2690,14 @@ void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { } void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glResizeCHROMIUM(" << width << ", " << height << ")"); helper_->ResizeCHROMIUM(width, height); } const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetRequestableExtensionsCHROMIUM()"); TRACE_EVENT0("gpu", "GLES2Implementation::GetRequestableExtensionsCHROMIUM()"); @@ -2673,6 +2727,7 @@ const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { } void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glRequestExtensionCHROMIUM(" << extension << ")"); SetBucketAsCString(kResultBucketId, extension); @@ -2685,6 +2740,7 @@ void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { } void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glRateLimitOffscreenCHROMIUM()"); // Wait if this would add too many rate limit tokens. if (rate_limit_tokens_.size() == kMaxSwapBuffers) { @@ -2696,6 +2752,7 @@ void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() { void GLES2Implementation::GetMultipleIntegervCHROMIUM( const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetMultipleIntegervCHROMIUM(" << static_cast<const void*>(pnames) << ", " << count << ", " << results << ", " << size << ")"); @@ -2763,6 +2820,7 @@ void GLES2Implementation::GetProgramInfoCHROMIUMHelper( void GLES2Implementation::GetProgramInfoCHROMIUM( GLuint program, GLsizei bufsize, GLsizei* size, void* info) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); if (bufsize < 0) { SetGLError(GL_INVALID_VALUE, "glProgramInfoCHROMIUM: bufsize less than 0."); return; @@ -2792,6 +2850,7 @@ void GLES2Implementation::GetProgramInfoCHROMIUM( } GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] CreateStreamTextureCHROMIUM(" << texture << ")"); TRACE_EVENT0("gpu", "GLES2::CreateStreamTextureCHROMIUM"); @@ -2808,6 +2867,7 @@ GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) { } void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] DestroyStreamTextureCHROMIUM(" << texture << ")"); TRACE_EVENT0("gpu", "GLES2::DestroyStreamTextureCHROMIUM"); @@ -2816,6 +2876,7 @@ void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) { void GLES2Implementation::PostSubBufferCHROMIUM( GLint x, GLint y, GLint width, GLint height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] PostSubBufferCHROMIUM(" << x << ", " << y << ", " << width << ", " << height << ")"); TRACE_EVENT0("gpu", "GLES2::PostSubBufferCHROMIUM"); diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 82739b4..5a23671 100644..100755 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -21,17 +21,20 @@ #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANCE_TESTS) // NOLINT #if defined(GLES2_INLINE_OPTIMIZATION) // TODO(gman): Replace with macros that work with inline optmization. + #define GPU_CLIENT_SINGLE_THREAD_CHECK() #define GPU_CLIENT_LOG(args) #define GPU_CLIENT_LOG_CODE_BLOCK(code) #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) #else #include "base/logging.h" + #define GPU_CLIENT_SINGLE_THREAD_CHECK() SingleThreadChecker checker(this); #define GPU_CLIENT_LOG(args) DLOG_IF(INFO, debug_) << args; #define GPU_CLIENT_LOG_CODE_BLOCK(code) code #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) code #define GPU_CLIENT_DEBUG #endif #else + #define GPU_CLIENT_SINGLE_THREAD_CHECK() #define GPU_CLIENT_LOG(args) #define GPU_CLIENT_LOG_CODE_BLOCK(code) #define GPU_CLIENT_DCHECK_CODE_BLOCK(code) @@ -383,6 +386,16 @@ class GLES2Implementation { GLuint bound_texture_cube_map; }; + // Checks for single threaded access. + class SingleThreadChecker { + public: + SingleThreadChecker(GLES2Implementation* gles2_implementation); + ~SingleThreadChecker(); + + private: + GLES2Implementation* gles2_implementation_; + }; + // Gets the value of the result. template <typename T> T GetResultAs() { @@ -542,6 +555,9 @@ class GLES2Implementation { bool bind_generates_resource_; + // Used to check for single threaded access. + int use_count_; + // Map of GLenum to Strings for glGetString. We need to cache these because // the pointer passed back to the client has to remain valid for eternity. typedef std::map<uint32, std::set<std::string> > GLStringMap; diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 86d7ae1..7047d3752 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -14,6 +14,7 @@ void ActiveTexture(GLenum texture); void AttachShader(GLuint program, GLuint shader) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glAttachShader(" << program << ", " << shader << ")"); // NOLINT helper_->AttachShader(program, shader); } @@ -21,6 +22,7 @@ void AttachShader(GLuint program, GLuint shader) { void BindAttribLocation(GLuint program, GLuint index, const char* name); void BindBuffer(GLenum target, GLuint buffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBindBuffer(" << GLES2Util::GetStringBufferTarget(target) << ", " << buffer << ")"); // NOLINT if (IsBufferReservedId(buffer)) { SetGLError(GL_INVALID_OPERATION, "BindBuffer: buffer reserved id"); @@ -31,6 +33,7 @@ void BindBuffer(GLenum target, GLuint buffer) { } void BindFramebuffer(GLenum target, GLuint framebuffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBindFramebuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << framebuffer << ")"); // NOLINT if (IsFramebufferReservedId(framebuffer)) { SetGLError( @@ -42,6 +45,7 @@ void BindFramebuffer(GLenum target, GLuint framebuffer) { } void BindRenderbuffer(GLenum target, GLuint renderbuffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBindRenderbuffer(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << renderbuffer << ")"); // NOLINT if (IsRenderbufferReservedId(renderbuffer)) { SetGLError( @@ -53,6 +57,7 @@ void BindRenderbuffer(GLenum target, GLuint renderbuffer) { } void BindTexture(GLenum target, GLuint texture) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBindTexture(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << texture << ")"); // NOLINT if (IsTextureReservedId(texture)) { SetGLError(GL_INVALID_OPERATION, "BindTexture: texture reserved id"); @@ -63,27 +68,32 @@ void BindTexture(GLenum target, GLuint texture) { } void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBlendColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT helper_->BlendColor(red, green, blue, alpha); } void BlendEquation(GLenum mode) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBlendEquation(" << GLES2Util::GetStringEquation(mode) << ")"); // NOLINT helper_->BlendEquation(mode); } void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBlendEquationSeparate(" << GLES2Util::GetStringEquation(modeRGB) << ", " << GLES2Util::GetStringEquation(modeAlpha) << ")"); // NOLINT helper_->BlendEquationSeparate(modeRGB, modeAlpha); } void BlendFunc(GLenum sfactor, GLenum dfactor) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBlendFunc(" << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", " << GLES2Util::GetStringDstBlendFactor(dfactor) << ")"); // NOLINT helper_->BlendFunc(sfactor, dfactor); } void BlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBlendFuncSeparate(" << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", " << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", " << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", " << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")"); // NOLINT helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } @@ -95,6 +105,7 @@ void BufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const void* data); GLenum CheckFramebufferStatus(GLenum target) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCheckFramebufferStatus(" << GLES2Util::GetStringFrameBufferTarget(target) << ")"); // NOLINT typedef CheckFramebufferStatus::Result Result; Result* result = GetResultAs<Result*>(); @@ -107,27 +118,32 @@ GLenum CheckFramebufferStatus(GLenum target) { } void Clear(GLbitfield mask) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glClear(" << mask << ")"); helper_->Clear(mask); } void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glClearColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT helper_->ClearColor(red, green, blue, alpha); } void ClearDepthf(GLclampf depth) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glClearDepthf(" << depth << ")"); helper_->ClearDepthf(depth); } void ClearStencil(GLint s) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glClearStencil(" << s << ")"); helper_->ClearStencil(s); } void ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glColorMask(" << GLES2Util::GetStringBool( red) << ", " << GLES2Util::GetStringBool( green) << ", " << GLES2Util::GetStringBool( @@ -136,6 +152,7 @@ void ColorMask( } void CompileShader(GLuint shader) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCompileShader(" << shader << ")"); helper_->CompileShader(shader); } @@ -151,6 +168,7 @@ void CompressedTexSubImage2D( void CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCopyTexImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D: width < 0"); @@ -167,6 +185,7 @@ void CopyTexImage2D( void CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCopyTexSubImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D: width < 0"); @@ -181,6 +200,7 @@ void CopyTexSubImage2D( } GLuint CreateProgram() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCreateProgram(" << ")"); GLuint client_id; id_handlers_[id_namespaces::kProgramsAndShaders]-> @@ -191,6 +211,7 @@ GLuint CreateProgram() { } GLuint CreateShader(GLenum type) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCreateShader(" << GLES2Util::GetStringShaderType(type) << ")"); // NOLINT GLuint client_id; id_handlers_[id_namespaces::kProgramsAndShaders]-> @@ -201,12 +222,14 @@ GLuint CreateShader(GLenum type) { } void CullFace(GLenum mode) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glCullFace(" << GLES2Util::GetStringFaceType( mode) << ")"); helper_->CullFace(mode); } void DeleteBuffers(GLsizei n, const GLuint* buffers) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDeleteBuffers(" << n << ", " << static_cast<const void*>(buffers) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { @@ -226,6 +249,7 @@ void DeleteBuffers(GLsizei n, const GLuint* buffers) { } void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDeleteFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { @@ -245,12 +269,14 @@ void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { } void DeleteProgram(GLuint program) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDeleteProgram(" << program << ")"); GPU_CLIENT_DCHECK(program != 0); DeleteProgramHelper(program); } void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDeleteRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { @@ -270,12 +296,14 @@ void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { } void DeleteShader(GLuint shader) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDeleteShader(" << shader << ")"); GPU_CLIENT_DCHECK(shader != 0); DeleteShaderHelper(shader); } void DeleteTextures(GLsizei n, const GLuint* textures) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDeleteTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { @@ -295,27 +323,32 @@ void DeleteTextures(GLsizei n, const GLuint* textures) { } void DepthFunc(GLenum func) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDepthFunc(" << GLES2Util::GetStringCmpFunction(func) << ")"); // NOLINT helper_->DepthFunc(func); } void DepthMask(GLboolean flag) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDepthMask(" << GLES2Util::GetStringBool( flag) << ")"); helper_->DepthMask(flag); } void DepthRangef(GLclampf zNear, GLclampf zFar) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDepthRangef(" << zNear << ", " << zFar << ")"); // NOLINT helper_->DepthRangef(zNear, zFar); } void DetachShader(GLuint program, GLuint shader) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDetachShader(" << program << ", " << shader << ")"); // NOLINT helper_->DetachShader(program, shader); } void Disable(GLenum cap) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glDisable(" << GLES2Util::GetStringCapability(cap) << ")"); // NOLINT helper_->Disable(cap); } @@ -326,6 +359,7 @@ void DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices); void Enable(GLenum cap) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glEnable(" << GLES2Util::GetStringCapability( cap) << ")"); helper_->Enable(cap); @@ -338,6 +372,7 @@ void Flush(); void FramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glFramebufferRenderbuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringRenderBufferTarget(renderbuffertarget) << ", " << renderbuffer << ")"); // NOLINT helper_->FramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer); @@ -346,11 +381,13 @@ void FramebufferRenderbuffer( void FramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glFramebufferTexture2D(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringTextureTarget(textarget) << ", " << texture << ", " << level << ")"); // NOLINT helper_->FramebufferTexture2D(target, attachment, textarget, texture, level); } void FrontFace(GLenum mode) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glFrontFace(" << GLES2Util::GetStringFaceMode(mode) << ")"); // NOLINT helper_->FrontFace(mode); } @@ -361,6 +398,7 @@ void GenBuffers(GLsizei n, GLuint* buffers) { SetGLError(GL_INVALID_VALUE, "glGenBuffers: n < 0"); return; } + GPU_CLIENT_SINGLE_THREAD_CHECK(); id_handlers_[id_namespaces::kBuffers]-> MakeIds(0, n, buffers); helper_->GenBuffersImmediate(n, buffers); @@ -372,6 +410,7 @@ void GenBuffers(GLsizei n, GLuint* buffers) { } void GenerateMipmap(GLenum target) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGenerateMipmap(" << GLES2Util::GetStringTextureBindTarget(target) << ")"); // NOLINT helper_->GenerateMipmap(target); } @@ -382,6 +421,7 @@ void GenFramebuffers(GLsizei n, GLuint* framebuffers) { SetGLError(GL_INVALID_VALUE, "glGenFramebuffers: n < 0"); return; } + GPU_CLIENT_SINGLE_THREAD_CHECK(); id_handlers_[id_namespaces::kFramebuffers]-> MakeIds(0, n, framebuffers); helper_->GenFramebuffersImmediate(n, framebuffers); @@ -398,6 +438,7 @@ void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers: n < 0"); return; } + GPU_CLIENT_SINGLE_THREAD_CHECK(); id_handlers_[id_namespaces::kRenderbuffers]-> MakeIds(0, n, renderbuffers); helper_->GenRenderbuffersImmediate(n, renderbuffers); @@ -414,6 +455,7 @@ void GenTextures(GLsizei n, GLuint* textures) { SetGLError(GL_INVALID_VALUE, "glGenTextures: n < 0"); return; } + GPU_CLIENT_SINGLE_THREAD_CHECK(); id_handlers_[id_namespaces::kTextures]-> MakeIds(0, n, textures); helper_->GenTexturesImmediate(n, textures); @@ -438,6 +480,7 @@ void GetAttachedShaders( GLint GetAttribLocation(GLuint program, const char* name); void GetBooleanv(GLenum pname, GLboolean* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params); GPU_CLIENT_LOG("[" << this << "] glGetBooleanv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetBooleanvHelper(pname, params)) { @@ -457,6 +500,7 @@ void GetBooleanv(GLenum pname, GLboolean* params) { }); } void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetBufferParameteriv(" << GLES2Util::GetStringBufferTarget(target) << ", " << GLES2Util::GetStringBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetBufferParameterivHelper(target, pname, params)) { @@ -478,6 +522,7 @@ void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { GLenum GetError(); void GetFloatv(GLenum pname, GLfloat* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetFloatv(" << GLES2Util::GetStringGLState( pname) << ", " << static_cast<const void*>(params) << ")"); if (GetFloatvHelper(pname, params)) { @@ -498,6 +543,7 @@ void GetFloatv(GLenum pname, GLfloat* params) { } void GetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetFramebufferAttachmentParameteriv(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringFrameBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetFramebufferAttachmentParameterivHelper( @@ -518,6 +564,7 @@ void GetFramebufferAttachmentParameteriv( }); } void GetIntegerv(GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetIntegerv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetIntegervHelper(pname, params)) { @@ -537,6 +584,7 @@ void GetIntegerv(GLenum pname, GLint* params) { }); } void GetProgramiv(GLuint program, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetProgramiv(" << program << ", " << GLES2Util::GetStringProgramParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetProgramivHelper(program, pname, params)) { @@ -557,6 +605,7 @@ void GetProgramiv(GLuint program, GLenum pname, GLint* params) { } void GetProgramInfoLog( GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); GPU_CLIENT_LOG("[" << this << "] glGetProgramInfoLog" << "(" << program << ", " @@ -581,6 +630,7 @@ void GetProgramInfoLog( } } void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetRenderbufferParameteriv(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetRenderbufferParameterivHelper(target, pname, params)) { @@ -600,6 +650,7 @@ void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { }); } void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetShaderiv(" << shader << ", " << GLES2Util::GetStringShaderParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetShaderivHelper(shader, pname, params)) { @@ -620,6 +671,7 @@ void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { } void GetShaderInfoLog( GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); GPU_CLIENT_LOG("[" << this << "] glGetShaderInfoLog" << "(" << shader << ", " @@ -648,6 +700,7 @@ void GetShaderPrecisionFormat( void GetShaderSource( GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); GPU_CLIENT_LOG("[" << this << "] glGetShaderSource" << "(" << shader << ", " @@ -674,6 +727,7 @@ void GetShaderSource( const GLubyte* GetString(GLenum name); void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetTexParameterfv(" << GLES2Util::GetStringGetTexParamTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetTexParameterfvHelper(target, pname, params)) { return; @@ -692,6 +746,7 @@ void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { }); } void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); GPU_CLIENT_LOG("[" << this << "] glGetTexParameteriv(" << GLES2Util::GetStringGetTexParamTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT if (GetTexParameterivHelper(target, pname, params)) { @@ -719,12 +774,14 @@ GLint GetUniformLocation(GLuint program, const char* name); void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer); void Hint(GLenum target, GLenum mode) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glHint(" << GLES2Util::GetStringHintTarget( target) << ", " << GLES2Util::GetStringHintMode(mode) << ")"); helper_->Hint(target, mode); } GLboolean IsBuffer(GLuint buffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsBuffer(" << buffer << ")"); typedef IsBuffer::Result Result; Result* result = GetResultAs<Result*>(); @@ -736,6 +793,7 @@ GLboolean IsBuffer(GLuint buffer) { } GLboolean IsEnabled(GLenum cap) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsEnabled(" << GLES2Util::GetStringCapability(cap) << ")"); // NOLINT typedef IsEnabled::Result Result; Result* result = GetResultAs<Result*>(); @@ -747,6 +805,7 @@ GLboolean IsEnabled(GLenum cap) { } GLboolean IsFramebuffer(GLuint framebuffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsFramebuffer(" << framebuffer << ")"); typedef IsFramebuffer::Result Result; Result* result = GetResultAs<Result*>(); @@ -758,6 +817,7 @@ GLboolean IsFramebuffer(GLuint framebuffer) { } GLboolean IsProgram(GLuint program) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsProgram(" << program << ")"); typedef IsProgram::Result Result; Result* result = GetResultAs<Result*>(); @@ -769,6 +829,7 @@ GLboolean IsProgram(GLuint program) { } GLboolean IsRenderbuffer(GLuint renderbuffer) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsRenderbuffer(" << renderbuffer << ")"); typedef IsRenderbuffer::Result Result; Result* result = GetResultAs<Result*>(); @@ -781,6 +842,7 @@ GLboolean IsRenderbuffer(GLuint renderbuffer) { } GLboolean IsShader(GLuint shader) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsShader(" << shader << ")"); typedef IsShader::Result Result; Result* result = GetResultAs<Result*>(); @@ -792,6 +854,7 @@ GLboolean IsShader(GLuint shader) { } GLboolean IsTexture(GLuint texture) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glIsTexture(" << texture << ")"); typedef IsTexture::Result Result; Result* result = GetResultAs<Result*>(); @@ -803,6 +866,7 @@ GLboolean IsTexture(GLuint texture) { } void LineWidth(GLfloat width) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glLineWidth(" << width << ")"); helper_->LineWidth(width); } @@ -812,6 +876,7 @@ void LinkProgram(GLuint program); void PixelStorei(GLenum pname, GLint param); void PolygonOffset(GLfloat factor, GLfloat units) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glPolygonOffset(" << factor << ", " << units << ")"); // NOLINT helper_->PolygonOffset(factor, units); } @@ -821,12 +886,14 @@ void ReadPixels( void* pixels); void ReleaseShaderCompiler() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glReleaseShaderCompiler(" << ")"); helper_->ReleaseShaderCompiler(); } void RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glRenderbufferStorage(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage: width < 0"); @@ -840,11 +907,13 @@ void RenderbufferStorage( } void SampleCoverage(GLclampf value, GLboolean invert) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glSampleCoverage(" << value << ", " << GLES2Util::GetStringBool(invert) << ")"); // NOLINT helper_->SampleCoverage(value, invert); } void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glScissor(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glScissor: width < 0"); @@ -865,31 +934,37 @@ void ShaderSource( GLuint shader, GLsizei count, const char** str, const GLint* length); void StencilFunc(GLenum func, GLint ref, GLuint mask) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glStencilFunc(" << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT helper_->StencilFunc(func, ref, mask); } void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glStencilFuncSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT helper_->StencilFuncSeparate(face, func, ref, mask); } void StencilMask(GLuint mask) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glStencilMask(" << mask << ")"); helper_->StencilMask(mask); } void StencilMaskSeparate(GLenum face, GLuint mask) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glStencilMaskSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << mask << ")"); // NOLINT helper_->StencilMaskSeparate(face, mask); } void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glStencilOp(" << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT helper_->StencilOp(fail, zfail, zpass); } void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glStencilOpSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT helper_->StencilOpSeparate(face, fail, zfail, zpass); } @@ -900,22 +975,26 @@ void TexImage2D( const void* pixels); void TexParameterf(GLenum target, GLenum pname, GLfloat param) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexParameterf(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT helper_->TexParameterf(target, pname, param); } void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexParameterfv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT GPU_CLIENT_LOG("values: " << params[0]); helper_->TexParameterfvImmediate(target, pname, params); } void TexParameteri(GLenum target, GLenum pname, GLint param) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexParameteri(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT helper_->TexParameteri(target, pname, param); } void TexParameteriv(GLenum target, GLenum pname, const GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexParameteriv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT GPU_CLIENT_LOG("values: " << params[0]); helper_->TexParameterivImmediate(target, pname, params); @@ -926,11 +1005,13 @@ void TexSubImage2D( GLsizei height, GLenum format, GLenum type, const void* pixels); void Uniform1f(GLint location, GLfloat x) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform1f(" << location << ", " << x << ")"); // NOLINT helper_->Uniform1f(location, x); } void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform1fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -945,11 +1026,13 @@ void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform1i(GLint location, GLint x) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform1i(" << location << ", " << x << ")"); // NOLINT helper_->Uniform1i(location, x); } void Uniform1iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform1iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -964,11 +1047,13 @@ void Uniform1iv(GLint location, GLsizei count, const GLint* v) { } void Uniform2f(GLint location, GLfloat x, GLfloat y) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform2f(" << location << ", " << x << ", " << y << ")"); // NOLINT helper_->Uniform2f(location, x, y); } void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform2fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -983,11 +1068,13 @@ void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform2i(GLint location, GLint x, GLint y) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform2i(" << location << ", " << x << ", " << y << ")"); // NOLINT helper_->Uniform2i(location, x, y); } void Uniform2iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform2iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1002,11 +1089,13 @@ void Uniform2iv(GLint location, GLsizei count, const GLint* v) { } void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform3f(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT helper_->Uniform3f(location, x, y, z); } void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform3fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1021,11 +1110,13 @@ void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform3i(GLint location, GLint x, GLint y, GLint z) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform3i(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT helper_->Uniform3i(location, x, y, z); } void Uniform3iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform3iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1040,11 +1131,13 @@ void Uniform3iv(GLint location, GLsizei count, const GLint* v) { } void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform4f(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT helper_->Uniform4f(location, x, y, z, w); } void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform4fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1059,11 +1152,13 @@ void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform4i(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT helper_->Uniform4i(location, x, y, z, w); } void Uniform4iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniform4iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1079,6 +1174,7 @@ void Uniform4iv(GLint location, GLsizei count, const GLint* v) { void UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniformMatrix2fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1094,6 +1190,7 @@ void UniformMatrix2fv( void UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniformMatrix3fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1109,6 +1206,7 @@ void UniformMatrix3fv( void UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUniformMatrix4fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { @@ -1123,54 +1221,64 @@ void UniformMatrix4fv( } void UseProgram(GLuint program) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glUseProgram(" << program << ")"); helper_->UseProgram(program); } void ValidateProgram(GLuint program) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glValidateProgram(" << program << ")"); helper_->ValidateProgram(program); } void VertexAttrib1f(GLuint indx, GLfloat x) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib1f(" << indx << ", " << x << ")"); // NOLINT helper_->VertexAttrib1f(indx, x); } void VertexAttrib1fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib1fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT GPU_CLIENT_LOG("values: " << values[0]); helper_->VertexAttrib1fvImmediate(indx, values); } void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib2f(" << indx << ", " << x << ", " << y << ")"); // NOLINT helper_->VertexAttrib2f(indx, x, y); } void VertexAttrib2fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib2fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1]); helper_->VertexAttrib2fvImmediate(indx, values); } void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib3f(" << indx << ", " << x << ", " << y << ", " << z << ")"); // NOLINT helper_->VertexAttrib3f(indx, x, y, z); } void VertexAttrib3fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib3fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2]); // NOLINT helper_->VertexAttrib3fvImmediate(indx, values); } void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib4f(" << indx << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT helper_->VertexAttrib4f(indx, x, y, z, w); } void VertexAttrib4fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glVertexAttrib4fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2] << ", " << values[3]); // NOLINT helper_->VertexAttrib4fvImmediate(indx, values); @@ -1181,6 +1289,7 @@ void VertexAttribPointer( const void* ptr); void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glViewport(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glViewport: width < 0"); @@ -1196,6 +1305,7 @@ void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { void BlitFramebufferEXT( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glBlitFramebufferEXT(" << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", " << dstY1 << ", " << mask << ", " << GLES2Util::GetStringBlitFilter(filter) << ")"); // NOLINT helper_->BlitFramebufferEXT( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); @@ -1204,6 +1314,7 @@ void BlitFramebufferEXT( void RenderbufferStorageMultisampleEXT( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glRenderbufferStorageMultisampleEXT(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT if (samples < 0) { SetGLError( @@ -1227,6 +1338,7 @@ void RenderbufferStorageMultisampleEXT( void TexStorage2DEXT( GLenum target, GLsizei levels, GLint internalFormat, GLsizei width, GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexStorage2DEXT(" << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", " << internalFormat << ", " << width << ", " << height << ")"); // NOLINT if (levels < 0) { SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT: levels < 0"); @@ -1247,6 +1359,7 @@ void SwapBuffers(); GLuint GetMaxValueInBufferCHROMIUM( GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glGetMaxValueInBufferCHROMIUM(" << buffer_id << ", " << count << ", " << GLES2Util::GetStringGetMaxIndexType(type) << ", " << offset << ")"); // NOLINT typedef GetMaxValueInBufferCHROMIUM::Result Result; Result* result = GetResultAs<Result*>(); @@ -1300,6 +1413,7 @@ void DestroyStreamTextureCHROMIUM(GLuint texture); void GetTranslatedShaderSourceANGLE( GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); GPU_CLIENT_LOG("[" << this << "] glGetTranslatedShaderSourceANGLE" << "(" << shader << ", " @@ -1328,6 +1442,7 @@ void PostSubBufferCHROMIUM(GLint x, GLint y, GLint width, GLint height); void TexImageIOSurface2DCHROMIUM( GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, GLuint plane) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << this << "] glTexImageIOSurface2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << width << ", " << height << ", " << ioSurfaceId << ", " << plane << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM: width < 0"); |