diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 19:13:19 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 19:13:19 +0000 |
commit | b9849abfc2e081a1d85bd5eda2c5c1d2fd9e35a5 (patch) | |
tree | 6d191fbaf63c019cf01f2c53598c8756cd2f75df /gpu | |
parent | 76180ea4287b9458d97f8d547daf785bf136fba1 (diff) | |
download | chromium_src-b9849abfc2e081a1d85bd5eda2c5c1d2fd9e35a5.zip chromium_src-b9849abfc2e081a1d85bd5eda2c5c1d2fd9e35a5.tar.gz chromium_src-b9849abfc2e081a1d85bd5eda2c5c1d2fd9e35a5.tar.bz2 |
Merged in recent changes to command buffer code.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/434063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
19 files changed, 1956 insertions, 1477 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 04f9a7b..0d9a7e8 100644 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -95,7 +95,7 @@ GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLResourceId program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); GL_APICALL void GL_APIENTRY glGetActiveUniform (GLResourceId program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLResourceId program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLResourceId program, const char* name); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLResourceId program, const char* name); GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL GLenum GL_APIENTRY glGetError (void); @@ -114,7 +114,7 @@ GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum p GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetUniformfv (GLResourceId program, GLint location, GLfloat* params); GL_APICALL void GL_APIENTRY glGetUniformiv (GLResourceId program, GLint location, GLint* params); -GL_APICALL int GL_APIENTRY glGetUniformLocation (GLResourceId program, const char* name); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLResourceId program, const char* name); GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer); @@ -193,6 +193,8 @@ GL_APICALL void GL_APIENTRY glSwapBuffers (void); # be called directly. # cmd_args: The arguments to use for the command. This overrides generating # them based on the GL function arguments. +# a NonImmediate type is a type that stays a pointer even in +# and immediate version of acommand. # 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. @@ -205,11 +207,11 @@ _FUNCTION_INFO = { 'BindBuffer': {'DecoderFunc': 'DoBindBuffer'}, 'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'}, 'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'}, - 'BufferData': {'type': 'Data'}, + 'BufferData': {'type': 'Manual', 'immediate': True,}, 'BufferSubData': {'type': 'Data'}, 'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'}, 'ClearDepthf': {'DecoderFunc': 'glClearDepth'}, - 'CompressedTexImage2D': {'type': 'Data'}, + 'CompressedTexImage2D': {'type': 'Manual', 'immediate': True,}, 'CompressedTexSubImage2D': {'type': 'Data'}, 'CreateProgram': {'type': 'Create'}, 'CreateShader': {'type': 'Create'}, @@ -234,10 +236,16 @@ _FUNCTION_INFO = { 'GetActiveAttrib': {'type': 'Custom'}, 'GetActiveUniform': {'type': 'Custom'}, 'GetAttachedShaders': {'type': 'Custom'}, - 'GetAttribLocation': {'type': 'GetGLchar'}, + 'GetAttribLocation': { + 'type': 'HandWritten', + 'immediate': True, + 'needs_size': True, + 'cmd_args': + 'GLResourceId program, const char* name, NonImmediate GLint* location', + }, 'GetBooleanv': {'type': 'GETn'}, 'GetBufferParameteriv': {'type': 'GETn'}, - 'GetError': {'type': 'Is'}, + 'GetError': {'type': 'Is', 'DecoderFunc': 'GetGLError'}, 'GetFloatv': {'type': 'GETn'}, 'GetFramebufferAttachmentParameteriv': { 'type': 'GETn', @@ -258,7 +266,13 @@ _FUNCTION_INFO = { 'GetTexParameteriv': {'type': 'GETn'}, 'GetUniformfv': {'type': 'Custom', 'immediate': False}, 'GetUniformiv': {'type': 'Custom', 'immediate': False}, - 'GetUniformLocation': {'type': 'GetGLchar'}, + 'GetUniformLocation': { + 'type': 'HandWritten', + 'immediate': True, + 'needs_size': True, + 'cmd_args': + 'GLResourceId program, const char* name, NonImmediate GLint* location', + }, 'GetVertexAttribfv': {'type': 'GETn'}, 'GetVertexAttribiv': {'type': 'GETn'}, 'GetVertexAttribPointerv': {'type': 'Custom', 'immediate': False}, @@ -269,7 +283,7 @@ _FUNCTION_INFO = { 'IsRenderbuffer': {'type': 'Is', 'DecoderFunc': 'glIsRenderbufferEXT'}, 'IsShader': {'type': 'Is'}, 'IsTexture': {'type': 'Is'}, - 'PixelStorei': {'type': 'Custom'}, + 'PixelStorei': {'type': 'Manual'}, 'RenderbufferStorage': {'DecoderFunc': 'glRenderbufferStorageEXT'}, 'ReadPixels': {'type': 'Custom', 'immediate': False}, 'ReleaseShaderCompiler': {'type': 'Noop'}, @@ -281,7 +295,7 @@ _FUNCTION_INFO = { 'cmd_args': 'GLuint shader, GLsizei count, const char* data', }, - 'TexImage2D': {'type': 'Data'}, + 'TexImage2D': {'type': 'Manual', 'immediate': True}, 'TexParameterfv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 1}, 'TexParameteriv': {'type': 'PUT', 'data_type': 'GLint', 'count': 1}, 'TexSubImage2D': {'type': 'Data'}, @@ -381,7 +395,7 @@ class TypeHandler(object): def InitFunction(self, func): """Add or adjust anything type specific for this function.""" if func.GetInfo('needs_size'): - func.AddCmdArg(CmdArg('data_size', 'uint32')) + func.AddCmdArg(Argument('data_size', 'uint32')) def AddImmediateFunction(self, generator, func): """Adds an immediate version of a function.""" @@ -391,10 +405,44 @@ class TypeHandler(object): if func.num_pointer_args == 1 or immediate: generator.AddFunction(ImmediateFunction(func)) + def WriteStruct(self, func, file): + """Writes a structure that matches the arguments to a function.""" + file.Write("struct %s {\n" % func.name) + file.Write(" typedef %s ValueType;\n" % func.name) + file.Write(" static const CommandId kCmdId = k%s;\n" % func.name) + func.WriteCmdArgFlag(file) + file.Write("\n") + + func.WriteCmdComputeSize(file) + func.WriteCmdSetHeader(file) + func.WriteCmdInit(file) + func.WriteCmdSet(file) + + file.Write(" command_buffer::CommandHeader header;\n") + args = func.GetCmdArgs() + for arg in args: + file.Write(" %s %s;\n" % (arg.cmd_type, arg.name)) + file.Write("};\n") + file.Write("\n") + + size = len(args) * _SIZE_OF_UINT32 + _SIZE_OF_COMMAND_HEADER + file.Write("COMPILE_ASSERT(sizeof(%s) == %d,\n" % (func.name, size)) + file.Write(" Sizeof_%s_is_not_%d);\n" % (func.name, size)) + file.Write("COMPILE_ASSERT(offsetof(%s, header) == 0,\n" % func.name) + file.Write(" OffsetOf_%s_header_not_0);\n" % func.name) + offset = _SIZE_OF_COMMAND_HEADER + for arg in args: + file.Write("COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" % + (func.name, arg.name, offset)) + file.Write(" OffsetOf_%s_%s_not_%d);\n" % + (func.name, arg.name, offset)) + offset += _SIZE_OF_UINT32 + file.Write("\n") + def WriteHandlerImplementation(self, func, file): """Writes the handler implementation for this command.""" file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -461,7 +509,7 @@ class TypeHandler(object): """Writes the handler impl for the immediate version of a command.""" file.Write(" // Immediate version.\n") file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -474,7 +522,7 @@ class TypeHandler(object): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) for arg in func.GetOriginalArgs(): arg.WriteGetCode(file) func.WriteHandlerImplementation(file) @@ -487,7 +535,7 @@ class TypeHandler(object): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) for arg in func.GetOriginalArgs(): arg.WriteGetCode(file) func.WriteHandlerImplementation(file) @@ -565,6 +613,16 @@ class TypeHandler(object): file.Write(" }\n") file.Write("\n") + def WriteCmdHelper(self, func, file): + """Writes the cmd helper definition for a cmd.""" + args = func.MakeCmdArgString("") + file.Write(" void %s(%s) {\n" % + (func.name, func.MakeTypedCmdArgString(""))) + file.Write(" gles2::%s& c = GetCmdSpace<gles2::%s>();\n" % + (func.name, func.name)) + file.Write(" c.Init(%s);\n" % args) + file.Write(" }\n\n") + def WriteImmediateCmdHelper(self, func, file): """Writes the cmd helper definition for the immediate version of a cmd.""" args = func.MakeCmdArgString("") @@ -590,7 +648,7 @@ class CustomHandler(TypeHandler): def WriteImmediateCmdGetTotalSize(self, func, file): """Overrriden from TypeHandler.""" - file.Write(" uint32 total_size = 0; // TODO(gman): get correct size.") + file.Write(" uint32 total_size = 0; // TODO(gman): get correct size.\n") def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" @@ -624,8 +682,49 @@ class TodoHandler(CustomHandler): pass +class HandWrittenHandler(CustomHandler): + """Handler for comands where everything must be written by hand.""" + + def InitFunction(self, func): + """Add or adjust anything type specific for this function.""" + CustomHandler.InitFunction(self, func) + func.can_auto_generate = False + + def WriteStruct(self, func, file): + """Overrriden from TypeHandler.""" + pass + + def WriteServiceImplementation(self, func, file): + """Overrriden from TypeHandler.""" + pass + + def WriteImmediateServiceImplementation(self, func, file): + """Overrriden from TypeHandler.""" + pass + + def WriteGLES2ImplementationImpl(self, func, file): + """Overrriden from TypeHandler.""" + pass + + def WriteImmediateCmdHelper(self, func, file): + """Overrriden from TypeHandler.""" + pass + + def WriteCmdHelper(self, func, file): + """Overrriden from TypeHandler.""" + pass + + def WriteFormatTest(self, func, file): + """Overrriden from TypeHandler.""" + file.Write("// TODO(gman): Write test for %s\n" % func.name) + + def WriteImmediateFormatTest(self, func, file): + """Overrriden from TypeHandler.""" + file.Write("// TODO(gman): Write test for %s\n" % func.name) + + class ManualHandler(CustomHandler): - """Handler for commands that must be written by hand.""" + """Handler for commands who's handlers must be written by hand.""" def __init__(self): CustomHandler.__init__(self) @@ -673,7 +772,7 @@ class DataHandler(CustomHandler): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) for arg in func.GetCmdArgs(): arg.WriteGetCode(file) @@ -763,7 +862,7 @@ class GENnHandler(TypeHandler): def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -774,7 +873,7 @@ class GENnHandler(TypeHandler): def WriteImmediateHandlerImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -898,13 +997,13 @@ class CreateHandler(TypeHandler): def InitFunction(self, func): """Overrriden from TypeHandler.""" - func.AddCmdArg(CmdArg("client_id", 'uint32')) + func.AddCmdArg(Argument("client_id", 'uint32')) def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 client_id = c.client_id;\n") file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -939,7 +1038,7 @@ class DELnHandler(TypeHandler): def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -950,7 +1049,7 @@ class DELnHandler(TypeHandler): def WriteImmediateHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -1081,7 +1180,7 @@ class GETnHandler(TypeHandler): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() all_but_last_args = func.GetOriginalArgs()[:-1] @@ -1106,13 +1205,14 @@ class GETnHandler(TypeHandler): all_but_last_args = func.GetOriginalArgs()[:-1] arg_string = ( ", ".join(["%s" % arg.name for arg in all_but_last_args])) - file.Write(" helper_->%s(%s, shared_memory_.GetId(), 0);\n" % + file.Write(" helper_->%s(%s, result_shm_id(), result_shm_offset());\n" % (func.name, arg_string)) - file.Write(" int32 token = helper_->InsertToken();\n") - file.Write(" helper_->WaitForToken(token);\n") + file.Write(" WaitForCmd();\n") file.Write(" GLsizei num_values = util_.GLGetNumValuesReturned(pname);\n") - file.Write(" memcpy(params, shared_memory_.GetAddress(0),\n") - file.Write(" num_values * sizeof(*params));\n") + file.Write( + " DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult);\n") + file.Write( + " memcpy(params, result_buffer_, num_values * sizeof(*params));\n") file.Write("}\n") file.Write("\n") @@ -1130,7 +1230,7 @@ class PUTHandler(TypeHandler): def WriteImmediateValidationCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" if (!CheckImmediateDataSize<%s>(" - "arg_count, 1, sizeof(%s), %d)) {\n" % + "immediate_data_size, 1, sizeof(%s), %d)) {\n" % (func.name, func.info.data_type, func.info.count)) file.Write(" return parse_error::kParseOutOfBounds;\n") file.Write(" }\n") @@ -1259,7 +1359,7 @@ class PUTnHandler(TypeHandler): def WriteImmediateValidationCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" if (!CheckImmediateDataSize<%s>(" - "arg_count, count, sizeof(%s), %d)) {\n" % + "immediate_data_size, count, sizeof(%s), %d)) {\n" % (func.name, func.info.data_type, func.info.count)) file.Write(" return parse_error::kParseOutOfBounds;\n") file.Write(" }\n") @@ -1387,14 +1487,14 @@ class GLcharHandler(TypeHandler): def InitFunction(self, func): """Overrriden from TypeHandler.""" - func.AddCmdArg(CmdArg('data_size', 'uint32')) + func.AddCmdArg(Argument('data_size', 'uint32')) def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() all_but_last_arg = func.GetOriginalArgs()[:-1] @@ -1407,7 +1507,7 @@ class GLcharHandler(TypeHandler): file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" % (last_arg.name, last_arg.name)) file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -1425,7 +1525,7 @@ class GLcharHandler(TypeHandler): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() all_but_last_arg = func.GetOriginalArgs()[:-1] @@ -1435,10 +1535,10 @@ class GLcharHandler(TypeHandler): file.Write(" uint32 name_size = c.data_size;\n") file.Write( " const char* name = GetImmediateDataAs<const char*>(c);\n") - file.Write(" // TODO(gman): Make sure validate checks arg_count\n") - file.Write(" // covers data_size.\n") + file.Write(" // TODO(gman): Make sure validate checks\n") + file.Write(" // immediate_data_size covers data_size.\n") file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -1565,10 +1665,10 @@ class GetGLcharHandler(GLcharHandler): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() - all_but_last_arg = func.GetOriginalArgs()[:-1] + all_but_last_arg = func.GetOriginalArgs() for arg in all_but_last_arg: arg.WriteGetCode(file) @@ -1577,17 +1677,20 @@ class GetGLcharHandler(GLcharHandler): last_arg.type) file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" % (last_arg.name, last_arg.name)) + file.Write(" GLint* location = GetSharedMemoryAs<GLint*>(\n") + file.Write( + " c.location_shm_id, c.location_shm_offset, sizeof(*location));\n") + file.Write(" // TODO(gman): Validate location.\n") file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") file.Write(" }\n") arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) file.Write(" String name_str(name, name_size);\n") - file.Write(" GLint location = %s(%s, name_str.c_str());\n" % + file.Write(" *location = %s(%s, name_str.c_str());\n" % (func.GetGLFunctionName(), arg_string)) - file.Write(" DCHECK(false); // TODO: return result.\n") file.Write(" return parse_error::kParseNoError;\n") file.Write("}\n") file.Write("\n") @@ -1597,7 +1700,7 @@ class GetGLcharHandler(GLcharHandler): file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() all_but_last_arg = func.GetOriginalArgs()[:-1] @@ -1607,19 +1710,22 @@ class GetGLcharHandler(GLcharHandler): file.Write(" uint32 name_size = c.data_size;\n") file.Write( " const char* name = GetImmediateDataAs<const char*>(c);\n") - file.Write(" // TODO(gman): Make sure validate checks arg_count\n") - file.Write(" // covers data_size.\n") + file.Write(" // TODO(gman): Make sure validate checks\n") + file.Write(" // immediate_data_size covers data_size.\n") + file.Write(" GLint* location = GetSharedMemoryAs<GLint*>(\n") + file.Write( + " c.location_shm_id, c.location_shm_offset, sizeof(*location));\n") + file.Write(" // TODO(gman): Validate location.\n") file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") file.Write(" }\n") arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) file.Write(" String name_str(name, name_size);\n") - file.Write(" GLint location = %s(%s, name_str.c_str());\n" % + file.Write(" *location = %s(%s, name_str.c_str());\n" % (func.GetGLFunctionName(), arg_string)) - file.Write(" DCHECK(false); // TODO: return result.\n") file.Write(" return parse_error::kParseNoError;\n") file.Write("}\n") file.Write("\n") @@ -1665,26 +1771,23 @@ class GetGLcharHandler(GLcharHandler): def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" - last_arg = func.GetLastOriginalArg() - file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) - file.Write(" SetHeader(_%s);\n" % last_arg.name) - args = func.GetCmdArgs()[:-1] + file.Write(" void Init(%s) {\n" % func.MakeTypedInitString("_")) + file.Write(" SetHeader(_name);\n") + args = func.GetInitArgs() for arg in args: file.Write(" %s = _%s;\n" % (arg.name, arg.name)) - file.Write(" data_size = strlen(_%s);\n" % last_arg.name) - file.Write(" memcpy(ImmediateDataAddress(this), _%s, data_size);\n" % - last_arg.name) + file.Write(" data_size = ComputeDataSize(_name);\n") + file.Write(" memcpy(ImmediateDataAddress(this), _name, data_size);\n") file.Write(" }\n") file.Write("\n") def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" - last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % - func.MakeTypedOriginalArgString("_", True)) + func.MakeTypedInitString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % - func.MakeOriginalArgString("_")) - file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) + func.MakeInitString("_")) + file.Write(" const uint32 size = ComputeSize(_name);\n") file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") file.Write(" }\n") @@ -1692,16 +1795,14 @@ class GetGLcharHandler(GLcharHandler): def WriteImmediateCmdHelper(self, func, file): """Overrriden from TypeHandler.""" - args = func.MakeOriginalArgString("") - last_arg = func.GetLastOriginalArg() file.Write(" void %s(%s) {\n" % - (func.name, func.MakeTypedOriginalArgString(""))) - file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % - (func.name, last_arg.name)) + (func.name, func.MakeTypedCmdArgString(""))) + file.Write(" const uint32 size = gles2::%s::ComputeSize(name);\n" % + func.name) file.Write(" gles2::%s& c = GetImmediateCmdSpaceTotalSize<gles2::%s>(" "size);\n" % (func.name, func.name)) - file.Write(" c.Init(%s);\n" % args) + file.Write(" c.Init(%s);\n" % func.MakeCmdArgString("")) file.Write(" }\n\n") def WriteImmediateFormatTest(self, func, file): @@ -1741,15 +1842,15 @@ class IsHandler(TypeHandler): def InitFunction(self, func): """Overrriden from TypeHandler.""" - func.AddCmdArg(CmdArg("result_shm_id", 'uint32')) - func.AddCmdArg(CmdArg("result_shm_offset", 'uint32')) + func.AddCmdArg(Argument("result_shm_id", 'uint32')) + func.AddCmdArg(Argument("result_shm_offset", 'uint32')) def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( - " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) + " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() for arg in args: arg.WriteGetCode(file) @@ -1759,7 +1860,7 @@ class IsHandler(TypeHandler): file.Write( " c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));\n") file.Write(" parse_error::ParseError result =\n") - file.Write(" Validate%s(this, arg_count%s);\n" % + file.Write(" Validate%s(this, immediate_data_size%s);\n" % (func.name, func.MakeOriginalArgString("", True))) file.Write(" if (result != parse_error::kParseNoError) {\n") file.Write(" return result;\n") @@ -1779,11 +1880,10 @@ class IsHandler(TypeHandler): comma = "" if len(arg_string) > 0: comma = ", " - file.Write(" helper_->%s(%s%sshared_memory_.GetId(), 0);\n" % + file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) - file.Write(" int32 token = helper_->InsertToken();\n") - file.Write(" helper_->WaitForToken(token);\n") - file.Write(" return *shared_memory_.GetAddressAs<%s*>(0);\n" % + file.Write(" WaitForCmd();\n") + file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n") @@ -1816,8 +1916,9 @@ class FunctionInfo(object): self.type = '' -class CmdArg(object): - """A class used to represent arguments at the command buffer level.""" +class Argument(object): + """A class that represents a function argument.""" + cmd_type_map_ = { 'GLfloat': 'float', 'GLclampf': 'float', @@ -1832,21 +1933,17 @@ class CmdArg(object): else: self.cmd_type = 'uint32' - def WriteGetCode(self, file): - file.Write(" %s %s = static_cast<%s>(c.%s);\n" % - (self.type, self.name, self.type, self.name)) - - -class Argument(object): - """A class that represents a function argument.""" - - def __init__(self, name, type): - self.name = name - self.type = type + def IsPointer(self): + """Returns true if argument is a pointer.""" + return False def AddCmdArgs(self, args): """Adds command arguments for this argument to the given list.""" - return args.append(CmdArg(self.name, self.type)) + return args.append(self) + + def AddInitArgs(self, args): + """Adds init arguments for this argument to the given list.""" + return args.append(self) def WriteGetCode(self, file): """Writes the code to get an argument from a command structure.""" @@ -1902,10 +1999,14 @@ class PointerArgument(Argument): def __init__(self, name, type): Argument.__init__(self, name, type) + def IsPointer(self): + """Returns true if argument is a pointer.""" + return True + def AddCmdArgs(self, args): """Overridden from Argument.""" - args.append(CmdArg("%s_shm_id" % self.name, 'uint32')) - args.append(CmdArg("%s_shm_offset" % self.name, 'uint32')) + args.append(Argument("%s_shm_id" % self.name, 'uint32')) + args.append(Argument("%s_shm_offset" % self.name, 'uint32')) def WriteGetCode(self, file): """Overridden from Argument.""" @@ -1936,6 +2037,21 @@ class PointerArgument(Argument): return ImmediatePointerArgument(self.name, self.type) +class NonImmediatePointerArgument(PointerArgument): + """A pointer argument that stays a pointer even in an immediate cmd.""" + + def __init__(self, name, type): + PointerArgument.__init__(self, name, type) + + def IsPointer(self): + """Returns true if argument is a pointer.""" + return False + + def GetImmediateVersion(self): + """Overridden from Argument.""" + return self + + class ResourceIdArgument(Argument): """A class that represents a resource id argument to a function.""" @@ -1957,7 +2073,7 @@ class Function(object): """A class that represents a function.""" def __init__(self, name, info, return_type, original_args, args_for_cmds, - cmd_args, num_pointer_args): + cmd_args, init_args, num_pointer_args): self.name = name self.original_name = name self.info = info @@ -1967,6 +2083,7 @@ class Function(object): self.num_pointer_args = num_pointer_args self.can_auto_generate = num_pointer_args == 0 and return_type == "void" self.cmd_args = cmd_args + self.init_args = init_args self.args_for_cmds = args_for_cmds self.type_handler.InitFunction(self) @@ -1994,6 +2111,10 @@ class Function(object): """Gets the command args for this function.""" return self.cmd_args + def GetInitArgs(self): + """Gets the init args for this function.""" + return self.init_args + def GetOriginalArgs(self): """Gets the original arguments to this function.""" return self.original_args @@ -2037,6 +2158,20 @@ class Function(object): ["%s%s" % (prefix, arg.name) for arg in args]) return self.__GetArgList(arg_string, add_comma) + def MakeTypedInitString(self, prefix, add_comma = False): + """Gets a typed list of arguments as they need to be for cmd Init/Set.""" + args = self.GetInitArgs() + arg_string = ", ".join( + ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) + return self.__GetArgList(arg_string, add_comma) + + def MakeInitString(self, prefix, add_comma = False): + """Gets the list of arguments as they need to be for cmd Init/Set.""" + args = self.GetInitArgs() + arg_string = ", ".join( + ["%s%s" % (prefix, arg.name) for arg in args]) + return self.__GetArgList(arg_string, add_comma) + def WriteHandlerImplementation(self, file): """Writes the handler implementation for this command.""" self.type_handler.WriteHandlerImplementation(self, file) @@ -2085,48 +2220,11 @@ class Function(object): file.Write("\n") def WriteStruct(self, file): - """Writes a structure that matched the arguments to the function.""" - file.Write("struct %s {\n" % self.name) - file.Write(" typedef %s ValueType;\n" % self.name) - file.Write(" static const CommandId kCmdId = k%s;\n" % self.name) - self.WriteCmdArgFlag(file) - file.Write("\n") - - self.WriteCmdComputeSize(file) - self.WriteCmdSetHeader(file) - self.WriteCmdInit(file) - self.WriteCmdSet(file) - - file.Write(" command_buffer::CommandHeader header;\n") - args = self.GetCmdArgs() - for arg in args: - file.Write(" %s %s;\n" % (arg.cmd_type, arg.name)) - file.Write("};\n") - file.Write("\n") - - size = len(args) * _SIZE_OF_UINT32 + _SIZE_OF_COMMAND_HEADER - file.Write("COMPILE_ASSERT(sizeof(%s) == %d,\n" % (self.name, size)) - file.Write(" Sizeof_%s_is_not_%d);\n" % (self.name, size)) - file.Write("COMPILE_ASSERT(offsetof(%s, header) == 0,\n" % self.name) - file.Write(" OffsetOf_%s_header_not_0);\n" % self.name) - offset = _SIZE_OF_COMMAND_HEADER - for arg in args: - file.Write("COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" % - (self.name, arg.name, offset)) - file.Write(" OffsetOf_%s_%s_not_%d);\n" % - (self.name, arg.name, offset)) - offset += _SIZE_OF_UINT32 - file.Write("\n") + self.type_handler.WriteStruct(self, file) def WriteCmdHelper(self, file): """Writes the cmd's helper.""" - args = self.MakeCmdArgString("") - file.Write(" void %s(%s) {\n" % - (self.name, self.MakeTypedCmdArgString(""))) - file.Write(" gles2::%s& c = GetCmdSpace<gles2::%s>();\n" % - (self.name, self.name)) - file.Write(" c.Init(%s);\n" % args) - file.Write(" }\n\n") + self.type_handler.WriteCmdHelper(self, file) def WriteServiceImplementation(self, file): """Writes the service implementation for a command.""" @@ -2163,6 +2261,10 @@ class ImmediateFunction(Function): new_args_for_cmds.append(new_arg) new_arg.AddCmdArgs(cmd_args) + new_init_args = [] + for arg in new_args_for_cmds: + arg.AddInitArgs(new_init_args) + Function.__init__( self, "%sImmediate" % func.name, @@ -2171,6 +2273,7 @@ class ImmediateFunction(Function): new_args, new_args_for_cmds, cmd_args, + new_init_args, 0) self.original_name = func.name @@ -2215,6 +2318,32 @@ class ImmediateFunction(Function): self.type_handler.WriteImmediateFormatTest(self, file) +def CreateArg(arg_string): + """Creates an Argument.""" + arg_parts = arg_string.split() + if len(arg_parts) == 1 and arg_parts[0] == 'void': + return None + # Is this a pointer argument? + elif arg_string.find('*') >= 0: + if arg_parts[0] == 'NonImmediate': + return NonImmediatePointerArgument( + arg_parts[-1], + " ".join(arg_parts[1:-1])) + else: + return PointerArgument( + arg_parts[-1], + " ".join(arg_parts[0:-1])) + # Is this a resource argument? Must come after pointer check. + elif arg_parts[0] == 'GLResourceId': + return ResourceIdArgument( + arg_parts[-1], + " ".join(arg_parts[0:-1])) + else: + return Argument( + arg_parts[-1], + " ".join(arg_parts[0:-1])) + + class GLGenerator(object): """A class to generate GL command buffers.""" @@ -2238,6 +2367,7 @@ class GLGenerator(object): 'GETn': GETnHandler(), 'GetGLchar': GetGLcharHandler(), 'GLchar': GLcharHandler(), + 'HandWritten': HandWrittenHandler(), 'Is': IsHandler(), 'Manual': ManualHandler(), 'PUT': PUTHandler(), @@ -2309,25 +2439,12 @@ class GLGenerator(object): args = [] num_pointer_args = 0 parts = arg_string.split(',') - for arg in parts: - arg_parts = arg.split() - if len(arg_parts) == 1 and arg_parts[0] == 'void': - pass - # Is this a pointer argument? - elif arg.find('*') >= 0: - num_pointer_args += 1 - args.append(PointerArgument( - arg_parts[-1], - " ".join(arg_parts[0:-1]))) - # Is this a resource argument? Must come after pointer check. - elif arg_parts[0] == 'GLResourceId': - args.append(ResourceIdArgument( - arg_parts[-1], - " ".join(arg_parts[0:-1]))) - else: - args.append(Argument( - arg_parts[-1], - " ".join(arg_parts[0:-1]))) + for arg_string in parts: + arg = CreateArg(arg_string) + if arg: + args.append(arg) + if arg.IsPointer(): + num_pointer_args += 1 return (args, num_pointer_args) def ParseGLH(self, filename): @@ -2348,8 +2465,14 @@ class GLGenerator(object): cmd_args = [] for arg in args_for_cmds: arg.AddCmdArgs(cmd_args) + init_args = [] + for arg in args_for_cmds: + arg.AddInitArgs(init_args) + return_arg = CreateArg(return_type + " result") + if return_arg: + init_args.append(return_arg) f = Function(func_name, func_info, return_type, args, args_for_cmds, - cmd_args, num_pointer_args) + cmd_args, init_args, num_pointer_args) self.original_functions.append(f) self.AddFunction(f) f.type_handler.AddImmediateFunction(self, f) @@ -2473,8 +2596,9 @@ class GLGenerator(object): file.Write("\n") for func in self.functions: file.Write("parse_error::ParseError Validate%s(\n" % func.name) - file.Write(" GLES2Decoder* decoder, unsigned int arg_count%s) {\n" % - func.MakeTypedOriginalArgString("", True)) + file.Write( + " GLES2Decoder* decoder, uint32 immediate_data_size%s) {\n" % + func.MakeTypedOriginalArgString("", True)) for arg in func.GetOriginalArgs(): arg.WriteValidationCode(file) func.WriteValidationCode(file) diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index c03a350..76f0973 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -214,7 +214,7 @@ void GLES2GetAttachedShaders( GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { gles2::GetGLContext()->GetAttachedShaders(program, maxcount, count, shaders); } -int GLES2GetAttribLocation(GLuint program, const char* name) { +GLint GLES2GetAttribLocation(GLuint program, const char* name) { return gles2::GetGLContext()->GetAttribLocation(program, name); } void GLES2GetBooleanv(GLenum pname, GLboolean* params) { @@ -280,7 +280,7 @@ void GLES2GetUniformfv(GLuint program, GLint location, GLfloat* params) { void GLES2GetUniformiv(GLuint program, GLint location, GLint* params) { gles2::GetGLContext()->GetUniformiv(program, location, params); } -int GLES2GetUniformLocation(GLuint program, const char* name) { +GLint GLES2GetUniformLocation(GLuint program, const char* name) { return gles2::GetGLContext()->GetUniformLocation(program, name); } void GLES2GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { diff --git a/gpu/command_buffer/client/gles2_cmd_helper.h b/gpu/command_buffer/client/gles2_cmd_helper.h index 9a1a741..fbb1ce1 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper.h +++ b/gpu/command_buffer/client/gles2_cmd_helper.h @@ -25,6 +25,46 @@ class GLES2CmdHelper : public CommandBufferHelper { // file instead of having to edit some template or the code generator. #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h" + // 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::GetAttribLocation& c = GetCmdSpace<gles2::GetAttribLocation>(); + c.Init( + program, name_shm_id, name_shm_offset, location_shm_id, + location_shm_offset, data_size); + } + + void GetAttribLocationImmediate( + GLuint program, const char* name, + uint32 location_shm_id, uint32 location_shm_offset) { + const uint32 size = gles2::GetAttribLocationImmediate::ComputeSize(name); + gles2::GetAttribLocationImmediate& c = + GetImmediateCmdSpaceTotalSize<gles2::GetAttribLocationImmediate>(size); + c.Init(program, name, 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::GetUniformLocation& c = GetCmdSpace<gles2::GetUniformLocation>(); + c.Init( + program, name_shm_id, name_shm_offset, location_shm_id, + location_shm_offset, data_size); + } + + void GetUniformLocationImmediate( + GLuint program, const char* name, + uint32 location_shm_id, uint32 location_shm_offset) { + const uint32 size = gles2::GetUniformLocationImmediate::ComputeSize(name); + gles2::GetUniformLocationImmediate& c = + GetImmediateCmdSpaceTotalSize<gles2::GetUniformLocationImmediate>(size); + c.Init(program, name, location_shm_id, location_shm_offset); + } + + private: DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper); }; diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 1cfee5b..f05c14b 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -450,20 +450,6 @@ shaders_shm_offset); } - void GetAttribLocation( - GLuint program, uint32 name_shm_id, uint32 name_shm_offset, - uint32 data_size) { - gles2::GetAttribLocation& c = GetCmdSpace<gles2::GetAttribLocation>(); - c.Init(program, name_shm_id, name_shm_offset, data_size); - } - - void GetAttribLocationImmediate(GLuint program, const char* name) { - const uint32 size = gles2::GetAttribLocationImmediate::ComputeSize(name); - gles2::GetAttribLocationImmediate& c = - GetImmediateCmdSpaceTotalSize<gles2::GetAttribLocationImmediate>(size); - c.Init(program, name); - } - void GetBooleanv( GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) { gles2::GetBooleanv& c = GetCmdSpace<gles2::GetBooleanv>(); @@ -599,21 +585,6 @@ c.Init(program, location, params_shm_id, params_shm_offset); } - void GetUniformLocation( - GLuint program, uint32 name_shm_id, uint32 name_shm_offset, - uint32 data_size) { - gles2::GetUniformLocation& c = GetCmdSpace<gles2::GetUniformLocation>(); - c.Init(program, name_shm_id, name_shm_offset, data_size); - } - - void GetUniformLocationImmediate(GLuint program, const char* name) { - const uint32 size = gles2::GetUniformLocationImmediate::ComputeSize(name); - gles2::GetUniformLocationImmediate& c = - GetImmediateCmdSpaceTotalSize<gles2::GetUniformLocationImmediate>( - size); - c.Init(program, name); - } - void GetVertexAttribfv( GLuint index, GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) { diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc index 04419c3..1595ea3 100644 --- a/gpu/command_buffer/client/gles2_demo.cc +++ b/gpu/command_buffer/client/gles2_demo.cc @@ -73,10 +73,18 @@ bool GLES2Demo::Setup(NPP npp, void* hwnd, int32 size) { size_t transfer_buffer_size = 512 * 1024; int32 transfer_buffer_id = command_buffer->CreateTransferBuffer(transfer_buffer_size); - void* transfer_buffer = + ::base::SharedMemory* shared_memory = command_buffer->GetTransferBuffer(transfer_buffer_id); + if (!shared_memory->Map(transfer_buffer_size)) { + return false; + } + void* transfer_buffer = shared_memory->memory(); + if (!transfer_buffer) { + return false; + } gles2::g_gl_impl = new GLES2Implementation(helper, + transfer_buffer_size, transfer_buffer, transfer_buffer_id); diff --git a/gpu/command_buffer/client/gles2_demo_c.c b/gpu/command_buffer/client/gles2_demo_c.c index 44b2c57..2f54bd1 100644 --- a/gpu/command_buffer/client/gles2_demo_c.c +++ b/gpu/command_buffer/client/gles2_demo_c.c @@ -9,7 +9,7 @@ #include "gpu/command_buffer/client/gles2_demo_c.h" void GLFromCTestFunction() { - glClear(GL_COLOR_BUFFER_BIT); + // glClear(GL_COLOR_BUFFER_BIT); } diff --git a/gpu/command_buffer/client/gles2_demo_cc.cc b/gpu/command_buffer/client/gles2_demo_cc.cc index d7a023c..ba5e618 100644 --- a/gpu/command_buffer/client/gles2_demo_cc.cc +++ b/gpu/command_buffer/client/gles2_demo_cc.cc @@ -8,14 +8,187 @@ #include <GLES2/gl2.h> #include "gpu/command_buffer/client/gles2_demo_cc.h" +namespace { + +int g_width = 512; +int g_height = 512; +GLuint g_texture = 0; +int g_textureLoc = -1; +GLuint g_programObject = 0; +GLuint g_vbo = 0; +GLsizei g_texCoordOffset = 0; + +void CheckGLError() { + GLenum error = glGetError(); + if (error != GL_NO_ERROR) { + DLOG(ERROR) << "GL Error: " << error; + } +} + +GLuint LoadShader(GLenum type, const char* shaderSrc) { + GLuint shader = glCreateShader(type); + if (shader == 0) { + return 0; + } + // Load the shader source + glShaderSource(shader, 1, &shaderSrc, NULL); + // Compile the shader + glCompileShader(shader); + // Check the compile status + GLint value; + glGetShaderiv(shader, GL_COMPILE_STATUS, &value); + if (value == 0) { + char buffer[1024]; + GLsizei length; + glGetShaderInfoLog(shader, sizeof(buffer), &length, buffer); + std::string log(buffer, length); + DLOG(ERROR) << "Error compiling shader:" << log; + glDeleteShader(shader); + return 0; + } + return shader; +} + +void InitShaders() { + static const char* vShaderStr = + "attribute vec3 g_Position;\n" + "attribute vec2 g_TexCoord0;\n" + "varying vec2 texCoord;\n" + "void main()\n" + "{\n" + " gl_Position = vec4(g_Position.x, g_Position.y, g_Position.z, 1.0);\n" + " texCoord = g_TexCoord0;\n" + "}\n"; + static const char* fShaderStr = + "uniform sampler2D tex;\n" + "varying vec2 texCoord;\n" + "void main()\n" + "{\n" + " gl_FragColor = texture2D(tex, texCoord);\n" + "}\n"; + + GLuint vertexShader = LoadShader(GL_VERTEX_SHADER, vShaderStr); + GLuint fragmentShader = LoadShader(GL_FRAGMENT_SHADER, fShaderStr); + // Create the program object + GLuint programObject = glCreateProgram(); + if (programObject == 0) { + DLOG(ERROR) << "Creating program failed"; + return; + } + glAttachShader(programObject, vertexShader); + glAttachShader(programObject, fragmentShader); + // Bind g_Position to attribute 0 + // Bind g_TexCoord0 to attribute 1 + glBindAttribLocation(programObject, 0, "g_Position"); + glBindAttribLocation(programObject, 1, "g_TexCoord0"); + // Link the program + glLinkProgram(programObject); + // Check the link status + GLint linked; + glGetProgramiv(programObject, GL_LINK_STATUS, &linked); + if (linked == 0) { + char buffer[1024]; + GLsizei length; + glGetProgramInfoLog(programObject, sizeof(buffer), &length, buffer); + std::string log(buffer, length); + DLOG(ERROR) << "Error linking program:" << log; + glDeleteProgram(programObject); + return; + } + g_programObject = programObject; + g_textureLoc = glGetUniformLocation(g_programObject, "tex"); + glGenBuffers(1, &g_vbo); + glBindBuffer(GL_ARRAY_BUFFER, g_vbo); + static float vertices[] = { + 0.25, 0.75, 0.0, + -0.75, 0.75, 0.0, + -0.75, -0.25, 0.0, + 0.25, 0.75, 0.0, + -0.75, -0.25, 0.0, + 0.25, -0.25, 0.0, + }; + static float texCoords[] = { + 1.0, 1.0, + 0.0, 1.0, + 0.0, 0.0, + 1.0, 1.0, + 0.0, 0.0, + 1.0, 0.0, + }; + g_texCoordOffset = sizeof(vertices); + glBufferData(GL_ARRAY_BUFFER, + sizeof(vertices) + sizeof(texCoords), + NULL, + GL_STATIC_DRAW); + glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); + glBufferSubData(GL_ARRAY_BUFFER, g_texCoordOffset, + sizeof(texCoords), texCoords); + CheckGLError(); +} + +void Draw() { + // Note: the viewport is automatically set up to cover the entire Canvas. + // Clear the color buffer + glClear(GL_COLOR_BUFFER_BIT); + CheckGLError(); + // Use the program object + glUseProgram(g_programObject); + CheckGLError(); + // Load the vertex data + glBindBuffer(GL_ARRAY_BUFFER, g_vbo); + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); + glEnableVertexAttribArray(1); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, + reinterpret_cast<const void*>(g_texCoordOffset)); + CheckGLError(); + // Bind the texture to texture unit 0 + glBindTexture(GL_TEXTURE_2D, g_texture); + CheckGLError(); + // Point the uniform sampler to texture unit 0 + glUniform1i(g_textureLoc, 0); + CheckGLError(); + glDrawArrays(GL_TRIANGLES, 0, 6); + CheckGLError(); + glFlush(); +} + +GLuint CreateCheckerboardTexture() { + static unsigned char pixels[] = { + 255, 255, 255, + 0, 0, 0, + 0, 0, 0, + 255, 255, 255, + }; + GLuint texture; + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, + pixels); + return texture; +} + +void Init() { + glClearColor(0.f, 0.f, .7f, 1.f); + g_texture = CreateCheckerboardTexture(); + InitShaders(); +} + +} // anonymous namespace. + void GLFromCPPTestFunction() { - static bool foo = true; - foo = !foo; - glClearColor( - foo ? 1.0f : 0.0f, - foo ? 0.0f : 1.0f, - 1.0f, - 1.0f); + static bool initialized = false; + if (!initialized) { + initialized = true; + Init(); + } + Draw(); } + diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index e60e68b..1208a57 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -14,13 +14,21 @@ namespace gles2 { GLES2Implementation::GLES2Implementation( GLES2CmdHelper* helper, + size_t transfer_buffer_size, void* transfer_buffer, - int transfer_buffer_id) + int32 transfer_buffer_id) : util_(0), // TODO(gman): Get real number of compressed texture formats. helper_(helper), - shared_memory_(transfer_buffer, transfer_buffer_id), + transfer_buffer_(transfer_buffer_size, helper, transfer_buffer), + transfer_buffer_id_(transfer_buffer_id), pack_alignment_(4), unpack_alignment_(4) { + // Eat 1 id so we start at 1 instead of 0. + GLuint eat; + MakeIds(1, &eat); + // Allocate space for simple GL results. + result_buffer_ = transfer_buffer_.Alloc(kMaxSizeOfSimpleResult); + result_shm_offset_ = transfer_buffer_.GetOffset(result_buffer_); } void GLES2Implementation::MakeIds(GLsizei n, GLuint* ids) { @@ -35,11 +43,47 @@ void GLES2Implementation::FreeIds(GLsizei n, const GLuint* ids) { } } +void GLES2Implementation::WaitForCmd() { + int32 token = helper_->InsertToken(); + helper_->WaitForToken(token); +} + void GLES2Implementation::DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices) { helper_->DrawElements(mode, count, type, reinterpret_cast<GLuint>(indices)); } +GLint GLES2Implementation::GetAttribLocation( + GLuint program, const char* name) { + helper_->GetAttribLocationImmediate( + program, name, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLint>(); +} + +GLint GLES2Implementation::GetUniformLocation( + GLuint program, const char* name) { + helper_->GetUniformLocationImmediate( + program, name, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLint>(); +} + +void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { + switch (pname) { + case GL_PACK_ALIGNMENT: + pack_alignment_ = param; + break; + case GL_UNPACK_ALIGNMENT: + unpack_alignment_ = param; + break; + default: + break; + } + helper_->PixelStorei(pname, param); +} + + void GLES2Implementation::VertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { @@ -48,103 +92,158 @@ void GLES2Implementation::VertexAttribPointer( } void GLES2Implementation::ShaderSource( - GLuint shader, GLsizei count, const char** string, const GLint* length) { + GLuint shader, GLsizei count, const char** source, const GLint* length) { // TODO(gman): change to use buckets and check that there is enough room. - uint32* offsets = shared_memory_.GetAddressAs<uint32*>(0); - char* strings = reinterpret_cast<char*>(offsets + count); + // Compute the total size. + uint32 total_size = count * sizeof(total_size); + for (GLsizei ii = 0; ii < count; ++ii) { + total_size += length ? length[ii] : strlen(source[ii]); + } + + // Create string table in transfer buffer. + char* strings = transfer_buffer_.AllocTyped<char>(total_size); + uint32* offsets = reinterpret_cast<uint32*>(strings); uint32 offset = count * sizeof(*offsets); for (GLsizei ii = 0; ii < count; ++ii) { - uint32 len = length ? length[ii] : strlen(string[ii]); - memcpy(strings + offset, string[ii], len); + uint32 len = length ? length[ii] : strlen(source[ii]); + memcpy(strings + offset, source[ii], len); offset += len; offsets[ii] = offset; } - helper_->ShaderSource(shader, count, shared_memory_.GetId(), 0, offset); - // TODO(gman): Should insert token but not wait until we need shared memory - // again. Really, I should implement a shared memory manager that puts - // things in the next unused part of shared memory and only blocks - // when it needs more memory. - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->ShaderSource(shader, count, + transfer_buffer_id_, + transfer_buffer_.GetOffset(strings), offset); + transfer_buffer_.FreePendingToken(strings, helper_->InsertToken()); } void GLES2Implementation::BufferData( GLenum target, GLsizeiptr size, const void* data, GLenum usage) { - // TODO(gman): Switch to use buckets alwayst or at least if no room in shared - // memory. - memcpy(shared_memory_.GetAddress(0), data, size); - helper_->BufferData(target, size, shared_memory_.GetId(), 0, usage); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + // NOTE: Should this be optimized for the case where we can call BufferData + // with the actual data in the case of our transfer buffer being big + // enough? + helper_->BufferData(target, size, 0, 0, usage); + if (data != NULL) { + BufferSubData(target, 0, size, data); + } } void GLES2Implementation::BufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { - // TODO(gman): Switch to use buckets alwayst or at least if no room in shared - // memory. - memcpy(shared_memory_.GetAddress(0), data, size); - helper_->BufferSubData(target, offset, size, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + const int8* source = static_cast<const int8*>(data); + GLsizeiptr max_size = transfer_buffer_.GetLargestFreeOrPendingSize(); + while (size) { + GLsizeiptr part_size = std::min(size, max_size); + void* buffer = transfer_buffer_.Alloc(part_size); + memcpy(buffer, source, part_size); + helper_->BufferSubData(target, offset, part_size, + transfer_buffer_id_, + transfer_buffer_.GetOffset(buffer)); + transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken()); + offset += part_size; + source += part_size; + size -= part_size; + } } void GLES2Implementation::CompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, const void* data) { + GLsizei height, GLint border, GLsizei image_size, const void* data) { // TODO(gman): Switch to use buckets alwayst or at least if no room in shared // memory. - memcpy(shared_memory_.GetAddress(0), data, imageSize); + DCHECK_LE(image_size, + static_cast<GLsizei>( + transfer_buffer_.GetLargestFreeOrPendingSize())); + void* buffer = transfer_buffer_.Alloc(image_size); + memcpy(buffer, data, image_size); helper_->CompressedTexImage2D( - target, level, internalformat, width, height, border, imageSize, - shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + target, level, internalformat, width, height, border, image_size, + transfer_buffer_id_, transfer_buffer_.GetOffset(buffer)); + transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken()); } void GLES2Implementation::CompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, const void* data) { + GLsizei height, GLenum format, GLsizei image_size, const void* data) { // TODO(gman): Switch to use buckets alwayst or at least if no room in shared // memory. - memcpy(shared_memory_.GetAddress(0), data, imageSize); + DCHECK_LE(image_size, + static_cast<GLsizei>( + transfer_buffer_.GetLargestFreeOrPendingSize())); + void* buffer = transfer_buffer_.Alloc(image_size); + memcpy(buffer, data, image_size); helper_->CompressedTexSubImage2D( - target, level, xoffset, yoffset, width, height, format, imageSize, - shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + target, level, xoffset, yoffset, width, height, format, image_size, + transfer_buffer_id_, transfer_buffer_.GetOffset(buffer)); + transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken()); } void GLES2Implementation::TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { - // TODO(gman): Switch to use buckets alwayst or at least if no room in shared - // memory. - uint32 pixels_size = GLES2Util::ComputeImageDataSize( - width, height, format, type, unpack_alignment_); - memcpy(shared_memory_.GetAddress(0), pixels, pixels_size); helper_->TexImage2D( - target, level, internalformat, width, height, border, format, type, - shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + target, level, internalformat, width, height, border, format, type, 0, 0); + if (pixels) { + TexSubImage2D(target, level, 0, 0, width, height, format, type, pixels); + } } void GLES2Implementation::TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { - // TODO(gman): Switch to use buckets alwayst or at least if no room in shared - // memory. - uint32 pixels_size = GLES2Util::ComputeImageDataSize( - width, height, format, type, unpack_alignment_); - memcpy(shared_memory_.GetAddress(0), pixels, pixels_size); - helper_->TexSubImage2D( - target, level, xoffset, yoffset, width, height, format, type, - shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + const int8* source = static_cast<const int8*>(pixels); + GLsizeiptr max_size = transfer_buffer_.GetLargestFreeOrPendingSize(); + + GLsizeiptr unpadded_row_size = GLES2Util::ComputeImageDataSize( + width, 1, format, type, unpack_alignment_); + GLsizeiptr padded_row_size = GLES2Util::ComputeImageDataSize( + width, 2, format, type, unpack_alignment_) - unpadded_row_size; + + if (padded_row_size <= max_size) { + // Transfer by rows. + GLint max_rows = max_size / padded_row_size; + while (height) { + GLint num_rows = std::min(height, max_rows); + GLsizeiptr part_size = num_rows * padded_row_size; + void* buffer = transfer_buffer_.Alloc(part_size); + memcpy(buffer, source, part_size); + helper_->TexSubImage2D( + target, level, xoffset, yoffset, width, num_rows, format, type, + transfer_buffer_id_, transfer_buffer_.GetOffset(buffer)); + transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken()); + yoffset += num_rows; + source += part_size; + height -= num_rows; + } + } else { + // Transfer by sub rows. Beacuse GL has no maximum texture dimensions. + GLsizeiptr element_size = GLES2Util::ComputeImageDataSize( + 1, 1, format, type, unpack_alignment_); + max_size -= max_size % element_size; + GLint max_sub_row_pixels = max_size / element_size; + for (; height; --height) { + GLint temp_width = width; + GLint temp_xoffset = xoffset; + const int8* row_source = source; + while (temp_width) { + GLint num_pixels = std::min(width, max_sub_row_pixels); + GLsizeiptr part_size = num_pixels * element_size; + void* buffer = transfer_buffer_.Alloc(part_size); + memcpy(buffer, row_source, part_size); + helper_->TexSubImage2D( + target, level, temp_xoffset, yoffset, temp_width, 1, format, type, + transfer_buffer_id_, transfer_buffer_.GetOffset(buffer)); + transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken()); + row_source += part_size; + temp_xoffset += num_pixels; + temp_width -= num_pixels; + } + ++yoffset; + source += padded_row_size; + } + } } diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 2df52ca..fec3de9 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -9,43 +9,11 @@ #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/id_allocator.h" +#include "gpu/command_buffer/client/fenced_allocator.h" namespace command_buffer { namespace gles2 { -// A class to help with shared memory. -class SharedMemoryHelper { - public: - SharedMemoryHelper(void* address, int id) - : address_(address), - id_(id) { - } - - unsigned int GetOffset(void* address) const { - return static_cast<int8*>(address) - - static_cast<int8*>(address_); - } - - void* GetAddress(unsigned int offset) const { - return static_cast<int8*>(address_) + offset; - } - - template <typename T> - T GetAddressAs(unsigned int offset) const { - return static_cast<T>(GetAddress(offset)); - } - - unsigned int GetId() const { - return id_; - } - - private: - void* address_; - int id_; - - DISALLOW_COPY_AND_ASSIGN(SharedMemoryHelper); -}; - // This class emulates GLES2 over command buffers. It can be used by a client // program so that the program does not need deal with shared memory and command // buffer management. See gl2_lib.h. Note that there is a performance gain to @@ -56,8 +24,9 @@ class GLES2Implementation { public: GLES2Implementation( GLES2CmdHelper* helper, + size_t transfer_buffer_size, void* transfer_buffer, - int transfer_buffer_id); // TODO: add size. + int32 transfer_buffer_id); // Include the auto-generated part of this class. We split this because // it means we can easily edit the non-auto generated parts right here in @@ -71,10 +40,35 @@ class GLES2Implementation { // Frees a set of Ids for glDelete___ functions. void FreeIds(GLsizei n, const GLuint* ids); + // Gets the shared memory id for the result buffer. + uint32 result_shm_id() const { + return transfer_buffer_id_; + } + + // Gets the shared memory offset for the result buffer. + uint32 result_shm_offset() const { + return result_shm_offset_; + } + + // Gets the value of the result. + template <typename T> + T GetResultAs() const { + return *static_cast<T*>(result_buffer_); + } + + // Waits for all commands to execute. + void WaitForCmd(); + + // The maxiumum result size from simple GL get commands. + static const size_t kMaxSizeOfSimpleResult = 4 * sizeof(uint32); // NOLINT. + GLES2Util util_; GLES2CmdHelper* helper_; IdAllocator id_allocator_; - SharedMemoryHelper shared_memory_; // TODO(gman): rename transfer_buffer_. + FencedAllocatorWrapper transfer_buffer_; + int transfer_buffer_id_; + void* result_buffer_; + uint32 result_shm_offset_; // pack alignment as last set by glPixelStorei GLint pack_alignment_; diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 940454b..c4b34b9 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -252,77 +252,63 @@ void GetActiveUniform( void GetAttachedShaders( GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -int GetAttribLocation(GLuint program, const char* name) { - // TODO(gman): This needs to change to use SendString. - GLint* result = shared_memory_.GetAddressAs<GLint*>(0); - DCHECK(false); // pass in shared memory - helper_->GetAttribLocationImmediate(program, name); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *result; -} +GLint GetAttribLocation(GLuint program, const char* name); void GetBooleanv(GLenum pname, GLboolean* params) { - helper_->GetBooleanv(pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetBooleanv(pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { - helper_->GetBufferParameteriv(target, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetBufferParameteriv( + target, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } GLenum GetError() { - helper_->GetError(shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLenum*>(0); + helper_->GetError(result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLenum>(); } void GetFloatv(GLenum pname, GLfloat* params) { - helper_->GetFloatv(pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetFloatv(pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params) { helper_->GetFramebufferAttachmentParameteriv( - target, attachment, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + target, attachment, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetIntegerv(GLenum pname, GLint* params) { - helper_->GetIntegerv(pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetIntegerv(pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetProgramiv(GLuint program, GLenum pname, GLint* params) { - helper_->GetProgramiv(program, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetProgramiv(program, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } // TODO(gman): Implement this @@ -331,21 +317,19 @@ void GetProgramInfoLog( void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { helper_->GetRenderbufferParameteriv( - target, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + target, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { - helper_->GetShaderiv(shader, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetShaderiv(shader, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } // TODO(gman): Implement this @@ -362,53 +346,45 @@ void GetShaderSource( const GLubyte* GetString(GLenum name); void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { - helper_->GetTexParameterfv(target, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetTexParameterfv( + target, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) { - helper_->GetTexParameteriv(target, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetTexParameteriv( + target, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetUniformfv(GLuint program, GLint location, GLfloat* params); void GetUniformiv(GLuint program, GLint location, GLint* params); -int GetUniformLocation(GLuint program, const char* name) { - // TODO(gman): This needs to change to use SendString. - GLint* result = shared_memory_.GetAddressAs<GLint*>(0); - DCHECK(false); // pass in shared memory - helper_->GetUniformLocationImmediate(program, name); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *result; -} +GLint GetUniformLocation(GLuint program, const char* name); void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { - helper_->GetVertexAttribfv(index, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetVertexAttribfv( + index, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { - helper_->GetVertexAttribiv(index, pname, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); + helper_->GetVertexAttribiv( + index, pname, result_shm_id(), result_shm_offset()); + WaitForCmd(); GLsizei num_values = util_.GLGetNumValuesReturned(pname); - memcpy(params, shared_memory_.GetAddress(0), - num_values * sizeof(*params)); + DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult); + memcpy(params, result_buffer_, num_values * sizeof(*params)); } void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer); @@ -418,52 +394,45 @@ void Hint(GLenum target, GLenum mode) { } GLboolean IsBuffer(GLuint buffer) { - helper_->IsBuffer(buffer, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsBuffer(buffer, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } GLboolean IsEnabled(GLenum cap) { - helper_->IsEnabled(cap, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsEnabled(cap, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } GLboolean IsFramebuffer(GLuint framebuffer) { - helper_->IsFramebuffer(framebuffer, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsFramebuffer(framebuffer, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } GLboolean IsProgram(GLuint program) { - helper_->IsProgram(program, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsProgram(program, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } GLboolean IsRenderbuffer(GLuint renderbuffer) { - helper_->IsRenderbuffer(renderbuffer, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsRenderbuffer(renderbuffer, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } GLboolean IsShader(GLuint shader) { - helper_->IsShader(shader, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsShader(shader, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } GLboolean IsTexture(GLuint texture) { - helper_->IsTexture(texture, shared_memory_.GetId(), 0); - int32 token = helper_->InsertToken(); - helper_->WaitForToken(token); - return *shared_memory_.GetAddressAs<GLboolean*>(0); + helper_->IsTexture(texture, result_shm_id(), result_shm_offset()); + WaitForCmd(); + return GetResultAs<GLboolean>(); } void LineWidth(GLfloat width) { @@ -474,9 +443,7 @@ void LinkProgram(GLuint program) { helper_->LinkProgram(program); } -void PixelStorei(GLenum pname, GLint param) { - helper_->PixelStorei(pname, param); -} +void PixelStorei(GLenum pname, GLint param); void PolygonOffset(GLfloat factor, GLfloat units) { helper_->PolygonOffset(factor, units); diff --git a/gpu/command_buffer/common/gles2_cmd_format.cc b/gpu/command_buffer/common/gles2_cmd_format.cc index 62e297d..7c88a84 100644 --- a/gpu/command_buffer/common/gles2_cmd_format.cc +++ b/gpu/command_buffer/common/gles2_cmd_format.cc @@ -23,8 +23,9 @@ const char* GetCommandName(CommandId id) { #undef GLES2_CMD_OP }; - return (static_cast<int>(id) >= 0 && static_cast<int>(id) < kNumCommands) ? - names[id] : "*unknown-command*"; + int index = static_cast<int>(id) - kStartPoint - 1; + return (index >= 0 && index < kNumCommands) ? + names[index] : "*unknown-command*"; } } // namespace gles2 diff --git a/gpu/command_buffer/common/gles2_cmd_format.h b/gpu/command_buffer/common/gles2_cmd_format.h index 729149d..6e3a09b 100644 --- a/gpu/command_buffer/common/gles2_cmd_format.h +++ b/gpu/command_buffer/common/gles2_cmd_format.h @@ -29,6 +29,251 @@ namespace gles2 { #include "gpu/command_buffer/common/gles2_cmd_format_autogen.h" +// These are hand written commands. +// TODO(gman): Attempt to make these auto-generated. + +struct GetAttribLocation { + typedef GetAttribLocation ValueType; + static const CommandId kCmdId = kGetAttribLocation; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + 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); + } + + command_buffer::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 GetAttribLocationImmediate { + typedef GetAttribLocationImmediate ValueType; + static const CommandId kCmdId = kGetAttribLocationImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(const char* s) { + return strlen(s); + } + + static uint32 ComputeSize(const char* s) { + return static_cast<uint32>(sizeof(ValueType) + ComputeDataSize(s)); + } + + void SetHeader(const char* s) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(s)); + } + + void Init( + GLuint _program, const char* _name, + uint32 _location_shm_id, uint32 _location_shm_offset) { + SetHeader(_name); + program = _program; + location_shm_id = _location_shm_id; + location_shm_offset = _location_shm_offset; + data_size = ComputeDataSize(_name); + memcpy(ImmediateDataAddress(this), _name, data_size); + } + + void* Set( + void* cmd, GLuint _program, const char* _name, + uint32 _location_shm_id, uint32 _location_shm_offset) { + uint32 total_size = ComputeSize(_name); + static_cast<ValueType*>( + cmd)->Init(_program, _name, _location_shm_id, _location_shm_offset); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 location_shm_id; + uint32 location_shm_offset; + uint32 data_size; +}; + +COMPILE_ASSERT(sizeof(GetAttribLocationImmediate) == 20, + Sizeof_GetAttribLocationImmediate_is_not_20); +COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, header) == 0, + OffsetOf_GetAttribLocationImmediate_header_not_0); +COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, program) == 4, + OffsetOf_GetAttribLocationImmediate_program_not_4); +COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, location_shm_id) == 8, + OffsetOf_GetAttribLocationImmediate_location_shm_id_not_8); +COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, location_shm_offset) == 12, + OffsetOf_GetAttribLocationImmediate_location_shm_offset_not_12); +COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, data_size) == 16, + OffsetOf_GetAttribLocationImmediate_data_size_not_16); + +struct GetUniformLocation { + typedef GetUniformLocation ValueType; + static const CommandId kCmdId = kGetUniformLocation; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + 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); + } + + command_buffer::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 GetUniformLocationImmediate { + typedef GetUniformLocationImmediate ValueType; + static const CommandId kCmdId = kGetUniformLocationImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(const char* s) { + return strlen(s); + } + + static uint32 ComputeSize(const char* s) { + return static_cast<uint32>(sizeof(ValueType) + ComputeDataSize(s)); + } + + void SetHeader(const char* s) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(s)); + } + + void Init( + GLuint _program, const char* _name, + uint32 _location_shm_id, uint32 _location_shm_offset) { + SetHeader(_name); + program = _program; + location_shm_id = _location_shm_id; + location_shm_offset = _location_shm_offset; + data_size = ComputeDataSize(_name); + memcpy(ImmediateDataAddress(this), _name, data_size); + } + + void* Set( + void* cmd, GLuint _program, const char* _name, + uint32 _location_shm_id, uint32 _location_shm_offset) { + uint32 total_size = ComputeSize(_name); + static_cast<ValueType*>( + cmd)->Init(_program, _name, _location_shm_id, _location_shm_offset); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 location_shm_id; + uint32 location_shm_offset; + uint32 data_size; +}; + +COMPILE_ASSERT(sizeof(GetUniformLocationImmediate) == 20, + Sizeof_GetUniformLocationImmediate_is_not_20); +COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, header) == 0, + OffsetOf_GetUniformLocationImmediate_header_not_0); +COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, program) == 4, + OffsetOf_GetUniformLocationImmediate_program_not_4); +COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, location_shm_id) == 8, + OffsetOf_GetUniformLocationImmediate_location_shm_id_not_8); +COMPILE_ASSERT( + offsetof(GetUniformLocationImmediate, location_shm_offset) == 12, + OffsetOf_GetUniformLocationImmediate_location_shm_offset_not_12); +COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, data_size) == 16, + OffsetOf_GetUniformLocationImmediate_data_size_not_16); + + } // namespace gles2 } // namespace command_buffer diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index e15713a..83c7869 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -609,7 +609,7 @@ struct BufferDataImmediate { } void Init(GLenum _target, GLsizeiptr _size, GLenum _usage) { - uint32 total_size = ComputeSize(_size); + uint32 total_size = 0; // TODO(gman): get correct size. SetHeader(total_size); target = _target; size = _size; @@ -617,7 +617,7 @@ struct BufferDataImmediate { } void* Set(void* cmd, GLenum _target, GLsizeiptr _size, GLenum _usage) { - uint32 total_size = ComputeSize(_size); + uint32 total_size = 0; // TODO(gman): get correct size. static_cast<ValueType*>(cmd)->Init(_target, _size, _usage); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); } @@ -1100,7 +1100,7 @@ struct CompressedTexImage2DImmediate { void Init( GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, GLsizei _height, GLint _border, GLsizei _imageSize) { - uint32 total_size = ComputeSize(_imageSize); + uint32 total_size = 0; // TODO(gman): get correct size. SetHeader(total_size); target = _target; level = _level; @@ -1114,7 +1114,7 @@ struct CompressedTexImage2DImmediate { void* Set( void* cmd, GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, GLsizei _height, GLint _border, GLsizei _imageSize) { - uint32 total_size = ComputeSize(_imageSize); + uint32 total_size = 0; // TODO(gman): get correct size. static_cast<ValueType*>( cmd)->Init( _target, _level, _internalformat, _width, _height, _border, @@ -3157,102 +3157,6 @@ COMPILE_ASSERT(offsetof(GetAttachedShaders, shaders_shm_id) == 20, COMPILE_ASSERT(offsetof(GetAttachedShaders, shaders_shm_offset) == 24, OffsetOf_GetAttachedShaders_shaders_shm_offset_not_24); -struct GetAttribLocation { - typedef GetAttribLocation ValueType; - static const CommandId kCmdId = kGetAttribLocation; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _data_size) { - SetHeader(); - program = _program; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - data_size = _data_size; - } - - void* Set( - void* cmd, GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _data_size) { - static_cast<ValueType*>( - cmd)->Init(_program, _name_shm_id, _name_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 name_shm_id; - uint32 name_shm_offset; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(GetAttribLocation) == 20, - Sizeof_GetAttribLocation_is_not_20); -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, data_size) == 16, - OffsetOf_GetAttribLocation_data_size_not_16); - -struct GetAttribLocationImmediate { - typedef GetAttribLocationImmediate ValueType; - static const CommandId kCmdId = kGetAttribLocationImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(const char* s) { - return strlen(s); - } - - static uint32 ComputeSize(const char* s) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(s)); // NOLINT - } - - void SetHeader(const char* s) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(s)); - } - - void Init(GLuint _program, const char* _name) { - SetHeader(_name); - program = _program; - data_size = strlen(_name); - memcpy(ImmediateDataAddress(this), _name, data_size); - } - - void* Set(void* cmd, GLuint _program, const char* _name) { - static_cast<ValueType*>(cmd)->Init(_program, _name); - const uint32 size = ComputeSize(_name); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(GetAttribLocationImmediate) == 12, - Sizeof_GetAttribLocationImmediate_is_not_12); -COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, header) == 0, - OffsetOf_GetAttribLocationImmediate_header_not_0); -COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, program) == 4, - OffsetOf_GetAttribLocationImmediate_program_not_4); -COMPILE_ASSERT(offsetof(GetAttribLocationImmediate, data_size) == 8, - OffsetOf_GetAttribLocationImmediate_data_size_not_8); - struct GetBooleanv { typedef GetBooleanv ValueType; static const CommandId kCmdId = kGetBooleanv; @@ -4178,102 +4082,6 @@ COMPILE_ASSERT(offsetof(GetUniformiv, params_shm_id) == 12, COMPILE_ASSERT(offsetof(GetUniformiv, params_shm_offset) == 16, OffsetOf_GetUniformiv_params_shm_offset_not_16); -struct GetUniformLocation { - typedef GetUniformLocation ValueType; - static const CommandId kCmdId = kGetUniformLocation; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _data_size) { - SetHeader(); - program = _program; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - data_size = _data_size; - } - - void* Set( - void* cmd, GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset, - uint32 _data_size) { - static_cast<ValueType*>( - cmd)->Init(_program, _name_shm_id, _name_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 name_shm_id; - uint32 name_shm_offset; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(GetUniformLocation) == 20, - Sizeof_GetUniformLocation_is_not_20); -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, data_size) == 16, - OffsetOf_GetUniformLocation_data_size_not_16); - -struct GetUniformLocationImmediate { - typedef GetUniformLocationImmediate ValueType; - static const CommandId kCmdId = kGetUniformLocationImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(const char* s) { - return strlen(s); - } - - static uint32 ComputeSize(const char* s) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(s)); // NOLINT - } - - void SetHeader(const char* s) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(s)); - } - - void Init(GLuint _program, const char* _name) { - SetHeader(_name); - program = _program; - data_size = strlen(_name); - memcpy(ImmediateDataAddress(this), _name, data_size); - } - - void* Set(void* cmd, GLuint _program, const char* _name) { - static_cast<ValueType*>(cmd)->Init(_program, _name); - const uint32 size = ComputeSize(_name); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(GetUniformLocationImmediate) == 12, - Sizeof_GetUniformLocationImmediate_is_not_12); -COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, header) == 0, - OffsetOf_GetUniformLocationImmediate_header_not_0); -COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, program) == 4, - OffsetOf_GetUniformLocationImmediate_program_not_4); -COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, data_size) == 8, - OffsetOf_GetUniformLocationImmediate_data_size_not_8); - struct GetVertexAttribfv { typedef GetVertexAttribfv ValueType; static const CommandId kCmdId = kGetVertexAttribfv; @@ -5581,7 +5389,7 @@ struct TexImage2DImmediate { void Init( GLenum _target, GLint _level, GLint _internalformat, GLsizei _width, GLsizei _height, GLint _border, GLenum _format, GLenum _type) { - uint32 total_size = 0; // TODO(gman): get correct size + uint32 total_size = 0; // TODO(gman): get correct size. SetHeader(total_size); target = _target; level = _level; @@ -5597,7 +5405,7 @@ struct TexImage2DImmediate { void* cmd, GLenum _target, GLint _level, GLint _internalformat, GLsizei _width, GLsizei _height, GLint _border, GLenum _format, GLenum _type) { - uint32 total_size = 0; // TODO(gman): get correct size + uint32 total_size = 0; // TODO(gman): get correct size. static_cast<ValueType*>( cmd)->Init( _target, _level, _internalformat, _width, _height, _border, _format, 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 b914e07..ed5455f 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -964,39 +964,8 @@ TEST(GLES2FormatTest, GetAttachedShaders) { EXPECT_EQ(static_cast<uint32>(16), cmd.shaders_shm_offset); } -TEST(GLES2FormatTest, GetAttribLocation) { - GetAttribLocation cmd = { 0, }; - void* next_cmd = cmd.Set( - &cmd, - static_cast<GLuint>(11), - static_cast<uint32>(12), - static_cast<uint32>(13), - static_cast<uint32>(14)); - EXPECT_EQ(GetAttribLocation::kCmdId, cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT - EXPECT_EQ(static_cast<GLuint>(11), cmd.program); - EXPECT_EQ(static_cast<uint32>(12), cmd.name_shm_id); - EXPECT_EQ(static_cast<uint32>(13), cmd.name_shm_offset); - EXPECT_EQ(static_cast<uint32>(14), cmd.data_size); -} - -TEST(GLES2FormatTest, GetAttribLocationImmediate) { - int8 buf[256] = { 0, }; - GetAttribLocationImmediate& cmd = - *static_cast<GetAttribLocationImmediate*>(static_cast<void*>(&buf)); - static const char* const test_str = "test string"; - void* next_cmd = cmd.Set( - &cmd, - static_cast<GLuint>(11), - test_str); - EXPECT_EQ(GetAttribLocationImmediate::kCmdId, cmd.header.command); - EXPECT_EQ(sizeof(cmd) + // NOLINT - RoundSizeToMultipleOfEntries(strlen(test_str)), - cmd.header.size * 4); - EXPECT_EQ(static_cast<GLuint>(11), cmd.program); - // TODO(gman): check that string got copied. -} - +// TODO(gman): Write test for GetAttribLocation +// TODO(gman): Write test for GetAttribLocationImmediate TEST(GLES2FormatTest, GetBooleanv) { GetBooleanv cmd = { 0, }; void* next_cmd = cmd.Set( @@ -1287,39 +1256,8 @@ TEST(GLES2FormatTest, GetUniformiv) { EXPECT_EQ(static_cast<uint32>(14), cmd.params_shm_offset); } -TEST(GLES2FormatTest, GetUniformLocation) { - GetUniformLocation cmd = { 0, }; - void* next_cmd = cmd.Set( - &cmd, - static_cast<GLuint>(11), - static_cast<uint32>(12), - static_cast<uint32>(13), - static_cast<uint32>(14)); - EXPECT_EQ(GetUniformLocation::kCmdId, cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT - EXPECT_EQ(static_cast<GLuint>(11), cmd.program); - EXPECT_EQ(static_cast<uint32>(12), cmd.name_shm_id); - EXPECT_EQ(static_cast<uint32>(13), cmd.name_shm_offset); - EXPECT_EQ(static_cast<uint32>(14), cmd.data_size); -} - -TEST(GLES2FormatTest, GetUniformLocationImmediate) { - int8 buf[256] = { 0, }; - GetUniformLocationImmediate& cmd = - *static_cast<GetUniformLocationImmediate*>(static_cast<void*>(&buf)); - static const char* const test_str = "test string"; - void* next_cmd = cmd.Set( - &cmd, - static_cast<GLuint>(11), - test_str); - EXPECT_EQ(GetUniformLocationImmediate::kCmdId, cmd.header.command); - EXPECT_EQ(sizeof(cmd) + // NOLINT - RoundSizeToMultipleOfEntries(strlen(test_str)), - cmd.header.size * 4); - EXPECT_EQ(static_cast<GLuint>(11), cmd.program); - // TODO(gman): check that string got copied. -} - +// TODO(gman): Write test for GetUniformLocation +// TODO(gman): Write test for GetUniformLocationImmediate TEST(GLES2FormatTest, GetVertexAttribfv) { GetVertexAttribfv cmd = { 0, }; void* next_cmd = cmd.Set( diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc index 9b0c20b..1268c23 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.cc +++ b/gpu/command_buffer/common/gles2_cmd_utils.cc @@ -332,12 +332,13 @@ int BytesPerElement(int type) { // Returns the amount of data glTexImage2D or glTexSubImage2D will access. uint32 GLES2Util::ComputeImageDataSize( int width, int height, int format, int type, int unpack_alignment) { - uint32 bytes_per_group = BytesPerElement(ElementsPerGroup(format, type)); + uint32 bytes_per_group = + BytesPerElement(type) * ElementsPerGroup(format, type); uint32 row_size = width * bytes_per_group; if (height > 1) { uint32 padded_row_size = ((row_size + unpack_alignment - 1) / unpack_alignment) * unpack_alignment; - return height - 1 * padded_row_size + row_size; + return (height - 1) * padded_row_size + row_size; } return height * row_size; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 159c5c5..d6f2aba 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -43,11 +43,11 @@ unsigned int ImmediateDataSize(uint32 arg_count) { // Checks if there is enough immediate data. template<typename T> bool CheckImmediateDataSize( - unsigned int arg_count, + uint32 immediate_data_size, GLuint count, size_t size, unsigned int elements_per_unit) { - return ImmediateDataSize<T>(arg_count) == count * size * elements_per_unit; + return immediate_data_size == count * size * elements_per_unit; } // A struct to hold info about each command. @@ -149,12 +149,16 @@ GLenum GLErrorBitToGLError(uint32 error_bit) { } // anonymous namespace. +#if defined(OS_LINUX) GLES2Decoder::GLES2Decoder() -#ifdef OS_LINUX - : window_(NULL) { -#endif -#ifdef OS_WIN - : hwnd_(NULL) { + : debug_(false), + window_(NULL) { +#elif defined(OS_WIN) +GLES2Decoder::GLES2Decoder() + : debug_(false), + hwnd_(NULL) { +#else +GLES2Decoder::GLES2Decoder() { #endif } @@ -311,7 +315,7 @@ class GLES2DecoderImpl : public GLES2Decoder { // typesafe way. #define GLES2_CMD_OP(name) \ ParseError Handle ## name( \ - unsigned int arg_count, \ + uint32 immediate_data_size, \ const gles2::name& args); \ GLES2_COMMAND_LIST(GLES2_CMD_OP) @@ -669,28 +673,44 @@ parse_error::ParseError GLES2DecoderImpl::DoCommand( unsigned int command, unsigned int arg_count, const void* cmd_data) { + parse_error::ParseError result; + if (debug()) { + // TODO(gman): Change output to something useful for NaCl. + const char* f = GetCommandName(command); + printf("cmd: %s\n", GetCommandName(command)); + } unsigned int command_index = command - kStartPoint - 1; if (command_index < arraysize(g_command_info)) { const CommandInfo& info = g_command_info[command_index]; unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { + uint32 immediate_data_size = + (arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT switch (command) { #define GLES2_CMD_OP(name) \ case name::kCmdId: \ - return Handle ## name( \ - arg_count, \ + result = Handle ## name( \ + immediate_data_size, \ *static_cast<const name*>(cmd_data)); \ + break; \ GLES2_COMMAND_LIST(GLES2_CMD_OP) - #undef GLES2_CMD_OP + if (debug()) { + if (glGetError() != 0) { + // TODO(gman): Change output to something useful for NaCl. + printf("GL ERROR b4: %s\n", GetCommandName(command)); + } + } } } else { - return parse_error::kParseInvalidArguments; + result = parse_error::kParseInvalidArguments; } + } else { + result = DoCommonCommand(command, arg_count, cmd_data); } - return DoCommonCommand(command, arg_count, cmd_data); + return result; } } // namespace gles2 @@ -786,7 +806,7 @@ void GLES2DecoderImpl::SetGLError(GLenum error) { } parse_error::ParseError GLES2DecoderImpl::HandleDrawElements( - unsigned int arg_count, const gles2::DrawElements& c) { + uint32 immediate_data_size, const gles2::DrawElements& c) { if (bound_element_array_buffer_ != 0) { GLenum mode = c.mode; GLsizei count = c.count; @@ -831,14 +851,21 @@ parse_error::ParseError ShaderSourceHelper( } // anonymous namespace. parse_error::ParseError GLES2DecoderImpl::HandleShaderSource( - unsigned int arg_count, const gles2::ShaderSource& c) { - GLuint shader = c.shader; + uint32 immediate_data_size, const gles2::ShaderSource& c) { + GLuint shader; + if (!id_map_.GetServiceId(c.shader, &shader)) { + SetGLError(GL_INVALID_VALUE); + return parse_error::kParseNoError; + } GLsizei count = c.count; uint32 data_size = c.data_size; const char** data = GetSharedMemoryAs<const char**>( c.data_shm_id, c.data_shm_offset, data_size); parse_error::ParseError result = - ValidateShaderSource(this, arg_count, shader, count, data, NULL); + // TODO(gman): Manually implement validation. + ValidateShaderSource( + this, immediate_data_size, shader, count, data, + reinterpret_cast<const GLint*>(1)); if (result != parse_error::kParseNoError) { return result; } @@ -847,15 +874,19 @@ parse_error::ParseError GLES2DecoderImpl::HandleShaderSource( } parse_error::ParseError GLES2DecoderImpl::HandleShaderSourceImmediate( - unsigned int arg_count, const gles2::ShaderSourceImmediate& c) { - GLuint shader = c.shader; + uint32 immediate_data_size, const gles2::ShaderSourceImmediate& c) { + GLuint shader; + if (!id_map_.GetServiceId(c.shader, &shader)) { + SetGLError(GL_INVALID_VALUE); + return parse_error::kParseNoError; + } GLsizei count = c.count; uint32 data_size = c.data_size; // TODO(gman): need to check that data_size is in range for arg_count. const char** data = GetImmediateDataAs<const char**>(c); parse_error::ParseError result = ValidateShaderSourceImmediate( - this, arg_count, shader, count, data, NULL); + this, immediate_data_size, shader, count, data, NULL); if (result != parse_error::kParseNoError) { return result; } @@ -864,7 +895,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleShaderSourceImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( - unsigned int arg_count, const gles2::VertexAttribPointer& c) { + uint32 immediate_data_size, const gles2::VertexAttribPointer& c) { if (bound_array_buffer_ != 0) { GLuint indx = c.indx; GLint size = c.size; @@ -873,9 +904,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( GLsizei stride = c.stride; GLuint offset = c.offset; const void* ptr = reinterpret_cast<const void*>(c.offset); + // TODO(gman): Do manual validation. parse_error::ParseError result = ValidateVertexAttribPointer( - this, arg_count, indx, size, type, normalized, stride, ptr); + this, immediate_data_size, indx, size, type, normalized, stride, + reinterpret_cast<const void*>(1)); if (result != parse_error::kParseNoError) { return result; } @@ -887,55 +920,308 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( } parse_error::ParseError GLES2DecoderImpl::HandleReadPixels( - unsigned int arg_count, const gles2::ReadPixels& c) { + uint32 immediate_data_size, const gles2::ReadPixels& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandlePixelStorei( - unsigned int arg_count, const gles2::PixelStorei& c) { - // TODO(gman): Implement. + uint32 immediate_data_size, const gles2::PixelStorei& c) { + GLenum pname = c.pname; + GLenum param = c.param; + parse_error::ParseError result = + ValidatePixelStorei(this, immediate_data_size, pname, param); + if (result != parse_error::kParseNoError) { + return result; + } + glPixelStorei(pname, param); + switch (pname) { + case GL_PACK_ALIGNMENT: + pack_alignment_ = param; + break; + case GL_UNPACK_ALIGNMENT: + unpack_alignment_ = param; + break; + default: + // Validation should have prevented us from getting here. + DCHECK(false); + break; + } + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocation( + uint32 immediate_data_size, const gles2::GetAttribLocation& c) { + GLuint program; + if (!id_map_.GetServiceId(c.program, &program)) { + SetGLError(GL_INVALID_VALUE); + return parse_error::kParseNoError; + } + uint32 name_size = c.data_size; + const char* name = GetSharedMemoryAs<const char*>( + c.name_shm_id, c.name_shm_offset, name_size); + GLint* location = GetSharedMemoryAs<GLint*>( + c.location_shm_id, c.location_shm_offset, sizeof(GLint)); + if (!location || !name) { + return parse_error::kParseOutOfBounds; + } + String name_str(name, name_size); + *location = glGetAttribLocation(program, name_str.c_str()); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocationImmediate( + uint32 immediate_data_size, const gles2::GetAttribLocationImmediate& c) { + GLuint program; + if (!id_map_.GetServiceId(c.program, &program)) { + SetGLError(GL_INVALID_VALUE); + return parse_error::kParseNoError; + } + uint32 name_size = c.data_size; + const char* name = GetImmediateDataAs<const char*>(c); + // TODO(gman): Make sure validate checks arg_count + // covers data_size. + GLint* location = GetSharedMemoryAs<GLint*>( + c.location_shm_id, c.location_shm_offset, sizeof(GLint)); + if (!location || !name) { + return parse_error::kParseOutOfBounds; + } + String name_str(name, name_size); + *location = glGetAttribLocation(program, name_str.c_str()); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocation( + uint32 immediate_data_size, const gles2::GetUniformLocation& c) { + GLuint program; + if (!id_map_.GetServiceId(c.program, &program)) { + SetGLError(GL_INVALID_VALUE); + return parse_error::kParseNoError; + } + uint32 name_size = c.data_size; + const char* name = GetSharedMemoryAs<const char*>( + c.name_shm_id, c.name_shm_offset, name_size); + GLint* location = GetSharedMemoryAs<GLint*>( + c.location_shm_id, c.location_shm_offset, sizeof(GLint)); + if (!location || !name) { + return parse_error::kParseOutOfBounds; + } + String name_str(name, name_size); + *location = glGetUniformLocation(program, name_str.c_str()); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocationImmediate( + uint32 immediate_data_size, const gles2::GetUniformLocationImmediate& c) { + GLuint program; + if (!id_map_.GetServiceId(c.program, &program)) { + SetGLError(GL_INVALID_VALUE); + return parse_error::kParseNoError; + } + uint32 name_size = c.data_size; + const char* name = GetImmediateDataAs<const char*>(c); + // TODO(gman): Make sure validate checks arg_count + // covers data_size. + GLint* location = GetSharedMemoryAs<GLint*>( + c.location_shm_id, c.location_shm_offset, sizeof(GLint)); + if (!location || !name) { + return parse_error::kParseOutOfBounds; + } + String name_str(name, name_size); + *location = glGetUniformLocation(program, name_str.c_str()); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleBufferData( + uint32 immediate_data_size, const gles2::BufferData& c) { + GLenum target = static_cast<GLenum>(c.target); + GLsizeiptr size = static_cast<GLsizeiptr>(c.size); + uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); + uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); + GLenum usage = static_cast<GLenum>(c.usage); + const void* data = NULL; + if (data_shm_id != 0 || data_shm_offset != 0) { + data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); + parse_error::ParseError result = + ValidateBufferData(this, immediate_data_size, target, size, data, + usage); + if (result != parse_error::kParseNoError) { + return result; + } + } + // TODO(gman): Validate case where data is NULL. + glBufferData(target, size, data, usage); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleBufferDataImmediate( + uint32 immediate_data_size, const gles2::BufferDataImmediate& c) { + GLenum target = static_cast<GLenum>(c.target); + GLsizeiptr size = static_cast<GLsizeiptr>(c.size); + const void* data = GetImmediateDataAs<const void*>(c); + GLenum usage = static_cast<GLenum>(c.usage); + // Immediate version. + // TODO(gman): Handle case where data is NULL. + parse_error::ParseError result = + ValidateBufferDataImmediate(this, immediate_data_size, target, size, data, + usage); + if (result != parse_error::kParseNoError) { + return result; + } + glBufferData(target, size, data, usage); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2D( + uint32 immediate_data_size, const gles2::CompressedTexImage2D& c) { + GLenum target = static_cast<GLenum>(c.target); + GLint level = static_cast<GLint>(c.level); + GLenum internal_format = static_cast<GLenum>(c.internalformat); + GLsizei width = static_cast<GLsizei>(c.width); + GLsizei height = static_cast<GLsizei>(c.height); + GLint border = static_cast<GLint>(c.border); + GLsizei image_size = static_cast<GLsizei>(c.imageSize); + uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); + uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); + const void* data = NULL; + if (data_shm_id != 0 || data_shm_offset != 0) { + data = GetSharedMemoryAs<const void*>( + data_shm_id, data_shm_offset, image_size); + parse_error::ParseError result = + ValidateCompressedTexImage2D( + this, immediate_data_size, target, level, internal_format, width, + height, border, image_size, data); + if (result != parse_error::kParseNoError) { + return result; + } + } + // TODO(gman): Validate case where data is NULL. + glCompressedTexImage2D( + target, level, internal_format, width, height, border, image_size, data); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2DImmediate( + uint32 immediate_data_size, const gles2::CompressedTexImage2DImmediate& c) { + GLenum target = static_cast<GLenum>(c.target); + GLint level = static_cast<GLint>(c.level); + GLenum internal_format = static_cast<GLenum>(c.internalformat); + GLsizei width = static_cast<GLsizei>(c.width); + GLsizei height = static_cast<GLsizei>(c.height); + GLint border = static_cast<GLint>(c.border); + GLsizei image_size = static_cast<GLsizei>(c.imageSize); + const void* data = GetImmediateDataAs<const void*>(c); + // Immediate version. + // TODO(gman): Handle case where data is NULL. + parse_error::ParseError result = + ValidateCompressedTexImage2DImmediate( + this, immediate_data_size, target, level, internal_format, width, + height, border, image_size, data); + if (result != parse_error::kParseNoError) { + return result; + } + glCompressedTexImage2D( + target, level, internal_format, width, height, border, image_size, data); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleTexImage2D( + uint32 immediate_data_size, const gles2::TexImage2D& c) { + GLenum target = static_cast<GLenum>(c.target); + GLint level = static_cast<GLint>(c.level); + GLint internal_format = static_cast<GLint>(c.internalformat); + GLsizei width = static_cast<GLsizei>(c.width); + GLsizei height = static_cast<GLsizei>(c.height); + GLint border = static_cast<GLint>(c.border); + GLenum format = static_cast<GLenum>(c.format); + GLenum type = static_cast<GLenum>(c.type); + uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); + uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); + uint32 pixels_size = GLES2Util::ComputeImageDataSize( + width, height, format, type, unpack_alignment_); + const void* pixels = NULL; + if (pixels_shm_id != 0 || pixels_shm_offset != 0) { + pixels = GetSharedMemoryAs<const void*>( + pixels_shm_id, pixels_shm_offset, pixels_size); + parse_error::ParseError result = + ValidateTexImage2D( + this, immediate_data_size, target, level, internal_format, width, + height, border, format, type, pixels); + if (result != parse_error::kParseNoError) { + return result; + } + } + // TODO(gman): Validate case where data is NULL. + glTexImage2D( + target, level, internal_format, width, height, border, format, type, + pixels); + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate( + uint32 immediate_data_size, const gles2::TexImage2DImmediate& c) { + GLenum target = static_cast<GLenum>(c.target); + GLint level = static_cast<GLint>(c.level); + GLint internalformat = static_cast<GLint>(c.internalformat); + GLsizei width = static_cast<GLsizei>(c.width); + GLsizei height = static_cast<GLsizei>(c.height); + GLint border = static_cast<GLint>(c.border); + GLenum format = static_cast<GLenum>(c.format); + GLenum type = static_cast<GLenum>(c.type); + const void* pixels = GetImmediateDataAs<const void*>(c); + // Immediate version. + // TODO(gman): Handle case where data is NULL. + parse_error::ParseError result = + ValidateTexImage2DImmediate( + this, immediate_data_size, target, level, internalformat, width, + height, border, format, type, pixels); + if (result != parse_error::kParseNoError) { + return result; + } + glTexImage2D( + target, level, internalformat, width, height, border, format, type, + pixels); return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribPointerv( - unsigned int arg_count, const gles2::GetVertexAttribPointerv& c) { + uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetUniformiv( - unsigned int arg_count, const gles2::GetUniformiv& c) { + uint32 immediate_data_size, const gles2::GetUniformiv& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetUniformfv( - unsigned int arg_count, const gles2::GetUniformfv& c) { + uint32 immediate_data_size, const gles2::GetUniformfv& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetShaderPrecisionFormat( - unsigned int arg_count, const gles2::GetShaderPrecisionFormat& c) { + uint32 immediate_data_size, const gles2::GetShaderPrecisionFormat& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetAttachedShaders( - unsigned int arg_count, const gles2::GetAttachedShaders& c) { + uint32 immediate_data_size, const gles2::GetAttachedShaders& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetActiveUniform( - unsigned int arg_count, const gles2::GetActiveUniform& c) { + uint32 immediate_data_size, const gles2::GetActiveUniform& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetActiveAttrib( - unsigned int arg_count, const gles2::GetActiveAttrib& c) { + uint32 immediate_data_size, const gles2::GetActiveAttrib& c) { // TODO(gman): Implement. return parse_error::kParseNoError; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index 10387c6..1442577 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -28,6 +28,14 @@ class GLES2Decoder : public CommonDecoder { virtual ~GLES2Decoder() { } + bool debug() const { + return debug_; + } + + void set_debug(bool debug) { + debug_ = debug; + } + #if defined(OS_LINUX) void set_window_wrapper(XWindowWrapper *window) { window_ = window; @@ -57,6 +65,8 @@ class GLES2Decoder : public CommonDecoder { GLES2Decoder(); private: + bool debug_; + #if defined(OS_LINUX) XWindowWrapper *window_; #elif defined(OS_WIN) diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index 1a247fd..19c865c 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h @@ -3,10 +3,10 @@ // It is included by gles2_cmd_decoder.cc parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( - unsigned int arg_count, const gles2::ActiveTexture& c) { + uint32 immediate_data_size, const gles2::ActiveTexture& c) { GLenum texture = static_cast<GLenum>(c.texture); parse_error::ParseError result = - ValidateActiveTexture(this, arg_count, texture); + ValidateActiveTexture(this, immediate_data_size, texture); if (result != parse_error::kParseNoError) { return result; } @@ -15,7 +15,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( } parse_error::ParseError GLES2DecoderImpl::HandleAttachShader( - unsigned int arg_count, const gles2::AttachShader& c) { + uint32 immediate_data_size, const gles2::AttachShader& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -27,7 +27,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleAttachShader( return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateAttachShader(this, arg_count, program, shader); + ValidateAttachShader(this, immediate_data_size, program, shader); if (result != parse_error::kParseNoError) { return result; } @@ -36,7 +36,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleAttachShader( } parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation( - unsigned int arg_count, const gles2::BindAttribLocation& c) { + uint32 immediate_data_size, const gles2::BindAttribLocation& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -47,7 +47,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation( const char* name = GetSharedMemoryAs<const char*>( c.name_shm_id, c.name_shm_offset, name_size); parse_error::ParseError result = - ValidateBindAttribLocation(this, arg_count, program, index, name); + ValidateBindAttribLocation( + this, immediate_data_size, program, index, name); if (result != parse_error::kParseNoError) { return result; } @@ -57,7 +58,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation( } parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( - unsigned int arg_count, const gles2::BindAttribLocationImmediate& c) { + uint32 immediate_data_size, const gles2::BindAttribLocationImmediate& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -66,11 +67,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( GLuint index = static_cast<GLuint>(c.index); uint32 name_size = c.data_size; const char* name = GetImmediateDataAs<const char*>(c); - // TODO(gman): Make sure validate checks arg_count - // covers data_size. + // TODO(gman): Make sure validate checks + // immediate_data_size covers data_size. parse_error::ParseError result = ValidateBindAttribLocationImmediate( - this, arg_count, program, index, name); + this, immediate_data_size, program, index, name); if (result != parse_error::kParseNoError) { return result; } @@ -80,7 +81,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( - unsigned int arg_count, const gles2::BindBuffer& c) { + uint32 immediate_data_size, const gles2::BindBuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLuint buffer; if (!id_map_.GetServiceId(c.buffer, &buffer)) { @@ -88,7 +89,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateBindBuffer(this, arg_count, target, buffer); + ValidateBindBuffer(this, immediate_data_size, target, buffer); if (result != parse_error::kParseNoError) { return result; } @@ -97,7 +98,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( } parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer( - unsigned int arg_count, const gles2::BindFramebuffer& c) { + uint32 immediate_data_size, const gles2::BindFramebuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLuint framebuffer; if (!id_map_.GetServiceId(c.framebuffer, &framebuffer)) { @@ -105,7 +106,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer( return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateBindFramebuffer(this, arg_count, target, framebuffer); + ValidateBindFramebuffer(this, immediate_data_size, target, framebuffer); if (result != parse_error::kParseNoError) { return result; } @@ -114,7 +115,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer( } parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer( - unsigned int arg_count, const gles2::BindRenderbuffer& c) { + uint32 immediate_data_size, const gles2::BindRenderbuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLuint renderbuffer; if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) { @@ -122,7 +123,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer( return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateBindRenderbuffer(this, arg_count, target, renderbuffer); + ValidateBindRenderbuffer( + this, immediate_data_size, target, renderbuffer); if (result != parse_error::kParseNoError) { return result; } @@ -131,7 +133,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer( } parse_error::ParseError GLES2DecoderImpl::HandleBindTexture( - unsigned int arg_count, const gles2::BindTexture& c) { + uint32 immediate_data_size, const gles2::BindTexture& c) { GLenum target = static_cast<GLenum>(c.target); GLuint texture; if (!id_map_.GetServiceId(c.texture, &texture)) { @@ -139,7 +141,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindTexture( return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateBindTexture(this, arg_count, target, texture); + ValidateBindTexture(this, immediate_data_size, target, texture); if (result != parse_error::kParseNoError) { return result; } @@ -148,13 +150,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindTexture( } parse_error::ParseError GLES2DecoderImpl::HandleBlendColor( - unsigned int arg_count, const gles2::BlendColor& c) { + uint32 immediate_data_size, const gles2::BlendColor& c) { GLclampf red = static_cast<GLclampf>(c.red); GLclampf green = static_cast<GLclampf>(c.green); GLclampf blue = static_cast<GLclampf>(c.blue); GLclampf alpha = static_cast<GLclampf>(c.alpha); parse_error::ParseError result = - ValidateBlendColor(this, arg_count, red, green, blue, alpha); + ValidateBlendColor(this, immediate_data_size, red, green, blue, alpha); if (result != parse_error::kParseNoError) { return result; } @@ -163,10 +165,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendColor( } parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation( - unsigned int arg_count, const gles2::BlendEquation& c) { + uint32 immediate_data_size, const gles2::BlendEquation& c) { GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = - ValidateBlendEquation(this, arg_count, mode); + ValidateBlendEquation(this, immediate_data_size, mode); if (result != parse_error::kParseNoError) { return result; } @@ -175,11 +177,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation( } parse_error::ParseError GLES2DecoderImpl::HandleBlendEquationSeparate( - unsigned int arg_count, const gles2::BlendEquationSeparate& c) { + uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) { GLenum modeRGB = static_cast<GLenum>(c.modeRGB); GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); parse_error::ParseError result = - ValidateBlendEquationSeparate(this, arg_count, modeRGB, modeAlpha); + ValidateBlendEquationSeparate( + this, immediate_data_size, modeRGB, modeAlpha); if (result != parse_error::kParseNoError) { return result; } @@ -188,11 +191,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendEquationSeparate( } parse_error::ParseError GLES2DecoderImpl::HandleBlendFunc( - unsigned int arg_count, const gles2::BlendFunc& c) { + uint32 immediate_data_size, const gles2::BlendFunc& c) { GLenum sfactor = static_cast<GLenum>(c.sfactor); GLenum dfactor = static_cast<GLenum>(c.dfactor); parse_error::ParseError result = - ValidateBlendFunc(this, arg_count, sfactor, dfactor); + ValidateBlendFunc(this, immediate_data_size, sfactor, dfactor); if (result != parse_error::kParseNoError) { return result; } @@ -201,14 +204,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendFunc( } parse_error::ParseError GLES2DecoderImpl::HandleBlendFuncSeparate( - unsigned int arg_count, const gles2::BlendFuncSeparate& c) { + uint32 immediate_data_size, const gles2::BlendFuncSeparate& c) { GLenum srcRGB = static_cast<GLenum>(c.srcRGB); GLenum dstRGB = static_cast<GLenum>(c.dstRGB); GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); parse_error::ParseError result = ValidateBlendFuncSeparate( - this, arg_count, srcRGB, dstRGB, srcAlpha, dstAlpha); + this, immediate_data_size, srcRGB, dstRGB, srcAlpha, dstAlpha); if (result != parse_error::kParseNoError) { return result; } @@ -216,43 +219,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendFuncSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2DecoderImpl::HandleBufferData( - unsigned int arg_count, const gles2::BufferData& c) { - GLenum target = static_cast<GLenum>(c.target); - GLsizeiptr size = static_cast<GLsizeiptr>(c.size); - uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); - uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); - GLenum usage = static_cast<GLenum>(c.usage); - uint32 data_size = size; - const void* data = GetSharedMemoryAs<const void*>( - data_shm_id, data_shm_offset, data_size); - parse_error::ParseError result = - ValidateBufferData(this, arg_count, target, size, data, usage); - if (result != parse_error::kParseNoError) { - return result; - } - glBufferData(target, size, data, usage); - return parse_error::kParseNoError; -} - -parse_error::ParseError GLES2DecoderImpl::HandleBufferDataImmediate( - unsigned int arg_count, const gles2::BufferDataImmediate& c) { - GLenum target = static_cast<GLenum>(c.target); - GLsizeiptr size = static_cast<GLsizeiptr>(c.size); - const void* data = GetImmediateDataAs<const void*>(c); - GLenum usage = static_cast<GLenum>(c.usage); - // Immediate version. - parse_error::ParseError result = - ValidateBufferDataImmediate(this, arg_count, target, size, data, usage); - if (result != parse_error::kParseNoError) { - return result; - } - glBufferData(target, size, data, usage); - return parse_error::kParseNoError; -} - parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( - unsigned int arg_count, const gles2::BufferSubData& c) { + uint32 immediate_data_size, const gles2::BufferSubData& c) { GLenum target = static_cast<GLenum>(c.target); GLintptr offset = static_cast<GLintptr>(c.offset); GLsizeiptr size = static_cast<GLsizeiptr>(c.size); @@ -262,7 +230,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( const void* data = GetSharedMemoryAs<const void*>( data_shm_id, data_shm_offset, data_size); parse_error::ParseError result = - ValidateBufferSubData(this, arg_count, target, offset, size, data); + ValidateBufferSubData( + this, immediate_data_size, target, offset, size, data); if (result != parse_error::kParseNoError) { return result; } @@ -271,7 +240,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( } parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( - unsigned int arg_count, const gles2::BufferSubDataImmediate& c) { + uint32 immediate_data_size, const gles2::BufferSubDataImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLintptr offset = static_cast<GLintptr>(c.offset); GLsizeiptr size = static_cast<GLsizeiptr>(c.size); @@ -279,7 +248,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( // Immediate version. parse_error::ParseError result = ValidateBufferSubDataImmediate( - this, arg_count, target, offset, size, data); + this, immediate_data_size, target, offset, size, data); if (result != parse_error::kParseNoError) { return result; } @@ -288,10 +257,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( - unsigned int arg_count, const gles2::CheckFramebufferStatus& c) { + uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) { GLenum target = static_cast<GLenum>(c.target); parse_error::ParseError result = - ValidateCheckFramebufferStatus(this, arg_count, target); + ValidateCheckFramebufferStatus(this, immediate_data_size, target); if (result != parse_error::kParseNoError) { return result; } @@ -300,10 +269,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( } parse_error::ParseError GLES2DecoderImpl::HandleClear( - unsigned int arg_count, const gles2::Clear& c) { + uint32 immediate_data_size, const gles2::Clear& c) { GLbitfield mask = static_cast<GLbitfield>(c.mask); parse_error::ParseError result = - ValidateClear(this, arg_count, mask); + ValidateClear(this, immediate_data_size, mask); if (result != parse_error::kParseNoError) { return result; } @@ -312,13 +281,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleClear( } parse_error::ParseError GLES2DecoderImpl::HandleClearColor( - unsigned int arg_count, const gles2::ClearColor& c) { + uint32 immediate_data_size, const gles2::ClearColor& c) { GLclampf red = static_cast<GLclampf>(c.red); GLclampf green = static_cast<GLclampf>(c.green); GLclampf blue = static_cast<GLclampf>(c.blue); GLclampf alpha = static_cast<GLclampf>(c.alpha); parse_error::ParseError result = - ValidateClearColor(this, arg_count, red, green, blue, alpha); + ValidateClearColor(this, immediate_data_size, red, green, blue, alpha); if (result != parse_error::kParseNoError) { return result; } @@ -327,10 +296,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleClearColor( } parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf( - unsigned int arg_count, const gles2::ClearDepthf& c) { + uint32 immediate_data_size, const gles2::ClearDepthf& c) { GLclampf depth = static_cast<GLclampf>(c.depth); parse_error::ParseError result = - ValidateClearDepthf(this, arg_count, depth); + ValidateClearDepthf(this, immediate_data_size, depth); if (result != parse_error::kParseNoError) { return result; } @@ -339,10 +308,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf( } parse_error::ParseError GLES2DecoderImpl::HandleClearStencil( - unsigned int arg_count, const gles2::ClearStencil& c) { + uint32 immediate_data_size, const gles2::ClearStencil& c) { GLint s = static_cast<GLint>(c.s); parse_error::ParseError result = - ValidateClearStencil(this, arg_count, s); + ValidateClearStencil(this, immediate_data_size, s); if (result != parse_error::kParseNoError) { return result; } @@ -351,13 +320,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleClearStencil( } parse_error::ParseError GLES2DecoderImpl::HandleColorMask( - unsigned int arg_count, const gles2::ColorMask& c) { + uint32 immediate_data_size, const gles2::ColorMask& c) { GLboolean red = static_cast<GLboolean>(c.red); GLboolean green = static_cast<GLboolean>(c.green); GLboolean blue = static_cast<GLboolean>(c.blue); GLboolean alpha = static_cast<GLboolean>(c.alpha); parse_error::ParseError result = - ValidateColorMask(this, arg_count, red, green, blue, alpha); + ValidateColorMask(this, immediate_data_size, red, green, blue, alpha); if (result != parse_error::kParseNoError) { return result; } @@ -366,14 +335,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleColorMask( } parse_error::ParseError GLES2DecoderImpl::HandleCompileShader( - unsigned int arg_count, const gles2::CompileShader& c) { + uint32 immediate_data_size, const gles2::CompileShader& c) { GLuint shader; if (!id_map_.GetServiceId(c.shader, &shader)) { SetGLError(GL_INVALID_VALUE); return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateCompileShader(this, arg_count, shader); + ValidateCompileShader(this, immediate_data_size, shader); if (result != parse_error::kParseNoError) { return result; } @@ -381,57 +350,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompileShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2D( - unsigned int arg_count, const gles2::CompressedTexImage2D& c) { - GLenum target = static_cast<GLenum>(c.target); - GLint level = static_cast<GLint>(c.level); - GLenum internalformat = static_cast<GLenum>(c.internalformat); - GLsizei width = static_cast<GLsizei>(c.width); - GLsizei height = static_cast<GLsizei>(c.height); - GLint border = static_cast<GLint>(c.border); - GLsizei imageSize = static_cast<GLsizei>(c.imageSize); - uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); - uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); - uint32 data_size = imageSize; - const void* data = GetSharedMemoryAs<const void*>( - data_shm_id, data_shm_offset, data_size); - parse_error::ParseError result = - ValidateCompressedTexImage2D( - this, arg_count, target, level, internalformat, width, height, border, - imageSize, data); - if (result != parse_error::kParseNoError) { - return result; - } - glCompressedTexImage2D( - target, level, internalformat, width, height, border, imageSize, data); - return parse_error::kParseNoError; -} - -parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2DImmediate( - unsigned int arg_count, const gles2::CompressedTexImage2DImmediate& c) { - GLenum target = static_cast<GLenum>(c.target); - GLint level = static_cast<GLint>(c.level); - GLenum internalformat = static_cast<GLenum>(c.internalformat); - GLsizei width = static_cast<GLsizei>(c.width); - GLsizei height = static_cast<GLsizei>(c.height); - GLint border = static_cast<GLint>(c.border); - GLsizei imageSize = static_cast<GLsizei>(c.imageSize); - const void* data = GetImmediateDataAs<const void*>(c); - // Immediate version. - parse_error::ParseError result = - ValidateCompressedTexImage2DImmediate( - this, arg_count, target, level, internalformat, width, height, border, - imageSize, data); - if (result != parse_error::kParseNoError) { - return result; - } - glCompressedTexImage2D( - target, level, internalformat, width, height, border, imageSize, data); - return parse_error::kParseNoError; -} - parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( - unsigned int arg_count, const gles2::CompressedTexSubImage2D& c) { + uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); @@ -447,8 +367,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( data_shm_id, data_shm_offset, data_size); parse_error::ParseError result = ValidateCompressedTexSubImage2D( - this, arg_count, target, level, xoffset, yoffset, width, height, - format, imageSize, data); + this, immediate_data_size, target, level, xoffset, yoffset, width, + height, format, imageSize, data); if (result != parse_error::kParseNoError) { return result; } @@ -459,7 +379,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate( - unsigned int arg_count, const gles2::CompressedTexSubImage2DImmediate& c) { + uint32 immediate_data_size, + const gles2::CompressedTexSubImage2DImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); @@ -472,8 +393,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate // Immediate version. parse_error::ParseError result = ValidateCompressedTexSubImage2DImmediate( - this, arg_count, target, level, xoffset, yoffset, width, height, - format, imageSize, data); + this, immediate_data_size, target, level, xoffset, yoffset, width, + height, format, imageSize, data); if (result != parse_error::kParseNoError) { return result; } @@ -483,7 +404,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate } parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( - unsigned int arg_count, const gles2::CopyTexImage2D& c) { + uint32 immediate_data_size, const gles2::CopyTexImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLenum internalformat = static_cast<GLenum>(c.internalformat); @@ -494,8 +415,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( GLint border = static_cast<GLint>(c.border); parse_error::ParseError result = ValidateCopyTexImage2D( - this, arg_count, target, level, internalformat, x, y, width, height, - border); + this, immediate_data_size, target, level, internalformat, x, y, width, + height, border); if (result != parse_error::kParseNoError) { return result; } @@ -504,7 +425,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( } parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D( - unsigned int arg_count, const gles2::CopyTexSubImage2D& c) { + uint32 immediate_data_size, const gles2::CopyTexSubImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); @@ -515,8 +436,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D( GLsizei height = static_cast<GLsizei>(c.height); parse_error::ParseError result = ValidateCopyTexSubImage2D( - this, arg_count, target, level, xoffset, yoffset, x, y, width, - height); + this, immediate_data_size, target, level, xoffset, yoffset, x, y, + width, height); if (result != parse_error::kParseNoError) { return result; } @@ -525,10 +446,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D( } parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram( - unsigned int arg_count, const gles2::CreateProgram& c) { + uint32 immediate_data_size, const gles2::CreateProgram& c) { uint32 client_id = c.client_id; parse_error::ParseError result = - ValidateCreateProgram(this, arg_count); + ValidateCreateProgram(this, immediate_data_size); if (result != parse_error::kParseNoError) { return result; } @@ -537,11 +458,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram( } parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( - unsigned int arg_count, const gles2::CreateShader& c) { + uint32 immediate_data_size, const gles2::CreateShader& c) { GLenum type = static_cast<GLenum>(c.type); uint32 client_id = c.client_id; parse_error::ParseError result = - ValidateCreateShader(this, arg_count, type); + ValidateCreateShader(this, immediate_data_size, type); if (result != parse_error::kParseNoError) { return result; } @@ -550,10 +471,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( } parse_error::ParseError GLES2DecoderImpl::HandleCullFace( - unsigned int arg_count, const gles2::CullFace& c) { + uint32 immediate_data_size, const gles2::CullFace& c) { GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = - ValidateCullFace(this, arg_count, mode); + ValidateCullFace(this, immediate_data_size, mode); if (result != parse_error::kParseNoError) { return result; } @@ -562,12 +483,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleCullFace( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers( - unsigned int arg_count, const gles2::DeleteBuffers& c) { + uint32 immediate_data_size, const gles2::DeleteBuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateDeleteBuffers(this, arg_count, n, buffers); + ValidateDeleteBuffers(this, immediate_data_size, n, buffers); if (result != parse_error::kParseNoError) { return result; } @@ -576,11 +497,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate( - unsigned int arg_count, const gles2::DeleteBuffersImmediate& c) { + uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c); parse_error::ParseError result = - ValidateDeleteBuffersImmediate(this, arg_count, n, buffers); + ValidateDeleteBuffersImmediate(this, immediate_data_size, n, buffers); if (result != parse_error::kParseNoError) { return result; } @@ -589,13 +510,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers( - unsigned int arg_count, const gles2::DeleteFramebuffers& c) { + uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( gman): size */); parse_error::ParseError result = - ValidateDeleteFramebuffers(this, arg_count, n, framebuffers); + ValidateDeleteFramebuffers(this, immediate_data_size, n, framebuffers); if (result != parse_error::kParseNoError) { return result; } @@ -604,11 +525,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( - unsigned int arg_count, const gles2::DeleteFramebuffersImmediate& c) { + uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c); parse_error::ParseError result = - ValidateDeleteFramebuffersImmediate(this, arg_count, n, framebuffers); + ValidateDeleteFramebuffersImmediate( + this, immediate_data_size, n, framebuffers); if (result != parse_error::kParseNoError) { return result; } @@ -617,14 +539,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram( - unsigned int arg_count, const gles2::DeleteProgram& c) { + uint32 immediate_data_size, const gles2::DeleteProgram& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateDeleteProgram(this, arg_count, program); + ValidateDeleteProgram(this, immediate_data_size, program); if (result != parse_error::kParseNoError) { return result; } @@ -633,13 +555,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( - unsigned int arg_count, const gles2::DeleteRenderbuffers& c) { + uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( gman): size */); parse_error::ParseError result = - ValidateDeleteRenderbuffers(this, arg_count, n, renderbuffers); + ValidateDeleteRenderbuffers(this, immediate_data_size, n, renderbuffers); if (result != parse_error::kParseNoError) { return result; } @@ -648,11 +570,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( - unsigned int arg_count, const gles2::DeleteRenderbuffersImmediate& c) { + uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c); parse_error::ParseError result = - ValidateDeleteRenderbuffersImmediate(this, arg_count, n, renderbuffers); + ValidateDeleteRenderbuffersImmediate( + this, immediate_data_size, n, renderbuffers); if (result != parse_error::kParseNoError) { return result; } @@ -661,14 +584,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( - unsigned int arg_count, const gles2::DeleteShader& c) { + uint32 immediate_data_size, const gles2::DeleteShader& c) { GLuint shader; if (!id_map_.GetServiceId(c.shader, &shader)) { SetGLError(GL_INVALID_VALUE); return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateDeleteShader(this, arg_count, shader); + ValidateDeleteShader(this, immediate_data_size, shader); if (result != parse_error::kParseNoError) { return result; } @@ -677,12 +600,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( - unsigned int arg_count, const gles2::DeleteTextures& c) { + uint32 immediate_data_size, const gles2::DeleteTextures& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* textures = GetSharedMemoryAs<const GLuint*>( c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateDeleteTextures(this, arg_count, n, textures); + ValidateDeleteTextures(this, immediate_data_size, n, textures); if (result != parse_error::kParseNoError) { return result; } @@ -691,11 +614,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( } parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate( - unsigned int arg_count, const gles2::DeleteTexturesImmediate& c) { + uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* textures = GetImmediateDataAs<const GLuint*>(c); parse_error::ParseError result = - ValidateDeleteTexturesImmediate(this, arg_count, n, textures); + ValidateDeleteTexturesImmediate(this, immediate_data_size, n, textures); if (result != parse_error::kParseNoError) { return result; } @@ -704,10 +627,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( - unsigned int arg_count, const gles2::DepthFunc& c) { + uint32 immediate_data_size, const gles2::DepthFunc& c) { GLenum func = static_cast<GLenum>(c.func); parse_error::ParseError result = - ValidateDepthFunc(this, arg_count, func); + ValidateDepthFunc(this, immediate_data_size, func); if (result != parse_error::kParseNoError) { return result; } @@ -716,10 +639,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( } parse_error::ParseError GLES2DecoderImpl::HandleDepthMask( - unsigned int arg_count, const gles2::DepthMask& c) { + uint32 immediate_data_size, const gles2::DepthMask& c) { GLboolean flag = static_cast<GLboolean>(c.flag); parse_error::ParseError result = - ValidateDepthMask(this, arg_count, flag); + ValidateDepthMask(this, immediate_data_size, flag); if (result != parse_error::kParseNoError) { return result; } @@ -728,11 +651,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDepthMask( } parse_error::ParseError GLES2DecoderImpl::HandleDepthRangef( - unsigned int arg_count, const gles2::DepthRangef& c) { + uint32 immediate_data_size, const gles2::DepthRangef& c) { GLclampf zNear = static_cast<GLclampf>(c.zNear); GLclampf zFar = static_cast<GLclampf>(c.zFar); parse_error::ParseError result = - ValidateDepthRangef(this, arg_count, zNear, zFar); + ValidateDepthRangef(this, immediate_data_size, zNear, zFar); if (result != parse_error::kParseNoError) { return result; } @@ -741,7 +664,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleDepthRangef( } parse_error::ParseError GLES2DecoderImpl::HandleDetachShader( - unsigned int arg_count, const gles2::DetachShader& c) { + uint32 immediate_data_size, const gles2::DetachShader& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -753,7 +676,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleDetachShader( return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateDetachShader(this, arg_count, program, shader); + ValidateDetachShader(this, immediate_data_size, program, shader); if (result != parse_error::kParseNoError) { return result; } @@ -762,10 +685,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleDetachShader( } parse_error::ParseError GLES2DecoderImpl::HandleDisable( - unsigned int arg_count, const gles2::Disable& c) { + uint32 immediate_data_size, const gles2::Disable& c) { GLenum cap = static_cast<GLenum>(c.cap); parse_error::ParseError result = - ValidateDisable(this, arg_count, cap); + ValidateDisable(this, immediate_data_size, cap); if (result != parse_error::kParseNoError) { return result; } @@ -774,10 +697,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleDisable( } parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( - unsigned int arg_count, const gles2::DisableVertexAttribArray& c) { + uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) { GLuint index = static_cast<GLuint>(c.index); parse_error::ParseError result = - ValidateDisableVertexAttribArray(this, arg_count, index); + ValidateDisableVertexAttribArray(this, immediate_data_size, index); if (result != parse_error::kParseNoError) { return result; } @@ -786,12 +709,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( } parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays( - unsigned int arg_count, const gles2::DrawArrays& c) { + uint32 immediate_data_size, const gles2::DrawArrays& c) { GLenum mode = static_cast<GLenum>(c.mode); GLint first = static_cast<GLint>(c.first); GLsizei count = static_cast<GLsizei>(c.count); parse_error::ParseError result = - ValidateDrawArrays(this, arg_count, mode, first, count); + ValidateDrawArrays(this, immediate_data_size, mode, first, count); if (result != parse_error::kParseNoError) { return result; } @@ -800,10 +723,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays( } parse_error::ParseError GLES2DecoderImpl::HandleEnable( - unsigned int arg_count, const gles2::Enable& c) { + uint32 immediate_data_size, const gles2::Enable& c) { GLenum cap = static_cast<GLenum>(c.cap); parse_error::ParseError result = - ValidateEnable(this, arg_count, cap); + ValidateEnable(this, immediate_data_size, cap); if (result != parse_error::kParseNoError) { return result; } @@ -812,10 +735,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleEnable( } parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( - unsigned int arg_count, const gles2::EnableVertexAttribArray& c) { + uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) { GLuint index = static_cast<GLuint>(c.index); parse_error::ParseError result = - ValidateEnableVertexAttribArray(this, arg_count, index); + ValidateEnableVertexAttribArray(this, immediate_data_size, index); if (result != parse_error::kParseNoError) { return result; } @@ -824,9 +747,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( } parse_error::ParseError GLES2DecoderImpl::HandleFinish( - unsigned int arg_count, const gles2::Finish& c) { + uint32 immediate_data_size, const gles2::Finish& c) { parse_error::ParseError result = - ValidateFinish(this, arg_count); + ValidateFinish(this, immediate_data_size); if (result != parse_error::kParseNoError) { return result; } @@ -835,9 +758,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleFinish( } parse_error::ParseError GLES2DecoderImpl::HandleFlush( - unsigned int arg_count, const gles2::Flush& c) { + uint32 immediate_data_size, const gles2::Flush& c) { parse_error::ParseError result = - ValidateFlush(this, arg_count); + ValidateFlush(this, immediate_data_size); if (result != parse_error::kParseNoError) { return result; } @@ -846,7 +769,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleFlush( } parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer( - unsigned int arg_count, const gles2::FramebufferRenderbuffer& c) { + uint32 immediate_data_size, const gles2::FramebufferRenderbuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLenum attachment = static_cast<GLenum>(c.attachment); GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget); @@ -857,7 +780,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer( } parse_error::ParseError result = ValidateFramebufferRenderbuffer( - this, arg_count, target, attachment, renderbuffertarget, + this, immediate_data_size, target, attachment, renderbuffertarget, renderbuffer); if (result != parse_error::kParseNoError) { return result; @@ -868,7 +791,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer( } parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D( - unsigned int arg_count, const gles2::FramebufferTexture2D& c) { + uint32 immediate_data_size, const gles2::FramebufferTexture2D& c) { GLenum target = static_cast<GLenum>(c.target); GLenum attachment = static_cast<GLenum>(c.attachment); GLenum textarget = static_cast<GLenum>(c.textarget); @@ -880,7 +803,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D( GLint level = static_cast<GLint>(c.level); parse_error::ParseError result = ValidateFramebufferTexture2D( - this, arg_count, target, attachment, textarget, texture, level); + this, immediate_data_size, target, attachment, textarget, texture, + level); if (result != parse_error::kParseNoError) { return result; } @@ -889,10 +813,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D( } parse_error::ParseError GLES2DecoderImpl::HandleFrontFace( - unsigned int arg_count, const gles2::FrontFace& c) { + uint32 immediate_data_size, const gles2::FrontFace& c) { GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = - ValidateFrontFace(this, arg_count, mode); + ValidateFrontFace(this, immediate_data_size, mode); if (result != parse_error::kParseNoError) { return result; } @@ -901,12 +825,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleFrontFace( } parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers( - unsigned int arg_count, const gles2::GenBuffers& c) { + uint32 immediate_data_size, const gles2::GenBuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* buffers = GetSharedMemoryAs<GLuint*>( c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateGenBuffers(this, arg_count, n, buffers); + ValidateGenBuffers(this, immediate_data_size, n, buffers); if (result != parse_error::kParseNoError) { return result; } @@ -915,11 +839,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers( } parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate( - unsigned int arg_count, const gles2::GenBuffersImmediate& c) { + uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* buffers = GetImmediateDataAs<GLuint*>(c); parse_error::ParseError result = - ValidateGenBuffersImmediate(this, arg_count, n, buffers); + ValidateGenBuffersImmediate(this, immediate_data_size, n, buffers); if (result != parse_error::kParseNoError) { return result; } @@ -928,10 +852,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( - unsigned int arg_count, const gles2::GenerateMipmap& c) { + uint32 immediate_data_size, const gles2::GenerateMipmap& c) { GLenum target = static_cast<GLenum>(c.target); parse_error::ParseError result = - ValidateGenerateMipmap(this, arg_count, target); + ValidateGenerateMipmap(this, immediate_data_size, target); if (result != parse_error::kParseNoError) { return result; } @@ -940,13 +864,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( } parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers( - unsigned int arg_count, const gles2::GenFramebuffers& c) { + uint32 immediate_data_size, const gles2::GenFramebuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( gman): size */); parse_error::ParseError result = - ValidateGenFramebuffers(this, arg_count, n, framebuffers); + ValidateGenFramebuffers(this, immediate_data_size, n, framebuffers); if (result != parse_error::kParseNoError) { return result; } @@ -955,11 +879,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers( } parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate( - unsigned int arg_count, const gles2::GenFramebuffersImmediate& c) { + uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c); parse_error::ParseError result = - ValidateGenFramebuffersImmediate(this, arg_count, n, framebuffers); + ValidateGenFramebuffersImmediate( + this, immediate_data_size, n, framebuffers); if (result != parse_error::kParseNoError) { return result; } @@ -968,13 +893,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers( - unsigned int arg_count, const gles2::GenRenderbuffers& c) { + uint32 immediate_data_size, const gles2::GenRenderbuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( gman): size */); parse_error::ParseError result = - ValidateGenRenderbuffers(this, arg_count, n, renderbuffers); + ValidateGenRenderbuffers(this, immediate_data_size, n, renderbuffers); if (result != parse_error::kParseNoError) { return result; } @@ -983,11 +908,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers( } parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate( - unsigned int arg_count, const gles2::GenRenderbuffersImmediate& c) { + uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c); parse_error::ParseError result = - ValidateGenRenderbuffersImmediate(this, arg_count, n, renderbuffers); + ValidateGenRenderbuffersImmediate( + this, immediate_data_size, n, renderbuffers); if (result != parse_error::kParseNoError) { return result; } @@ -996,12 +922,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleGenTextures( - unsigned int arg_count, const gles2::GenTextures& c) { + uint32 immediate_data_size, const gles2::GenTextures& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* textures = GetSharedMemoryAs<GLuint*>( c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateGenTextures(this, arg_count, n, textures); + ValidateGenTextures(this, immediate_data_size, n, textures); if (result != parse_error::kParseNoError) { return result; } @@ -1010,11 +936,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenTextures( } parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate( - unsigned int arg_count, const gles2::GenTexturesImmediate& c) { + uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* textures = GetImmediateDataAs<GLuint*>(c); parse_error::ParseError result = - ValidateGenTexturesImmediate(this, arg_count, n, textures); + ValidateGenTexturesImmediate(this, immediate_data_size, n, textures); if (result != parse_error::kParseNoError) { return result; } @@ -1022,51 +948,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocation( - unsigned int arg_count, const gles2::GetAttribLocation& c) { - GLuint program; - if (!id_map_.GetServiceId(c.program, &program)) { - SetGLError(GL_INVALID_VALUE); - return parse_error::kParseNoError; - } - uint32 name_size = c.data_size; - const char* name = GetSharedMemoryAs<const char*>( - c.name_shm_id, c.name_shm_offset, name_size); - parse_error::ParseError result = - ValidateGetAttribLocation(this, arg_count, program, name); - if (result != parse_error::kParseNoError) { - return result; - } - String name_str(name, name_size); - GLint location = glGetAttribLocation(program, name_str.c_str()); - DCHECK(false); // TODO: return result. - return parse_error::kParseNoError; -} - -parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocationImmediate( - unsigned int arg_count, const gles2::GetAttribLocationImmediate& c) { - GLuint program; - if (!id_map_.GetServiceId(c.program, &program)) { - SetGLError(GL_INVALID_VALUE); - return parse_error::kParseNoError; - } - uint32 name_size = c.data_size; - const char* name = GetImmediateDataAs<const char*>(c); - // TODO(gman): Make sure validate checks arg_count - // covers data_size. - parse_error::ParseError result = - ValidateGetAttribLocationImmediate(this, arg_count, program, name); - if (result != parse_error::kParseNoError) { - return result; - } - String name_str(name, name_size); - GLint location = glGetAttribLocation(program, name_str.c_str()); - DCHECK(false); // TODO: return result. - return parse_error::kParseNoError; -} - parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( - unsigned int arg_count, const gles2::GetBooleanv& c) { + uint32 immediate_data_size, const gles2::GetBooleanv& c) { GLenum pname = static_cast<GLenum>(c.pname); GLboolean* params; GLsizei num_values = util_.GLGetNumValuesReturned(pname); @@ -1074,7 +957,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( params = GetSharedMemoryAs<GLboolean*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetBooleanv(this, arg_count, pname, params); + ValidateGetBooleanv(this, immediate_data_size, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1083,7 +966,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( } parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv( - unsigned int arg_count, const gles2::GetBufferParameteriv& c) { + uint32 immediate_data_size, const gles2::GetBufferParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); GLint* params; @@ -1092,7 +975,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv( params = GetSharedMemoryAs<GLint*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetBufferParameteriv(this, arg_count, target, pname, params); + ValidateGetBufferParameteriv( + this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1101,20 +985,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv( } parse_error::ParseError GLES2DecoderImpl::HandleGetError( - unsigned int arg_count, const gles2::GetError& c) { + uint32 immediate_data_size, const gles2::GetError& c) { GLenum* result_dst = GetSharedMemoryAs<GLenum*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateGetError(this, arg_count); + ValidateGetError(this, immediate_data_size); if (result != parse_error::kParseNoError) { return result; } - *result_dst = glGetError(); + *result_dst = GetGLError(); return parse_error::kParseNoError; } parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv( - unsigned int arg_count, const gles2::GetFloatv& c) { + uint32 immediate_data_size, const gles2::GetFloatv& c) { GLenum pname = static_cast<GLenum>(c.pname); GLfloat* params; GLsizei num_values = util_.GLGetNumValuesReturned(pname); @@ -1122,7 +1006,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv( params = GetSharedMemoryAs<GLfloat*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetFloatv(this, arg_count, pname, params); + ValidateGetFloatv(this, immediate_data_size, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1132,7 +1016,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv( parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParameteriv( - unsigned int arg_count, + uint32 immediate_data_size, const gles2::GetFramebufferAttachmentParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum attachment = static_cast<GLenum>(c.attachment); @@ -1144,7 +1028,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParamete c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = ValidateGetFramebufferAttachmentParameteriv( - this, arg_count, target, attachment, pname, params); + this, immediate_data_size, target, attachment, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1153,7 +1037,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParamete } parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv( - unsigned int arg_count, const gles2::GetIntegerv& c) { + uint32 immediate_data_size, const gles2::GetIntegerv& c) { GLenum pname = static_cast<GLenum>(c.pname); GLint* params; GLsizei num_values = util_.GLGetNumValuesReturned(pname); @@ -1161,7 +1045,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv( params = GetSharedMemoryAs<GLint*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetIntegerv(this, arg_count, pname, params); + ValidateGetIntegerv(this, immediate_data_size, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1170,7 +1054,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv( } parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv( - unsigned int arg_count, const gles2::GetProgramiv& c) { + uint32 immediate_data_size, const gles2::GetProgramiv& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -1183,7 +1067,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv( params = GetSharedMemoryAs<GLint*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetProgramiv(this, arg_count, program, pname, params); + ValidateGetProgramiv(this, immediate_data_size, program, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1192,7 +1076,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv( } parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( - unsigned int arg_count, const gles2::GetProgramInfoLog& c) { + uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -1205,7 +1089,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = ValidateGetProgramInfoLog( - this, arg_count, program, bufsize, length, infolog); + this, immediate_data_size, program, bufsize, length, infolog); if (result != parse_error::kParseNoError) { return result; } @@ -1214,7 +1098,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( } parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( - unsigned int arg_count, const gles2::GetRenderbufferParameteriv& c) { + uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); GLint* params; @@ -1224,7 +1108,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = ValidateGetRenderbufferParameteriv( - this, arg_count, target, pname, params); + this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1233,7 +1117,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( } parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv( - unsigned int arg_count, const gles2::GetShaderiv& c) { + uint32 immediate_data_size, const gles2::GetShaderiv& c) { GLuint shader; if (!id_map_.GetServiceId(c.shader, &shader)) { SetGLError(GL_INVALID_VALUE); @@ -1246,7 +1130,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv( params = GetSharedMemoryAs<GLint*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetShaderiv(this, arg_count, shader, pname, params); + ValidateGetShaderiv(this, immediate_data_size, shader, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1255,7 +1139,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv( } parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( - unsigned int arg_count, const gles2::GetShaderInfoLog& c) { + uint32 immediate_data_size, const gles2::GetShaderInfoLog& c) { GLuint shader; if (!id_map_.GetServiceId(c.shader, &shader)) { SetGLError(GL_INVALID_VALUE); @@ -1268,7 +1152,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = ValidateGetShaderInfoLog( - this, arg_count, shader, bufsize, length, infolog); + this, immediate_data_size, shader, bufsize, length, infolog); if (result != parse_error::kParseNoError) { return result; } @@ -1277,7 +1161,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( } parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( - unsigned int arg_count, const gles2::GetShaderSource& c) { + uint32 immediate_data_size, const gles2::GetShaderSource& c) { GLuint shader; if (!id_map_.GetServiceId(c.shader, &shader)) { SetGLError(GL_INVALID_VALUE); @@ -1290,7 +1174,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( c.source_shm_id, c.source_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = ValidateGetShaderSource( - this, arg_count, shader, bufsize, length, source); + this, immediate_data_size, shader, bufsize, length, source); if (result != parse_error::kParseNoError) { return result; } @@ -1299,10 +1183,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( } parse_error::ParseError GLES2DecoderImpl::HandleGetString( - unsigned int arg_count, const gles2::GetString& c) { + uint32 immediate_data_size, const gles2::GetString& c) { GLenum name = static_cast<GLenum>(c.name); parse_error::ParseError result = - ValidateGetString(this, arg_count, name); + ValidateGetString(this, immediate_data_size, name); if (result != parse_error::kParseNoError) { return result; } @@ -1311,7 +1195,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetString( } parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv( - unsigned int arg_count, const gles2::GetTexParameterfv& c) { + uint32 immediate_data_size, const gles2::GetTexParameterfv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); GLfloat* params; @@ -1320,7 +1204,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv( params = GetSharedMemoryAs<GLfloat*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetTexParameterfv(this, arg_count, target, pname, params); + ValidateGetTexParameterfv( + this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1329,7 +1214,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv( } parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv( - unsigned int arg_count, const gles2::GetTexParameteriv& c) { + uint32 immediate_data_size, const gles2::GetTexParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); GLint* params; @@ -1338,7 +1223,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv( params = GetSharedMemoryAs<GLint*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetTexParameteriv(this, arg_count, target, pname, params); + ValidateGetTexParameteriv( + this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1346,51 +1232,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocation( - unsigned int arg_count, const gles2::GetUniformLocation& c) { - GLuint program; - if (!id_map_.GetServiceId(c.program, &program)) { - SetGLError(GL_INVALID_VALUE); - return parse_error::kParseNoError; - } - uint32 name_size = c.data_size; - const char* name = GetSharedMemoryAs<const char*>( - c.name_shm_id, c.name_shm_offset, name_size); - parse_error::ParseError result = - ValidateGetUniformLocation(this, arg_count, program, name); - if (result != parse_error::kParseNoError) { - return result; - } - String name_str(name, name_size); - GLint location = glGetUniformLocation(program, name_str.c_str()); - DCHECK(false); // TODO: return result. - return parse_error::kParseNoError; -} - -parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocationImmediate( - unsigned int arg_count, const gles2::GetUniformLocationImmediate& c) { - GLuint program; - if (!id_map_.GetServiceId(c.program, &program)) { - SetGLError(GL_INVALID_VALUE); - return parse_error::kParseNoError; - } - uint32 name_size = c.data_size; - const char* name = GetImmediateDataAs<const char*>(c); - // TODO(gman): Make sure validate checks arg_count - // covers data_size. - parse_error::ParseError result = - ValidateGetUniformLocationImmediate(this, arg_count, program, name); - if (result != parse_error::kParseNoError) { - return result; - } - String name_str(name, name_size); - GLint location = glGetUniformLocation(program, name_str.c_str()); - DCHECK(false); // TODO: return result. - return parse_error::kParseNoError; -} - parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv( - unsigned int arg_count, const gles2::GetVertexAttribfv& c) { + uint32 immediate_data_size, const gles2::GetVertexAttribfv& c) { GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); GLfloat* params; @@ -1399,7 +1242,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv( params = GetSharedMemoryAs<GLfloat*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetVertexAttribfv(this, arg_count, index, pname, params); + ValidateGetVertexAttribfv( + this, immediate_data_size, index, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1408,7 +1252,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv( } parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv( - unsigned int arg_count, const gles2::GetVertexAttribiv& c) { + uint32 immediate_data_size, const gles2::GetVertexAttribiv& c) { GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); GLint* params; @@ -1417,7 +1261,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv( params = GetSharedMemoryAs<GLint*>( c.params_shm_id, c.params_shm_offset, params_size); parse_error::ParseError result = - ValidateGetVertexAttribiv(this, arg_count, index, pname, params); + ValidateGetVertexAttribiv( + this, immediate_data_size, index, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1426,11 +1271,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv( } parse_error::ParseError GLES2DecoderImpl::HandleHint( - unsigned int arg_count, const gles2::Hint& c) { + uint32 immediate_data_size, const gles2::Hint& c) { GLenum target = static_cast<GLenum>(c.target); GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = - ValidateHint(this, arg_count, target, mode); + ValidateHint(this, immediate_data_size, target, mode); if (result != parse_error::kParseNoError) { return result; } @@ -1439,7 +1284,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleHint( } parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer( - unsigned int arg_count, const gles2::IsBuffer& c) { + uint32 immediate_data_size, const gles2::IsBuffer& c) { GLuint buffer; if (!id_map_.GetServiceId(c.buffer, &buffer)) { SetGLError(GL_INVALID_VALUE); @@ -1448,7 +1293,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer( GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsBuffer(this, arg_count, buffer); + ValidateIsBuffer(this, immediate_data_size, buffer); if (result != parse_error::kParseNoError) { return result; } @@ -1457,12 +1302,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer( } parse_error::ParseError GLES2DecoderImpl::HandleIsEnabled( - unsigned int arg_count, const gles2::IsEnabled& c) { + uint32 immediate_data_size, const gles2::IsEnabled& c) { GLenum cap = static_cast<GLenum>(c.cap); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsEnabled(this, arg_count, cap); + ValidateIsEnabled(this, immediate_data_size, cap); if (result != parse_error::kParseNoError) { return result; } @@ -1471,7 +1316,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsEnabled( } parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer( - unsigned int arg_count, const gles2::IsFramebuffer& c) { + uint32 immediate_data_size, const gles2::IsFramebuffer& c) { GLuint framebuffer; if (!id_map_.GetServiceId(c.framebuffer, &framebuffer)) { SetGLError(GL_INVALID_VALUE); @@ -1480,7 +1325,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer( GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsFramebuffer(this, arg_count, framebuffer); + ValidateIsFramebuffer(this, immediate_data_size, framebuffer); if (result != parse_error::kParseNoError) { return result; } @@ -1489,7 +1334,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer( } parse_error::ParseError GLES2DecoderImpl::HandleIsProgram( - unsigned int arg_count, const gles2::IsProgram& c) { + uint32 immediate_data_size, const gles2::IsProgram& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); @@ -1498,7 +1343,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsProgram( GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsProgram(this, arg_count, program); + ValidateIsProgram(this, immediate_data_size, program); if (result != parse_error::kParseNoError) { return result; } @@ -1507,7 +1352,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsProgram( } parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer( - unsigned int arg_count, const gles2::IsRenderbuffer& c) { + uint32 immediate_data_size, const gles2::IsRenderbuffer& c) { GLuint renderbuffer; if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) { SetGLError(GL_INVALID_VALUE); @@ -1516,7 +1361,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer( GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsRenderbuffer(this, arg_count, renderbuffer); + ValidateIsRenderbuffer(this, immediate_data_size, renderbuffer); if (result != parse_error::kParseNoError) { return result; } @@ -1525,7 +1370,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer( } parse_error::ParseError GLES2DecoderImpl::HandleIsShader( - unsigned int arg_count, const gles2::IsShader& c) { + uint32 immediate_data_size, const gles2::IsShader& c) { GLuint shader; if (!id_map_.GetServiceId(c.shader, &shader)) { SetGLError(GL_INVALID_VALUE); @@ -1534,7 +1379,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsShader( GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsShader(this, arg_count, shader); + ValidateIsShader(this, immediate_data_size, shader); if (result != parse_error::kParseNoError) { return result; } @@ -1543,7 +1388,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsShader( } parse_error::ParseError GLES2DecoderImpl::HandleIsTexture( - unsigned int arg_count, const gles2::IsTexture& c) { + uint32 immediate_data_size, const gles2::IsTexture& c) { GLuint texture; if (!id_map_.GetServiceId(c.texture, &texture)) { SetGLError(GL_INVALID_VALUE); @@ -1552,7 +1397,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsTexture( GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); parse_error::ParseError result = - ValidateIsTexture(this, arg_count, texture); + ValidateIsTexture(this, immediate_data_size, texture); if (result != parse_error::kParseNoError) { return result; } @@ -1561,10 +1406,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsTexture( } parse_error::ParseError GLES2DecoderImpl::HandleLineWidth( - unsigned int arg_count, const gles2::LineWidth& c) { + uint32 immediate_data_size, const gles2::LineWidth& c) { GLfloat width = static_cast<GLfloat>(c.width); parse_error::ParseError result = - ValidateLineWidth(this, arg_count, width); + ValidateLineWidth(this, immediate_data_size, width); if (result != parse_error::kParseNoError) { return result; } @@ -1573,14 +1418,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleLineWidth( } parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram( - unsigned int arg_count, const gles2::LinkProgram& c) { + uint32 immediate_data_size, const gles2::LinkProgram& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateLinkProgram(this, arg_count, program); + ValidateLinkProgram(this, immediate_data_size, program); if (result != parse_error::kParseNoError) { return result; } @@ -1589,11 +1434,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram( } parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset( - unsigned int arg_count, const gles2::PolygonOffset& c) { + uint32 immediate_data_size, const gles2::PolygonOffset& c) { GLfloat factor = static_cast<GLfloat>(c.factor); GLfloat units = static_cast<GLfloat>(c.units); parse_error::ParseError result = - ValidatePolygonOffset(this, arg_count, factor, units); + ValidatePolygonOffset(this, immediate_data_size, factor, units); if (result != parse_error::kParseNoError) { return result; } @@ -1602,14 +1447,14 @@ parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset( } parse_error::ParseError GLES2DecoderImpl::HandleRenderbufferStorage( - unsigned int arg_count, const gles2::RenderbufferStorage& c) { + uint32 immediate_data_size, const gles2::RenderbufferStorage& c) { GLenum target = static_cast<GLenum>(c.target); GLenum internalformat = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); parse_error::ParseError result = ValidateRenderbufferStorage( - this, arg_count, target, internalformat, width, height); + this, immediate_data_size, target, internalformat, width, height); if (result != parse_error::kParseNoError) { return result; } @@ -1618,11 +1463,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleRenderbufferStorage( } parse_error::ParseError GLES2DecoderImpl::HandleSampleCoverage( - unsigned int arg_count, const gles2::SampleCoverage& c) { + uint32 immediate_data_size, const gles2::SampleCoverage& c) { GLclampf value = static_cast<GLclampf>(c.value); GLboolean invert = static_cast<GLboolean>(c.invert); parse_error::ParseError result = - ValidateSampleCoverage(this, arg_count, value, invert); + ValidateSampleCoverage(this, immediate_data_size, value, invert); if (result != parse_error::kParseNoError) { return result; } @@ -1631,13 +1476,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleSampleCoverage( } parse_error::ParseError GLES2DecoderImpl::HandleScissor( - unsigned int arg_count, const gles2::Scissor& c) { + uint32 immediate_data_size, const gles2::Scissor& c) { GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); parse_error::ParseError result = - ValidateScissor(this, arg_count, x, y, width, height); + ValidateScissor(this, immediate_data_size, x, y, width, height); if (result != parse_error::kParseNoError) { return result; } @@ -1646,12 +1491,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleScissor( } parse_error::ParseError GLES2DecoderImpl::HandleStencilFunc( - unsigned int arg_count, const gles2::StencilFunc& c) { + uint32 immediate_data_size, const gles2::StencilFunc& c) { GLenum func = static_cast<GLenum>(c.func); GLint ref = static_cast<GLint>(c.ref); GLuint mask = static_cast<GLuint>(c.mask); parse_error::ParseError result = - ValidateStencilFunc(this, arg_count, func, ref, mask); + ValidateStencilFunc(this, immediate_data_size, func, ref, mask); if (result != parse_error::kParseNoError) { return result; } @@ -1660,13 +1505,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilFunc( } parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate( - unsigned int arg_count, const gles2::StencilFuncSeparate& c) { + uint32 immediate_data_size, const gles2::StencilFuncSeparate& c) { GLenum face = static_cast<GLenum>(c.face); GLenum func = static_cast<GLenum>(c.func); GLint ref = static_cast<GLint>(c.ref); GLuint mask = static_cast<GLuint>(c.mask); parse_error::ParseError result = - ValidateStencilFuncSeparate(this, arg_count, face, func, ref, mask); + ValidateStencilFuncSeparate( + this, immediate_data_size, face, func, ref, mask); if (result != parse_error::kParseNoError) { return result; } @@ -1675,10 +1521,10 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate( } parse_error::ParseError GLES2DecoderImpl::HandleStencilMask( - unsigned int arg_count, const gles2::StencilMask& c) { + uint32 immediate_data_size, const gles2::StencilMask& c) { GLuint mask = static_cast<GLuint>(c.mask); parse_error::ParseError result = - ValidateStencilMask(this, arg_count, mask); + ValidateStencilMask(this, immediate_data_size, mask); if (result != parse_error::kParseNoError) { return result; } @@ -1687,11 +1533,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilMask( } parse_error::ParseError GLES2DecoderImpl::HandleStencilMaskSeparate( - unsigned int arg_count, const gles2::StencilMaskSeparate& c) { + uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) { GLenum face = static_cast<GLenum>(c.face); GLuint mask = static_cast<GLuint>(c.mask); parse_error::ParseError result = - ValidateStencilMaskSeparate(this, arg_count, face, mask); + ValidateStencilMaskSeparate(this, immediate_data_size, face, mask); if (result != parse_error::kParseNoError) { return result; } @@ -1700,12 +1546,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilMaskSeparate( } parse_error::ParseError GLES2DecoderImpl::HandleStencilOp( - unsigned int arg_count, const gles2::StencilOp& c) { + uint32 immediate_data_size, const gles2::StencilOp& c) { GLenum fail = static_cast<GLenum>(c.fail); GLenum zfail = static_cast<GLenum>(c.zfail); GLenum zpass = static_cast<GLenum>(c.zpass); parse_error::ParseError result = - ValidateStencilOp(this, arg_count, fail, zfail, zpass); + ValidateStencilOp(this, immediate_data_size, fail, zfail, zpass); if (result != parse_error::kParseNoError) { return result; } @@ -1714,13 +1560,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilOp( } parse_error::ParseError GLES2DecoderImpl::HandleStencilOpSeparate( - unsigned int arg_count, const gles2::StencilOpSeparate& c) { + uint32 immediate_data_size, const gles2::StencilOpSeparate& c) { GLenum face = static_cast<GLenum>(c.face); GLenum fail = static_cast<GLenum>(c.fail); GLenum zfail = static_cast<GLenum>(c.zfail); GLenum zpass = static_cast<GLenum>(c.zpass); parse_error::ParseError result = - ValidateStencilOpSeparate(this, arg_count, face, fail, zfail, zpass); + ValidateStencilOpSeparate( + this, immediate_data_size, face, fail, zfail, zpass); if (result != parse_error::kParseNoError) { return result; } @@ -1728,67 +1575,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilOpSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2DecoderImpl::HandleTexImage2D( - unsigned int arg_count, const gles2::TexImage2D& c) { - GLenum target = static_cast<GLenum>(c.target); - GLint level = static_cast<GLint>(c.level); - GLint internalformat = static_cast<GLint>(c.internalformat); - GLsizei width = static_cast<GLsizei>(c.width); - GLsizei height = static_cast<GLsizei>(c.height); - GLint border = static_cast<GLint>(c.border); - GLenum format = static_cast<GLenum>(c.format); - GLenum type = static_cast<GLenum>(c.type); - uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); - uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); - uint32 pixels_size = GLES2Util::ComputeImageDataSize( - width, height, format, type, unpack_alignment_); - const void* pixels = GetSharedMemoryAs<const void*>( - pixels_shm_id, pixels_shm_offset, pixels_size); - parse_error::ParseError result = - ValidateTexImage2D( - this, arg_count, target, level, internalformat, width, height, border, - format, type, pixels); - if (result != parse_error::kParseNoError) { - return result; - } - glTexImage2D( - target, level, internalformat, width, height, border, format, type, - pixels); - return parse_error::kParseNoError; -} - -parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate( - unsigned int arg_count, const gles2::TexImage2DImmediate& c) { - GLenum target = static_cast<GLenum>(c.target); - GLint level = static_cast<GLint>(c.level); - GLint internalformat = static_cast<GLint>(c.internalformat); - GLsizei width = static_cast<GLsizei>(c.width); - GLsizei height = static_cast<GLsizei>(c.height); - GLint border = static_cast<GLint>(c.border); - GLenum format = static_cast<GLenum>(c.format); - GLenum type = static_cast<GLenum>(c.type); - const void* pixels = GetImmediateDataAs<const void*>(c); - // Immediate version. - parse_error::ParseError result = - ValidateTexImage2DImmediate( - this, arg_count, target, level, internalformat, width, height, border, - format, type, pixels); - if (result != parse_error::kParseNoError) { - return result; - } - glTexImage2D( - target, level, internalformat, width, height, border, format, type, - pixels); - return parse_error::kParseNoError; -} - parse_error::ParseError GLES2DecoderImpl::HandleTexParameterf( - unsigned int arg_count, const gles2::TexParameterf& c) { + uint32 immediate_data_size, const gles2::TexParameterf& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); GLfloat param = static_cast<GLfloat>(c.param); parse_error::ParseError result = - ValidateTexParameterf(this, arg_count, target, pname, param); + ValidateTexParameterf(this, immediate_data_size, target, pname, param); if (result != parse_error::kParseNoError) { return result; } @@ -1797,13 +1590,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterf( } parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv( - unsigned int arg_count, const gles2::TexParameterfv& c) { + uint32 immediate_data_size, const gles2::TexParameterfv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateTexParameterfv(this, arg_count, target, pname, params); + ValidateTexParameterfv(this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1812,13 +1605,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv( } parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate( - unsigned int arg_count, const gles2::TexParameterfvImmediate& c) { + uint32 immediate_data_size, const gles2::TexParameterfvImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateTexParameterfvImmediate(this, arg_count, target, pname, params); + ValidateTexParameterfvImmediate( + this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1827,12 +1621,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri( - unsigned int arg_count, const gles2::TexParameteri& c) { + uint32 immediate_data_size, const gles2::TexParameteri& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); GLint param = static_cast<GLint>(c.param); parse_error::ParseError result = - ValidateTexParameteri(this, arg_count, target, pname, param); + ValidateTexParameteri(this, immediate_data_size, target, pname, param); if (result != parse_error::kParseNoError) { return result; } @@ -1841,13 +1635,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri( } parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv( - unsigned int arg_count, const gles2::TexParameteriv& c) { + uint32 immediate_data_size, const gles2::TexParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); const GLint* params = GetSharedMemoryAs<const GLint*>( c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateTexParameteriv(this, arg_count, target, pname, params); + ValidateTexParameteriv(this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1856,13 +1650,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv( } parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate( - unsigned int arg_count, const gles2::TexParameterivImmediate& c) { + uint32 immediate_data_size, const gles2::TexParameterivImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); const GLint* params = GetImmediateDataAs<const GLint*>(c); // Immediate version. parse_error::ParseError result = - ValidateTexParameterivImmediate(this, arg_count, target, pname, params); + ValidateTexParameterivImmediate( + this, immediate_data_size, target, pname, params); if (result != parse_error::kParseNoError) { return result; } @@ -1871,7 +1666,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( - unsigned int arg_count, const gles2::TexSubImage2D& c) { + uint32 immediate_data_size, const gles2::TexSubImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); @@ -1888,8 +1683,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( pixels_shm_id, pixels_shm_offset, pixels_size); parse_error::ParseError result = ValidateTexSubImage2D( - this, arg_count, target, level, xoffset, yoffset, width, height, - format, type, pixels); + this, immediate_data_size, target, level, xoffset, yoffset, width, + height, format, type, pixels); if (result != parse_error::kParseNoError) { return result; } @@ -1899,7 +1694,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( } parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( - unsigned int arg_count, const gles2::TexSubImage2DImmediate& c) { + uint32 immediate_data_size, const gles2::TexSubImage2DImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); GLint xoffset = static_cast<GLint>(c.xoffset); @@ -1912,8 +1707,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( // Immediate version. parse_error::ParseError result = ValidateTexSubImage2DImmediate( - this, arg_count, target, level, xoffset, yoffset, width, height, - format, type, pixels); + this, immediate_data_size, target, level, xoffset, yoffset, width, + height, format, type, pixels); if (result != parse_error::kParseNoError) { return result; } @@ -1923,11 +1718,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform1f( - unsigned int arg_count, const gles2::Uniform1f& c) { + uint32 immediate_data_size, const gles2::Uniform1f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); parse_error::ParseError result = - ValidateUniform1f(this, arg_count, location, x); + ValidateUniform1f(this, immediate_data_size, location, x); if (result != parse_error::kParseNoError) { return result; } @@ -1936,13 +1731,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1f( } parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv( - unsigned int arg_count, const gles2::Uniform1fv& c) { + uint32 immediate_data_size, const gles2::Uniform1fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform1fv(this, arg_count, location, count, v); + ValidateUniform1fv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -1951,13 +1746,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate( - unsigned int arg_count, const gles2::Uniform1fvImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform1fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform1fvImmediate(this, arg_count, location, count, v); + ValidateUniform1fvImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -1966,11 +1762,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform1i( - unsigned int arg_count, const gles2::Uniform1i& c) { + uint32 immediate_data_size, const gles2::Uniform1i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); parse_error::ParseError result = - ValidateUniform1i(this, arg_count, location, x); + ValidateUniform1i(this, immediate_data_size, location, x); if (result != parse_error::kParseNoError) { return result; } @@ -1979,13 +1775,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1i( } parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv( - unsigned int arg_count, const gles2::Uniform1iv& c) { + uint32 immediate_data_size, const gles2::Uniform1iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetSharedMemoryAs<const GLint*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform1iv(this, arg_count, location, count, v); + ValidateUniform1iv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -1994,13 +1790,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate( - unsigned int arg_count, const gles2::Uniform1ivImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform1ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetImmediateDataAs<const GLint*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform1ivImmediate(this, arg_count, location, count, v); + ValidateUniform1ivImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2009,12 +1806,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform2f( - unsigned int arg_count, const gles2::Uniform2f& c) { + uint32 immediate_data_size, const gles2::Uniform2f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); GLfloat y = static_cast<GLfloat>(c.y); parse_error::ParseError result = - ValidateUniform2f(this, arg_count, location, x, y); + ValidateUniform2f(this, immediate_data_size, location, x, y); if (result != parse_error::kParseNoError) { return result; } @@ -2023,13 +1820,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2f( } parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv( - unsigned int arg_count, const gles2::Uniform2fv& c) { + uint32 immediate_data_size, const gles2::Uniform2fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform2fv(this, arg_count, location, count, v); + ValidateUniform2fv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2038,13 +1835,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate( - unsigned int arg_count, const gles2::Uniform2fvImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform2fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform2fvImmediate(this, arg_count, location, count, v); + ValidateUniform2fvImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2053,12 +1851,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform2i( - unsigned int arg_count, const gles2::Uniform2i& c) { + uint32 immediate_data_size, const gles2::Uniform2i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); parse_error::ParseError result = - ValidateUniform2i(this, arg_count, location, x, y); + ValidateUniform2i(this, immediate_data_size, location, x, y); if (result != parse_error::kParseNoError) { return result; } @@ -2067,13 +1865,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2i( } parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv( - unsigned int arg_count, const gles2::Uniform2iv& c) { + uint32 immediate_data_size, const gles2::Uniform2iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetSharedMemoryAs<const GLint*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform2iv(this, arg_count, location, count, v); + ValidateUniform2iv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2082,13 +1880,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate( - unsigned int arg_count, const gles2::Uniform2ivImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform2ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetImmediateDataAs<const GLint*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform2ivImmediate(this, arg_count, location, count, v); + ValidateUniform2ivImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2097,13 +1896,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform3f( - unsigned int arg_count, const gles2::Uniform3f& c) { + uint32 immediate_data_size, const gles2::Uniform3f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); GLfloat y = static_cast<GLfloat>(c.y); GLfloat z = static_cast<GLfloat>(c.z); parse_error::ParseError result = - ValidateUniform3f(this, arg_count, location, x, y, z); + ValidateUniform3f(this, immediate_data_size, location, x, y, z); if (result != parse_error::kParseNoError) { return result; } @@ -2112,13 +1911,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3f( } parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv( - unsigned int arg_count, const gles2::Uniform3fv& c) { + uint32 immediate_data_size, const gles2::Uniform3fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform3fv(this, arg_count, location, count, v); + ValidateUniform3fv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2127,13 +1926,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate( - unsigned int arg_count, const gles2::Uniform3fvImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform3fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform3fvImmediate(this, arg_count, location, count, v); + ValidateUniform3fvImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2142,13 +1942,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform3i( - unsigned int arg_count, const gles2::Uniform3i& c) { + uint32 immediate_data_size, const gles2::Uniform3i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); GLint z = static_cast<GLint>(c.z); parse_error::ParseError result = - ValidateUniform3i(this, arg_count, location, x, y, z); + ValidateUniform3i(this, immediate_data_size, location, x, y, z); if (result != parse_error::kParseNoError) { return result; } @@ -2157,13 +1957,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3i( } parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv( - unsigned int arg_count, const gles2::Uniform3iv& c) { + uint32 immediate_data_size, const gles2::Uniform3iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetSharedMemoryAs<const GLint*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform3iv(this, arg_count, location, count, v); + ValidateUniform3iv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2172,13 +1972,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate( - unsigned int arg_count, const gles2::Uniform3ivImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform3ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetImmediateDataAs<const GLint*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform3ivImmediate(this, arg_count, location, count, v); + ValidateUniform3ivImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2187,14 +1988,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform4f( - unsigned int arg_count, const gles2::Uniform4f& c) { + uint32 immediate_data_size, const gles2::Uniform4f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); GLfloat y = static_cast<GLfloat>(c.y); GLfloat z = static_cast<GLfloat>(c.z); GLfloat w = static_cast<GLfloat>(c.w); parse_error::ParseError result = - ValidateUniform4f(this, arg_count, location, x, y, z, w); + ValidateUniform4f(this, immediate_data_size, location, x, y, z, w); if (result != parse_error::kParseNoError) { return result; } @@ -2203,13 +2004,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4f( } parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv( - unsigned int arg_count, const gles2::Uniform4fv& c) { + uint32 immediate_data_size, const gles2::Uniform4fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform4fv(this, arg_count, location, count, v); + ValidateUniform4fv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2218,13 +2019,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate( - unsigned int arg_count, const gles2::Uniform4fvImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform4fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform4fvImmediate(this, arg_count, location, count, v); + ValidateUniform4fvImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2233,14 +2035,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniform4i( - unsigned int arg_count, const gles2::Uniform4i& c) { + uint32 immediate_data_size, const gles2::Uniform4i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); GLint z = static_cast<GLint>(c.z); GLint w = static_cast<GLint>(c.w); parse_error::ParseError result = - ValidateUniform4i(this, arg_count, location, x, y, z, w); + ValidateUniform4i(this, immediate_data_size, location, x, y, z, w); if (result != parse_error::kParseNoError) { return result; } @@ -2249,13 +2051,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4i( } parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv( - unsigned int arg_count, const gles2::Uniform4iv& c) { + uint32 immediate_data_size, const gles2::Uniform4iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetSharedMemoryAs<const GLint*>( c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateUniform4iv(this, arg_count, location, count, v); + ValidateUniform4iv(this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2264,13 +2066,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv( } parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate( - unsigned int arg_count, const gles2::Uniform4ivImmediate& c) { + uint32 immediate_data_size, const gles2::Uniform4ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); const GLint* v = GetImmediateDataAs<const GLint*>(c); // Immediate version. parse_error::ParseError result = - ValidateUniform4ivImmediate(this, arg_count, location, count, v); + ValidateUniform4ivImmediate( + this, immediate_data_size, location, count, v); if (result != parse_error::kParseNoError) { return result; } @@ -2279,7 +2082,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( - unsigned int arg_count, const gles2::UniformMatrix2fv& c) { + uint32 immediate_data_size, const gles2::UniformMatrix2fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); GLboolean transpose = static_cast<GLboolean>(c.transpose); @@ -2287,7 +2090,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = ValidateUniformMatrix2fv( - this, arg_count, location, count, transpose, value); + this, immediate_data_size, location, count, transpose, value); if (result != parse_error::kParseNoError) { return result; } @@ -2296,7 +2099,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( - unsigned int arg_count, const gles2::UniformMatrix2fvImmediate& c) { + uint32 immediate_data_size, const gles2::UniformMatrix2fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); GLboolean transpose = static_cast<GLboolean>(c.transpose); @@ -2304,7 +2107,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( // Immediate version. parse_error::ParseError result = ValidateUniformMatrix2fvImmediate( - this, arg_count, location, count, transpose, value); + this, immediate_data_size, location, count, transpose, value); if (result != parse_error::kParseNoError) { return result; } @@ -2313,7 +2116,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( - unsigned int arg_count, const gles2::UniformMatrix3fv& c) { + uint32 immediate_data_size, const gles2::UniformMatrix3fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); GLboolean transpose = static_cast<GLboolean>(c.transpose); @@ -2321,7 +2124,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = ValidateUniformMatrix3fv( - this, arg_count, location, count, transpose, value); + this, immediate_data_size, location, count, transpose, value); if (result != parse_error::kParseNoError) { return result; } @@ -2330,7 +2133,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( - unsigned int arg_count, const gles2::UniformMatrix3fvImmediate& c) { + uint32 immediate_data_size, const gles2::UniformMatrix3fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); GLboolean transpose = static_cast<GLboolean>(c.transpose); @@ -2338,7 +2141,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( // Immediate version. parse_error::ParseError result = ValidateUniformMatrix3fvImmediate( - this, arg_count, location, count, transpose, value); + this, immediate_data_size, location, count, transpose, value); if (result != parse_error::kParseNoError) { return result; } @@ -2347,7 +2150,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( - unsigned int arg_count, const gles2::UniformMatrix4fv& c) { + uint32 immediate_data_size, const gles2::UniformMatrix4fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); GLboolean transpose = static_cast<GLboolean>(c.transpose); @@ -2355,7 +2158,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = ValidateUniformMatrix4fv( - this, arg_count, location, count, transpose, value); + this, immediate_data_size, location, count, transpose, value); if (result != parse_error::kParseNoError) { return result; } @@ -2364,7 +2167,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( } parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( - unsigned int arg_count, const gles2::UniformMatrix4fvImmediate& c) { + uint32 immediate_data_size, const gles2::UniformMatrix4fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); GLboolean transpose = static_cast<GLboolean>(c.transpose); @@ -2372,7 +2175,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( // Immediate version. parse_error::ParseError result = ValidateUniformMatrix4fvImmediate( - this, arg_count, location, count, transpose, value); + this, immediate_data_size, location, count, transpose, value); if (result != parse_error::kParseNoError) { return result; } @@ -2381,14 +2184,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleUseProgram( - unsigned int arg_count, const gles2::UseProgram& c) { + uint32 immediate_data_size, const gles2::UseProgram& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateUseProgram(this, arg_count, program); + ValidateUseProgram(this, immediate_data_size, program); if (result != parse_error::kParseNoError) { return result; } @@ -2397,14 +2200,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleUseProgram( } parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram( - unsigned int arg_count, const gles2::ValidateProgram& c) { + uint32 immediate_data_size, const gles2::ValidateProgram& c) { GLuint program; if (!id_map_.GetServiceId(c.program, &program)) { SetGLError(GL_INVALID_VALUE); return parse_error::kParseNoError; } parse_error::ParseError result = - ValidateValidateProgram(this, arg_count, program); + ValidateValidateProgram(this, immediate_data_size, program); if (result != parse_error::kParseNoError) { return result; } @@ -2413,11 +2216,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f( - unsigned int arg_count, const gles2::VertexAttrib1f& c) { + uint32 immediate_data_size, const gles2::VertexAttrib1f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); parse_error::ParseError result = - ValidateVertexAttrib1f(this, arg_count, indx, x); + ValidateVertexAttrib1f(this, immediate_data_size, indx, x); if (result != parse_error::kParseNoError) { return result; } @@ -2426,12 +2229,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv( - unsigned int arg_count, const gles2::VertexAttrib1fv& c) { + uint32 immediate_data_size, const gles2::VertexAttrib1fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateVertexAttrib1fv(this, arg_count, indx, values); + ValidateVertexAttrib1fv(this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2440,12 +2243,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( - unsigned int arg_count, const gles2::VertexAttrib1fvImmediate& c) { + uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateVertexAttrib1fvImmediate(this, arg_count, indx, values); + ValidateVertexAttrib1fvImmediate( + this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2454,12 +2258,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f( - unsigned int arg_count, const gles2::VertexAttrib2f& c) { + uint32 immediate_data_size, const gles2::VertexAttrib2f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); GLfloat y = static_cast<GLfloat>(c.y); parse_error::ParseError result = - ValidateVertexAttrib2f(this, arg_count, indx, x, y); + ValidateVertexAttrib2f(this, immediate_data_size, indx, x, y); if (result != parse_error::kParseNoError) { return result; } @@ -2468,12 +2272,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv( - unsigned int arg_count, const gles2::VertexAttrib2fv& c) { + uint32 immediate_data_size, const gles2::VertexAttrib2fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateVertexAttrib2fv(this, arg_count, indx, values); + ValidateVertexAttrib2fv(this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2482,12 +2286,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( - unsigned int arg_count, const gles2::VertexAttrib2fvImmediate& c) { + uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateVertexAttrib2fvImmediate(this, arg_count, indx, values); + ValidateVertexAttrib2fvImmediate( + this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2496,13 +2301,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f( - unsigned int arg_count, const gles2::VertexAttrib3f& c) { + uint32 immediate_data_size, const gles2::VertexAttrib3f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); GLfloat y = static_cast<GLfloat>(c.y); GLfloat z = static_cast<GLfloat>(c.z); parse_error::ParseError result = - ValidateVertexAttrib3f(this, arg_count, indx, x, y, z); + ValidateVertexAttrib3f(this, immediate_data_size, indx, x, y, z); if (result != parse_error::kParseNoError) { return result; } @@ -2511,12 +2316,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv( - unsigned int arg_count, const gles2::VertexAttrib3fv& c) { + uint32 immediate_data_size, const gles2::VertexAttrib3fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateVertexAttrib3fv(this, arg_count, indx, values); + ValidateVertexAttrib3fv(this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2525,12 +2330,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( - unsigned int arg_count, const gles2::VertexAttrib3fvImmediate& c) { + uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateVertexAttrib3fvImmediate(this, arg_count, indx, values); + ValidateVertexAttrib3fvImmediate( + this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2539,14 +2345,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f( - unsigned int arg_count, const gles2::VertexAttrib4f& c) { + uint32 immediate_data_size, const gles2::VertexAttrib4f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); GLfloat y = static_cast<GLfloat>(c.y); GLfloat z = static_cast<GLfloat>(c.z); GLfloat w = static_cast<GLfloat>(c.w); parse_error::ParseError result = - ValidateVertexAttrib4f(this, arg_count, indx, x, y, z, w); + ValidateVertexAttrib4f(this, immediate_data_size, indx, x, y, z, w); if (result != parse_error::kParseNoError) { return result; } @@ -2555,12 +2361,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv( - unsigned int arg_count, const gles2::VertexAttrib4fv& c) { + uint32 immediate_data_size, const gles2::VertexAttrib4fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); parse_error::ParseError result = - ValidateVertexAttrib4fv(this, arg_count, indx, values); + ValidateVertexAttrib4fv(this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2569,12 +2375,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv( } parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( - unsigned int arg_count, const gles2::VertexAttrib4fvImmediate& c) { + uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); // Immediate version. parse_error::ParseError result = - ValidateVertexAttrib4fvImmediate(this, arg_count, indx, values); + ValidateVertexAttrib4fvImmediate( + this, immediate_data_size, indx, values); if (result != parse_error::kParseNoError) { return result; } @@ -2583,13 +2390,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( } parse_error::ParseError GLES2DecoderImpl::HandleViewport( - unsigned int arg_count, const gles2::Viewport& c) { + uint32 immediate_data_size, const gles2::Viewport& c) { GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); parse_error::ParseError result = - ValidateViewport(this, arg_count, x, y, width, height); + ValidateViewport(this, immediate_data_size, x, y, width, height); if (result != parse_error::kParseNoError) { return result; } @@ -2598,9 +2405,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleViewport( } parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers( - unsigned int arg_count, const gles2::SwapBuffers& c) { + uint32 immediate_data_size, const gles2::SwapBuffers& c) { parse_error::ParseError result = - ValidateSwapBuffers(this, arg_count); + ValidateSwapBuffers(this, immediate_data_size); if (result != parse_error::kParseNoError) { return result; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_validate.h b/gpu/command_buffer/service/gles2_cmd_decoder_validate.h index 616d3fc..ff51aae 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_validate.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_validate.h @@ -10,76 +10,76 @@ namespace gles2 { namespace { parse_error::ParseError ValidateActiveTexture( - GLES2Decoder* decoder, unsigned int arg_count, GLenum texture) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum texture) { return parse_error::kParseNoError; } parse_error::ParseError ValidateAttachShader( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, GLuint shader) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBindAttribLocation( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, GLuint index, - const char* name) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, + GLuint index, const char* name) { if (name == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateBindAttribLocationImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, GLuint index, - const char* name) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, + GLuint index, const char* name) { if (name == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateBindBuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLuint buffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBindFramebuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLuint framebuffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBindRenderbuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLuint renderbuffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBindTexture( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLuint texture) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBlendColor( - GLES2Decoder* decoder, unsigned int arg_count, GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf red, + GLclampf green, GLclampf blue, GLclampf alpha) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBlendEquation( - GLES2Decoder* decoder, unsigned int arg_count, GLenum mode) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBlendEquationSeparate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum modeRGB, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum modeRGB, GLenum modeAlpha) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBlendFunc( - GLES2Decoder* decoder, unsigned int arg_count, GLenum sfactor, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum sfactor, GLenum dfactor) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBlendFuncSeparate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum srcRGB, GLenum dstRGB, - GLenum srcAlpha, GLenum dstAlpha) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum srcRGB, + GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { return parse_error::kParseNoError; } parse_error::ParseError ValidateBufferData( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLsizeiptr size, const void* data, GLenum usage) { if (data == NULL) { return parse_error::kParseOutOfBounds; @@ -87,7 +87,7 @@ parse_error::ParseError ValidateBufferData( return parse_error::kParseNoError; } parse_error::ParseError ValidateBufferDataImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLsizeiptr size, const void* data, GLenum usage) { if (data == NULL) { return parse_error::kParseOutOfBounds; @@ -95,7 +95,7 @@ parse_error::ParseError ValidateBufferDataImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateBufferSubData( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { if (data == NULL) { return parse_error::kParseOutOfBounds; @@ -103,7 +103,7 @@ parse_error::ParseError ValidateBufferSubData( return parse_error::kParseNoError; } parse_error::ParseError ValidateBufferSubDataImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { if (data == NULL) { return parse_error::kParseOutOfBounds; @@ -111,97 +111,97 @@ parse_error::ParseError ValidateBufferSubDataImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateCheckFramebufferStatus( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target) { return parse_error::kParseNoError; } parse_error::ParseError ValidateClear( - GLES2Decoder* decoder, unsigned int arg_count, GLbitfield mask) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLbitfield mask) { return parse_error::kParseNoError; } parse_error::ParseError ValidateClearColor( - GLES2Decoder* decoder, unsigned int arg_count, GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf red, + GLclampf green, GLclampf blue, GLclampf alpha) { return parse_error::kParseNoError; } parse_error::ParseError ValidateClearDepthf( - GLES2Decoder* decoder, unsigned int arg_count, GLclampf depth) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf depth) { return parse_error::kParseNoError; } parse_error::ParseError ValidateClearStencil( - GLES2Decoder* decoder, unsigned int arg_count, GLint s) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLint s) { return parse_error::kParseNoError; } parse_error::ParseError ValidateColorMask( - GLES2Decoder* decoder, unsigned int arg_count, GLboolean red, + GLES2Decoder* decoder, uint32 immediate_data_size, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { return parse_error::kParseNoError; } parse_error::ParseError ValidateCompileShader( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader) { return parse_error::kParseNoError; } parse_error::ParseError ValidateCompressedTexImage2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLenum internalformat, GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const void* data) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLenum internalformat, GLsizei width, GLsizei height, + GLint border, GLsizei imageSize, const void* data) { if (data == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateCompressedTexImage2DImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLenum internalformat, GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const void* data) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLenum internalformat, GLsizei width, GLsizei height, + GLint border, GLsizei imageSize, const void* data) { if (data == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateCompressedTexSubImage2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLsizei imageSize, const void* data) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, const void* data) { if (data == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateCompressedTexSubImage2DImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLsizei imageSize, const void* data) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, const void* data) { if (data == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateCopyTexImage2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, - GLint border) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height, GLint border) { return parse_error::kParseNoError; } parse_error::ParseError ValidateCopyTexSubImage2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { return parse_error::kParseNoError; } parse_error::ParseError ValidateCreateProgram( - GLES2Decoder* decoder, unsigned int arg_count) { + GLES2Decoder* decoder, uint32 immediate_data_size) { return parse_error::kParseNoError; } parse_error::ParseError ValidateCreateShader( - GLES2Decoder* decoder, unsigned int arg_count, GLenum type) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum type) { return parse_error::kParseNoError; } parse_error::ParseError ValidateCullFace( - GLES2Decoder* decoder, unsigned int arg_count, GLenum mode) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteBuffers( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* buffers) { if (buffers == NULL) { return parse_error::kParseOutOfBounds; @@ -209,7 +209,7 @@ parse_error::ParseError ValidateDeleteBuffers( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteBuffersImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* buffers) { if (buffers == NULL) { return parse_error::kParseOutOfBounds; @@ -217,7 +217,7 @@ parse_error::ParseError ValidateDeleteBuffersImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteFramebuffers( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* framebuffers) { if (framebuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -225,7 +225,7 @@ parse_error::ParseError ValidateDeleteFramebuffers( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteFramebuffersImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* framebuffers) { if (framebuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -233,11 +233,11 @@ parse_error::ParseError ValidateDeleteFramebuffersImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteProgram( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteRenderbuffers( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* renderbuffers) { if (renderbuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -245,7 +245,7 @@ parse_error::ParseError ValidateDeleteRenderbuffers( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteRenderbuffersImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* renderbuffers) { if (renderbuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -253,11 +253,11 @@ parse_error::ParseError ValidateDeleteRenderbuffersImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteShader( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteTextures( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* textures) { if (textures == NULL) { return parse_error::kParseOutOfBounds; @@ -265,7 +265,7 @@ parse_error::ParseError ValidateDeleteTextures( return parse_error::kParseNoError; } parse_error::ParseError ValidateDeleteTexturesImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, const GLuint* textures) { if (textures == NULL) { return parse_error::kParseOutOfBounds; @@ -273,76 +273,76 @@ parse_error::ParseError ValidateDeleteTexturesImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateDepthFunc( - GLES2Decoder* decoder, unsigned int arg_count, GLenum func) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum func) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDepthMask( - GLES2Decoder* decoder, unsigned int arg_count, GLboolean flag) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLboolean flag) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDepthRangef( - GLES2Decoder* decoder, unsigned int arg_count, GLclampf zNear, + GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf zNear, GLclampf zFar) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDetachShader( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, GLuint shader) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDisable( - GLES2Decoder* decoder, unsigned int arg_count, GLenum cap) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum cap) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDisableVertexAttribArray( - GLES2Decoder* decoder, unsigned int arg_count, GLuint index) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDrawArrays( - GLES2Decoder* decoder, unsigned int arg_count, GLenum mode, GLint first, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode, GLint first, GLsizei count) { return parse_error::kParseNoError; } parse_error::ParseError ValidateDrawElements( - GLES2Decoder* decoder, unsigned int arg_count, GLenum mode, GLsizei count, - GLenum type, const void* indices) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode, + GLsizei count, GLenum type, const void* indices) { if (indices == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateEnable( - GLES2Decoder* decoder, unsigned int arg_count, GLenum cap) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum cap) { return parse_error::kParseNoError; } parse_error::ParseError ValidateEnableVertexAttribArray( - GLES2Decoder* decoder, unsigned int arg_count, GLuint index) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index) { return parse_error::kParseNoError; } parse_error::ParseError ValidateFinish( - GLES2Decoder* decoder, unsigned int arg_count) { + GLES2Decoder* decoder, uint32 immediate_data_size) { return parse_error::kParseNoError; } parse_error::ParseError ValidateFlush( - GLES2Decoder* decoder, unsigned int arg_count) { + GLES2Decoder* decoder, uint32 immediate_data_size) { return parse_error::kParseNoError; } parse_error::ParseError ValidateFramebufferRenderbuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateFramebufferTexture2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { return parse_error::kParseNoError; } parse_error::ParseError ValidateFrontFace( - GLES2Decoder* decoder, unsigned int arg_count, GLenum mode) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode) { return parse_error::kParseNoError; } parse_error::ParseError ValidateGenBuffers( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* buffers) { if (buffers == NULL) { return parse_error::kParseOutOfBounds; @@ -350,7 +350,7 @@ parse_error::ParseError ValidateGenBuffers( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenBuffersImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* buffers) { if (buffers == NULL) { return parse_error::kParseOutOfBounds; @@ -358,11 +358,11 @@ parse_error::ParseError ValidateGenBuffersImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenerateMipmap( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target) { return parse_error::kParseNoError; } parse_error::ParseError ValidateGenFramebuffers( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* framebuffers) { if (framebuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -370,7 +370,7 @@ parse_error::ParseError ValidateGenFramebuffers( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenFramebuffersImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* framebuffers) { if (framebuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -378,7 +378,7 @@ parse_error::ParseError ValidateGenFramebuffersImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenRenderbuffers( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* renderbuffers) { if (renderbuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -386,7 +386,7 @@ parse_error::ParseError ValidateGenRenderbuffers( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenRenderbuffersImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* renderbuffers) { if (renderbuffers == NULL) { return parse_error::kParseOutOfBounds; @@ -394,7 +394,7 @@ parse_error::ParseError ValidateGenRenderbuffersImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenTextures( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* textures) { if (textures == NULL) { return parse_error::kParseOutOfBounds; @@ -402,7 +402,7 @@ parse_error::ParseError ValidateGenTextures( return parse_error::kParseNoError; } parse_error::ParseError ValidateGenTexturesImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLsizei n, + GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n, GLuint* textures) { if (textures == NULL) { return parse_error::kParseOutOfBounds; @@ -410,8 +410,9 @@ parse_error::ParseError ValidateGenTexturesImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetActiveAttrib( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, GLuint index, - GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, + GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, + char* name) { if (length == NULL) { return parse_error::kParseOutOfBounds; } @@ -427,8 +428,9 @@ parse_error::ParseError ValidateGetActiveAttrib( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetActiveUniform( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, GLuint index, - GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, + GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, + char* name) { if (length == NULL) { return parse_error::kParseOutOfBounds; } @@ -444,7 +446,7 @@ parse_error::ParseError ValidateGetActiveUniform( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetAttachedShaders( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { if (count == NULL) { return parse_error::kParseOutOfBounds; @@ -455,7 +457,7 @@ parse_error::ParseError ValidateGetAttachedShaders( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetAttribLocation( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, const char* name) { if (name == NULL) { return parse_error::kParseOutOfBounds; @@ -463,7 +465,7 @@ parse_error::ParseError ValidateGetAttribLocation( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetAttribLocationImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, const char* name) { if (name == NULL) { return parse_error::kParseOutOfBounds; @@ -471,7 +473,7 @@ parse_error::ParseError ValidateGetAttribLocationImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetBooleanv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum pname, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname, GLboolean* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; @@ -479,19 +481,19 @@ parse_error::ParseError ValidateGetBooleanv( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetBufferParameteriv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetError( - GLES2Decoder* decoder, unsigned int arg_count) { + GLES2Decoder* decoder, uint32 immediate_data_size) { return parse_error::kParseNoError; } parse_error::ParseError ValidateGetFloatv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum pname, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname, GLfloat* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; @@ -499,7 +501,7 @@ parse_error::ParseError ValidateGetFloatv( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetFramebufferAttachmentParameteriv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLenum attachment, GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; @@ -507,7 +509,7 @@ parse_error::ParseError ValidateGetFramebufferAttachmentParameteriv( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetIntegerv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum pname, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; @@ -515,15 +517,15 @@ parse_error::ParseError ValidateGetIntegerv( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetProgramiv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, GLenum pname, - GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, + GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetProgramInfoLog( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { if (length == NULL) { return parse_error::kParseOutOfBounds; @@ -534,23 +536,23 @@ parse_error::ParseError ValidateGetProgramInfoLog( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetRenderbufferParameteriv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetShaderiv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader, GLenum pname, - GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader, + GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetShaderInfoLog( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { if (length == NULL) { return parse_error::kParseOutOfBounds; @@ -561,7 +563,7 @@ parse_error::ParseError ValidateGetShaderInfoLog( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetShaderPrecisionFormat( - GLES2Decoder* decoder, unsigned int arg_count, GLenum shadertype, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { if (range == NULL) { return parse_error::kParseOutOfBounds; @@ -572,7 +574,7 @@ parse_error::ParseError ValidateGetShaderPrecisionFormat( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetShaderSource( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { if (length == NULL) { return parse_error::kParseOutOfBounds; @@ -583,27 +585,27 @@ parse_error::ParseError ValidateGetShaderSource( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetString( - GLES2Decoder* decoder, unsigned int arg_count, GLenum name) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum name) { return parse_error::kParseNoError; } parse_error::ParseError ValidateGetTexParameterfv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - GLfloat* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, GLfloat* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetTexParameteriv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetUniformfv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, GLint location, GLfloat* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; @@ -611,7 +613,7 @@ parse_error::ParseError ValidateGetUniformfv( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetUniformiv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, GLint location, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; @@ -619,7 +621,7 @@ parse_error::ParseError ValidateGetUniformiv( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetUniformLocation( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, const char* name) { if (name == NULL) { return parse_error::kParseOutOfBounds; @@ -627,7 +629,7 @@ parse_error::ParseError ValidateGetUniformLocation( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetUniformLocationImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program, const char* name) { if (name == NULL) { return parse_error::kParseOutOfBounds; @@ -635,81 +637,82 @@ parse_error::ParseError ValidateGetUniformLocationImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateGetVertexAttribfv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint index, GLenum pname, - GLfloat* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index, + GLenum pname, GLfloat* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetVertexAttribiv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint index, GLenum pname, - GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index, + GLenum pname, GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateGetVertexAttribPointerv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint index, GLenum pname, - void** pointer) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index, + GLenum pname, void** pointer) { if (pointer == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateHint( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLenum mode) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsBuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLuint buffer) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint buffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsEnabled( - GLES2Decoder* decoder, unsigned int arg_count, GLenum cap) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum cap) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsFramebuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLuint framebuffer) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint framebuffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsProgram( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsRenderbuffer( - GLES2Decoder* decoder, unsigned int arg_count, GLuint renderbuffer) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint renderbuffer) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsShader( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader) { return parse_error::kParseNoError; } parse_error::ParseError ValidateIsTexture( - GLES2Decoder* decoder, unsigned int arg_count, GLuint texture) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint texture) { return parse_error::kParseNoError; } parse_error::ParseError ValidateLineWidth( - GLES2Decoder* decoder, unsigned int arg_count, GLfloat width) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLfloat width) { return parse_error::kParseNoError; } parse_error::ParseError ValidateLinkProgram( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) { return parse_error::kParseNoError; } parse_error::ParseError ValidatePixelStorei( - GLES2Decoder* decoder, unsigned int arg_count, GLenum pname, GLint param) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname, + GLint param) { return parse_error::kParseNoError; } parse_error::ParseError ValidatePolygonOffset( - GLES2Decoder* decoder, unsigned int arg_count, GLfloat factor, + GLES2Decoder* decoder, uint32 immediate_data_size, GLfloat factor, GLfloat units) { return parse_error::kParseNoError; } parse_error::ParseError ValidateReadPixels( - GLES2Decoder* decoder, unsigned int arg_count, GLint x, GLint y, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { if (pixels == NULL) { return parse_error::kParseOutOfBounds; @@ -717,23 +720,23 @@ parse_error::ParseError ValidateReadPixels( return parse_error::kParseNoError; } parse_error::ParseError ValidateRenderbufferStorage( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { return parse_error::kParseNoError; } parse_error::ParseError ValidateSampleCoverage( - GLES2Decoder* decoder, unsigned int arg_count, GLclampf value, + GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf value, GLboolean invert) { return parse_error::kParseNoError; } parse_error::ParseError ValidateScissor( - GLES2Decoder* decoder, unsigned int arg_count, GLint x, GLint y, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint x, GLint y, GLsizei width, GLsizei height) { return parse_error::kParseNoError; } parse_error::ParseError ValidateShaderSource( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader, GLsizei count, - const char** string, const GLint* length) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader, + GLsizei count, const char** string, const GLint* length) { if (string == NULL) { return parse_error::kParseOutOfBounds; } @@ -743,8 +746,8 @@ parse_error::ParseError ValidateShaderSource( return parse_error::kParseNoError; } parse_error::ParseError ValidateShaderSourceImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint shader, GLsizei count, - const char** string, const GLint* length) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader, + GLsizei count, const char** string, const GLint* length) { if (string == NULL) { return parse_error::kParseOutOfBounds; } @@ -754,125 +757,127 @@ parse_error::ParseError ValidateShaderSourceImmediate( return parse_error::kParseNoError; } parse_error::ParseError ValidateStencilFunc( - GLES2Decoder* decoder, unsigned int arg_count, GLenum func, GLint ref, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum func, GLint ref, GLuint mask) { return parse_error::kParseNoError; } parse_error::ParseError ValidateStencilFuncSeparate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum face, GLenum func, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum face, GLenum func, GLint ref, GLuint mask) { return parse_error::kParseNoError; } parse_error::ParseError ValidateStencilMask( - GLES2Decoder* decoder, unsigned int arg_count, GLuint mask) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint mask) { return parse_error::kParseNoError; } parse_error::ParseError ValidateStencilMaskSeparate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum face, GLuint mask) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum face, + GLuint mask) { return parse_error::kParseNoError; } parse_error::ParseError ValidateStencilOp( - GLES2Decoder* decoder, unsigned int arg_count, GLenum fail, GLenum zfail, - GLenum zpass) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum fail, + GLenum zfail, GLenum zpass) { return parse_error::kParseNoError; } parse_error::ParseError ValidateStencilOpSeparate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum face, GLenum fail, + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { return parse_error::kParseNoError; } parse_error::ParseError ValidateTexImage2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint internalformat, GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, const void* pixels) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, const void* pixels) { if (pixels == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexImage2DImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint internalformat, GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, const void* pixels) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, const void* pixels) { if (pixels == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexParameterf( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - GLfloat param) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, GLfloat param) { return parse_error::kParseNoError; } parse_error::ParseError ValidateTexParameterfv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - const GLfloat* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, const GLfloat* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexParameterfvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - const GLfloat* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, const GLfloat* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<TexParameterfvImmediate>( - arg_count, 1, sizeof(GLfloat), 1)) { + immediate_data_size, 1, sizeof(GLfloat), 1)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexParameteri( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - GLint param) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, GLint param) { return parse_error::kParseNoError; } parse_error::ParseError ValidateTexParameteriv( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - const GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, const GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexParameterivImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLenum pname, - const GLint* params) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLenum pname, const GLint* params) { if (params == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<TexParameterivImmediate>( - arg_count, 1, sizeof(GLint), 1)) { + immediate_data_size, 1, sizeof(GLint), 1)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexSubImage2D( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLenum type, const void* pixels) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLenum type, const void* pixels) { if (pixels == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateTexSubImage2DImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, - GLenum type, const void* pixels) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target, + GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLenum type, const void* pixels) { if (pixels == NULL) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform1f( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLfloat x) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, + GLfloat x) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform1fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -880,23 +885,24 @@ parse_error::ParseError ValidateUniform1fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform1fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform1fvImmediate>( - arg_count, count, sizeof(GLfloat), 1)) { + immediate_data_size, count, sizeof(GLfloat), 1)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform1i( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLint x) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, + GLint x) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform1iv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -904,24 +910,24 @@ parse_error::ParseError ValidateUniform1iv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform1ivImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform1ivImmediate>( - arg_count, count, sizeof(GLint), 1)) { + immediate_data_size, count, sizeof(GLint), 1)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform2f( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLfloat x, - GLfloat y) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, + GLfloat x, GLfloat y) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform2fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -929,24 +935,24 @@ parse_error::ParseError ValidateUniform2fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform2fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform2fvImmediate>( - arg_count, count, sizeof(GLfloat), 2)) { + immediate_data_size, count, sizeof(GLfloat), 2)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform2i( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLint x, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLint x, GLint y) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform2iv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -954,24 +960,24 @@ parse_error::ParseError ValidateUniform2iv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform2ivImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform2ivImmediate>( - arg_count, count, sizeof(GLint), 2)) { + immediate_data_size, count, sizeof(GLint), 2)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform3f( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLfloat x, - GLfloat y, GLfloat z) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, + GLfloat x, GLfloat y, GLfloat z) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform3fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -979,24 +985,24 @@ parse_error::ParseError ValidateUniform3fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform3fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform3fvImmediate>( - arg_count, count, sizeof(GLfloat), 3)) { + immediate_data_size, count, sizeof(GLfloat), 3)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform3i( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLint x, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLint x, GLint y, GLint z) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform3iv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -1004,24 +1010,24 @@ parse_error::ParseError ValidateUniform3iv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform3ivImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform3ivImmediate>( - arg_count, count, sizeof(GLint), 3)) { + immediate_data_size, count, sizeof(GLint), 3)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform4f( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLfloat x, - GLfloat y, GLfloat z, GLfloat w) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform4fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -1029,24 +1035,24 @@ parse_error::ParseError ValidateUniform4fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform4fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLfloat* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform4fvImmediate>( - arg_count, count, sizeof(GLfloat), 4)) { + immediate_data_size, count, sizeof(GLfloat), 4)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform4i( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, GLint x, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLint x, GLint y, GLint z, GLint w) { return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform4iv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; @@ -1054,19 +1060,19 @@ parse_error::ParseError ValidateUniform4iv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniform4ivImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, const GLint* v) { if (v == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<Uniform4ivImmediate>( - arg_count, count, sizeof(GLint), 4)) { + immediate_data_size, count, sizeof(GLint), 4)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniformMatrix2fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { if (value == NULL) { return parse_error::kParseOutOfBounds; @@ -1074,19 +1080,19 @@ parse_error::ParseError ValidateUniformMatrix2fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniformMatrix2fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { if (value == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>( - arg_count, count, sizeof(GLfloat), 4)) { + immediate_data_size, count, sizeof(GLfloat), 4)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniformMatrix3fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { if (value == NULL) { return parse_error::kParseOutOfBounds; @@ -1094,19 +1100,19 @@ parse_error::ParseError ValidateUniformMatrix3fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniformMatrix3fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { if (value == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>( - arg_count, count, sizeof(GLfloat), 9)) { + immediate_data_size, count, sizeof(GLfloat), 9)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUniformMatrix4fv( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { if (value == NULL) { return parse_error::kParseOutOfBounds; @@ -1114,31 +1120,32 @@ parse_error::ParseError ValidateUniformMatrix4fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateUniformMatrix4fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLint location, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { if (value == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>( - arg_count, count, sizeof(GLfloat), 16)) { + immediate_data_size, count, sizeof(GLfloat), 16)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateUseProgram( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) { return parse_error::kParseNoError; } parse_error::ParseError ValidateValidateProgram( - GLES2Decoder* decoder, unsigned int arg_count, GLuint program) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) { return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib1f( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, GLfloat x) { + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, + GLfloat x) { return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib1fv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; @@ -1146,24 +1153,24 @@ parse_error::ParseError ValidateVertexAttrib1fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib1fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>( - arg_count, 1, sizeof(GLfloat), 1)) { + immediate_data_size, 1, sizeof(GLfloat), 1)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib2f( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, GLfloat x, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLfloat x, GLfloat y) { return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib2fv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; @@ -1171,24 +1178,24 @@ parse_error::ParseError ValidateVertexAttrib2fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib2fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>( - arg_count, 1, sizeof(GLfloat), 2)) { + immediate_data_size, 1, sizeof(GLfloat), 2)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib3f( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, GLfloat x, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib3fv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; @@ -1196,24 +1203,24 @@ parse_error::ParseError ValidateVertexAttrib3fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib3fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>( - arg_count, 1, sizeof(GLfloat), 3)) { + immediate_data_size, 1, sizeof(GLfloat), 3)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib4f( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, GLfloat x, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib4fv( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; @@ -1221,19 +1228,19 @@ parse_error::ParseError ValidateVertexAttrib4fv( return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttrib4fvImmediate( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, const GLfloat* values) { if (values == NULL) { return parse_error::kParseOutOfBounds; } if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>( - arg_count, 1, sizeof(GLfloat), 4)) { + immediate_data_size, 1, sizeof(GLfloat), 4)) { return parse_error::kParseOutOfBounds; } return parse_error::kParseNoError; } parse_error::ParseError ValidateVertexAttribPointer( - GLES2Decoder* decoder, unsigned int arg_count, GLuint indx, GLint size, + GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { if (ptr == NULL) { return parse_error::kParseOutOfBounds; @@ -1241,12 +1248,12 @@ parse_error::ParseError ValidateVertexAttribPointer( return parse_error::kParseNoError; } parse_error::ParseError ValidateViewport( - GLES2Decoder* decoder, unsigned int arg_count, GLint x, GLint y, + GLES2Decoder* decoder, uint32 immediate_data_size, GLint x, GLint y, GLsizei width, GLsizei height) { return parse_error::kParseNoError; } parse_error::ParseError ValidateSwapBuffers( - GLES2Decoder* decoder, unsigned int arg_count) { + GLES2Decoder* decoder, uint32 immediate_data_size) { return parse_error::kParseNoError; } } // anonymous namespace |