diff options
author | kkinnunen@nvidia.com <kkinnunen@nvidia.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 10:06:00 +0000 |
---|---|---|
committer | kkinnunen@nvidia.com <kkinnunen@nvidia.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 10:06:00 +0000 |
commit | eeb9d77c1f9dd0bcabae5323df3aa465e2203419 (patch) | |
tree | c3f7a77f6b8c808d5d3c79a49a0da301c84b5e32 /gpu | |
parent | 420bebd57c773c3dc3d2c7b01d1ad98dffb92655 (diff) | |
download | chromium_src-eeb9d77c1f9dd0bcabae5323df3aa465e2203419.zip chromium_src-eeb9d77c1f9dd0bcabae5323df3aa465e2203419.tar.gz chromium_src-eeb9d77c1f9dd0bcabae5323df3aa465e2203419.tar.bz2 |
Remove unneeded shm versions of bucket functions from command buffer
Remove shm versions of bucket functions from command buffer for commands
that do not need two different ways to send pointer data.
The actual code uses only bucket commands. The shm versions are
either unused or used only by the unit tests.
Make the unit tests use the immediate commands.
Solves the problem of not having to implement one useless function for
the a new command when using bucket commands.
Support the case of CompressedTex{,Sub}Image2D, where the function
is implemented with shm and bucket commands.
In the code generator function info table, replace 'immediate': False
and 'bucket': True properties of function info objects with
'data_transfer_method': ['immediate', 'bucket', 'shm' ] property.
Remove the handwritten GetAttribLocation command and rename
GetAttribLocationBucket to GetAttribLocation. This is consistent with
other handwritten commands: the command name is the gl call name, and it
just happens to use buckets to communicate some of its arguments. The
command does not have 'Bucket' prefix due to it not being a 'Bucket'
variant. Do the same with GetUniformLocation and
GetUniformLocationBucket.
BUG=373763
Review URL: https://codereview.chromium.org/282253002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
15 files changed, 565 insertions, 1399 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 6a99981b..1c7b019 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1242,10 +1242,14 @@ _PEPPER_INTERFACES = [ # a NonImmediate type is a type that stays a pointer even in # and immediate version of acommand. # gen_cmd: Whether or not this function geneates a command. Default = True. -# immediate: Whether or not to generate an immediate command for the GL -# function. The default is if there is exactly 1 pointer argument -# in the GL function an immediate command is generated. -# bucket: True to generate a bucket version of the command. +# data_transfer_methods: Array of methods that are used for transfering the +# pointer data. Possible values: 'immediate', 'shm', 'bucket'. +# The default is 'immediate' if the command has one pointer +# argument, otherwise 'shm'. One command is generated for each +# transfer method. Affects only commands which are not of type +# 'HandWritten', 'GETn' or 'GLcharN'. +# Note: the command arguments that affect this are the final args, +# taking cmd_args override into consideration. # impl_func: Whether or not to generate the GLES2Implementation part of this # command. # impl_decl: Whether or not to generate the GLES2Implementation declaration @@ -1290,9 +1294,8 @@ _FUNCTION_INFO = { 'AttachShader': {'decoder_func': 'DoAttachShader'}, 'BindAttribLocation': { 'type': 'GLchar', - 'bucket': True, + 'data_transfer_methods': ['bucket'], 'needs_size': True, - 'immediate': False, }, 'BindBuffer': { 'type': 'Bind', @@ -1332,14 +1335,14 @@ _FUNCTION_INFO = { }, 'BufferData': { 'type': 'Manual', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'client_test': False, }, 'BufferSubData': { 'type': 'Data', 'client_test': False, 'decoder_func': 'DoBufferSubData', - 'immediate': False, + 'data_transfer_methods': ['shm'], }, 'CheckFramebufferStatus': { 'type': 'Is', @@ -1387,6 +1390,7 @@ _FUNCTION_INFO = { 'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM', 'impl_func': False, 'type': 'HandWritten', + 'data_transfer_methods': ['immediate'], 'unit_test': False, 'client_test': False, 'extension': True, @@ -1398,7 +1402,7 @@ _FUNCTION_INFO = { }, 'EnableFeatureCHROMIUM': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'decoder_func': 'DoEnableFeatureCHROMIUM', 'expectation': False, 'cmd_args': 'GLuint bucket_id, GLint* result', @@ -1410,14 +1414,12 @@ _FUNCTION_INFO = { 'CompileShader': {'decoder_func': 'DoCompileShader', 'unit_test': False}, 'CompressedTexImage2D': { 'type': 'Manual', - 'immediate': False, - 'bucket': True, + 'data_transfer_methods': ['bucket', 'shm'], }, 'CompressedTexSubImage2D': { 'type': 'Data', - 'bucket': True, + 'data_transfer_methods': ['bucket', 'shm'], 'decoder_func': 'DoCompressedTexSubImage2D', - 'immediate': False, }, 'CopyTexImage2D': { 'decoder_func': 'DoCopyTexImage2D', @@ -1441,7 +1443,6 @@ _FUNCTION_INFO = { }, 'DestroyImageCHROMIUM': { 'type': 'Manual', - 'immediate': False, 'client_test': False, 'gen_cmd': False, 'extension': True, @@ -1555,7 +1556,7 @@ _FUNCTION_INFO = { 'decoder_func': 'DoDeleteSharedIdsCHROMIUM', 'impl_func': False, 'expectation': False, - 'immediate': False, + 'data_transfer_methods': ['shm'], 'extension': True, 'chromium': True, }, @@ -1646,7 +1647,6 @@ _FUNCTION_INFO = { }, 'GenMailboxCHROMIUM': { 'type': 'HandWritten', - 'immediate': False, 'impl_func': False, 'extension': True, 'chromium': True, @@ -1673,13 +1673,13 @@ _FUNCTION_INFO = { 'decoder_func': 'DoGenSharedIdsCHROMIUM', 'impl_func': False, 'expectation': False, - 'immediate': False, + 'data_transfer_methods': ['shm'], 'extension': True, 'chromium': True, }, 'GetActiveAttrib': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'cmd_args': 'GLidProgram program, GLuint index, uint32_t name_bucket_id, ' 'void* result', @@ -1691,7 +1691,7 @@ _FUNCTION_INFO = { }, 'GetActiveUniform': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'cmd_args': 'GLidProgram program, GLuint index, uint32_t name_bucket_id, ' 'void* result', @@ -1703,14 +1703,12 @@ _FUNCTION_INFO = { }, 'GetAttachedShaders': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'cmd_args': 'GLidProgram program, void* result, uint32_t result_size', 'result': ['SizedResult<GLuint>'], }, 'GetAttribLocation': { 'type': 'HandWritten', - 'immediate': False, - 'bucket': True, 'needs_size': True, 'cmd_args': 'GLidProgram program, const char* name, NonImmediate GLint* location', @@ -1767,7 +1765,7 @@ _FUNCTION_INFO = { }, 'GetMultipleIntegervCHROMIUM': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'expectation': False, 'extension': True, 'chromium': True, @@ -1781,7 +1779,6 @@ _FUNCTION_INFO = { }, 'GetProgramInfoCHROMIUM': { 'type': 'Custom', - 'immediate': False, 'expectation': False, 'impl_func': False, 'extension': True, @@ -1817,7 +1814,7 @@ _FUNCTION_INFO = { }, 'GetShaderPrecisionFormat': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'cmd_args': 'GLenumShaderType shadertype, GLenumShaderPrecision precisiontype, ' 'void* result', @@ -1859,18 +1856,16 @@ _FUNCTION_INFO = { }, 'GetUniformfv': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'result': ['SizedResult<GLfloat>'], }, 'GetUniformiv': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'result': ['SizedResult<GLint>'], }, 'GetUniformLocation': { 'type': 'HandWritten', - 'immediate': False, - 'bucket': True, 'needs_size': True, 'cmd_args': 'GLidProgram program, const char* name, NonImmediate GLint* location', @@ -1895,7 +1890,7 @@ _FUNCTION_INFO = { }, 'GetVertexAttribPointerv': { 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'result': ['SizedResult<GLuint>'], 'client_test': False, }, @@ -2027,7 +2022,7 @@ _FUNCTION_INFO = { '// it is easier to specify the result going to some specific place\n' '// that exactly fits the rectangle of pixels.\n', 'type': 'Custom', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'impl_func': False, 'client_test': False, 'cmd_args': @@ -2044,7 +2039,7 @@ _FUNCTION_INFO = { 'decoder_func': 'DoRegisterSharedIdsCHROMIUM', 'impl_func': False, 'expectation': False, - 'immediate': False, + 'data_transfer_methods': ['shm'], 'extension': True, 'chromium': True, }, @@ -2058,8 +2053,7 @@ _FUNCTION_INFO = { }, 'ShaderSource': { 'type': 'Manual', - 'immediate': False, - 'bucket': True, + 'data_transfer_methods': ['bucket'], 'needs_size': True, 'client_test': False, 'cmd_args': @@ -2089,7 +2083,7 @@ _FUNCTION_INFO = { }, 'TexImage2D': { 'type': 'Manual', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'client_test': False, }, 'TexParameterf': { @@ -2122,7 +2116,7 @@ _FUNCTION_INFO = { }, 'TexSubImage2D': { 'type': 'Manual', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'client_test': False, 'cmd_args': 'GLenumTextureTarget target, GLint level, ' 'GLint xoffset, GLint yoffset, ' @@ -2273,7 +2267,6 @@ _FUNCTION_INFO = { 'GetRequestableExtensionsCHROMIUM': { 'type': 'Custom', 'impl_func': False, - 'immediate': False, 'cmd_args': 'uint32_t bucket_id', 'extension': True, 'chromium': True, @@ -2281,7 +2274,6 @@ _FUNCTION_INFO = { 'RequestExtensionCHROMIUM': { 'type': 'Custom', 'impl_func': False, - 'immediate': False, 'client_test': False, 'cmd_args': 'uint32_t bucket_id', 'extension': True, @@ -2297,7 +2289,6 @@ _FUNCTION_INFO = { 'type': 'HandWritten', 'impl_func': False, 'gen_cmd': False, - 'immediate': False, 'extension': True, 'chromium': True, }, @@ -2379,7 +2370,7 @@ _FUNCTION_INFO = { 'BeginQueryEXT': { 'type': 'Manual', 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'gl_test_func': 'glBeginQuery', 'pepper_interface': 'Query', }, @@ -2405,10 +2396,9 @@ _FUNCTION_INFO = { 'BindUniformLocationCHROMIUM': { 'type': 'GLchar', 'extension': True, - 'bucket': True, + 'data_transfer_methods': ['bucket'], 'needs_size': True, 'gl_test_func': 'DoBindUniformLocationCHROMIUM', - 'immediate': False, }, 'InsertEventMarkerEXT': { 'type': 'GLcharN', @@ -2491,7 +2481,6 @@ _FUNCTION_INFO = { 'TraceBeginCHROMIUM': { 'type': 'Custom', 'impl_func': False, - 'immediate': False, 'client_test': False, 'cmd_args': 'GLuint bucket_id', 'extension': True, @@ -2499,7 +2488,6 @@ _FUNCTION_INFO = { }, 'TraceEndCHROMIUM': { 'impl_func': False, - 'immediate': False, 'client_test': False, 'decoder_func': 'DoTraceEndCHROMIUM', 'unit_test': False, @@ -2508,7 +2496,7 @@ _FUNCTION_INFO = { }, 'AsyncTexImage2DCHROMIUM': { 'type': 'Manual', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'client_test': False, 'cmd_args': 'GLenumTextureTarget target, GLint level, ' 'GLintTextureInternalFormat internalformat, ' @@ -2523,7 +2511,7 @@ _FUNCTION_INFO = { }, 'AsyncTexSubImage2DCHROMIUM': { 'type': 'Manual', - 'immediate': False, + 'data_transfer_methods': ['shm'], 'client_test': False, 'cmd_args': 'GLenumTextureTarget target, GLint level, ' 'GLint xoffset, GLint yoffset, ' @@ -2537,14 +2525,12 @@ _FUNCTION_INFO = { }, 'WaitAsyncTexImage2DCHROMIUM': { 'type': 'Manual', - 'immediate': False, 'client_test': False, 'extension': True, 'chromium': True, }, 'WaitAllAsyncTexImage2DCHROMIUM': { 'type': 'Manual', - 'immediate': False, 'client_test': False, 'extension': True, 'chromium': True, @@ -2725,21 +2711,9 @@ class TypeHandler(object): if func.GetInfo('needs_size') and not func.name.endswith('Bucket'): func.AddCmdArg(DataSizeArgument('data_size')) - def AddImmediateFunction(self, generator, func): - """Adds an immediate version of a function.""" - # Generate an immediate command if there is only 1 pointer arg. - immediate = func.GetInfo('immediate') # can be True, False or None - if immediate == True or immediate == None: - if func.num_pointer_args == 1 or immediate: - generator.AddFunction(ImmediateFunction(func)) - return True - - def AddBucketFunction(self, generator, func): - """Adds a bucket version of a function.""" - # Generate an immediate command if there is only 1 pointer arg. - bucket = func.GetInfo('bucket') # can be True, False or None - if bucket: - generator.AddFunction(BucketFunction(func)) + def NeedsDataTransferFunction(self, func): + """Overriden from TypeHandler.""" + return func.num_pointer_args >= 1 def WriteStruct(self, func, file): """Writes a structure that matches the arguments to a function.""" @@ -3594,9 +3568,9 @@ class CustomHandler(TypeHandler): class TodoHandler(CustomHandler): """Handle for commands that are not yet implemented.""" - def AddImmediateFunction(self, generator, func): - """Overrriden from TypeHandler.""" - pass + def NeedsDataTransferFunction(self, func): + """Overriden from TypeHandler.""" + return False def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" @@ -3646,6 +3620,13 @@ class HandWrittenHandler(CustomHandler): CustomHandler.InitFunction(self, func) func.can_auto_generate = False + def NeedsDataTransferFunction(self, func): + """Overriden from TypeHandler.""" + # If specified explicitly, force the data transfer method. + if func.GetInfo('data_transfer_methods'): + return True + return False + def WriteStruct(self, func, file): """Overrriden from TypeHandler.""" pass @@ -4615,9 +4596,9 @@ class GETnHandler(TypeHandler): def __init__(self): TypeHandler.__init__(self) - def AddImmediateFunction(self, generator, func): - """Overrriden from TypeHandler.""" - pass + def NeedsDataTransferFunction(self, func): + """Overriden from TypeHandler.""" + return False def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" @@ -5621,9 +5602,9 @@ class GLcharNHandler(CustomHandler): func.cmd_args = [] func.AddCmdArg(Argument('bucket_id', 'GLuint')) - def AddImmediateFunction(self, generator, func): - """Overrriden from TypeHandler.""" - pass + def NeedsDataTransferFunction(self, func): + """Overriden from TypeHandler.""" + return False def AddBucketFunction(self, generator, func): """Overrriden from TypeHandler.""" @@ -6779,6 +6760,10 @@ class Function(object): gl_func_name = self.original_name return gl_func_name + def GetDataTransferMethods(self): + return self.GetInfo('data_transfer_methods', + ['immediate' if self.num_pointer_args == 1 else 'shm']) + def AddCmdArg(self, arg): """Adds a cmd argument to this function.""" self.cmd_args.append(arg) @@ -7333,9 +7318,16 @@ class GLGenerator(object): gen_cmd = f.GetInfo('gen_cmd') if gen_cmd == True or gen_cmd == None: - if not f.type_handler.AddImmediateFunction(self, f): + if f.type_handler.NeedsDataTransferFunction(f): + methods = f.GetDataTransferMethods() + if 'immediate' in methods: + self.AddFunction(ImmediateFunction(f)) + if 'bucket' in methods: + self.AddFunction(BucketFunction(f)) + if 'shm' in methods: + self.AddFunction(f) + else: self.AddFunction(f) - f.type_handler.AddBucketFunction(self, f) self.Log("Auto Generated Functions : %d" % len([f for f in self.functions if f.can_auto_generate or diff --git a/gpu/command_buffer/client/gles2_cmd_helper.h b/gpu/command_buffer/client/gles2_cmd_helper.h index 4e57cce..0726fbb 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper.h +++ b/gpu/command_buffer/client/gles2_cmd_helper.h @@ -25,46 +25,21 @@ class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper { // Helpers that could not be auto-generated. // TODO(gman): Auto generate these. - void GetAttribLocation( - GLuint program, uint32 name_shm_id, uint32 name_shm_offset, - uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { - gles2::cmds::GetAttribLocation* c = - GetCmdSpace<gles2::cmds::GetAttribLocation>(); - if (c) { - c->Init( - program, name_shm_id, name_shm_offset, location_shm_id, - location_shm_offset, data_size); - } - } - - void GetAttribLocationBucket( GLuint program, uint32 name_bucket_id, uint32 location_shm_id, uint32 location_shm_offset) { - gles2::cmds::GetAttribLocationBucket* c = - GetCmdSpace<gles2::cmds::GetAttribLocationBucket>(); + gles2::cmds::GetAttribLocation* c = + GetCmdSpace<gles2::cmds::GetAttribLocation>(); if (c) { c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); } } void GetUniformLocation( - GLuint program, uint32 name_shm_id, uint32 name_shm_offset, - uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { - gles2::cmds::GetUniformLocation* c = - GetCmdSpace<gles2::cmds::GetUniformLocation>(); - if (c) { - c->Init( - program, name_shm_id, name_shm_offset, location_shm_id, - location_shm_offset, data_size); - } - } - - void GetUniformLocationBucket( GLuint program, uint32 name_bucket_id, uint32 location_shm_id, uint32 location_shm_offset) { - gles2::cmds::GetUniformLocationBucket* c = - GetCmdSpace<gles2::cmds::GetUniformLocationBucket>(); + gles2::cmds::GetUniformLocation* c = + GetCmdSpace<gles2::cmds::GetUniformLocation>(); if (c) { c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); } diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index f56713f..49d0336 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -25,18 +25,6 @@ void AttachShader(GLuint program, GLuint shader) { } } -void BindAttribLocation(GLuint program, - GLuint index, - uint32_t name_shm_id, - uint32_t name_shm_offset, - uint32_t data_size) { - gles2::cmds::BindAttribLocation* c = - GetCmdSpace<gles2::cmds::BindAttribLocation>(); - if (c) { - c->Init(program, index, name_shm_id, name_shm_offset, data_size); - } -} - void BindAttribLocationBucket(GLuint program, GLuint index, uint32_t name_bucket_id) { @@ -193,6 +181,19 @@ void CompileShader(GLuint shader) { } } +void CompressedTexImage2DBucket(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLuint bucket_id) { + gles2::cmds::CompressedTexImage2DBucket* c = + GetCmdSpace<gles2::cmds::CompressedTexImage2DBucket>(); + if (c) { + c->Init(target, level, internalformat, width, height, bucket_id); + } +} + void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, @@ -215,16 +216,18 @@ void CompressedTexImage2D(GLenum target, } } -void CompressedTexImage2DBucket(GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLuint bucket_id) { - gles2::cmds::CompressedTexImage2DBucket* c = - GetCmdSpace<gles2::cmds::CompressedTexImage2DBucket>(); +void CompressedTexSubImage2DBucket(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLuint bucket_id) { + gles2::cmds::CompressedTexSubImage2DBucket* c = + GetCmdSpace<gles2::cmds::CompressedTexSubImage2DBucket>(); if (c) { - c->Init(target, level, internalformat, width, height, bucket_id); + c->Init(target, level, xoffset, yoffset, width, height, format, bucket_id); } } @@ -254,21 +257,6 @@ void CompressedTexSubImage2D(GLenum target, } } -void CompressedTexSubImage2DBucket(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLuint bucket_id) { - gles2::cmds::CompressedTexSubImage2DBucket* c = - GetCmdSpace<gles2::cmds::CompressedTexSubImage2DBucket>(); - if (c) { - c->Init(target, level, xoffset, yoffset, width, height, format, bucket_id); - } -} - void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, @@ -948,16 +936,6 @@ void ShaderBinary(GLsizei n, } } -void ShaderSource(GLuint shader, - uint32_t data_shm_id, - uint32_t data_shm_offset, - uint32_t data_size) { - gles2::cmds::ShaderSource* c = GetCmdSpace<gles2::cmds::ShaderSource>(); - if (c) { - c->Init(shader, data_shm_id, data_shm_offset, data_size); - } -} - void ShaderSourceBucket(GLuint shader, uint32_t data_bucket_id) { gles2::cmds::ShaderSourceBucket* c = GetCmdSpace<gles2::cmds::ShaderSourceBucket>(); @@ -1749,18 +1727,6 @@ void ConsumeTextureCHROMIUMImmediate(GLenum target, const GLbyte* mailbox) { } } -void BindUniformLocationCHROMIUM(GLuint program, - GLint location, - uint32_t name_shm_id, - uint32_t name_shm_offset, - uint32_t data_size) { - gles2::cmds::BindUniformLocationCHROMIUM* c = - GetCmdSpace<gles2::cmds::BindUniformLocationCHROMIUM>(); - if (c) { - c->Init(program, location, name_shm_id, name_shm_offset, data_size); - } -} - void BindUniformLocationCHROMIUMBucket(GLuint program, GLint location, uint32_t name_bucket_id) { diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index d6b6c97..f8a84ed 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -1123,14 +1123,14 @@ void GLES2Implementation::DeleteShaderStub( GLint GLES2Implementation::GetAttribLocationHelper( GLuint program, const char* name) { - typedef cmds::GetAttribLocationBucket::Result Result; + typedef cmds::GetAttribLocation::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { return -1; } *result = -1; SetBucketAsCString(kResultBucketId, name); - helper_->GetAttribLocationBucket( + helper_->GetAttribLocation( program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); @@ -1152,14 +1152,14 @@ GLint GLES2Implementation::GetAttribLocation( GLint GLES2Implementation::GetUniformLocationHelper( GLuint program, const char* name) { - typedef cmds::GetUniformLocationBucket::Result Result; + typedef cmds::GetUniformLocation::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { return -1; } *result = -1; SetBucketAsCString(kResultBucketId, name); - helper_->GetUniformLocationBucket(program, kResultBucketId, + helper_->GetUniformLocation(program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); diff --git a/gpu/command_buffer/common/gles2_cmd_format.h b/gpu/command_buffer/common/gles2_cmd_format.h index 656b4b1..e8051b4 100644 --- a/gpu/command_buffer/common/gles2_cmd_format.h +++ b/gpu/command_buffer/common/gles2_cmd_format.h @@ -199,7 +199,6 @@ namespace cmds { // These are hand written commands. // TODO(gman): Attempt to make these auto-generated. - struct GetAttribLocation { typedef GetAttribLocation ValueType; static const CommandId kCmdId = kGetAttribLocation; @@ -217,73 +216,6 @@ struct GetAttribLocation { } void Init( - GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _location_shm_id, uint32 _location_shm_offset, - uint32 _data_size) { - SetHeader(); - program = _program; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - location_shm_id = _location_shm_id; - location_shm_offset = _location_shm_offset; - data_size = _data_size; - } - - void* Set( - void* cmd, GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _location_shm_id, uint32 _location_shm_offset, - uint32 _data_size) { - static_cast<ValueType*>( - cmd)->Init( - _program, _name_shm_id, _name_shm_offset, _location_shm_id, - _location_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - CommandHeader header; - uint32 program; - uint32 name_shm_id; - uint32 name_shm_offset; - uint32 location_shm_id; - uint32 location_shm_offset; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(GetAttribLocation) == 28, - Sizeof_GetAttribLocation_is_not_28); -COMPILE_ASSERT(offsetof(GetAttribLocation, header) == 0, - OffsetOf_GetAttribLocation_header_not_0); -COMPILE_ASSERT(offsetof(GetAttribLocation, program) == 4, - OffsetOf_GetAttribLocation_program_not_4); -COMPILE_ASSERT(offsetof(GetAttribLocation, name_shm_id) == 8, - OffsetOf_GetAttribLocation_name_shm_id_not_8); -COMPILE_ASSERT(offsetof(GetAttribLocation, name_shm_offset) == 12, - OffsetOf_GetAttribLocation_name_shm_offset_not_12); -COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_id) == 16, - OffsetOf_GetAttribLocation_location_shm_id_not_16); -COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_offset) == 20, - OffsetOf_GetAttribLocation_location_shm_offset_not_20); -COMPILE_ASSERT(offsetof(GetAttribLocation, data_size) == 24, - OffsetOf_GetAttribLocation_data_size_not_24); - - -struct GetAttribLocationBucket { - typedef GetAttribLocationBucket ValueType; - static const CommandId kCmdId = kGetAttribLocationBucket; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - typedef GLint Result; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( GLuint _program, uint32 _name_bucket_id, uint32 _location_shm_id, uint32 _location_shm_offset) { SetHeader(); @@ -310,18 +242,18 @@ struct GetAttribLocationBucket { uint32 location_shm_offset; }; -COMPILE_ASSERT(sizeof(GetAttribLocationBucket) == 20, - Sizeof_GetAttribLocationBucket_is_not_24); -COMPILE_ASSERT(offsetof(GetAttribLocationBucket, header) == 0, - OffsetOf_GetAttribLocationBucket_header_not_0); -COMPILE_ASSERT(offsetof(GetAttribLocationBucket, program) == 4, - OffsetOf_GetAttribLocationBucket_program_not_4); -COMPILE_ASSERT(offsetof(GetAttribLocationBucket, name_bucket_id) == 8, - OffsetOf_GetAttribLocationBucket_name_bucket_id_not_8); -COMPILE_ASSERT(offsetof(GetAttribLocationBucket, location_shm_id) == 12, - OffsetOf_GetAttribLocationBucket_location_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetAttribLocationBucket, location_shm_offset) == 16, - OffsetOf_GetAttribLocationBucket_location_shm_offset_not_16); +COMPILE_ASSERT(sizeof(GetAttribLocation) == 20, + Sizeof_GetAttribLocation_is_not_24); +COMPILE_ASSERT(offsetof(GetAttribLocation, header) == 0, + OffsetOf_GetAttribLocation_header_not_0); +COMPILE_ASSERT(offsetof(GetAttribLocation, program) == 4, + OffsetOf_GetAttribLocation_program_not_4); +COMPILE_ASSERT(offsetof(GetAttribLocation, name_bucket_id) == 8, + OffsetOf_GetAttribLocation_name_bucket_id_not_8); +COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_id) == 12, + OffsetOf_GetAttribLocation_location_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_offset) == 16, + OffsetOf_GetAttribLocation_location_shm_offset_not_16); struct GetUniformLocation { typedef GetUniformLocation ValueType; @@ -340,72 +272,6 @@ struct GetUniformLocation { } void Init( - GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _location_shm_id, uint32 _location_shm_offset, - uint32 _data_size) { - SetHeader(); - program = _program; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - location_shm_id = _location_shm_id; - location_shm_offset = _location_shm_offset; - data_size = _data_size; - } - - void* Set( - void* cmd, GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _location_shm_id, uint32 _location_shm_offset, - uint32 _data_size) { - static_cast<ValueType*>( - cmd)->Init( - _program, _name_shm_id, _name_shm_offset, _location_shm_id, - _location_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - CommandHeader header; - uint32 program; - uint32 name_shm_id; - uint32 name_shm_offset; - uint32 location_shm_id; - uint32 location_shm_offset; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(GetUniformLocation) == 28, - Sizeof_GetUniformLocation_is_not_28); -COMPILE_ASSERT(offsetof(GetUniformLocation, header) == 0, - OffsetOf_GetUniformLocation_header_not_0); -COMPILE_ASSERT(offsetof(GetUniformLocation, program) == 4, - OffsetOf_GetUniformLocation_program_not_4); -COMPILE_ASSERT(offsetof(GetUniformLocation, name_shm_id) == 8, - OffsetOf_GetUniformLocation_name_shm_id_not_8); -COMPILE_ASSERT(offsetof(GetUniformLocation, name_shm_offset) == 12, - OffsetOf_GetUniformLocation_name_shm_offset_not_12); -COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_id) == 16, - OffsetOf_GetUniformLocation_location_shm_id_not_16); -COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_offset) == 20, - OffsetOf_GetUniformLocation_location_shm_offset_not_20); -COMPILE_ASSERT(offsetof(GetUniformLocation, data_size) == 24, - OffsetOf_GetUniformLocation_data_size_not_24); - -struct GetUniformLocationBucket { - typedef GetUniformLocationBucket ValueType; - static const CommandId kCmdId = kGetUniformLocationBucket; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - typedef GLint Result; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( GLuint _program, uint32 _name_bucket_id, uint32 _location_shm_id, uint32 _location_shm_offset) { SetHeader(); @@ -432,18 +298,18 @@ struct GetUniformLocationBucket { uint32 location_shm_offset; }; -COMPILE_ASSERT(sizeof(GetUniformLocationBucket) == 20, - Sizeof_GetUniformLocationBucket_is_not_24); -COMPILE_ASSERT(offsetof(GetUniformLocationBucket, header) == 0, - OffsetOf_GetUniformLocationBucket_header_not_0); -COMPILE_ASSERT(offsetof(GetUniformLocationBucket, program) == 4, - OffsetOf_GetUniformLocationBucket_program_not_4); -COMPILE_ASSERT(offsetof(GetUniformLocationBucket, name_bucket_id) == 8, - OffsetOf_GetUniformLocationBucket_name_bucket_id_not_8); -COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_id) == 12, - OffsetOf_GetUniformLocationBucket_location_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_offset) == 16, - OffsetOf_GetUniformLocationBucket_location_shm_offset_not_16); +COMPILE_ASSERT(sizeof(GetUniformLocation) == 20, + Sizeof_GetUniformLocation_is_not_24); +COMPILE_ASSERT(offsetof(GetUniformLocation, header) == 0, + OffsetOf_GetUniformLocation_header_not_0); +COMPILE_ASSERT(offsetof(GetUniformLocation, program) == 4, + OffsetOf_GetUniformLocation_program_not_4); +COMPILE_ASSERT(offsetof(GetUniformLocation, name_bucket_id) == 8, + OffsetOf_GetUniformLocation_name_bucket_id_not_8); +COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_id) == 12, + OffsetOf_GetUniformLocation_location_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_offset) == 16, + OffsetOf_GetUniformLocation_location_shm_offset_not_16); struct GenMailboxCHROMIUM { typedef GenMailboxCHROMIUM ValueType; diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index fe03fdf..35b7c8b 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -79,65 +79,6 @@ COMPILE_ASSERT(offsetof(AttachShader, program) == 4, COMPILE_ASSERT(offsetof(AttachShader, shader) == 8, OffsetOf_AttachShader_shader_not_8); -struct BindAttribLocation { - typedef BindAttribLocation ValueType; - static const CommandId kCmdId = kBindAttribLocation; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLuint _program, - GLuint _index, - uint32_t _name_shm_id, - uint32_t _name_shm_offset, - uint32_t _data_size) { - SetHeader(); - program = _program; - index = _index; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - data_size = _data_size; - } - - void* Set(void* cmd, - GLuint _program, - GLuint _index, - uint32_t _name_shm_id, - uint32_t _name_shm_offset, - uint32_t _data_size) { - static_cast<ValueType*>(cmd) - ->Init(_program, _index, _name_shm_id, _name_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t program; - uint32_t index; - uint32_t name_shm_id; - uint32_t name_shm_offset; - uint32_t data_size; -}; - -COMPILE_ASSERT(sizeof(BindAttribLocation) == 24, - Sizeof_BindAttribLocation_is_not_24); -COMPILE_ASSERT(offsetof(BindAttribLocation, header) == 0, - OffsetOf_BindAttribLocation_header_not_0); -COMPILE_ASSERT(offsetof(BindAttribLocation, program) == 4, - OffsetOf_BindAttribLocation_program_not_4); -COMPILE_ASSERT(offsetof(BindAttribLocation, index) == 8, - OffsetOf_BindAttribLocation_index_not_8); -COMPILE_ASSERT(offsetof(BindAttribLocation, name_shm_id) == 12, - OffsetOf_BindAttribLocation_name_shm_id_not_12); -COMPILE_ASSERT(offsetof(BindAttribLocation, name_shm_offset) == 16, - OffsetOf_BindAttribLocation_name_shm_offset_not_16); -COMPILE_ASSERT(offsetof(BindAttribLocation, data_size) == 20, - OffsetOf_BindAttribLocation_data_size_not_20); - struct BindAttribLocationBucket { typedef BindAttribLocationBucket ValueType; static const CommandId kCmdId = kBindAttribLocationBucket; @@ -915,6 +856,72 @@ COMPILE_ASSERT(offsetof(CompileShader, header) == 0, COMPILE_ASSERT(offsetof(CompileShader, shader) == 4, OffsetOf_CompileShader_shader_not_4); +struct CompressedTexImage2DBucket { + typedef CompressedTexImage2DBucket ValueType; + static const CommandId kCmdId = kCompressedTexImage2DBucket; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); + + static uint32_t ComputeSize() { + return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { header.SetCmd<ValueType>(); } + + void Init(GLenum _target, + GLint _level, + GLenum _internalformat, + GLsizei _width, + GLsizei _height, + GLuint _bucket_id) { + SetHeader(); + target = _target; + level = _level; + internalformat = _internalformat; + width = _width; + height = _height; + bucket_id = _bucket_id; + } + + void* Set(void* cmd, + GLenum _target, + GLint _level, + GLenum _internalformat, + GLsizei _width, + GLsizei _height, + GLuint _bucket_id) { + static_cast<ValueType*>(cmd) + ->Init(_target, _level, _internalformat, _width, _height, _bucket_id); + return NextCmdAddress<ValueType>(cmd); + } + + gpu::CommandHeader header; + uint32_t target; + int32_t level; + uint32_t internalformat; + int32_t width; + int32_t height; + uint32_t bucket_id; + static const int32_t border = 0; +}; + +COMPILE_ASSERT(sizeof(CompressedTexImage2DBucket) == 28, + Sizeof_CompressedTexImage2DBucket_is_not_28); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, header) == 0, + OffsetOf_CompressedTexImage2DBucket_header_not_0); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, target) == 4, + OffsetOf_CompressedTexImage2DBucket_target_not_4); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, level) == 8, + OffsetOf_CompressedTexImage2DBucket_level_not_8); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, internalformat) == 12, + OffsetOf_CompressedTexImage2DBucket_internalformat_not_12); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, width) == 16, + OffsetOf_CompressedTexImage2DBucket_width_not_16); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, height) == 20, + OffsetOf_CompressedTexImage2DBucket_height_not_20); +COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, bucket_id) == 24, + OffsetOf_CompressedTexImage2DBucket_bucket_id_not_24); + struct CompressedTexImage2D { typedef CompressedTexImage2D ValueType; static const CommandId kCmdId = kCompressedTexImage2D; @@ -999,9 +1006,9 @@ COMPILE_ASSERT(offsetof(CompressedTexImage2D, data_shm_id) == 28, COMPILE_ASSERT(offsetof(CompressedTexImage2D, data_shm_offset) == 32, OffsetOf_CompressedTexImage2D_data_shm_offset_not_32); -struct CompressedTexImage2DBucket { - typedef CompressedTexImage2DBucket ValueType; - static const CommandId kCmdId = kCompressedTexImage2DBucket; +struct CompressedTexSubImage2DBucket { + typedef CompressedTexSubImage2DBucket ValueType; + static const CommandId kCmdId = kCompressedTexSubImage2DBucket; static const cmd::ArgFlags kArgFlags = cmd::kFixed; static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); @@ -1013,57 +1020,74 @@ struct CompressedTexImage2DBucket { void Init(GLenum _target, GLint _level, - GLenum _internalformat, + GLint _xoffset, + GLint _yoffset, GLsizei _width, GLsizei _height, + GLenum _format, GLuint _bucket_id) { SetHeader(); target = _target; level = _level; - internalformat = _internalformat; + xoffset = _xoffset; + yoffset = _yoffset; width = _width; height = _height; + format = _format; bucket_id = _bucket_id; } void* Set(void* cmd, GLenum _target, GLint _level, - GLenum _internalformat, + GLint _xoffset, + GLint _yoffset, GLsizei _width, GLsizei _height, + GLenum _format, GLuint _bucket_id) { - static_cast<ValueType*>(cmd) - ->Init(_target, _level, _internalformat, _width, _height, _bucket_id); + static_cast<ValueType*>(cmd)->Init(_target, + _level, + _xoffset, + _yoffset, + _width, + _height, + _format, + _bucket_id); return NextCmdAddress<ValueType>(cmd); } gpu::CommandHeader header; uint32_t target; int32_t level; - uint32_t internalformat; + int32_t xoffset; + int32_t yoffset; int32_t width; int32_t height; + uint32_t format; uint32_t bucket_id; - static const int32_t border = 0; }; -COMPILE_ASSERT(sizeof(CompressedTexImage2DBucket) == 28, - Sizeof_CompressedTexImage2DBucket_is_not_28); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, header) == 0, - OffsetOf_CompressedTexImage2DBucket_header_not_0); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, target) == 4, - OffsetOf_CompressedTexImage2DBucket_target_not_4); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, level) == 8, - OffsetOf_CompressedTexImage2DBucket_level_not_8); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, internalformat) == 12, - OffsetOf_CompressedTexImage2DBucket_internalformat_not_12); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, width) == 16, - OffsetOf_CompressedTexImage2DBucket_width_not_16); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, height) == 20, - OffsetOf_CompressedTexImage2DBucket_height_not_20); -COMPILE_ASSERT(offsetof(CompressedTexImage2DBucket, bucket_id) == 24, - OffsetOf_CompressedTexImage2DBucket_bucket_id_not_24); +COMPILE_ASSERT(sizeof(CompressedTexSubImage2DBucket) == 36, + Sizeof_CompressedTexSubImage2DBucket_is_not_36); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, header) == 0, + OffsetOf_CompressedTexSubImage2DBucket_header_not_0); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, target) == 4, + OffsetOf_CompressedTexSubImage2DBucket_target_not_4); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, level) == 8, + OffsetOf_CompressedTexSubImage2DBucket_level_not_8); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, xoffset) == 12, + OffsetOf_CompressedTexSubImage2DBucket_xoffset_not_12); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, yoffset) == 16, + OffsetOf_CompressedTexSubImage2DBucket_yoffset_not_16); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, width) == 20, + OffsetOf_CompressedTexSubImage2DBucket_width_not_20); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, height) == 24, + OffsetOf_CompressedTexSubImage2DBucket_height_not_24); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, format) == 28, + OffsetOf_CompressedTexSubImage2DBucket_format_not_28); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, bucket_id) == 32, + OffsetOf_CompressedTexSubImage2DBucket_bucket_id_not_32); struct CompressedTexSubImage2D { typedef CompressedTexSubImage2D ValueType; @@ -1162,89 +1186,6 @@ COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, data_shm_id) == 36, COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, data_shm_offset) == 40, OffsetOf_CompressedTexSubImage2D_data_shm_offset_not_40); -struct CompressedTexSubImage2DBucket { - typedef CompressedTexSubImage2DBucket ValueType; - static const CommandId kCmdId = kCompressedTexSubImage2DBucket; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLenum _target, - GLint _level, - GLint _xoffset, - GLint _yoffset, - GLsizei _width, - GLsizei _height, - GLenum _format, - GLuint _bucket_id) { - SetHeader(); - target = _target; - level = _level; - xoffset = _xoffset; - yoffset = _yoffset; - width = _width; - height = _height; - format = _format; - bucket_id = _bucket_id; - } - - void* Set(void* cmd, - GLenum _target, - GLint _level, - GLint _xoffset, - GLint _yoffset, - GLsizei _width, - GLsizei _height, - GLenum _format, - GLuint _bucket_id) { - static_cast<ValueType*>(cmd)->Init(_target, - _level, - _xoffset, - _yoffset, - _width, - _height, - _format, - _bucket_id); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t target; - int32_t level; - int32_t xoffset; - int32_t yoffset; - int32_t width; - int32_t height; - uint32_t format; - uint32_t bucket_id; -}; - -COMPILE_ASSERT(sizeof(CompressedTexSubImage2DBucket) == 36, - Sizeof_CompressedTexSubImage2DBucket_is_not_36); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, header) == 0, - OffsetOf_CompressedTexSubImage2DBucket_header_not_0); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, target) == 4, - OffsetOf_CompressedTexSubImage2DBucket_target_not_4); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, level) == 8, - OffsetOf_CompressedTexSubImage2DBucket_level_not_8); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, xoffset) == 12, - OffsetOf_CompressedTexSubImage2DBucket_xoffset_not_12); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, yoffset) == 16, - OffsetOf_CompressedTexSubImage2DBucket_yoffset_not_16); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, width) == 20, - OffsetOf_CompressedTexSubImage2DBucket_width_not_20); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, height) == 24, - OffsetOf_CompressedTexSubImage2DBucket_height_not_24); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, format) == 28, - OffsetOf_CompressedTexSubImage2DBucket_format_not_28); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DBucket, bucket_id) == 32, - OffsetOf_CompressedTexSubImage2DBucket_bucket_id_not_32); - struct CopyTexImage2D { typedef CopyTexImage2D ValueType; static const CommandId kCmdId = kCopyTexImage2D; @@ -4543,58 +4484,6 @@ COMPILE_ASSERT(offsetof(ShaderBinary, binary_shm_offset) == 24, COMPILE_ASSERT(offsetof(ShaderBinary, length) == 28, OffsetOf_ShaderBinary_length_not_28); -struct ShaderSource { - typedef ShaderSource ValueType; - static const CommandId kCmdId = kShaderSource; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLuint _shader, - uint32_t _data_shm_id, - uint32_t _data_shm_offset, - uint32_t _data_size) { - SetHeader(); - shader = _shader; - data_shm_id = _data_shm_id; - data_shm_offset = _data_shm_offset; - data_size = _data_size; - } - - void* Set(void* cmd, - GLuint _shader, - uint32_t _data_shm_id, - uint32_t _data_shm_offset, - uint32_t _data_size) { - static_cast<ValueType*>(cmd) - ->Init(_shader, _data_shm_id, _data_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t shader; - uint32_t data_shm_id; - uint32_t data_shm_offset; - uint32_t data_size; -}; - -COMPILE_ASSERT(sizeof(ShaderSource) == 20, Sizeof_ShaderSource_is_not_20); -COMPILE_ASSERT(offsetof(ShaderSource, header) == 0, - OffsetOf_ShaderSource_header_not_0); -COMPILE_ASSERT(offsetof(ShaderSource, shader) == 4, - OffsetOf_ShaderSource_shader_not_4); -COMPILE_ASSERT(offsetof(ShaderSource, data_shm_id) == 8, - OffsetOf_ShaderSource_data_shm_id_not_8); -COMPILE_ASSERT(offsetof(ShaderSource, data_shm_offset) == 12, - OffsetOf_ShaderSource_data_shm_offset_not_12); -COMPILE_ASSERT(offsetof(ShaderSource, data_size) == 16, - OffsetOf_ShaderSource_data_size_not_16); - struct ShaderSourceBucket { typedef ShaderSourceBucket ValueType; static const CommandId kCmdId = kShaderSourceBucket; @@ -8347,65 +8236,6 @@ COMPILE_ASSERT(offsetof(ConsumeTextureCHROMIUMImmediate, header) == 0, COMPILE_ASSERT(offsetof(ConsumeTextureCHROMIUMImmediate, target) == 4, OffsetOf_ConsumeTextureCHROMIUMImmediate_target_not_4); -struct BindUniformLocationCHROMIUM { - typedef BindUniformLocationCHROMIUM ValueType; - static const CommandId kCmdId = kBindUniformLocationCHROMIUM; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLuint _program, - GLint _location, - uint32_t _name_shm_id, - uint32_t _name_shm_offset, - uint32_t _data_size) { - SetHeader(); - program = _program; - location = _location; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - data_size = _data_size; - } - - void* Set(void* cmd, - GLuint _program, - GLint _location, - uint32_t _name_shm_id, - uint32_t _name_shm_offset, - uint32_t _data_size) { - static_cast<ValueType*>(cmd) - ->Init(_program, _location, _name_shm_id, _name_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t program; - int32_t location; - uint32_t name_shm_id; - uint32_t name_shm_offset; - uint32_t data_size; -}; - -COMPILE_ASSERT(sizeof(BindUniformLocationCHROMIUM) == 24, - Sizeof_BindUniformLocationCHROMIUM_is_not_24); -COMPILE_ASSERT(offsetof(BindUniformLocationCHROMIUM, header) == 0, - OffsetOf_BindUniformLocationCHROMIUM_header_not_0); -COMPILE_ASSERT(offsetof(BindUniformLocationCHROMIUM, program) == 4, - OffsetOf_BindUniformLocationCHROMIUM_program_not_4); -COMPILE_ASSERT(offsetof(BindUniformLocationCHROMIUM, location) == 8, - OffsetOf_BindUniformLocationCHROMIUM_location_not_8); -COMPILE_ASSERT(offsetof(BindUniformLocationCHROMIUM, name_shm_id) == 12, - OffsetOf_BindUniformLocationCHROMIUM_name_shm_id_not_12); -COMPILE_ASSERT(offsetof(BindUniformLocationCHROMIUM, name_shm_offset) == 16, - OffsetOf_BindUniformLocationCHROMIUM_name_shm_offset_not_16); -COMPILE_ASSERT(offsetof(BindUniformLocationCHROMIUM, data_size) == 20, - OffsetOf_BindUniformLocationCHROMIUM_data_size_not_20); - struct BindUniformLocationCHROMIUMBucket { typedef BindUniformLocationCHROMIUMBucket ValueType; static const CommandId kCmdId = kBindUniformLocationCHROMIUMBucket; diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index 6df2295..071bde2 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -36,25 +36,6 @@ TEST_F(GLES2FormatTest, AttachShader) { CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, BindAttribLocation) { - cmds::BindAttribLocation& cmd = *GetBufferAs<cmds::BindAttribLocation>(); - void* next_cmd = cmd.Set(&cmd, - static_cast<GLuint>(11), - static_cast<GLuint>(12), - static_cast<uint32_t>(13), - static_cast<uint32_t>(14), - static_cast<uint32_t>(15)); - EXPECT_EQ(static_cast<uint32_t>(cmds::BindAttribLocation::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLuint>(11), cmd.program); - EXPECT_EQ(static_cast<GLuint>(12), cmd.index); - EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_shm_id); - EXPECT_EQ(static_cast<uint32_t>(14), cmd.name_shm_offset); - EXPECT_EQ(static_cast<uint32_t>(15), cmd.data_size); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - TEST_F(GLES2FormatTest, BindAttribLocationBucket) { cmds::BindAttribLocationBucket& cmd = *GetBufferAs<cmds::BindAttribLocationBucket>(); @@ -313,18 +294,17 @@ TEST_F(GLES2FormatTest, CompileShader) { CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, CompressedTexImage2D) { - cmds::CompressedTexImage2D& cmd = *GetBufferAs<cmds::CompressedTexImage2D>(); +TEST_F(GLES2FormatTest, CompressedTexImage2DBucket) { + cmds::CompressedTexImage2DBucket& cmd = + *GetBufferAs<cmds::CompressedTexImage2DBucket>(); void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), static_cast<GLenum>(13), static_cast<GLsizei>(14), static_cast<GLsizei>(15), - static_cast<GLsizei>(16), - static_cast<uint32_t>(17), - static_cast<uint32_t>(18)); - EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2D::kCmdId), + static_cast<GLuint>(16)); + EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2DBucket::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); EXPECT_EQ(static_cast<GLenum>(11), cmd.target); @@ -332,23 +312,22 @@ TEST_F(GLES2FormatTest, CompressedTexImage2D) { EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat); EXPECT_EQ(static_cast<GLsizei>(14), cmd.width); EXPECT_EQ(static_cast<GLsizei>(15), cmd.height); - EXPECT_EQ(static_cast<GLsizei>(16), cmd.imageSize); - EXPECT_EQ(static_cast<uint32_t>(17), cmd.data_shm_id); - EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_offset); + EXPECT_EQ(static_cast<GLuint>(16), cmd.bucket_id); CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, CompressedTexImage2DBucket) { - cmds::CompressedTexImage2DBucket& cmd = - *GetBufferAs<cmds::CompressedTexImage2DBucket>(); +TEST_F(GLES2FormatTest, CompressedTexImage2D) { + cmds::CompressedTexImage2D& cmd = *GetBufferAs<cmds::CompressedTexImage2D>(); void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), static_cast<GLenum>(13), static_cast<GLsizei>(14), static_cast<GLsizei>(15), - static_cast<GLuint>(16)); - EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2DBucket::kCmdId), + static_cast<GLsizei>(16), + static_cast<uint32_t>(17), + static_cast<uint32_t>(18)); + EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2D::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); EXPECT_EQ(static_cast<GLenum>(11), cmd.target); @@ -356,13 +335,15 @@ TEST_F(GLES2FormatTest, CompressedTexImage2DBucket) { EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat); EXPECT_EQ(static_cast<GLsizei>(14), cmd.width); EXPECT_EQ(static_cast<GLsizei>(15), cmd.height); - EXPECT_EQ(static_cast<GLuint>(16), cmd.bucket_id); + EXPECT_EQ(static_cast<GLsizei>(16), cmd.imageSize); + EXPECT_EQ(static_cast<uint32_t>(17), cmd.data_shm_id); + EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_offset); CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, CompressedTexSubImage2D) { - cmds::CompressedTexSubImage2D& cmd = - *GetBufferAs<cmds::CompressedTexSubImage2D>(); +TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) { + cmds::CompressedTexSubImage2DBucket& cmd = + *GetBufferAs<cmds::CompressedTexSubImage2DBucket>(); void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), @@ -371,10 +352,8 @@ TEST_F(GLES2FormatTest, CompressedTexSubImage2D) { static_cast<GLsizei>(15), static_cast<GLsizei>(16), static_cast<GLenum>(17), - static_cast<GLsizei>(18), - static_cast<uint32_t>(19), - static_cast<uint32_t>(20)); - EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2D::kCmdId), + static_cast<GLuint>(18)); + EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2DBucket::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); EXPECT_EQ(static_cast<GLenum>(11), cmd.target); @@ -384,15 +363,13 @@ TEST_F(GLES2FormatTest, CompressedTexSubImage2D) { EXPECT_EQ(static_cast<GLsizei>(15), cmd.width); EXPECT_EQ(static_cast<GLsizei>(16), cmd.height); EXPECT_EQ(static_cast<GLenum>(17), cmd.format); - EXPECT_EQ(static_cast<GLsizei>(18), cmd.imageSize); - EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id); - EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset); + EXPECT_EQ(static_cast<GLuint>(18), cmd.bucket_id); CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) { - cmds::CompressedTexSubImage2DBucket& cmd = - *GetBufferAs<cmds::CompressedTexSubImage2DBucket>(); +TEST_F(GLES2FormatTest, CompressedTexSubImage2D) { + cmds::CompressedTexSubImage2D& cmd = + *GetBufferAs<cmds::CompressedTexSubImage2D>(); void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), @@ -401,8 +378,10 @@ TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) { static_cast<GLsizei>(15), static_cast<GLsizei>(16), static_cast<GLenum>(17), - static_cast<GLuint>(18)); - EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2DBucket::kCmdId), + static_cast<GLsizei>(18), + static_cast<uint32_t>(19), + static_cast<uint32_t>(20)); + EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2D::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); EXPECT_EQ(static_cast<GLenum>(11), cmd.target); @@ -412,7 +391,9 @@ TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) { EXPECT_EQ(static_cast<GLsizei>(15), cmd.width); EXPECT_EQ(static_cast<GLsizei>(16), cmd.height); EXPECT_EQ(static_cast<GLenum>(17), cmd.format); - EXPECT_EQ(static_cast<GLuint>(18), cmd.bucket_id); + EXPECT_EQ(static_cast<GLsizei>(18), cmd.imageSize); + EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id); + EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset); CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } @@ -897,7 +878,6 @@ TEST_F(GLES2FormatTest, GetAttachedShaders) { } // TODO(gman): Write test for GetAttribLocation -// TODO(gman): Write test for GetAttribLocationBucket TEST_F(GLES2FormatTest, GetBooleanv) { cmds::GetBooleanv& cmd = *GetBufferAs<cmds::GetBooleanv>(); void* next_cmd = cmd.Set(&cmd, @@ -1177,7 +1157,6 @@ TEST_F(GLES2FormatTest, GetUniformiv) { } // TODO(gman): Write test for GetUniformLocation -// TODO(gman): Write test for GetUniformLocationBucket TEST_F(GLES2FormatTest, GetVertexAttribfv) { cmds::GetVertexAttribfv& cmd = *GetBufferAs<cmds::GetVertexAttribfv>(); void* next_cmd = cmd.Set(&cmd, @@ -1493,23 +1472,6 @@ TEST_F(GLES2FormatTest, ShaderBinary) { CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, ShaderSource) { - cmds::ShaderSource& cmd = *GetBufferAs<cmds::ShaderSource>(); - void* next_cmd = cmd.Set(&cmd, - static_cast<GLuint>(11), - static_cast<uint32_t>(12), - static_cast<uint32_t>(13), - static_cast<uint32_t>(14)); - EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderSource::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLuint>(11), cmd.shader); - EXPECT_EQ(static_cast<uint32_t>(12), cmd.data_shm_id); - EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_offset); - EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_size); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - TEST_F(GLES2FormatTest, ShaderSourceBucket) { cmds::ShaderSourceBucket& cmd = *GetBufferAs<cmds::ShaderSourceBucket>(); void* next_cmd = @@ -3187,26 +3149,6 @@ TEST_F(GLES2FormatTest, ConsumeTextureCHROMIUMImmediate) { } // TODO(gman): Write test for CreateAndConsumeTextureCHROMIUMImmediate -TEST_F(GLES2FormatTest, BindUniformLocationCHROMIUM) { - cmds::BindUniformLocationCHROMIUM& cmd = - *GetBufferAs<cmds::BindUniformLocationCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, - static_cast<GLuint>(11), - static_cast<GLint>(12), - static_cast<uint32_t>(13), - static_cast<uint32_t>(14), - static_cast<uint32_t>(15)); - EXPECT_EQ(static_cast<uint32_t>(cmds::BindUniformLocationCHROMIUM::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLuint>(11), cmd.program); - EXPECT_EQ(static_cast<GLint>(12), cmd.location); - EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_shm_id); - EXPECT_EQ(static_cast<uint32_t>(14), cmd.name_shm_offset); - EXPECT_EQ(static_cast<uint32_t>(15), cmd.data_size); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - TEST_F(GLES2FormatTest, BindUniformLocationCHROMIUMBucket) { cmds::BindUniformLocationCHROMIUMBucket& cmd = *GetBufferAs<cmds::BindUniformLocationCHROMIUMBucket>(); diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h index 824ceb2..0d2b9b7 100644 --- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h @@ -14,208 +14,203 @@ #define GLES2_COMMAND_LIST(OP) \ OP(ActiveTexture) /* 256 */ \ OP(AttachShader) /* 257 */ \ - OP(BindAttribLocation) /* 258 */ \ - OP(BindAttribLocationBucket) /* 259 */ \ - OP(BindBuffer) /* 260 */ \ - OP(BindFramebuffer) /* 261 */ \ - OP(BindRenderbuffer) /* 262 */ \ - OP(BindTexture) /* 263 */ \ - OP(BlendColor) /* 264 */ \ - OP(BlendEquation) /* 265 */ \ - OP(BlendEquationSeparate) /* 266 */ \ - OP(BlendFunc) /* 267 */ \ - OP(BlendFuncSeparate) /* 268 */ \ - OP(BufferData) /* 269 */ \ - OP(BufferSubData) /* 270 */ \ - OP(CheckFramebufferStatus) /* 271 */ \ - OP(Clear) /* 272 */ \ - OP(ClearColor) /* 273 */ \ - OP(ClearDepthf) /* 274 */ \ - OP(ClearStencil) /* 275 */ \ - OP(ColorMask) /* 276 */ \ - OP(CompileShader) /* 277 */ \ + OP(BindAttribLocationBucket) /* 258 */ \ + OP(BindBuffer) /* 259 */ \ + OP(BindFramebuffer) /* 260 */ \ + OP(BindRenderbuffer) /* 261 */ \ + OP(BindTexture) /* 262 */ \ + OP(BlendColor) /* 263 */ \ + OP(BlendEquation) /* 264 */ \ + OP(BlendEquationSeparate) /* 265 */ \ + OP(BlendFunc) /* 266 */ \ + OP(BlendFuncSeparate) /* 267 */ \ + OP(BufferData) /* 268 */ \ + OP(BufferSubData) /* 269 */ \ + OP(CheckFramebufferStatus) /* 270 */ \ + OP(Clear) /* 271 */ \ + OP(ClearColor) /* 272 */ \ + OP(ClearDepthf) /* 273 */ \ + OP(ClearStencil) /* 274 */ \ + OP(ColorMask) /* 275 */ \ + OP(CompileShader) /* 276 */ \ + OP(CompressedTexImage2DBucket) /* 277 */ \ OP(CompressedTexImage2D) /* 278 */ \ - OP(CompressedTexImage2DBucket) /* 279 */ \ + OP(CompressedTexSubImage2DBucket) /* 279 */ \ OP(CompressedTexSubImage2D) /* 280 */ \ - OP(CompressedTexSubImage2DBucket) /* 281 */ \ - OP(CopyTexImage2D) /* 282 */ \ - OP(CopyTexSubImage2D) /* 283 */ \ - OP(CreateProgram) /* 284 */ \ - OP(CreateShader) /* 285 */ \ - OP(CullFace) /* 286 */ \ - OP(DeleteBuffersImmediate) /* 287 */ \ - OP(DeleteFramebuffersImmediate) /* 288 */ \ - OP(DeleteProgram) /* 289 */ \ - OP(DeleteRenderbuffersImmediate) /* 290 */ \ - OP(DeleteShader) /* 291 */ \ - OP(DeleteTexturesImmediate) /* 292 */ \ - OP(DepthFunc) /* 293 */ \ - OP(DepthMask) /* 294 */ \ - OP(DepthRangef) /* 295 */ \ - OP(DetachShader) /* 296 */ \ - OP(Disable) /* 297 */ \ - OP(DisableVertexAttribArray) /* 298 */ \ - OP(DrawArrays) /* 299 */ \ - OP(DrawElements) /* 300 */ \ - OP(Enable) /* 301 */ \ - OP(EnableVertexAttribArray) /* 302 */ \ - OP(Finish) /* 303 */ \ - OP(Flush) /* 304 */ \ - OP(FramebufferRenderbuffer) /* 305 */ \ - OP(FramebufferTexture2D) /* 306 */ \ - OP(FrontFace) /* 307 */ \ - OP(GenBuffersImmediate) /* 308 */ \ - OP(GenerateMipmap) /* 309 */ \ - OP(GenFramebuffersImmediate) /* 310 */ \ - OP(GenRenderbuffersImmediate) /* 311 */ \ - OP(GenTexturesImmediate) /* 312 */ \ - OP(GetActiveAttrib) /* 313 */ \ - OP(GetActiveUniform) /* 314 */ \ - OP(GetAttachedShaders) /* 315 */ \ - OP(GetAttribLocation) /* 316 */ \ - OP(GetAttribLocationBucket) /* 317 */ \ - OP(GetBooleanv) /* 318 */ \ - OP(GetBufferParameteriv) /* 319 */ \ - OP(GetError) /* 320 */ \ - OP(GetFloatv) /* 321 */ \ - OP(GetFramebufferAttachmentParameteriv) /* 322 */ \ - OP(GetIntegerv) /* 323 */ \ - OP(GetProgramiv) /* 324 */ \ - OP(GetProgramInfoLog) /* 325 */ \ - OP(GetRenderbufferParameteriv) /* 326 */ \ - OP(GetShaderiv) /* 327 */ \ - OP(GetShaderInfoLog) /* 328 */ \ - OP(GetShaderPrecisionFormat) /* 329 */ \ - OP(GetShaderSource) /* 330 */ \ - OP(GetString) /* 331 */ \ - OP(GetTexParameterfv) /* 332 */ \ - OP(GetTexParameteriv) /* 333 */ \ - OP(GetUniformfv) /* 334 */ \ - OP(GetUniformiv) /* 335 */ \ - OP(GetUniformLocation) /* 336 */ \ - OP(GetUniformLocationBucket) /* 337 */ \ - OP(GetVertexAttribfv) /* 338 */ \ - OP(GetVertexAttribiv) /* 339 */ \ - OP(GetVertexAttribPointerv) /* 340 */ \ - OP(Hint) /* 341 */ \ - OP(IsBuffer) /* 342 */ \ - OP(IsEnabled) /* 343 */ \ - OP(IsFramebuffer) /* 344 */ \ - OP(IsProgram) /* 345 */ \ - OP(IsRenderbuffer) /* 346 */ \ - OP(IsShader) /* 347 */ \ - OP(IsTexture) /* 348 */ \ - OP(LineWidth) /* 349 */ \ - OP(LinkProgram) /* 350 */ \ - OP(PixelStorei) /* 351 */ \ - OP(PolygonOffset) /* 352 */ \ - OP(ReadPixels) /* 353 */ \ - OP(ReleaseShaderCompiler) /* 354 */ \ - OP(RenderbufferStorage) /* 355 */ \ - OP(SampleCoverage) /* 356 */ \ - OP(Scissor) /* 357 */ \ - OP(ShaderBinary) /* 358 */ \ - OP(ShaderSource) /* 359 */ \ - OP(ShaderSourceBucket) /* 360 */ \ - OP(StencilFunc) /* 361 */ \ - OP(StencilFuncSeparate) /* 362 */ \ - OP(StencilMask) /* 363 */ \ - OP(StencilMaskSeparate) /* 364 */ \ - OP(StencilOp) /* 365 */ \ - OP(StencilOpSeparate) /* 366 */ \ - OP(TexImage2D) /* 367 */ \ - OP(TexParameterf) /* 368 */ \ - OP(TexParameterfvImmediate) /* 369 */ \ - OP(TexParameteri) /* 370 */ \ - OP(TexParameterivImmediate) /* 371 */ \ - OP(TexSubImage2D) /* 372 */ \ - OP(Uniform1f) /* 373 */ \ - OP(Uniform1fvImmediate) /* 374 */ \ - OP(Uniform1i) /* 375 */ \ - OP(Uniform1ivImmediate) /* 376 */ \ - OP(Uniform2f) /* 377 */ \ - OP(Uniform2fvImmediate) /* 378 */ \ - OP(Uniform2i) /* 379 */ \ - OP(Uniform2ivImmediate) /* 380 */ \ - OP(Uniform3f) /* 381 */ \ - OP(Uniform3fvImmediate) /* 382 */ \ - OP(Uniform3i) /* 383 */ \ - OP(Uniform3ivImmediate) /* 384 */ \ - OP(Uniform4f) /* 385 */ \ - OP(Uniform4fvImmediate) /* 386 */ \ - OP(Uniform4i) /* 387 */ \ - OP(Uniform4ivImmediate) /* 388 */ \ - OP(UniformMatrix2fvImmediate) /* 389 */ \ - OP(UniformMatrix3fvImmediate) /* 390 */ \ - OP(UniformMatrix4fvImmediate) /* 391 */ \ - OP(UseProgram) /* 392 */ \ - OP(ValidateProgram) /* 393 */ \ - OP(VertexAttrib1f) /* 394 */ \ - OP(VertexAttrib1fvImmediate) /* 395 */ \ - OP(VertexAttrib2f) /* 396 */ \ - OP(VertexAttrib2fvImmediate) /* 397 */ \ - OP(VertexAttrib3f) /* 398 */ \ - OP(VertexAttrib3fvImmediate) /* 399 */ \ - OP(VertexAttrib4f) /* 400 */ \ - OP(VertexAttrib4fvImmediate) /* 401 */ \ - OP(VertexAttribPointer) /* 402 */ \ - OP(Viewport) /* 403 */ \ - OP(BlitFramebufferCHROMIUM) /* 404 */ \ - OP(RenderbufferStorageMultisampleCHROMIUM) /* 405 */ \ - OP(RenderbufferStorageMultisampleEXT) /* 406 */ \ - OP(FramebufferTexture2DMultisampleEXT) /* 407 */ \ - OP(TexStorage2DEXT) /* 408 */ \ - OP(GenQueriesEXTImmediate) /* 409 */ \ - OP(DeleteQueriesEXTImmediate) /* 410 */ \ - OP(BeginQueryEXT) /* 411 */ \ - OP(EndQueryEXT) /* 412 */ \ - OP(InsertEventMarkerEXT) /* 413 */ \ - OP(PushGroupMarkerEXT) /* 414 */ \ - OP(PopGroupMarkerEXT) /* 415 */ \ - OP(GenVertexArraysOESImmediate) /* 416 */ \ - OP(DeleteVertexArraysOESImmediate) /* 417 */ \ - OP(IsVertexArrayOES) /* 418 */ \ - OP(BindVertexArrayOES) /* 419 */ \ - OP(SwapBuffers) /* 420 */ \ - OP(GetMaxValueInBufferCHROMIUM) /* 421 */ \ - OP(GenSharedIdsCHROMIUM) /* 422 */ \ - OP(DeleteSharedIdsCHROMIUM) /* 423 */ \ - OP(RegisterSharedIdsCHROMIUM) /* 424 */ \ - OP(EnableFeatureCHROMIUM) /* 425 */ \ - OP(ResizeCHROMIUM) /* 426 */ \ - OP(GetRequestableExtensionsCHROMIUM) /* 427 */ \ - OP(RequestExtensionCHROMIUM) /* 428 */ \ - OP(GetMultipleIntegervCHROMIUM) /* 429 */ \ - OP(GetProgramInfoCHROMIUM) /* 430 */ \ - OP(GetTranslatedShaderSourceANGLE) /* 431 */ \ - OP(PostSubBufferCHROMIUM) /* 432 */ \ - OP(TexImageIOSurface2DCHROMIUM) /* 433 */ \ - OP(CopyTextureCHROMIUM) /* 434 */ \ - OP(DrawArraysInstancedANGLE) /* 435 */ \ - OP(DrawElementsInstancedANGLE) /* 436 */ \ - OP(VertexAttribDivisorANGLE) /* 437 */ \ - OP(GenMailboxCHROMIUM) /* 438 */ \ - OP(ProduceTextureCHROMIUMImmediate) /* 439 */ \ - OP(ProduceTextureDirectCHROMIUMImmediate) /* 440 */ \ - OP(ConsumeTextureCHROMIUMImmediate) /* 441 */ \ - OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 442 */ \ - OP(BindUniformLocationCHROMIUM) /* 443 */ \ - OP(BindUniformLocationCHROMIUMBucket) /* 444 */ \ - OP(BindTexImage2DCHROMIUM) /* 445 */ \ - OP(ReleaseTexImage2DCHROMIUM) /* 446 */ \ - OP(TraceBeginCHROMIUM) /* 447 */ \ - OP(TraceEndCHROMIUM) /* 448 */ \ - OP(AsyncTexSubImage2DCHROMIUM) /* 449 */ \ - OP(AsyncTexImage2DCHROMIUM) /* 450 */ \ - OP(WaitAsyncTexImage2DCHROMIUM) /* 451 */ \ - OP(WaitAllAsyncTexImage2DCHROMIUM) /* 452 */ \ - OP(DiscardFramebufferEXTImmediate) /* 453 */ \ - OP(LoseContextCHROMIUM) /* 454 */ \ - OP(InsertSyncPointCHROMIUM) /* 455 */ \ - OP(WaitSyncPointCHROMIUM) /* 456 */ \ - OP(DrawBuffersEXTImmediate) /* 457 */ \ - OP(DiscardBackbufferCHROMIUM) /* 458 */ \ - OP(ScheduleOverlayPlaneCHROMIUM) /* 459 */ + OP(CopyTexImage2D) /* 281 */ \ + OP(CopyTexSubImage2D) /* 282 */ \ + OP(CreateProgram) /* 283 */ \ + OP(CreateShader) /* 284 */ \ + OP(CullFace) /* 285 */ \ + OP(DeleteBuffersImmediate) /* 286 */ \ + OP(DeleteFramebuffersImmediate) /* 287 */ \ + OP(DeleteProgram) /* 288 */ \ + OP(DeleteRenderbuffersImmediate) /* 289 */ \ + OP(DeleteShader) /* 290 */ \ + OP(DeleteTexturesImmediate) /* 291 */ \ + OP(DepthFunc) /* 292 */ \ + OP(DepthMask) /* 293 */ \ + OP(DepthRangef) /* 294 */ \ + OP(DetachShader) /* 295 */ \ + OP(Disable) /* 296 */ \ + OP(DisableVertexAttribArray) /* 297 */ \ + OP(DrawArrays) /* 298 */ \ + OP(DrawElements) /* 299 */ \ + OP(Enable) /* 300 */ \ + OP(EnableVertexAttribArray) /* 301 */ \ + OP(Finish) /* 302 */ \ + OP(Flush) /* 303 */ \ + OP(FramebufferRenderbuffer) /* 304 */ \ + OP(FramebufferTexture2D) /* 305 */ \ + OP(FrontFace) /* 306 */ \ + OP(GenBuffersImmediate) /* 307 */ \ + OP(GenerateMipmap) /* 308 */ \ + OP(GenFramebuffersImmediate) /* 309 */ \ + OP(GenRenderbuffersImmediate) /* 310 */ \ + OP(GenTexturesImmediate) /* 311 */ \ + OP(GetActiveAttrib) /* 312 */ \ + OP(GetActiveUniform) /* 313 */ \ + OP(GetAttachedShaders) /* 314 */ \ + OP(GetAttribLocation) /* 315 */ \ + OP(GetBooleanv) /* 316 */ \ + OP(GetBufferParameteriv) /* 317 */ \ + OP(GetError) /* 318 */ \ + OP(GetFloatv) /* 319 */ \ + OP(GetFramebufferAttachmentParameteriv) /* 320 */ \ + OP(GetIntegerv) /* 321 */ \ + OP(GetProgramiv) /* 322 */ \ + OP(GetProgramInfoLog) /* 323 */ \ + OP(GetRenderbufferParameteriv) /* 324 */ \ + OP(GetShaderiv) /* 325 */ \ + OP(GetShaderInfoLog) /* 326 */ \ + OP(GetShaderPrecisionFormat) /* 327 */ \ + OP(GetShaderSource) /* 328 */ \ + OP(GetString) /* 329 */ \ + OP(GetTexParameterfv) /* 330 */ \ + OP(GetTexParameteriv) /* 331 */ \ + OP(GetUniformfv) /* 332 */ \ + OP(GetUniformiv) /* 333 */ \ + OP(GetUniformLocation) /* 334 */ \ + OP(GetVertexAttribfv) /* 335 */ \ + OP(GetVertexAttribiv) /* 336 */ \ + OP(GetVertexAttribPointerv) /* 337 */ \ + OP(Hint) /* 338 */ \ + OP(IsBuffer) /* 339 */ \ + OP(IsEnabled) /* 340 */ \ + OP(IsFramebuffer) /* 341 */ \ + OP(IsProgram) /* 342 */ \ + OP(IsRenderbuffer) /* 343 */ \ + OP(IsShader) /* 344 */ \ + OP(IsTexture) /* 345 */ \ + OP(LineWidth) /* 346 */ \ + OP(LinkProgram) /* 347 */ \ + OP(PixelStorei) /* 348 */ \ + OP(PolygonOffset) /* 349 */ \ + OP(ReadPixels) /* 350 */ \ + OP(ReleaseShaderCompiler) /* 351 */ \ + OP(RenderbufferStorage) /* 352 */ \ + OP(SampleCoverage) /* 353 */ \ + OP(Scissor) /* 354 */ \ + OP(ShaderBinary) /* 355 */ \ + OP(ShaderSourceBucket) /* 356 */ \ + OP(StencilFunc) /* 357 */ \ + OP(StencilFuncSeparate) /* 358 */ \ + OP(StencilMask) /* 359 */ \ + OP(StencilMaskSeparate) /* 360 */ \ + OP(StencilOp) /* 361 */ \ + OP(StencilOpSeparate) /* 362 */ \ + OP(TexImage2D) /* 363 */ \ + OP(TexParameterf) /* 364 */ \ + OP(TexParameterfvImmediate) /* 365 */ \ + OP(TexParameteri) /* 366 */ \ + OP(TexParameterivImmediate) /* 367 */ \ + OP(TexSubImage2D) /* 368 */ \ + OP(Uniform1f) /* 369 */ \ + OP(Uniform1fvImmediate) /* 370 */ \ + OP(Uniform1i) /* 371 */ \ + OP(Uniform1ivImmediate) /* 372 */ \ + OP(Uniform2f) /* 373 */ \ + OP(Uniform2fvImmediate) /* 374 */ \ + OP(Uniform2i) /* 375 */ \ + OP(Uniform2ivImmediate) /* 376 */ \ + OP(Uniform3f) /* 377 */ \ + OP(Uniform3fvImmediate) /* 378 */ \ + OP(Uniform3i) /* 379 */ \ + OP(Uniform3ivImmediate) /* 380 */ \ + OP(Uniform4f) /* 381 */ \ + OP(Uniform4fvImmediate) /* 382 */ \ + OP(Uniform4i) /* 383 */ \ + OP(Uniform4ivImmediate) /* 384 */ \ + OP(UniformMatrix2fvImmediate) /* 385 */ \ + OP(UniformMatrix3fvImmediate) /* 386 */ \ + OP(UniformMatrix4fvImmediate) /* 387 */ \ + OP(UseProgram) /* 388 */ \ + OP(ValidateProgram) /* 389 */ \ + OP(VertexAttrib1f) /* 390 */ \ + OP(VertexAttrib1fvImmediate) /* 391 */ \ + OP(VertexAttrib2f) /* 392 */ \ + OP(VertexAttrib2fvImmediate) /* 393 */ \ + OP(VertexAttrib3f) /* 394 */ \ + OP(VertexAttrib3fvImmediate) /* 395 */ \ + OP(VertexAttrib4f) /* 396 */ \ + OP(VertexAttrib4fvImmediate) /* 397 */ \ + OP(VertexAttribPointer) /* 398 */ \ + OP(Viewport) /* 399 */ \ + OP(BlitFramebufferCHROMIUM) /* 400 */ \ + OP(RenderbufferStorageMultisampleCHROMIUM) /* 401 */ \ + OP(RenderbufferStorageMultisampleEXT) /* 402 */ \ + OP(FramebufferTexture2DMultisampleEXT) /* 403 */ \ + OP(TexStorage2DEXT) /* 404 */ \ + OP(GenQueriesEXTImmediate) /* 405 */ \ + OP(DeleteQueriesEXTImmediate) /* 406 */ \ + OP(BeginQueryEXT) /* 407 */ \ + OP(EndQueryEXT) /* 408 */ \ + OP(InsertEventMarkerEXT) /* 409 */ \ + OP(PushGroupMarkerEXT) /* 410 */ \ + OP(PopGroupMarkerEXT) /* 411 */ \ + OP(GenVertexArraysOESImmediate) /* 412 */ \ + OP(DeleteVertexArraysOESImmediate) /* 413 */ \ + OP(IsVertexArrayOES) /* 414 */ \ + OP(BindVertexArrayOES) /* 415 */ \ + OP(SwapBuffers) /* 416 */ \ + OP(GetMaxValueInBufferCHROMIUM) /* 417 */ \ + OP(GenSharedIdsCHROMIUM) /* 418 */ \ + OP(DeleteSharedIdsCHROMIUM) /* 419 */ \ + OP(RegisterSharedIdsCHROMIUM) /* 420 */ \ + OP(EnableFeatureCHROMIUM) /* 421 */ \ + OP(ResizeCHROMIUM) /* 422 */ \ + OP(GetRequestableExtensionsCHROMIUM) /* 423 */ \ + OP(RequestExtensionCHROMIUM) /* 424 */ \ + OP(GetMultipleIntegervCHROMIUM) /* 425 */ \ + OP(GetProgramInfoCHROMIUM) /* 426 */ \ + OP(GetTranslatedShaderSourceANGLE) /* 427 */ \ + OP(PostSubBufferCHROMIUM) /* 428 */ \ + OP(TexImageIOSurface2DCHROMIUM) /* 429 */ \ + OP(CopyTextureCHROMIUM) /* 430 */ \ + OP(DrawArraysInstancedANGLE) /* 431 */ \ + OP(DrawElementsInstancedANGLE) /* 432 */ \ + OP(VertexAttribDivisorANGLE) /* 433 */ \ + OP(GenMailboxCHROMIUM) /* 434 */ \ + OP(ProduceTextureCHROMIUMImmediate) /* 435 */ \ + OP(ProduceTextureDirectCHROMIUMImmediate) /* 436 */ \ + OP(ConsumeTextureCHROMIUMImmediate) /* 437 */ \ + OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 438 */ \ + OP(BindUniformLocationCHROMIUMBucket) /* 439 */ \ + OP(BindTexImage2DCHROMIUM) /* 440 */ \ + OP(ReleaseTexImage2DCHROMIUM) /* 441 */ \ + OP(TraceBeginCHROMIUM) /* 442 */ \ + OP(TraceEndCHROMIUM) /* 443 */ \ + OP(AsyncTexSubImage2DCHROMIUM) /* 444 */ \ + OP(AsyncTexImage2DCHROMIUM) /* 445 */ \ + OP(WaitAsyncTexImage2DCHROMIUM) /* 446 */ \ + OP(WaitAllAsyncTexImage2DCHROMIUM) /* 447 */ \ + OP(DiscardFramebufferEXTImmediate) /* 448 */ \ + OP(LoseContextCHROMIUM) /* 449 */ \ + OP(InsertSyncPointCHROMIUM) /* 450 */ \ + OP(WaitSyncPointCHROMIUM) /* 451 */ \ + OP(DrawBuffersEXTImmediate) /* 452 */ \ + OP(DiscardBackbufferCHROMIUM) /* 453 */ \ + OP(ScheduleOverlayPlaneCHROMIUM) /* 454 */ enum CommandId { kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index f14058d..069ca52 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -4728,21 +4728,6 @@ void GLES2DecoderImpl::DoBindAttribLocation( glBindAttribLocation(program->service_id(), index, name); } -error::Error GLES2DecoderImpl::HandleBindAttribLocation( - uint32 immediate_data_size, const cmds::BindAttribLocation& c) { - GLuint program = static_cast<GLuint>(c.program); - GLuint index = static_cast<GLuint>(c.index); - uint32 name_size = c.data_size; - const char* name = GetSharedMemoryAs<const char*>( - c.name_shm_id, c.name_shm_offset, name_size); - if (name == NULL) { - return error::kOutOfBounds; - } - std::string name_str(name, name_size); - DoBindAttribLocation(program, index, name_str.c_str()); - return error::kNoError; -} - error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) { GLuint program = static_cast<GLuint>(c.program); @@ -4793,21 +4778,6 @@ void GLES2DecoderImpl::DoBindUniformLocationCHROMIUM( } } -error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUM( - uint32 immediate_data_size, const cmds::BindUniformLocationCHROMIUM& c) { - GLuint program = static_cast<GLuint>(c.program); - GLint location = static_cast<GLint>(c.location); - uint32 name_size = c.data_size; - const char* name = GetSharedMemoryAs<const char*>( - c.name_shm_id, c.name_shm_offset, name_size); - if (name == NULL) { - return error::kOutOfBounds; - } - std::string name_str(name, name_size); - DoBindUniformLocationCHROMIUM(program, location, name_str.c_str()); - return error::kNoError; -} - error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( uint32 immediate_data_size, const cmds::BindUniformLocationCHROMIUMBucket& c) { @@ -6701,17 +6671,6 @@ error::Error GLES2DecoderImpl::ShaderSourceHelper( return error::kNoError; } -error::Error GLES2DecoderImpl::HandleShaderSource( - uint32 immediate_data_size, const cmds::ShaderSource& c) { - uint32 data_size = c.data_size; - const char* data = GetSharedMemoryAs<const char*>( - c.data_shm_id, c.data_shm_offset, data_size); - if (!data) { - return error::kOutOfBounds; - } - return ShaderSourceHelper(c.shader, data, data_size); -} - error::Error GLES2DecoderImpl::HandleShaderSourceBucket( uint32 immediate_data_size, const cmds::ShaderSourceBucket& c) { Bucket* bucket = GetBucket(c.data_bucket_id); @@ -7637,19 +7596,6 @@ error::Error GLES2DecoderImpl::GetAttribLocationHelper( error::Error GLES2DecoderImpl::HandleGetAttribLocation( uint32 immediate_data_size, const cmds::GetAttribLocation& c) { - uint32 name_size = c.data_size; - const char* name = GetSharedMemoryAs<const char*>( - c.name_shm_id, c.name_shm_offset, name_size); - if (!name) { - return error::kOutOfBounds; - } - std::string name_str(name, name_size); - return GetAttribLocationHelper( - c.program, c.location_shm_id, c.location_shm_offset, name_str); -} - -error::Error GLES2DecoderImpl::HandleGetAttribLocationBucket( - uint32 immediate_data_size, const cmds::GetAttribLocationBucket& c) { Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket) { return error::kInvalidArguments; @@ -7696,19 +7642,6 @@ error::Error GLES2DecoderImpl::GetUniformLocationHelper( error::Error GLES2DecoderImpl::HandleGetUniformLocation( uint32 immediate_data_size, const cmds::GetUniformLocation& c) { - uint32 name_size = c.data_size; - const char* name = GetSharedMemoryAs<const char*>( - c.name_shm_id, c.name_shm_offset, name_size); - if (!name) { - return error::kOutOfBounds; - } - std::string name_str(name, name_size); - return GetUniformLocationHelper( - c.program, c.location_shm_id, c.location_shm_offset, name_str); -} - -error::Error GLES2DecoderImpl::HandleGetUniformLocationBucket( - uint32 immediate_data_size, const cmds::GetUniformLocationBucket& c) { Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket) { return error::kInvalidArguments; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc index f851473..10f6af1 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc @@ -275,6 +275,26 @@ void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribiv, 0>( } }; +template <> +void GLES2DecoderTestBase::SpecializedSetup<cmds::RenderbufferStorage, 0>( + bool valid) { + DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, + kServiceRenderbufferId); + if (valid) { + EXPECT_CALL(*gl_, GetError()) + .WillOnce(Return(GL_NO_ERROR)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, + RenderbufferStorageEXT(GL_RENDERBUFFER, _, 3, 4)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, GetError()) + .WillOnce(Return(GL_NO_ERROR)) + .RetiresOnSaturation(); + } +} + + #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h" } // namespace gles2 diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h index 8d605c5..32e20d8 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h @@ -22,8 +22,6 @@ TEST_P(GLES2DecoderTest1, AttachShaderValidArgs) { EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_NO_ERROR, GetGLError()); } -// TODO(gman): BindAttribLocation - // TODO(gman): BindAttribLocationBucket TEST_P(GLES2DecoderTest1, BindBufferValidArgs) { @@ -348,12 +346,12 @@ TEST_P(GLES2DecoderTest1, ColorMaskValidArgs) { EXPECT_EQ(GL_NO_ERROR, GetGLError()); } // TODO(gman): CompileShader +// TODO(gman): CompressedTexImage2DBucket // TODO(gman): CompressedTexImage2D -// TODO(gman): CompressedTexImage2DBucket +// TODO(gman): CompressedTexSubImage2DBucket // TODO(gman): CompressedTexSubImage2D -// TODO(gman): CompressedTexSubImage2DBucket // TODO(gman): CopyTexImage2D TEST_P(GLES2DecoderTest1, CopyTexSubImage2DValidArgs) { @@ -899,8 +897,6 @@ TEST_P(GLES2DecoderTest1, GenTexturesImmediateInvalidArgs) { // TODO(gman): GetAttribLocation -// TODO(gman): GetAttribLocationBucket - TEST_P(GLES2DecoderTest1, GetBooleanvValidArgs) { EXPECT_CALL(*gl_, GetError()) .WillOnce(Return(GL_NO_ERROR)) @@ -1626,8 +1622,6 @@ TEST_P(GLES2DecoderTest1, GetTexParameterivInvalidArgs2_1) { // TODO(gman): GetUniformLocation -// TODO(gman): GetUniformLocationBucket - TEST_P(GLES2DecoderTest1, GetVertexAttribfvValidArgs) { SpecializedSetup<cmds::GetVertexAttribfv, 0>(true); typedef cmds::GetVertexAttribfv::Result Result; @@ -1913,4 +1907,49 @@ TEST_P(GLES2DecoderTest1, PolygonOffsetValidArgs) { } // TODO(gman): ReadPixels +// TODO(gman): ReleaseShaderCompiler + +TEST_P(GLES2DecoderTest1, RenderbufferStorageValidArgs) { + SpecializedSetup<cmds::RenderbufferStorage, 0>(true); + cmds::RenderbufferStorage cmd; + cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} + +TEST_P(GLES2DecoderTest1, RenderbufferStorageInvalidArgs0_0) { + EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); + SpecializedSetup<cmds::RenderbufferStorage, 0>(false); + cmds::RenderbufferStorage cmd; + cmd.Init(GL_FRAMEBUFFER, GL_RGBA4, 3, 4); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); +} + +TEST_P(GLES2DecoderTest1, RenderbufferStorageInvalidArgs2_0) { + EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); + SpecializedSetup<cmds::RenderbufferStorage, 0>(false); + cmds::RenderbufferStorage cmd; + cmd.Init(GL_RENDERBUFFER, GL_RGBA4, -1, 4); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); +} + +TEST_P(GLES2DecoderTest1, RenderbufferStorageInvalidArgs3_0) { + EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); + SpecializedSetup<cmds::RenderbufferStorage, 0>(false); + cmds::RenderbufferStorage cmd; + cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, -1); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); +} + +TEST_P(GLES2DecoderTest1, SampleCoverageValidArgs) { + EXPECT_CALL(*gl_, SampleCoverage(1, true)); + SpecializedSetup<cmds::SampleCoverage, 0>(true); + cmds::SampleCoverage cmd; + cmd.Init(1, true); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_ diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc index de52efe..221aa33 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc @@ -472,25 +472,6 @@ void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix4fvImmediate, 0>( }; template <> -void GLES2DecoderTestBase::SpecializedSetup<cmds::RenderbufferStorage, 0>( - bool valid) { - DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, - kServiceRenderbufferId); - if (valid) { - EXPECT_CALL(*gl_, GetError()) - .WillOnce(Return(GL_NO_ERROR)) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, - RenderbufferStorageEXT(GL_RENDERBUFFER, _, 3, 4)) - .Times(1) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetError()) - .WillOnce(Return(GL_NO_ERROR)) - .RetiresOnSaturation(); - } -}; - -template <> void GLES2DecoderTestBase::SpecializedSetup<cmds::TexParameterf, 0>( bool /* valid */) { DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h index cbff801..dd2cd0e 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h @@ -12,52 +12,6 @@ #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_ #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_ -// TODO(gman): ReleaseShaderCompiler - -TEST_P(GLES2DecoderTest2, RenderbufferStorageValidArgs) { - SpecializedSetup<cmds::RenderbufferStorage, 0>(true); - cmds::RenderbufferStorage cmd; - cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} - -TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs0_0) { - EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); - SpecializedSetup<cmds::RenderbufferStorage, 0>(false); - cmds::RenderbufferStorage cmd; - cmd.Init(GL_FRAMEBUFFER, GL_RGBA4, 3, 4); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); -} - -TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs2_0) { - EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); - SpecializedSetup<cmds::RenderbufferStorage, 0>(false); - cmds::RenderbufferStorage cmd; - cmd.Init(GL_RENDERBUFFER, GL_RGBA4, -1, 4); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -} - -TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs3_0) { - EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); - SpecializedSetup<cmds::RenderbufferStorage, 0>(false); - cmds::RenderbufferStorage cmd; - cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, -1); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -} - -TEST_P(GLES2DecoderTest2, SampleCoverageValidArgs) { - EXPECT_CALL(*gl_, SampleCoverage(1, true)); - SpecializedSetup<cmds::SampleCoverage, 0>(true); - cmds::SampleCoverage cmd; - cmd.Init(1, true); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} - TEST_P(GLES2DecoderTest2, ScissorValidArgs) { EXPECT_CALL(*gl_, Scissor(1, 2, 3, 4)); SpecializedSetup<cmds::Scissor, 0>(true); @@ -86,8 +40,6 @@ TEST_P(GLES2DecoderTest2, ScissorInvalidArgs3_0) { } // TODO(gman): ShaderBinary -// TODO(gman): ShaderSource - // TODO(gman): ShaderSourceBucket TEST_P(GLES2DecoderTest2, StencilFuncValidArgs) { @@ -749,8 +701,6 @@ TEST_P(GLES2DecoderTest2, PopGroupMarkerEXTValidArgs) { // TODO(gman): ProduceTextureDirectCHROMIUMImmediate // TODO(gman): ConsumeTextureCHROMIUMImmediate // TODO(gman): CreateAndConsumeTextureCHROMIUMImmediate -// TODO(gman): BindUniformLocationCHROMIUM - // TODO(gman): BindUniformLocationCHROMIUMBucket // TODO(gman): BindTexImage2DCHROMIUM // TODO(gman): ReleaseTexImage2DCHROMIUM @@ -763,4 +713,12 @@ TEST_P(GLES2DecoderTest2, PopGroupMarkerEXTValidArgs) { // TODO(gman): WaitAsyncTexImage2DCHROMIUM +// TODO(gman): WaitAllAsyncTexImage2DCHROMIUM + +// TODO(gman): DiscardFramebufferEXTImmediate +// TODO(gman): LoseContextCHROMIUM +// TODO(gman): InsertSyncPointCHROMIUM + +// TODO(gman): WaitSyncPointCHROMIUM + #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_ diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h index ce869a4..adbde49 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h @@ -12,14 +12,6 @@ #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_ #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_ -// TODO(gman): WaitAllAsyncTexImage2DCHROMIUM - -// TODO(gman): DiscardFramebufferEXTImmediate -// TODO(gman): LoseContextCHROMIUM -// TODO(gman): InsertSyncPointCHROMIUM - -// TODO(gman): WaitSyncPointCHROMIUM - // TODO(gman): DrawBuffersEXTImmediate // TODO(gman): DiscardBackbufferCHROMIUM diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc index ec7fd48..ce12382 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc @@ -691,57 +691,6 @@ TEST_P(GLES2DecoderTest, CompileShaderInvalidArgs) { #endif // GLES2_TEST_SHADER_VS_PROGRAM_IDS } -TEST_P(GLES2DecoderTest, ShaderSourceAndGetShaderSourceValidArgs) { - const uint32 kBucketId = 123; - const char kSource[] = "hello"; - const uint32 kSourceSize = sizeof(kSource) - 1; - memcpy(shared_memory_address_, kSource, kSourceSize); - ShaderSource cmd; - cmd.Init( - client_shader_id_, kSharedMemoryId, kSharedMemoryOffset, kSourceSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - memset(shared_memory_address_, 0, kSourceSize); - GetShaderSource get_cmd; - get_cmd.Init(client_shader_id_, kBucketId); - EXPECT_EQ(error::kNoError, ExecuteCmd(get_cmd)); - CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); - ASSERT_TRUE(bucket != NULL); - EXPECT_EQ(kSourceSize + 1, bucket->size()); - EXPECT_EQ( - 0, memcmp(bucket->GetData(0, bucket->size()), kSource, bucket->size())); -} - -TEST_P(GLES2DecoderTest, ShaderSourceInvalidArgs) { - const char kSource[] = "hello"; - const uint32 kSourceSize = sizeof(kSource) - 1; - memcpy(shared_memory_address_, kSource, kSourceSize); - ShaderSource cmd; - cmd.Init(kInvalidClientId, kSharedMemoryId, kSharedMemoryOffset, kSourceSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -#if GLES2_TEST_SHADER_VS_PROGRAM_IDS - cmd.Init( - client_program_id_, kSharedMemoryId, kSharedMemoryOffset, kSourceSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); -#endif // GLES2_TEST_SHADER_VS_PROGRAM_IDS - cmd.Init(client_shader_id_, - kInvalidSharedMemoryId, - kSharedMemoryOffset, - kSourceSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - cmd.Init(client_shader_id_, - kSharedMemoryId, - kInvalidSharedMemoryOffset, - kSourceSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - cmd.Init(client_shader_id_, - kSharedMemoryId, - kSharedMemoryOffset, - kSharedBufferSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); -} - TEST_P(GLES2DecoderTest, ShaderSourceBucketAndGetShaderSourceValidArgs) { const uint32 kInBucketId = 123; const uint32 kOutBucketId = 125; @@ -776,6 +725,13 @@ TEST_P(GLES2DecoderTest, ShaderSourceBucketInvalidArgs) { cmd.Init(kInvalidClientId, kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); +#if GLES2_TEST_SHADER_VS_PROGRAM_IDS + SetBucketAsCString(kBucketId, kSource); + cmd.Init( + client_program_id_, kBucketId); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); +#endif // GLES2_TEST_SHADER_VS_PROGRAM_IDS } TEST_P(GLES2DecoderTest, ShaderSourceStripComments) { @@ -845,67 +801,6 @@ TEST_P(GLES2DecoderWithShaderTest, Uniform1ivSamplerIsLimited) { EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); } -TEST_P(GLES2DecoderTest, BindAttribLocation) { - const GLint kLocation = 2; - const char* kName = "testing"; - const uint32 kNameSize = strlen(kName); - EXPECT_CALL(*gl_, - BindAttribLocation(kServiceProgramId, kLocation, StrEq(kName))) - .Times(1); - memcpy(shared_memory_address_, kName, kNameSize); - BindAttribLocation cmd; - cmd.Init(client_program_id_, - kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); -} - -TEST_P(GLES2DecoderTest, BindAttribLocationInvalidArgs) { - const GLint kLocation = 2; - const char* kName = "testing"; - const char* kBadName = "test\aing"; - const uint32 kNameSize = strlen(kName); - const uint32 kBadNameSize = strlen(kBadName); - EXPECT_CALL(*gl_, BindAttribLocation(_, _, _)).Times(0); - memcpy(shared_memory_address_, kName, kNameSize); - BindAttribLocation cmd; - cmd.Init(kInvalidClientId, - kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); - cmd.Init(client_program_id_, - kLocation, - kInvalidSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - cmd.Init(client_program_id_, - kLocation, - kSharedMemoryId, - kInvalidSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - cmd.Init(client_program_id_, - kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kSharedBufferSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - memcpy(shared_memory_address_, kBadName, kBadNameSize); - cmd.Init(client_program_id_, - kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kBadNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -} - TEST_P(GLES2DecoderTest, BindAttribLocationBucket) { const uint32 kBucketId = 123; const GLint kLocation = 2; @@ -940,116 +835,13 @@ TEST_P(GLES2DecoderTest, BindAttribLocationBucketInvalidArgs) { } TEST_P(GLES2DecoderWithShaderTest, GetAttribLocation) { - const uint32 kNameSize = strlen(kAttrib2Name); - const char* kNonExistentName = "foobar"; - const uint32 kNonExistentNameSize = strlen(kNonExistentName); - typedef GetAttribLocation::Result Result; - Result* result = GetSharedMemoryAs<Result*>(); - *result = -1; - char* name = GetSharedMemoryAsWithOffset<char*>(sizeof(*result)); - const uint32 kNameOffset = kSharedMemoryOffset + sizeof(*result); - memcpy(name, kAttrib2Name, kNameSize); - GetAttribLocation cmd; - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(kAttrib2Location, *result); - *result = -1; - memcpy(name, kNonExistentName, kNonExistentNameSize); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNonExistentNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); -} - -TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationInvalidArgs) { - const uint32 kNameSize = strlen(kAttrib2Name); - const char* kBadName = "foo\abar"; - const uint32 kBadNameSize = strlen(kBadName); - typedef GetAttribLocation::Result Result; - Result* result = GetSharedMemoryAs<Result*>(); - *result = -1; - char* name = GetSharedMemoryAsWithOffset<char*>(sizeof(*result)); - const uint32 kNameOffset = kSharedMemoryOffset + sizeof(*result); - memcpy(name, kAttrib2Name, kNameSize); - GetAttribLocation cmd; - cmd.Init(kInvalidClientId, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); - *result = -1; - cmd.Init(client_program_id_, - kInvalidSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kInvalidSharedMemoryOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kInvalidSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kInvalidSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kSharedBufferSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - memcpy(name, kBadName, kBadNameSize); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kBadNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -} - -TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationBucket) { const uint32 kBucketId = 123; const char* kNonExistentName = "foobar"; - typedef GetAttribLocationBucket::Result Result; + typedef GetAttribLocation::Result Result; Result* result = GetSharedMemoryAs<Result*>(); SetBucketAsCString(kBucketId, kAttrib2Name); *result = -1; - GetAttribLocationBucket cmd; + GetAttribLocation cmd; cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(kAttrib2Location, *result); @@ -1060,12 +852,12 @@ TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationBucket) { EXPECT_EQ(-1, *result); } -TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationBucketInvalidArgs) { +TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationInvalidArgs) { const uint32 kBucketId = 123; - typedef GetAttribLocationBucket::Result Result; + typedef GetAttribLocation::Result Result; Result* result = GetSharedMemoryAs<Result*>(); *result = -1; - GetAttribLocationBucket cmd; + GetAttribLocation cmd; // Check no bucket cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); @@ -1091,116 +883,13 @@ TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationBucketInvalidArgs) { } TEST_P(GLES2DecoderWithShaderTest, GetUniformLocation) { - const uint32 kNameSize = strlen(kUniform2Name); - const char* kNonExistentName = "foobar"; - const uint32 kNonExistentNameSize = strlen(kNonExistentName); - typedef GetUniformLocation::Result Result; - Result* result = GetSharedMemoryAs<Result*>(); - *result = -1; - char* name = GetSharedMemoryAsWithOffset<char*>(sizeof(*result)); - const uint32 kNameOffset = kSharedMemoryOffset + sizeof(*result); - memcpy(name, kUniform2Name, kNameSize); - GetUniformLocation cmd; - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(kUniform2FakeLocation, *result); - memcpy(name, kNonExistentName, kNonExistentNameSize); - *result = -1; - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNonExistentNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); -} - -TEST_P(GLES2DecoderWithShaderTest, GetUniformLocationInvalidArgs) { - const uint32 kNameSize = strlen(kUniform2Name); - const char* kBadName = "foo\abar"; - const uint32 kBadNameSize = strlen(kBadName); - typedef GetUniformLocation::Result Result; - Result* result = GetSharedMemoryAs<Result*>(); - *result = -1; - char* name = GetSharedMemoryAsWithOffset<char*>(sizeof(*result)); - const uint32 kNameOffset = kSharedMemoryOffset + sizeof(*result); - memcpy(name, kUniform2Name, kNameSize); - GetUniformLocation cmd; - cmd.Init(kInvalidClientId, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); - *result = -1; - cmd.Init(client_program_id_, - kInvalidSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kInvalidSharedMemoryOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kInvalidSharedMemoryId, - kSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kInvalidSharedMemoryOffset, - kNameSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kSharedBufferSize); - EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(-1, *result); - memcpy(name, kBadName, kBadNameSize); - cmd.Init(client_program_id_, - kSharedMemoryId, - kNameOffset, - kSharedMemoryId, - kSharedMemoryOffset, - kBadNameSize); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -} - -TEST_P(GLES2DecoderWithShaderTest, GetUniformLocationBucket) { const uint32 kBucketId = 123; const char* kNonExistentName = "foobar"; - typedef GetUniformLocationBucket::Result Result; + typedef GetUniformLocation::Result Result; Result* result = GetSharedMemoryAs<Result*>(); SetBucketAsCString(kBucketId, kUniform2Name); *result = -1; - GetUniformLocationBucket cmd; + GetUniformLocation cmd; cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(kUniform2FakeLocation, *result); @@ -1211,12 +900,12 @@ TEST_P(GLES2DecoderWithShaderTest, GetUniformLocationBucket) { EXPECT_EQ(-1, *result); } -TEST_P(GLES2DecoderWithShaderTest, GetUniformLocationBucketInvalidArgs) { +TEST_P(GLES2DecoderWithShaderTest, GetUniformLocationInvalidArgs) { const uint32 kBucketId = 123; - typedef GetUniformLocationBucket::Result Result; + typedef GetUniformLocation::Result Result; Result* result = GetSharedMemoryAs<Result*>(); *result = -1; - GetUniformLocationBucket cmd; + GetUniformLocation cmd; // Check no bucket cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); @@ -1241,65 +930,53 @@ TEST_P(GLES2DecoderWithShaderTest, GetUniformLocationBucketInvalidArgs) { EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); } -TEST_P(GLES2DecoderWithShaderTest, BindUniformLocationCHROMIUM) { +TEST_P(GLES2DecoderWithShaderTest, BindUniformLocationCHROMIUMBucket) { + const uint32 kBucketId = 123; const GLint kLocation = 2; const char* kName = "testing"; - const uint32 kNameSize = strlen(kName); const char* kBadName1 = "gl_testing"; - const uint32 kBadName1Size = strlen(kBadName1); const char* kBadName2 = "testing[1]"; - const uint32 kBadName2Size = strlen(kBadName2); - memcpy(shared_memory_address_, kName, kNameSize); - BindUniformLocationCHROMIUM cmd; + + SetBucketAsCString(kBucketId, kName); + BindUniformLocationCHROMIUMBucket cmd; cmd.Init(client_program_id_, kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); + kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_NO_ERROR, GetGLError()); // check negative location - memcpy(shared_memory_address_, kName, kNameSize); - cmd.Init( - client_program_id_, -1, kSharedMemoryId, kSharedMemoryOffset, kNameSize); + SetBucketAsCString(kBucketId, kName); + cmd.Init(client_program_id_, -1, kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); // check highest location - memcpy(shared_memory_address_, kName, kNameSize); + SetBucketAsCString(kBucketId, kName); GLint kMaxLocation = (kMaxFragmentUniformVectors + kMaxVertexUniformVectors) * 4 - 1; cmd.Init(client_program_id_, kMaxLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); + kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_NO_ERROR, GetGLError()); // check too high location - memcpy(shared_memory_address_, kName, kNameSize); + SetBucketAsCString(kBucketId, kName); cmd.Init(client_program_id_, kMaxLocation + 1, - kSharedMemoryId, - kSharedMemoryOffset, - kNameSize); + kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); // check bad name "gl_..." - memcpy(shared_memory_address_, kBadName1, kBadName1Size); + SetBucketAsCString(kBucketId, kBadName1); cmd.Init(client_program_id_, kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kBadName1Size); + kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); // check bad name "name[1]" non zero - memcpy(shared_memory_address_, kBadName2, kBadName2Size); + SetBucketAsCString(kBucketId, kBadName2); cmd.Init(client_program_id_, kLocation, - kSharedMemoryId, - kSharedMemoryOffset, - kBadName2Size); + kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); } |