diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 23:11:14 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 23:11:14 +0000 |
commit | fe9b9e029c920a893ad48ebfd3f4e78282a1845d (patch) | |
tree | 6bb2f180aa6e7e03e31780040fc38d27ebc552e8 /o3d | |
parent | 6d1729ee957d70b80195a701c0532ffb99e064ec (diff) | |
download | chromium_src-fe9b9e029c920a893ad48ebfd3f4e78282a1845d.zip chromium_src-fe9b9e029c920a893ad48ebfd3f4e78282a1845d.tar.gz chromium_src-fe9b9e029c920a893ad48ebfd3f4e78282a1845d.tar.bz2 |
Change GPUProcess to use GLES2 instead of GAPI
and fix includes so service side and compile
with system GL and client side can compile
with Command Buffer GL.
Review URL: http://codereview.chromium.org/407006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32429 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
22 files changed, 9880 insertions, 8901 deletions
diff --git a/o3d/gpu/command_buffer/build_gles2_cmd_buffer.py b/o3d/gpu/command_buffer/build_gles2_cmd_buffer.py index e62195f..a1f60c8 100644 --- a/o3d/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/o3d/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -42,8 +42,11 @@ _LICENSE = "\n".join([ _FUNCTION_INFO = { 'BindAttribLocation': {'type': 'GLchar'}, 'BindBuffer': {'DecoderFunc': 'DoBindBuffer'}, + 'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'}, + 'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'}, 'BufferData': {'type': 'Data'}, 'BufferSubData': {'type': 'Data'}, + 'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'}, 'ClearDepthf': {'DecoderFunc': 'glClearDepth'}, 'CompressedTexImage2D': {'type': 'Data'}, 'CompressedTexSubImage2D': {'type': 'Data'}, @@ -60,6 +63,9 @@ _FUNCTION_INFO = { 'type': 'Manual', 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset', }, + 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'}, + 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'}, + 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'}, 'GenBuffers': {'type': 'GENn'}, 'GenFramebuffers': {'type': 'GENn'}, 'GenRenderbuffers': {'type': 'GENn'}, @@ -72,11 +78,17 @@ _FUNCTION_INFO = { 'GetBufferParameteriv': {'type': 'GETn'}, 'GetError': {'type': 'Is'}, 'GetFloatv': {'type': 'GETn'}, - 'GetFramebufferAttachmentParameteriv': {'type': 'GETn'}, + 'GetFramebufferAttachmentParameteriv': { + 'type': 'GETn', + 'DecoderFunc': 'glGetFramebufferAttachmentParameterivEXT', + }, 'GetIntegerv': {'type': 'GETn'}, 'GetProgramiv': {'type': 'GETn'}, 'GetProgramInfoLog': {'type': 'STRn'}, - 'GetRenderbufferParameteriv': {'type': 'GETn'}, + 'GetRenderbufferParameteriv': { + 'type': 'GETn', + 'DecoderFunc': 'glGetRenderbufferParameterivEXT', + }, 'GetShaderiv': {'type': 'GETn'}, 'GetShaderInfoLog': {'type': 'STRn'}, 'GetShaderPrecisionFormat': {'type': 'Custom'}, @@ -91,12 +103,13 @@ _FUNCTION_INFO = { 'GetVertexAttribPointerv': {'type': 'Custom', 'immediate': False}, 'IsBuffer': {'type': 'Is'}, 'IsEnabled': {'type': 'Is'}, - 'IsFramebuffer': {'type': 'Is'}, + 'IsFramebuffer': {'type': 'Is', 'DecoderFunc': 'glIsFramebufferEXT'}, 'IsProgram': {'type': 'Is'}, - 'IsRenderbuffer': {'type': 'Is'}, + 'IsRenderbuffer': {'type': 'Is', 'DecoderFunc': 'glIsRenderbufferEXT'}, 'IsShader': {'type': 'Is'}, 'IsTexture': {'type': 'Is'}, 'PixelStorei': {'type': 'Custom'}, + 'RenderbufferStorage': {'DecoderFunc': 'glRenderbufferStorageEXT'}, 'ReadPixels': {'type': 'Custom', 'immediate': False}, 'ReleaseShaderCompiler': {'type': 'Noop'}, 'ShaderBinary': {'type': 'Noop'}, @@ -297,7 +310,7 @@ class TypeHandler(object): def WriteServiceImplementation(self, func, file): """Writes the service implementation for a command.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) for arg in func.GetOriginalArgs(): @@ -310,7 +323,7 @@ class TypeHandler(object): def WriteImmediateServiceImplementation(self, func, file): """Writes the service implementation for an immediate version of command.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) for arg in func.GetOriginalArgs(): @@ -496,7 +509,7 @@ class DataHandler(CustomHandler): def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) for arg in func.GetCmdArgs(): @@ -904,7 +917,7 @@ class GETnHandler(TypeHandler): def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() @@ -1217,7 +1230,7 @@ class GLcharHandler(TypeHandler): def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() @@ -1248,7 +1261,7 @@ class GLcharHandler(TypeHandler): def WriteImmediateServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg() @@ -1394,7 +1407,7 @@ class IsHandler(TypeHandler): def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( - "parse_error::ParseError GLES2Decoder::Handle%s(\n" % func.name) + "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " unsigned int arg_count, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() @@ -1992,23 +2005,10 @@ class GLGenerator(object): for f in funcs: self.Log(" %-10s %-20s gl%s" % (f.info.type, f.return_type, f.name)) - def WriteFormat(self, filename): + def WriteCommandIds(self, filename): """Writes the command buffer format""" - guard = self.MakeGuard(filename) file = CWriter(filename) self.WriteHeader(file) - file.Write("\n") - file.Write("#ifndef %s\n" % guard) - file.Write("#define %s\n" % guard) - file.Write("\n") - file.Write( - "#include \"gpu/command_buffer/common/gles2_cmd_utils.h\"\n") - file.Write( - "#include \"gpu/command_buffer/common/cmd_buffer_common.h\"\n") - file.Write("\n") - - self.WriteNamespaceOpen(file) - file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") command_id = _FIRST_SPECIFIC_COMMAND_ID for func in self.functions: @@ -2025,17 +2025,20 @@ class GLGenerator(object): file.Write(" kNumCommands\n") file.Write("};\n") file.Write("\n") + file.Close() + + def WriteFormat(self, filename): + """Writes the command buffer format""" + file = CWriter(filename) + self.WriteHeader(file) file.Write("#pragma pack(push, 1)\n") file.Write("\n") for func in self.functions: func.WriteStruct(file) - self.WriteNamespaceClose(file) - file.Write("#pragma pack(pop)\n") file.Write("\n") - file.Write("#endif // %s\n" % guard) file.Close() def WriteFormatTest(self, filename): @@ -2145,6 +2148,31 @@ class GLGenerator(object): file.Close() + def WriteGLES2CLibImplementation(self, filename): + """Writes the GLES2 c lib implementation.""" + file = CWriter(filename) + self.WriteHeader(file) + file.Write("\n") + file.Write("// These functions emluate GLES2 over command buffers.\n") + file.Write("\n") + file.Write("\n") + + for func in self.original_functions: + file.Write("%s gl%s(%s) {\n" % + (func.return_type, func.name, + func.MakeTypedOriginalArgString(""))) + return_string = "return " + if func.return_type == "void": + return_string = "" + file.Write(" %sg_gl_impl->%s(%s);\n" % + (return_string, func.original_name, + func.MakeOriginalArgString(""))) + file.Write("}\n") + + file.Write("\n") + + file.Close() + def WriteGLES2ImplementationHeader(self, filename): """Writes the GLES2 helper header.""" file = CWriter(filename) @@ -2192,10 +2220,12 @@ def main(argv): gen = GLGenerator(options.verbose) gen.ParseGLH("common/GLES2/gl2.h") - gen.WriteFormat("common/gles2_cmd_format.h") + gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") + gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2LibHeader("client/gles2_lib_autogen.h") + gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") diff --git a/o3d/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/o3d/gpu/command_buffer/client/cmd_buffer_helper_test.cc index 413b561..4e2b31b 100644 --- a/o3d/gpu/command_buffer/client/cmd_buffer_helper_test.cc +++ b/o3d/gpu/command_buffer/client/cmd_buffer_helper_test.cc @@ -86,7 +86,7 @@ class CommandBufferHelperTest : public testing::Test { api_mock_.get()); scoped_refptr<GPUProcessor> gpu_processor(new GPUProcessor( - command_buffer_.get(), NULL, NULL, parser_, 1)); + command_buffer_.get(), NULL, parser_, 1)); command_buffer_->SetPutOffsetChangeCallback(NewCallback( gpu_processor.get(), &GPUProcessor::ProcessCommands)); diff --git a/o3d/gpu/command_buffer/client/fenced_allocator_test.cc b/o3d/gpu/command_buffer/client/fenced_allocator_test.cc index 2a1c81d..f3d6bd5 100644 --- a/o3d/gpu/command_buffer/client/fenced_allocator_test.cc +++ b/o3d/gpu/command_buffer/client/fenced_allocator_test.cc @@ -87,7 +87,7 @@ class BaseFencedAllocatorTest : public testing::Test { api_mock_.get()); scoped_refptr<GPUProcessor> gpu_processor(new GPUProcessor( - command_buffer_.get(), NULL, NULL, parser_, INT_MAX)); + command_buffer_.get(), NULL, parser_, INT_MAX)); command_buffer_->SetPutOffsetChangeCallback(NewCallback( gpu_processor.get(), &GPUProcessor::ProcessCommands)); diff --git a/o3d/gpu/command_buffer/client/gles2_c_lib.cc b/o3d/gpu/command_buffer/client/gles2_c_lib.cc new file mode 100644 index 0000000..9ebd26c --- /dev/null +++ b/o3d/gpu/command_buffer/client/gles2_c_lib.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// These functions emluate GLES2 over command buffers for C. + +extern "C" { +static ::command_buffer::gles2::GLES2Implementation* g_gl_impl; + +// Include the auto-generated part of this file. We split this because it means +// we can easily edit the non-auto generated parts right here in this file +// instead of having to edit some template or the code generator. +#include "gpu/command_buffer/client/gles2_lib_c_autogen.h" +} // extern "C" + + diff --git a/o3d/gpu/command_buffer/client/gles2_c_lib_autogen.h b/o3d/gpu/command_buffer/client/gles2_c_lib_autogen.h new file mode 100644 index 0000000..d55c94e --- /dev/null +++ b/o3d/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -0,0 +1,485 @@ +// This file is auto-generated. DO NOT EDIT! + + +// These functions emluate GLES2 over command buffers. + + +void glActiveTexture(GLenum texture) { + g_gl_impl->ActiveTexture(texture); +} +void glAttachShader(GLuint program, GLuint shader) { + g_gl_impl->AttachShader(program, shader); +} +void glBindAttribLocation(GLuint program, GLuint index, const char* name) { + g_gl_impl->BindAttribLocation(program, index, name); +} +void glBindBuffer(GLenum target, GLuint buffer) { + g_gl_impl->BindBuffer(target, buffer); +} +void glBindFramebuffer(GLenum target, GLuint framebuffer) { + g_gl_impl->BindFramebuffer(target, framebuffer); +} +void glBindRenderbuffer(GLenum target, GLuint renderbuffer) { + g_gl_impl->BindRenderbuffer(target, renderbuffer); +} +void glBindTexture(GLenum target, GLuint texture) { + g_gl_impl->BindTexture(target, texture); +} +void glBlendColor( + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + g_gl_impl->BlendColor(red, green, blue, alpha); +} +void glBlendEquation(GLenum mode) { + g_gl_impl->BlendEquation(mode); +} +void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { + g_gl_impl->BlendEquationSeparate(modeRGB, modeAlpha); +} +void glBlendFunc(GLenum sfactor, GLenum dfactor) { + g_gl_impl->BlendFunc(sfactor, dfactor); +} +void glBlendFuncSeparate( + GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + g_gl_impl->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); +} +void glBufferData( + GLenum target, GLsizeiptr size, const void* data, GLenum usage) { + g_gl_impl->BufferData(target, size, data, usage); +} +void glBufferSubData( + GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { + g_gl_impl->BufferSubData(target, offset, size, data); +} +GLenum glCheckFramebufferStatus(GLenum target) { + return g_gl_impl->CheckFramebufferStatus(target); +} +void glClear(GLbitfield mask) { + g_gl_impl->Clear(mask); +} +void glClearColor( + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + g_gl_impl->ClearColor(red, green, blue, alpha); +} +void glClearDepthf(GLclampf depth) { + g_gl_impl->ClearDepthf(depth); +} +void glClearStencil(GLint s) { + g_gl_impl->ClearStencil(s); +} +void glColorMask( + GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { + g_gl_impl->ColorMask(red, green, blue, alpha); +} +void glCompileShader(GLuint shader) { + g_gl_impl->CompileShader(shader); +} +void glCompressedTexImage2D( + GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, const void* data) { + g_gl_impl->CompressedTexImage2D( + target, level, internalformat, width, height, border, imageSize, data); +} +void glCompressedTexSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLsizei imageSize, const void* data) { + g_gl_impl->CompressedTexSubImage2D( + target, level, xoffset, yoffset, width, height, format, imageSize, data); +} +void glCopyTexImage2D( + GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border) { + g_gl_impl->CopyTexImage2D( + target, level, internalformat, x, y, width, height, border); +} +void glCopyTexSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, + GLsizei width, GLsizei height) { + g_gl_impl->CopyTexSubImage2D( + target, level, xoffset, yoffset, x, y, width, height); +} +GLuint glCreateProgram() { + return g_gl_impl->CreateProgram(); +} +GLuint glCreateShader(GLenum type) { + return g_gl_impl->CreateShader(type); +} +void glCullFace(GLenum mode) { + g_gl_impl->CullFace(mode); +} +void glDeleteBuffers(GLsizei n, const GLuint* buffers) { + g_gl_impl->DeleteBuffers(n, buffers); +} +void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { + g_gl_impl->DeleteFramebuffers(n, framebuffers); +} +void glDeleteProgram(GLuint program) { + g_gl_impl->DeleteProgram(program); +} +void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { + g_gl_impl->DeleteRenderbuffers(n, renderbuffers); +} +void glDeleteShader(GLuint shader) { + g_gl_impl->DeleteShader(shader); +} +void glDeleteTextures(GLsizei n, const GLuint* textures) { + g_gl_impl->DeleteTextures(n, textures); +} +void glDepthFunc(GLenum func) { + g_gl_impl->DepthFunc(func); +} +void glDepthMask(GLboolean flag) { + g_gl_impl->DepthMask(flag); +} +void glDepthRangef(GLclampf zNear, GLclampf zFar) { + g_gl_impl->DepthRangef(zNear, zFar); +} +void glDetachShader(GLuint program, GLuint shader) { + g_gl_impl->DetachShader(program, shader); +} +void glDisable(GLenum cap) { + g_gl_impl->Disable(cap); +} +void glDisableVertexAttribArray(GLuint index) { + g_gl_impl->DisableVertexAttribArray(index); +} +void glDrawArrays(GLenum mode, GLint first, GLsizei count) { + g_gl_impl->DrawArrays(mode, first, count); +} +void glDrawElements( + GLenum mode, GLsizei count, GLenum type, const void* indices) { + g_gl_impl->DrawElements(mode, count, type, indices); +} +void glEnable(GLenum cap) { + g_gl_impl->Enable(cap); +} +void glEnableVertexAttribArray(GLuint index) { + g_gl_impl->EnableVertexAttribArray(index); +} +void glFinish() { + g_gl_impl->Finish(); +} +void glFlush() { + g_gl_impl->Flush(); +} +void glFramebufferRenderbuffer( + GLenum target, GLenum attachment, GLenum renderbuffertarget, + GLuint renderbuffer) { + g_gl_impl->FramebufferRenderbuffer( + target, attachment, renderbuffertarget, renderbuffer); +} +void glFramebufferTexture2D( + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, + GLint level) { + g_gl_impl->FramebufferTexture2D( + target, attachment, textarget, texture, level); +} +void glFrontFace(GLenum mode) { + g_gl_impl->FrontFace(mode); +} +void glGenBuffers(GLsizei n, GLuint* buffers) { + g_gl_impl->GenBuffers(n, buffers); +} +void glGenerateMipmap(GLenum target) { + g_gl_impl->GenerateMipmap(target); +} +void glGenFramebuffers(GLsizei n, GLuint* framebuffers) { + g_gl_impl->GenFramebuffers(n, framebuffers); +} +void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { + g_gl_impl->GenRenderbuffers(n, renderbuffers); +} +void glGenTextures(GLsizei n, GLuint* textures) { + g_gl_impl->GenTextures(n, textures); +} +void glGetActiveAttrib( + GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, + GLenum* type, char* name) { + g_gl_impl->GetActiveAttrib( + program, index, bufsize, length, size, type, name); +} +void glGetActiveUniform( + GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, + GLenum* type, char* name) { + g_gl_impl->GetActiveUniform( + program, index, bufsize, length, size, type, name); +} +void glGetAttachedShaders( + GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + g_gl_impl->GetAttachedShaders(program, maxcount, count, shaders); +} +int glGetAttribLocation(GLuint program, const char* name) { + return g_gl_impl->GetAttribLocation(program, name); +} +void glGetBooleanv(GLenum pname, GLboolean* params) { + g_gl_impl->GetBooleanv(pname, params); +} +void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { + g_gl_impl->GetBufferParameteriv(target, pname, params); +} +GLenum glGetError() { + return g_gl_impl->GetError(); +} +void glGetFloatv(GLenum pname, GLfloat* params) { + g_gl_impl->GetFloatv(pname, params); +} +void glGetFramebufferAttachmentParameteriv( + GLenum target, GLenum attachment, GLenum pname, GLint* params) { + g_gl_impl->GetFramebufferAttachmentParameteriv( + target, attachment, pname, params); +} +void glGetIntegerv(GLenum pname, GLint* params) { + g_gl_impl->GetIntegerv(pname, params); +} +void glGetProgramiv(GLuint program, GLenum pname, GLint* params) { + g_gl_impl->GetProgramiv(program, pname, params); +} +void glGetProgramInfoLog( + GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { + g_gl_impl->GetProgramInfoLog(program, bufsize, length, infolog); +} +void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { + g_gl_impl->GetRenderbufferParameteriv(target, pname, params); +} +void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { + g_gl_impl->GetShaderiv(shader, pname, params); +} +void glGetShaderInfoLog( + GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { + g_gl_impl->GetShaderInfoLog(shader, bufsize, length, infolog); +} +void glGetShaderPrecisionFormat( + GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { + g_gl_impl->GetShaderPrecisionFormat( + shadertype, precisiontype, range, precision); +} +void glGetShaderSource( + GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + g_gl_impl->GetShaderSource(shader, bufsize, length, source); +} +const GLubyte* glGetString(GLenum name) { + return g_gl_impl->GetString(name); +} +void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { + g_gl_impl->GetTexParameterfv(target, pname, params); +} +void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) { + g_gl_impl->GetTexParameteriv(target, pname, params); +} +void glGetUniformfv(GLuint program, GLint location, GLfloat* params) { + g_gl_impl->GetUniformfv(program, location, params); +} +void glGetUniformiv(GLuint program, GLint location, GLint* params) { + g_gl_impl->GetUniformiv(program, location, params); +} +int glGetUniformLocation(GLuint program, const char* name) { + return g_gl_impl->GetUniformLocation(program, name); +} +void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { + g_gl_impl->GetVertexAttribfv(index, pname, params); +} +void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { + g_gl_impl->GetVertexAttribiv(index, pname, params); +} +void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { + g_gl_impl->GetVertexAttribPointerv(index, pname, pointer); +} +void glHint(GLenum target, GLenum mode) { + g_gl_impl->Hint(target, mode); +} +GLboolean glIsBuffer(GLuint buffer) { + return g_gl_impl->IsBuffer(buffer); +} +GLboolean glIsEnabled(GLenum cap) { + return g_gl_impl->IsEnabled(cap); +} +GLboolean glIsFramebuffer(GLuint framebuffer) { + return g_gl_impl->IsFramebuffer(framebuffer); +} +GLboolean glIsProgram(GLuint program) { + return g_gl_impl->IsProgram(program); +} +GLboolean glIsRenderbuffer(GLuint renderbuffer) { + return g_gl_impl->IsRenderbuffer(renderbuffer); +} +GLboolean glIsShader(GLuint shader) { + return g_gl_impl->IsShader(shader); +} +GLboolean glIsTexture(GLuint texture) { + return g_gl_impl->IsTexture(texture); +} +void glLineWidth(GLfloat width) { + g_gl_impl->LineWidth(width); +} +void glLinkProgram(GLuint program) { + g_gl_impl->LinkProgram(program); +} +void glPixelStorei(GLenum pname, GLint param) { + g_gl_impl->PixelStorei(pname, param); +} +void glPolygonOffset(GLfloat factor, GLfloat units) { + g_gl_impl->PolygonOffset(factor, units); +} +void glReadPixels( + GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + void* pixels) { + g_gl_impl->ReadPixels(x, y, width, height, format, type, pixels); +} +void glRenderbufferStorage( + GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + g_gl_impl->RenderbufferStorage(target, internalformat, width, height); +} +void glSampleCoverage(GLclampf value, GLboolean invert) { + g_gl_impl->SampleCoverage(value, invert); +} +void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { + g_gl_impl->Scissor(x, y, width, height); +} +void glShaderSource( + GLuint shader, GLsizei count, const char** string, const GLint* length) { + g_gl_impl->ShaderSource(shader, count, string, length); +} +void glStencilFunc(GLenum func, GLint ref, GLuint mask) { + g_gl_impl->StencilFunc(func, ref, mask); +} +void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { + g_gl_impl->StencilFuncSeparate(face, func, ref, mask); +} +void glStencilMask(GLuint mask) { + g_gl_impl->StencilMask(mask); +} +void glStencilMaskSeparate(GLenum face, GLuint mask) { + g_gl_impl->StencilMaskSeparate(face, mask); +} +void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + g_gl_impl->StencilOp(fail, zfail, zpass); +} +void glStencilOpSeparate( + GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + g_gl_impl->StencilOpSeparate(face, fail, zfail, zpass); +} +void glTexImage2D( + GLenum target, GLint level, GLint internalformat, GLsizei width, + GLsizei height, GLint border, GLenum format, GLenum type, + const void* pixels) { + g_gl_impl->TexImage2D( + target, level, internalformat, width, height, border, format, type, + pixels); +} +void glTexParameterf(GLenum target, GLenum pname, GLfloat param) { + g_gl_impl->TexParameterf(target, pname, param); +} +void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { + g_gl_impl->TexParameterfv(target, pname, params); +} +void glTexParameteri(GLenum target, GLenum pname, GLint param) { + g_gl_impl->TexParameteri(target, pname, param); +} +void glTexParameteriv(GLenum target, GLenum pname, const GLint* params) { + g_gl_impl->TexParameteriv(target, pname, params); +} +void glTexSubImage2D( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, const void* pixels) { + g_gl_impl->TexSubImage2D( + target, level, xoffset, yoffset, width, height, format, type, pixels); +} +void glUniform1f(GLint location, GLfloat x) { + g_gl_impl->Uniform1f(location, x); +} +void glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { + g_gl_impl->Uniform1fv(location, count, v); +} +void glUniform1i(GLint location, GLint x) { + g_gl_impl->Uniform1i(location, x); +} +void glUniform1iv(GLint location, GLsizei count, const GLint* v) { + g_gl_impl->Uniform1iv(location, count, v); +} +void glUniform2f(GLint location, GLfloat x, GLfloat y) { + g_gl_impl->Uniform2f(location, x, y); +} +void glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { + g_gl_impl->Uniform2fv(location, count, v); +} +void glUniform2i(GLint location, GLint x, GLint y) { + g_gl_impl->Uniform2i(location, x, y); +} +void glUniform2iv(GLint location, GLsizei count, const GLint* v) { + g_gl_impl->Uniform2iv(location, count, v); +} +void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { + g_gl_impl->Uniform3f(location, x, y, z); +} +void glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { + g_gl_impl->Uniform3fv(location, count, v); +} +void glUniform3i(GLint location, GLint x, GLint y, GLint z) { + g_gl_impl->Uniform3i(location, x, y, z); +} +void glUniform3iv(GLint location, GLsizei count, const GLint* v) { + g_gl_impl->Uniform3iv(location, count, v); +} +void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + g_gl_impl->Uniform4f(location, x, y, z, w); +} +void glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { + g_gl_impl->Uniform4fv(location, count, v); +} +void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { + g_gl_impl->Uniform4i(location, x, y, z, w); +} +void glUniform4iv(GLint location, GLsizei count, const GLint* v) { + g_gl_impl->Uniform4iv(location, count, v); +} +void glUniformMatrix2fv( + GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + g_gl_impl->UniformMatrix2fv(location, count, transpose, value); +} +void glUniformMatrix3fv( + GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + g_gl_impl->UniformMatrix3fv(location, count, transpose, value); +} +void glUniformMatrix4fv( + GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + g_gl_impl->UniformMatrix4fv(location, count, transpose, value); +} +void glUseProgram(GLuint program) { + g_gl_impl->UseProgram(program); +} +void glValidateProgram(GLuint program) { + g_gl_impl->ValidateProgram(program); +} +void glVertexAttrib1f(GLuint indx, GLfloat x) { + g_gl_impl->VertexAttrib1f(indx, x); +} +void glVertexAttrib1fv(GLuint indx, const GLfloat* values) { + g_gl_impl->VertexAttrib1fv(indx, values); +} +void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { + g_gl_impl->VertexAttrib2f(indx, x, y); +} +void glVertexAttrib2fv(GLuint indx, const GLfloat* values) { + g_gl_impl->VertexAttrib2fv(indx, values); +} +void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + g_gl_impl->VertexAttrib3f(indx, x, y, z); +} +void glVertexAttrib3fv(GLuint indx, const GLfloat* values) { + g_gl_impl->VertexAttrib3fv(indx, values); +} +void glVertexAttrib4f( + GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + g_gl_impl->VertexAttrib4f(indx, x, y, z, w); +} +void glVertexAttrib4fv(GLuint indx, const GLfloat* values) { + g_gl_impl->VertexAttrib4fv(indx, values); +} +void glVertexAttribPointer( + GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, + const void* ptr) { + g_gl_impl->VertexAttribPointer(indx, size, type, normalized, stride, ptr); +} +void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { + g_gl_impl->Viewport(x, y, width, height); +} + diff --git a/o3d/gpu/command_buffer/client/gles2_cmd_helper.h b/o3d/gpu/command_buffer/client/gles2_cmd_helper.h index 578e4c8..9a1a741 100644 --- a/o3d/gpu/command_buffer/client/gles2_cmd_helper.h +++ b/o3d/gpu/command_buffer/client/gles2_cmd_helper.h @@ -6,7 +6,6 @@ #define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H #include "gpu/command_buffer/client/cmd_buffer_helper.h" -#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/gles2_cmd_format.h" namespace command_buffer { diff --git a/o3d/gpu/command_buffer/client/gles2_implementation.cc b/o3d/gpu/command_buffer/client/gles2_implementation.cc index c13d63c..5f4e56f 100644 --- a/o3d/gpu/command_buffer/client/gles2_implementation.cc +++ b/o3d/gpu/command_buffer/client/gles2_implementation.cc @@ -5,6 +5,7 @@ // A class to emluate GLES2 over command buffers. #include "gpu/command_buffer/client/gles2_implementation.h" +// TODO(gman): remove when all functions have been implemented. #include "gpu/command_buffer/client/gles2_implementation_gen.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" diff --git a/o3d/gpu/command_buffer/client/gles2_implementation.h b/o3d/gpu/command_buffer/client/gles2_implementation.h index c8484ec..dbeb9ad 100644 --- a/o3d/gpu/command_buffer/client/gles2_implementation.h +++ b/o3d/gpu/command_buffer/client/gles2_implementation.h @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_HELPER_H -#define GPU_COMMAND_BUFFER_CLIENT_GLES2_HELPER_H +#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H +#define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H +#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" @@ -89,5 +90,5 @@ class GLES2Implementation { } // namespace gles2 } // namespace command_buffer -#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_HELPER_H +#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_format.cc b/o3d/gpu/command_buffer/common/gles2_cmd_format.cc index ab8cb5c..62e297d 100644 --- a/o3d/gpu/command_buffer/common/gles2_cmd_format.cc +++ b/o3d/gpu/command_buffer/common/gles2_cmd_format.cc @@ -5,11 +5,15 @@ // This file contains the binary format definition of the command buffer and // command buffer commands. -#include "gpu/command_buffer/common/gles2_cmd_format.h" +// We explicitly do NOT include gles2_cmd_format.h here because client side +// and service side have different requirements. +#include "gpu/command_buffer/common/cmd_buffer_common.h" namespace command_buffer { namespace gles2 { +#include "gpu/command_buffer/common/gles2_cmd_ids_autogen.h" + const char* GetCommandName(CommandId id) { static const char* const names[] = { #define GLES2_CMD_OP(name) "k" # name, diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_format.h b/o3d/gpu/command_buffer/common/gles2_cmd_format.h index 4c40c1f..fbf9e51 100644 --- a/o3d/gpu/command_buffer/common/gles2_cmd_format.h +++ b/o3d/gpu/command_buffer/common/gles2_cmd_format.h @@ -1,8447 +1,36 @@ -// This file is auto-generated. DO NOT EDIT! - - -#ifndef O3D_SPUD_O3D_GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H -#define O3D_SPUD_O3D_GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H - -#include "gpu/command_buffer/common/gles2_cmd_utils.h" +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file defines the GLES2 command buffer commands. + +#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H +#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H + +// This is here because service side code must include the system's version of +// the GL headers where as client side code includes the Chrome version. +#ifdef GLES2_GPU_SERVICE +#include <GL/glew.h> +#if defined(OS_WIN) +#include <GL/wglew.h> +#endif +#else +#include <GLES2/gl2.h> +#endif + +#include "base/basictypes.h" +#include "gpu/command_buffer/common/types.h" +#include "gpu/command_buffer/common/bitfield_helpers.h" #include "gpu/command_buffer/common/cmd_buffer_common.h" +#include "gpu/command_buffer/common/gles2_cmd_ids.h" namespace command_buffer { namespace gles2 { -#define GLES2_COMMAND_LIST(OP) \ - OP(ActiveTexture) /* 1024 */ \ - OP(AttachShader) /* 1025 */ \ - OP(BindAttribLocation) /* 1026 */ \ - OP(BindAttribLocationImmediate) /* 1027 */ \ - OP(BindBuffer) /* 1028 */ \ - OP(BindFramebuffer) /* 1029 */ \ - OP(BindRenderbuffer) /* 1030 */ \ - OP(BindTexture) /* 1031 */ \ - OP(BlendColor) /* 1032 */ \ - OP(BlendEquation) /* 1033 */ \ - OP(BlendEquationSeparate) /* 1034 */ \ - OP(BlendFunc) /* 1035 */ \ - OP(BlendFuncSeparate) /* 1036 */ \ - OP(BufferData) /* 1037 */ \ - OP(BufferDataImmediate) /* 1038 */ \ - OP(BufferSubData) /* 1039 */ \ - OP(BufferSubDataImmediate) /* 1040 */ \ - OP(CheckFramebufferStatus) /* 1041 */ \ - OP(Clear) /* 1042 */ \ - OP(ClearColor) /* 1043 */ \ - OP(ClearDepthf) /* 1044 */ \ - OP(ClearStencil) /* 1045 */ \ - OP(ColorMask) /* 1046 */ \ - OP(CompileShader) /* 1047 */ \ - OP(CompressedTexImage2D) /* 1048 */ \ - OP(CompressedTexImage2DImmediate) /* 1049 */ \ - OP(CompressedTexSubImage2D) /* 1050 */ \ - OP(CompressedTexSubImage2DImmediate) /* 1051 */ \ - OP(CopyTexImage2D) /* 1052 */ \ - OP(CopyTexSubImage2D) /* 1053 */ \ - OP(CreateProgram) /* 1054 */ \ - OP(CreateShader) /* 1055 */ \ - OP(CullFace) /* 1056 */ \ - OP(DeleteBuffers) /* 1057 */ \ - OP(DeleteBuffersImmediate) /* 1058 */ \ - OP(DeleteFramebuffers) /* 1059 */ \ - OP(DeleteFramebuffersImmediate) /* 1060 */ \ - OP(DeleteProgram) /* 1061 */ \ - OP(DeleteRenderbuffers) /* 1062 */ \ - OP(DeleteRenderbuffersImmediate) /* 1063 */ \ - OP(DeleteShader) /* 1064 */ \ - OP(DeleteTextures) /* 1065 */ \ - OP(DeleteTexturesImmediate) /* 1066 */ \ - OP(DepthFunc) /* 1067 */ \ - OP(DepthMask) /* 1068 */ \ - OP(DepthRangef) /* 1069 */ \ - OP(DetachShader) /* 1070 */ \ - OP(Disable) /* 1071 */ \ - OP(DisableVertexAttribArray) /* 1072 */ \ - OP(DrawArrays) /* 1073 */ \ - OP(DrawElements) /* 1074 */ \ - OP(Enable) /* 1075 */ \ - OP(EnableVertexAttribArray) /* 1076 */ \ - OP(Finish) /* 1077 */ \ - OP(Flush) /* 1078 */ \ - OP(FramebufferRenderbuffer) /* 1079 */ \ - OP(FramebufferTexture2D) /* 1080 */ \ - OP(FrontFace) /* 1081 */ \ - OP(GenBuffers) /* 1082 */ \ - OP(GenBuffersImmediate) /* 1083 */ \ - OP(GenerateMipmap) /* 1084 */ \ - OP(GenFramebuffers) /* 1085 */ \ - OP(GenFramebuffersImmediate) /* 1086 */ \ - OP(GenRenderbuffers) /* 1087 */ \ - OP(GenRenderbuffersImmediate) /* 1088 */ \ - OP(GenTextures) /* 1089 */ \ - OP(GenTexturesImmediate) /* 1090 */ \ - OP(GetActiveAttrib) /* 1091 */ \ - OP(GetActiveUniform) /* 1092 */ \ - OP(GetAttachedShaders) /* 1093 */ \ - OP(GetAttribLocation) /* 1094 */ \ - OP(GetAttribLocationImmediate) /* 1095 */ \ - OP(GetBooleanv) /* 1096 */ \ - OP(GetBufferParameteriv) /* 1097 */ \ - OP(GetError) /* 1098 */ \ - OP(GetFloatv) /* 1099 */ \ - OP(GetFramebufferAttachmentParameteriv) /* 1100 */ \ - OP(GetIntegerv) /* 1101 */ \ - OP(GetProgramiv) /* 1102 */ \ - OP(GetProgramInfoLog) /* 1103 */ \ - OP(GetRenderbufferParameteriv) /* 1104 */ \ - OP(GetShaderiv) /* 1105 */ \ - OP(GetShaderInfoLog) /* 1106 */ \ - OP(GetShaderPrecisionFormat) /* 1107 */ \ - OP(GetShaderSource) /* 1108 */ \ - OP(GetString) /* 1109 */ \ - OP(GetTexParameterfv) /* 1110 */ \ - OP(GetTexParameteriv) /* 1111 */ \ - OP(GetUniformfv) /* 1112 */ \ - OP(GetUniformiv) /* 1113 */ \ - OP(GetUniformLocation) /* 1114 */ \ - OP(GetUniformLocationImmediate) /* 1115 */ \ - OP(GetVertexAttribfv) /* 1116 */ \ - OP(GetVertexAttribiv) /* 1117 */ \ - OP(GetVertexAttribPointerv) /* 1118 */ \ - OP(Hint) /* 1119 */ \ - OP(IsBuffer) /* 1120 */ \ - OP(IsEnabled) /* 1121 */ \ - OP(IsFramebuffer) /* 1122 */ \ - OP(IsProgram) /* 1123 */ \ - OP(IsRenderbuffer) /* 1124 */ \ - OP(IsShader) /* 1125 */ \ - OP(IsTexture) /* 1126 */ \ - OP(LineWidth) /* 1127 */ \ - OP(LinkProgram) /* 1128 */ \ - OP(PixelStorei) /* 1129 */ \ - OP(PolygonOffset) /* 1130 */ \ - OP(ReadPixels) /* 1131 */ \ - OP(RenderbufferStorage) /* 1132 */ \ - OP(SampleCoverage) /* 1133 */ \ - OP(Scissor) /* 1134 */ \ - OP(ShaderSource) /* 1135 */ \ - OP(ShaderSourceImmediate) /* 1136 */ \ - OP(StencilFunc) /* 1137 */ \ - OP(StencilFuncSeparate) /* 1138 */ \ - OP(StencilMask) /* 1139 */ \ - OP(StencilMaskSeparate) /* 1140 */ \ - OP(StencilOp) /* 1141 */ \ - OP(StencilOpSeparate) /* 1142 */ \ - OP(TexImage2D) /* 1143 */ \ - OP(TexImage2DImmediate) /* 1144 */ \ - OP(TexParameterf) /* 1145 */ \ - OP(TexParameterfv) /* 1146 */ \ - OP(TexParameterfvImmediate) /* 1147 */ \ - OP(TexParameteri) /* 1148 */ \ - OP(TexParameteriv) /* 1149 */ \ - OP(TexParameterivImmediate) /* 1150 */ \ - OP(TexSubImage2D) /* 1151 */ \ - OP(TexSubImage2DImmediate) /* 1152 */ \ - OP(Uniform1f) /* 1153 */ \ - OP(Uniform1fv) /* 1154 */ \ - OP(Uniform1fvImmediate) /* 1155 */ \ - OP(Uniform1i) /* 1156 */ \ - OP(Uniform1iv) /* 1157 */ \ - OP(Uniform1ivImmediate) /* 1158 */ \ - OP(Uniform2f) /* 1159 */ \ - OP(Uniform2fv) /* 1160 */ \ - OP(Uniform2fvImmediate) /* 1161 */ \ - OP(Uniform2i) /* 1162 */ \ - OP(Uniform2iv) /* 1163 */ \ - OP(Uniform2ivImmediate) /* 1164 */ \ - OP(Uniform3f) /* 1165 */ \ - OP(Uniform3fv) /* 1166 */ \ - OP(Uniform3fvImmediate) /* 1167 */ \ - OP(Uniform3i) /* 1168 */ \ - OP(Uniform3iv) /* 1169 */ \ - OP(Uniform3ivImmediate) /* 1170 */ \ - OP(Uniform4f) /* 1171 */ \ - OP(Uniform4fv) /* 1172 */ \ - OP(Uniform4fvImmediate) /* 1173 */ \ - OP(Uniform4i) /* 1174 */ \ - OP(Uniform4iv) /* 1175 */ \ - OP(Uniform4ivImmediate) /* 1176 */ \ - OP(UniformMatrix2fv) /* 1177 */ \ - OP(UniformMatrix2fvImmediate) /* 1178 */ \ - OP(UniformMatrix3fv) /* 1179 */ \ - OP(UniformMatrix3fvImmediate) /* 1180 */ \ - OP(UniformMatrix4fv) /* 1181 */ \ - OP(UniformMatrix4fvImmediate) /* 1182 */ \ - OP(UseProgram) /* 1183 */ \ - OP(ValidateProgram) /* 1184 */ \ - OP(VertexAttrib1f) /* 1185 */ \ - OP(VertexAttrib1fv) /* 1186 */ \ - OP(VertexAttrib1fvImmediate) /* 1187 */ \ - OP(VertexAttrib2f) /* 1188 */ \ - OP(VertexAttrib2fv) /* 1189 */ \ - OP(VertexAttrib2fvImmediate) /* 1190 */ \ - OP(VertexAttrib3f) /* 1191 */ \ - OP(VertexAttrib3fv) /* 1192 */ \ - OP(VertexAttrib3fvImmediate) /* 1193 */ \ - OP(VertexAttrib4f) /* 1194 */ \ - OP(VertexAttrib4fv) /* 1195 */ \ - OP(VertexAttrib4fvImmediate) /* 1196 */ \ - OP(VertexAttribPointer) /* 1197 */ \ - OP(Viewport) /* 1198 */ \ - -enum CommandId { - kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. -#define GLES2_CMD_OP(name) k ## name, - GLES2_COMMAND_LIST(GLES2_CMD_OP) -#undef GLES2_CMD_OP - kNumCommands -}; - -#pragma pack(push, 1) - -struct ActiveTexture { - typedef ActiveTexture ValueType; - static const CommandId kCmdId = kActiveTexture; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _texture) { - SetHeader(); - texture = _texture; - } - - void* Set(void* cmd, GLenum _texture) { - static_cast<ValueType*>(cmd)->Init(_texture); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 texture; -}; - -COMPILE_ASSERT(sizeof(ActiveTexture) == 8, - Sizeof_ActiveTexture_is_not_8); -COMPILE_ASSERT(offsetof(ActiveTexture, header) == 0, - OffsetOf_ActiveTexture_header_not_0); -COMPILE_ASSERT(offsetof(ActiveTexture, texture) == 4, - OffsetOf_ActiveTexture_texture_not_4); - -struct AttachShader { - typedef AttachShader ValueType; - static const CommandId kCmdId = kAttachShader; - 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, GLuint _shader) { - SetHeader(); - program = _program; - shader = _shader; - } - - void* Set(void* cmd, GLuint _program, GLuint _shader) { - static_cast<ValueType*>(cmd)->Init(_program, _shader); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 shader; -}; - -COMPILE_ASSERT(sizeof(AttachShader) == 12, - Sizeof_AttachShader_is_not_12); -COMPILE_ASSERT(offsetof(AttachShader, header) == 0, - OffsetOf_AttachShader_header_not_0); -COMPILE_ASSERT(offsetof(AttachShader, program) == 4, - OffsetOf_AttachShader_program_not_4); -COMPILE_ASSERT(offsetof(AttachShader, shader) == 8, - OffsetOf_AttachShader_shader_not_8); - -struct BindAttribLocation { - typedef BindAttribLocation ValueType; - static const CommandId kCmdId = kBindAttribLocation; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLuint _program, GLuint _index, uint32 _name_shm_id, - uint32 _name_shm_offset, uint32 _data_size) { - SetHeader(); - program = _program; - index = _index; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - data_size = _data_size; - } - - void* Set( - void* cmd, GLuint _program, GLuint _index, uint32 _name_shm_id, - uint32 _name_shm_offset, uint32 _data_size) { - static_cast<ValueType*>( - cmd)->Init( - _program, _index, _name_shm_id, _name_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 index; - uint32 name_shm_id; - uint32 name_shm_offset; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(BindAttribLocation) == 24, - Sizeof_BindAttribLocation_is_not_24); -COMPILE_ASSERT(offsetof(BindAttribLocation, header) == 0, - OffsetOf_BindAttribLocation_header_not_0); -COMPILE_ASSERT(offsetof(BindAttribLocation, program) == 4, - OffsetOf_BindAttribLocation_program_not_4); -COMPILE_ASSERT(offsetof(BindAttribLocation, index) == 8, - OffsetOf_BindAttribLocation_index_not_8); -COMPILE_ASSERT(offsetof(BindAttribLocation, name_shm_id) == 12, - OffsetOf_BindAttribLocation_name_shm_id_not_12); -COMPILE_ASSERT(offsetof(BindAttribLocation, name_shm_offset) == 16, - OffsetOf_BindAttribLocation_name_shm_offset_not_16); -COMPILE_ASSERT(offsetof(BindAttribLocation, data_size) == 20, - OffsetOf_BindAttribLocation_data_size_not_20); - -struct BindAttribLocationImmediate { - typedef BindAttribLocationImmediate ValueType; - static const CommandId kCmdId = kBindAttribLocationImmediate; - 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, GLuint _index, const char* _name) { - SetHeader(_name); - program = _program; - index = _index; - data_size = strlen(_name); - memcpy(ImmediateDataAddress(this), _name, data_size); - } - - void* Set(void* cmd, GLuint _program, GLuint _index, const char* _name) { - static_cast<ValueType*>(cmd)->Init(_program, _index, _name); - const uint32 size = ComputeSize(_name); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 index; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(BindAttribLocationImmediate) == 16, - Sizeof_BindAttribLocationImmediate_is_not_16); -COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, header) == 0, - OffsetOf_BindAttribLocationImmediate_header_not_0); -COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, program) == 4, - OffsetOf_BindAttribLocationImmediate_program_not_4); -COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, index) == 8, - OffsetOf_BindAttribLocationImmediate_index_not_8); -COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, data_size) == 12, - OffsetOf_BindAttribLocationImmediate_data_size_not_12); - -struct BindBuffer { - typedef BindBuffer ValueType; - static const CommandId kCmdId = kBindBuffer; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLuint _buffer) { - SetHeader(); - target = _target; - buffer = _buffer; - } - - void* Set(void* cmd, GLenum _target, GLuint _buffer) { - static_cast<ValueType*>(cmd)->Init(_target, _buffer); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 buffer; -}; - -COMPILE_ASSERT(sizeof(BindBuffer) == 12, - Sizeof_BindBuffer_is_not_12); -COMPILE_ASSERT(offsetof(BindBuffer, header) == 0, - OffsetOf_BindBuffer_header_not_0); -COMPILE_ASSERT(offsetof(BindBuffer, target) == 4, - OffsetOf_BindBuffer_target_not_4); -COMPILE_ASSERT(offsetof(BindBuffer, buffer) == 8, - OffsetOf_BindBuffer_buffer_not_8); - -struct BindFramebuffer { - typedef BindFramebuffer ValueType; - static const CommandId kCmdId = kBindFramebuffer; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLuint _framebuffer) { - SetHeader(); - target = _target; - framebuffer = _framebuffer; - } - - void* Set(void* cmd, GLenum _target, GLuint _framebuffer) { - static_cast<ValueType*>(cmd)->Init(_target, _framebuffer); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 framebuffer; -}; - -COMPILE_ASSERT(sizeof(BindFramebuffer) == 12, - Sizeof_BindFramebuffer_is_not_12); -COMPILE_ASSERT(offsetof(BindFramebuffer, header) == 0, - OffsetOf_BindFramebuffer_header_not_0); -COMPILE_ASSERT(offsetof(BindFramebuffer, target) == 4, - OffsetOf_BindFramebuffer_target_not_4); -COMPILE_ASSERT(offsetof(BindFramebuffer, framebuffer) == 8, - OffsetOf_BindFramebuffer_framebuffer_not_8); - -struct BindRenderbuffer { - typedef BindRenderbuffer ValueType; - static const CommandId kCmdId = kBindRenderbuffer; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLuint _renderbuffer) { - SetHeader(); - target = _target; - renderbuffer = _renderbuffer; - } - - void* Set(void* cmd, GLenum _target, GLuint _renderbuffer) { - static_cast<ValueType*>(cmd)->Init(_target, _renderbuffer); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 renderbuffer; -}; - -COMPILE_ASSERT(sizeof(BindRenderbuffer) == 12, - Sizeof_BindRenderbuffer_is_not_12); -COMPILE_ASSERT(offsetof(BindRenderbuffer, header) == 0, - OffsetOf_BindRenderbuffer_header_not_0); -COMPILE_ASSERT(offsetof(BindRenderbuffer, target) == 4, - OffsetOf_BindRenderbuffer_target_not_4); -COMPILE_ASSERT(offsetof(BindRenderbuffer, renderbuffer) == 8, - OffsetOf_BindRenderbuffer_renderbuffer_not_8); - -struct BindTexture { - typedef BindTexture ValueType; - static const CommandId kCmdId = kBindTexture; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLuint _texture) { - SetHeader(); - target = _target; - texture = _texture; - } - - void* Set(void* cmd, GLenum _target, GLuint _texture) { - static_cast<ValueType*>(cmd)->Init(_target, _texture); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 texture; -}; - -COMPILE_ASSERT(sizeof(BindTexture) == 12, - Sizeof_BindTexture_is_not_12); -COMPILE_ASSERT(offsetof(BindTexture, header) == 0, - OffsetOf_BindTexture_header_not_0); -COMPILE_ASSERT(offsetof(BindTexture, target) == 4, - OffsetOf_BindTexture_target_not_4); -COMPILE_ASSERT(offsetof(BindTexture, texture) == 8, - OffsetOf_BindTexture_texture_not_8); - -struct BlendColor { - typedef BlendColor ValueType; - static const CommandId kCmdId = kBlendColor; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLclampf _red, GLclampf _green, GLclampf _blue, GLclampf _alpha) { - SetHeader(); - red = _red; - green = _green; - blue = _blue; - alpha = _alpha; - } - - void* Set( - void* cmd, GLclampf _red, GLclampf _green, GLclampf _blue, - GLclampf _alpha) { - static_cast<ValueType*>(cmd)->Init(_red, _green, _blue, _alpha); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float red; - float green; - float blue; - float alpha; -}; - -COMPILE_ASSERT(sizeof(BlendColor) == 20, - Sizeof_BlendColor_is_not_20); -COMPILE_ASSERT(offsetof(BlendColor, header) == 0, - OffsetOf_BlendColor_header_not_0); -COMPILE_ASSERT(offsetof(BlendColor, red) == 4, - OffsetOf_BlendColor_red_not_4); -COMPILE_ASSERT(offsetof(BlendColor, green) == 8, - OffsetOf_BlendColor_green_not_8); -COMPILE_ASSERT(offsetof(BlendColor, blue) == 12, - OffsetOf_BlendColor_blue_not_12); -COMPILE_ASSERT(offsetof(BlendColor, alpha) == 16, - OffsetOf_BlendColor_alpha_not_16); - -struct BlendEquation { - typedef BlendEquation ValueType; - static const CommandId kCmdId = kBlendEquation; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _mode) { - SetHeader(); - mode = _mode; - } - - void* Set(void* cmd, GLenum _mode) { - static_cast<ValueType*>(cmd)->Init(_mode); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mode; -}; - -COMPILE_ASSERT(sizeof(BlendEquation) == 8, - Sizeof_BlendEquation_is_not_8); -COMPILE_ASSERT(offsetof(BlendEquation, header) == 0, - OffsetOf_BlendEquation_header_not_0); -COMPILE_ASSERT(offsetof(BlendEquation, mode) == 4, - OffsetOf_BlendEquation_mode_not_4); - -struct BlendEquationSeparate { - typedef BlendEquationSeparate ValueType; - static const CommandId kCmdId = kBlendEquationSeparate; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _modeRGB, GLenum _modeAlpha) { - SetHeader(); - modeRGB = _modeRGB; - modeAlpha = _modeAlpha; - } - - void* Set(void* cmd, GLenum _modeRGB, GLenum _modeAlpha) { - static_cast<ValueType*>(cmd)->Init(_modeRGB, _modeAlpha); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 modeRGB; - uint32 modeAlpha; -}; - -COMPILE_ASSERT(sizeof(BlendEquationSeparate) == 12, - Sizeof_BlendEquationSeparate_is_not_12); -COMPILE_ASSERT(offsetof(BlendEquationSeparate, header) == 0, - OffsetOf_BlendEquationSeparate_header_not_0); -COMPILE_ASSERT(offsetof(BlendEquationSeparate, modeRGB) == 4, - OffsetOf_BlendEquationSeparate_modeRGB_not_4); -COMPILE_ASSERT(offsetof(BlendEquationSeparate, modeAlpha) == 8, - OffsetOf_BlendEquationSeparate_modeAlpha_not_8); - -struct BlendFunc { - typedef BlendFunc ValueType; - static const CommandId kCmdId = kBlendFunc; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _sfactor, GLenum _dfactor) { - SetHeader(); - sfactor = _sfactor; - dfactor = _dfactor; - } - - void* Set(void* cmd, GLenum _sfactor, GLenum _dfactor) { - static_cast<ValueType*>(cmd)->Init(_sfactor, _dfactor); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 sfactor; - uint32 dfactor; -}; - -COMPILE_ASSERT(sizeof(BlendFunc) == 12, - Sizeof_BlendFunc_is_not_12); -COMPILE_ASSERT(offsetof(BlendFunc, header) == 0, - OffsetOf_BlendFunc_header_not_0); -COMPILE_ASSERT(offsetof(BlendFunc, sfactor) == 4, - OffsetOf_BlendFunc_sfactor_not_4); -COMPILE_ASSERT(offsetof(BlendFunc, dfactor) == 8, - OffsetOf_BlendFunc_dfactor_not_8); - -struct BlendFuncSeparate { - typedef BlendFuncSeparate ValueType; - static const CommandId kCmdId = kBlendFuncSeparate; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha, GLenum _dstAlpha) { - SetHeader(); - srcRGB = _srcRGB; - dstRGB = _dstRGB; - srcAlpha = _srcAlpha; - dstAlpha = _dstAlpha; - } - - void* Set( - void* cmd, GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha, - GLenum _dstAlpha) { - static_cast<ValueType*>(cmd)->Init(_srcRGB, _dstRGB, _srcAlpha, _dstAlpha); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 srcRGB; - uint32 dstRGB; - uint32 srcAlpha; - uint32 dstAlpha; -}; - -COMPILE_ASSERT(sizeof(BlendFuncSeparate) == 20, - Sizeof_BlendFuncSeparate_is_not_20); -COMPILE_ASSERT(offsetof(BlendFuncSeparate, header) == 0, - OffsetOf_BlendFuncSeparate_header_not_0); -COMPILE_ASSERT(offsetof(BlendFuncSeparate, srcRGB) == 4, - OffsetOf_BlendFuncSeparate_srcRGB_not_4); -COMPILE_ASSERT(offsetof(BlendFuncSeparate, dstRGB) == 8, - OffsetOf_BlendFuncSeparate_dstRGB_not_8); -COMPILE_ASSERT(offsetof(BlendFuncSeparate, srcAlpha) == 12, - OffsetOf_BlendFuncSeparate_srcAlpha_not_12); -COMPILE_ASSERT(offsetof(BlendFuncSeparate, dstAlpha) == 16, - OffsetOf_BlendFuncSeparate_dstAlpha_not_16); - -struct BufferData { - typedef BufferData ValueType; - static const CommandId kCmdId = kBufferData; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLsizeiptr _size, uint32 _data_shm_id, - uint32 _data_shm_offset, GLenum _usage) { - SetHeader(); - target = _target; - size = _size; - data_shm_id = _data_shm_id; - data_shm_offset = _data_shm_offset; - usage = _usage; - } - - void* Set( - void* cmd, GLenum _target, GLsizeiptr _size, uint32 _data_shm_id, - uint32 _data_shm_offset, GLenum _usage) { - static_cast<ValueType*>( - cmd)->Init(_target, _size, _data_shm_id, _data_shm_offset, _usage); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 size; - uint32 data_shm_id; - uint32 data_shm_offset; - uint32 usage; -}; - -COMPILE_ASSERT(sizeof(BufferData) == 24, - Sizeof_BufferData_is_not_24); -COMPILE_ASSERT(offsetof(BufferData, header) == 0, - OffsetOf_BufferData_header_not_0); -COMPILE_ASSERT(offsetof(BufferData, target) == 4, - OffsetOf_BufferData_target_not_4); -COMPILE_ASSERT(offsetof(BufferData, size) == 8, - OffsetOf_BufferData_size_not_8); -COMPILE_ASSERT(offsetof(BufferData, data_shm_id) == 12, - OffsetOf_BufferData_data_shm_id_not_12); -COMPILE_ASSERT(offsetof(BufferData, data_shm_offset) == 16, - OffsetOf_BufferData_data_shm_offset_not_16); -COMPILE_ASSERT(offsetof(BufferData, usage) == 20, - OffsetOf_BufferData_usage_not_20); - -struct BufferDataImmediate { - typedef BufferDataImmediate ValueType; - static const CommandId kCmdId = kBufferDataImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - void Init(GLenum _target, GLsizeiptr _size, GLenum _usage) { - uint32 total_size = ComputeSize(_size); - SetHeader(total_size); - target = _target; - size = _size; - usage = _usage; - } - - void* Set(void* cmd, GLenum _target, GLsizeiptr _size, GLenum _usage) { - uint32 total_size = ComputeSize(_size); - static_cast<ValueType*>(cmd)->Init(_target, _size, _usage); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 size; - uint32 usage; -}; - -COMPILE_ASSERT(sizeof(BufferDataImmediate) == 16, - Sizeof_BufferDataImmediate_is_not_16); -COMPILE_ASSERT(offsetof(BufferDataImmediate, header) == 0, - OffsetOf_BufferDataImmediate_header_not_0); -COMPILE_ASSERT(offsetof(BufferDataImmediate, target) == 4, - OffsetOf_BufferDataImmediate_target_not_4); -COMPILE_ASSERT(offsetof(BufferDataImmediate, size) == 8, - OffsetOf_BufferDataImmediate_size_not_8); -COMPILE_ASSERT(offsetof(BufferDataImmediate, usage) == 12, - OffsetOf_BufferDataImmediate_usage_not_12); - -struct BufferSubData { - typedef BufferSubData ValueType; - static const CommandId kCmdId = kBufferSubData; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLintptr _offset, GLsizeiptr _size, uint32 _data_shm_id, - uint32 _data_shm_offset) { - SetHeader(); - target = _target; - offset = _offset; - size = _size; - data_shm_id = _data_shm_id; - data_shm_offset = _data_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLintptr _offset, GLsizeiptr _size, - uint32 _data_shm_id, uint32 _data_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _offset, _size, _data_shm_id, _data_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 offset; - uint32 size; - uint32 data_shm_id; - uint32 data_shm_offset; -}; - -COMPILE_ASSERT(sizeof(BufferSubData) == 24, - Sizeof_BufferSubData_is_not_24); -COMPILE_ASSERT(offsetof(BufferSubData, header) == 0, - OffsetOf_BufferSubData_header_not_0); -COMPILE_ASSERT(offsetof(BufferSubData, target) == 4, - OffsetOf_BufferSubData_target_not_4); -COMPILE_ASSERT(offsetof(BufferSubData, offset) == 8, - OffsetOf_BufferSubData_offset_not_8); -COMPILE_ASSERT(offsetof(BufferSubData, size) == 12, - OffsetOf_BufferSubData_size_not_12); -COMPILE_ASSERT(offsetof(BufferSubData, data_shm_id) == 16, - OffsetOf_BufferSubData_data_shm_id_not_16); -COMPILE_ASSERT(offsetof(BufferSubData, data_shm_offset) == 20, - OffsetOf_BufferSubData_data_shm_offset_not_20); - -struct BufferSubDataImmediate { - typedef BufferSubDataImmediate ValueType; - static const CommandId kCmdId = kBufferSubDataImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - void Init(GLenum _target, GLintptr _offset, GLsizeiptr _size) { - uint32 total_size = ComputeSize(_size); - SetHeader(total_size); - target = _target; - offset = _offset; - size = _size; - } - - void* Set(void* cmd, GLenum _target, GLintptr _offset, GLsizeiptr _size) { - uint32 total_size = ComputeSize(_size); - static_cast<ValueType*>(cmd)->Init(_target, _offset, _size); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 offset; - uint32 size; -}; - -COMPILE_ASSERT(sizeof(BufferSubDataImmediate) == 16, - Sizeof_BufferSubDataImmediate_is_not_16); -COMPILE_ASSERT(offsetof(BufferSubDataImmediate, header) == 0, - OffsetOf_BufferSubDataImmediate_header_not_0); -COMPILE_ASSERT(offsetof(BufferSubDataImmediate, target) == 4, - OffsetOf_BufferSubDataImmediate_target_not_4); -COMPILE_ASSERT(offsetof(BufferSubDataImmediate, offset) == 8, - OffsetOf_BufferSubDataImmediate_offset_not_8); -COMPILE_ASSERT(offsetof(BufferSubDataImmediate, size) == 12, - OffsetOf_BufferSubDataImmediate_size_not_12); - -struct CheckFramebufferStatus { - typedef CheckFramebufferStatus ValueType; - static const CommandId kCmdId = kCheckFramebufferStatus; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target) { - SetHeader(); - target = _target; - } - - void* Set(void* cmd, GLenum _target) { - static_cast<ValueType*>(cmd)->Init(_target); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; -}; - -COMPILE_ASSERT(sizeof(CheckFramebufferStatus) == 8, - Sizeof_CheckFramebufferStatus_is_not_8); -COMPILE_ASSERT(offsetof(CheckFramebufferStatus, header) == 0, - OffsetOf_CheckFramebufferStatus_header_not_0); -COMPILE_ASSERT(offsetof(CheckFramebufferStatus, target) == 4, - OffsetOf_CheckFramebufferStatus_target_not_4); - -struct Clear { - typedef Clear ValueType; - static const CommandId kCmdId = kClear; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLbitfield _mask) { - SetHeader(); - mask = _mask; - } - - void* Set(void* cmd, GLbitfield _mask) { - static_cast<ValueType*>(cmd)->Init(_mask); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mask; -}; - -COMPILE_ASSERT(sizeof(Clear) == 8, - Sizeof_Clear_is_not_8); -COMPILE_ASSERT(offsetof(Clear, header) == 0, - OffsetOf_Clear_header_not_0); -COMPILE_ASSERT(offsetof(Clear, mask) == 4, - OffsetOf_Clear_mask_not_4); - -struct ClearColor { - typedef ClearColor ValueType; - static const CommandId kCmdId = kClearColor; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLclampf _red, GLclampf _green, GLclampf _blue, GLclampf _alpha) { - SetHeader(); - red = _red; - green = _green; - blue = _blue; - alpha = _alpha; - } - - void* Set( - void* cmd, GLclampf _red, GLclampf _green, GLclampf _blue, - GLclampf _alpha) { - static_cast<ValueType*>(cmd)->Init(_red, _green, _blue, _alpha); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float red; - float green; - float blue; - float alpha; -}; - -COMPILE_ASSERT(sizeof(ClearColor) == 20, - Sizeof_ClearColor_is_not_20); -COMPILE_ASSERT(offsetof(ClearColor, header) == 0, - OffsetOf_ClearColor_header_not_0); -COMPILE_ASSERT(offsetof(ClearColor, red) == 4, - OffsetOf_ClearColor_red_not_4); -COMPILE_ASSERT(offsetof(ClearColor, green) == 8, - OffsetOf_ClearColor_green_not_8); -COMPILE_ASSERT(offsetof(ClearColor, blue) == 12, - OffsetOf_ClearColor_blue_not_12); -COMPILE_ASSERT(offsetof(ClearColor, alpha) == 16, - OffsetOf_ClearColor_alpha_not_16); - -struct ClearDepthf { - typedef ClearDepthf ValueType; - static const CommandId kCmdId = kClearDepthf; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLclampf _depth) { - SetHeader(); - depth = _depth; - } - - void* Set(void* cmd, GLclampf _depth) { - static_cast<ValueType*>(cmd)->Init(_depth); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float depth; -}; - -COMPILE_ASSERT(sizeof(ClearDepthf) == 8, - Sizeof_ClearDepthf_is_not_8); -COMPILE_ASSERT(offsetof(ClearDepthf, header) == 0, - OffsetOf_ClearDepthf_header_not_0); -COMPILE_ASSERT(offsetof(ClearDepthf, depth) == 4, - OffsetOf_ClearDepthf_depth_not_4); - -struct ClearStencil { - typedef ClearStencil ValueType; - static const CommandId kCmdId = kClearStencil; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _s) { - SetHeader(); - s = _s; - } - - void* Set(void* cmd, GLint _s) { - static_cast<ValueType*>(cmd)->Init(_s); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 s; -}; - -COMPILE_ASSERT(sizeof(ClearStencil) == 8, - Sizeof_ClearStencil_is_not_8); -COMPILE_ASSERT(offsetof(ClearStencil, header) == 0, - OffsetOf_ClearStencil_header_not_0); -COMPILE_ASSERT(offsetof(ClearStencil, s) == 4, - OffsetOf_ClearStencil_s_not_4); - -struct ColorMask { - typedef ColorMask ValueType; - static const CommandId kCmdId = kColorMask; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLboolean _red, GLboolean _green, GLboolean _blue, GLboolean _alpha) { - SetHeader(); - red = _red; - green = _green; - blue = _blue; - alpha = _alpha; - } - - void* Set( - void* cmd, GLboolean _red, GLboolean _green, GLboolean _blue, - GLboolean _alpha) { - static_cast<ValueType*>(cmd)->Init(_red, _green, _blue, _alpha); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 red; - uint32 green; - uint32 blue; - uint32 alpha; -}; - -COMPILE_ASSERT(sizeof(ColorMask) == 20, - Sizeof_ColorMask_is_not_20); -COMPILE_ASSERT(offsetof(ColorMask, header) == 0, - OffsetOf_ColorMask_header_not_0); -COMPILE_ASSERT(offsetof(ColorMask, red) == 4, - OffsetOf_ColorMask_red_not_4); -COMPILE_ASSERT(offsetof(ColorMask, green) == 8, - OffsetOf_ColorMask_green_not_8); -COMPILE_ASSERT(offsetof(ColorMask, blue) == 12, - OffsetOf_ColorMask_blue_not_12); -COMPILE_ASSERT(offsetof(ColorMask, alpha) == 16, - OffsetOf_ColorMask_alpha_not_16); - -struct CompileShader { - typedef CompileShader ValueType; - static const CommandId kCmdId = kCompileShader; - 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 _shader) { - SetHeader(); - shader = _shader; - } - - void* Set(void* cmd, GLuint _shader) { - static_cast<ValueType*>(cmd)->Init(_shader); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; -}; - -COMPILE_ASSERT(sizeof(CompileShader) == 8, - Sizeof_CompileShader_is_not_8); -COMPILE_ASSERT(offsetof(CompileShader, header) == 0, - OffsetOf_CompileShader_header_not_0); -COMPILE_ASSERT(offsetof(CompileShader, shader) == 4, - OffsetOf_CompileShader_shader_not_4); - -struct CompressedTexImage2D { - typedef CompressedTexImage2D ValueType; - static const CommandId kCmdId = kCompressedTexImage2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, - GLsizei _height, GLint _border, GLsizei _imageSize, uint32 _data_shm_id, - uint32 _data_shm_offset) { - SetHeader(); - target = _target; - level = _level; - internalformat = _internalformat; - width = _width; - height = _height; - border = _border; - imageSize = _imageSize; - data_shm_id = _data_shm_id; - data_shm_offset = _data_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLenum _internalformat, - GLsizei _width, GLsizei _height, GLint _border, GLsizei _imageSize, - uint32 _data_shm_id, uint32 _data_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _internalformat, _width, _height, _border, - _imageSize, _data_shm_id, _data_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 internalformat; - uint32 width; - uint32 height; - uint32 border; - uint32 imageSize; - uint32 data_shm_id; - uint32 data_shm_offset; -}; - -COMPILE_ASSERT(sizeof(CompressedTexImage2D) == 40, - Sizeof_CompressedTexImage2D_is_not_40); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, header) == 0, - OffsetOf_CompressedTexImage2D_header_not_0); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, target) == 4, - OffsetOf_CompressedTexImage2D_target_not_4); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, level) == 8, - OffsetOf_CompressedTexImage2D_level_not_8); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, internalformat) == 12, - OffsetOf_CompressedTexImage2D_internalformat_not_12); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, width) == 16, - OffsetOf_CompressedTexImage2D_width_not_16); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, height) == 20, - OffsetOf_CompressedTexImage2D_height_not_20); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, border) == 24, - OffsetOf_CompressedTexImage2D_border_not_24); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, imageSize) == 28, - OffsetOf_CompressedTexImage2D_imageSize_not_28); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, data_shm_id) == 32, - OffsetOf_CompressedTexImage2D_data_shm_id_not_32); -COMPILE_ASSERT(offsetof(CompressedTexImage2D, data_shm_offset) == 36, - OffsetOf_CompressedTexImage2D_data_shm_offset_not_36); - -struct CompressedTexImage2DImmediate { - typedef CompressedTexImage2DImmediate ValueType; - static const CommandId kCmdId = kCompressedTexImage2DImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - void Init( - GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, - GLsizei _height, GLint _border, GLsizei _imageSize) { - uint32 total_size = ComputeSize(_imageSize); - SetHeader(total_size); - target = _target; - level = _level; - internalformat = _internalformat; - width = _width; - height = _height; - border = _border; - imageSize = _imageSize; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLenum _internalformat, - GLsizei _width, GLsizei _height, GLint _border, GLsizei _imageSize) { - uint32 total_size = ComputeSize(_imageSize); - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _internalformat, _width, _height, _border, - _imageSize); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 internalformat; - uint32 width; - uint32 height; - uint32 border; - uint32 imageSize; -}; - -COMPILE_ASSERT(sizeof(CompressedTexImage2DImmediate) == 32, - Sizeof_CompressedTexImage2DImmediate_is_not_32); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, header) == 0, - OffsetOf_CompressedTexImage2DImmediate_header_not_0); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, target) == 4, - OffsetOf_CompressedTexImage2DImmediate_target_not_4); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, level) == 8, - OffsetOf_CompressedTexImage2DImmediate_level_not_8); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, internalformat) == 12, - OffsetOf_CompressedTexImage2DImmediate_internalformat_not_12); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, width) == 16, - OffsetOf_CompressedTexImage2DImmediate_width_not_16); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, height) == 20, - OffsetOf_CompressedTexImage2DImmediate_height_not_20); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, border) == 24, - OffsetOf_CompressedTexImage2DImmediate_border_not_24); -COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, imageSize) == 28, - OffsetOf_CompressedTexImage2DImmediate_imageSize_not_28); - -struct CompressedTexSubImage2D { - typedef CompressedTexSubImage2D ValueType; - static const CommandId kCmdId = kCompressedTexSubImage2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize, - uint32 _data_shm_id, uint32 _data_shm_offset) { - SetHeader(); - target = _target; - level = _level; - xoffset = _xoffset; - yoffset = _yoffset; - width = _width; - height = _height; - format = _format; - imageSize = _imageSize; - data_shm_id = _data_shm_id; - data_shm_offset = _data_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize, - uint32 _data_shm_id, uint32 _data_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _xoffset, _yoffset, _width, _height, _format, - _imageSize, _data_shm_id, _data_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 xoffset; - uint32 yoffset; - uint32 width; - uint32 height; - uint32 format; - uint32 imageSize; - uint32 data_shm_id; - uint32 data_shm_offset; -}; - -COMPILE_ASSERT(sizeof(CompressedTexSubImage2D) == 44, - Sizeof_CompressedTexSubImage2D_is_not_44); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, header) == 0, - OffsetOf_CompressedTexSubImage2D_header_not_0); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, target) == 4, - OffsetOf_CompressedTexSubImage2D_target_not_4); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, level) == 8, - OffsetOf_CompressedTexSubImage2D_level_not_8); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, xoffset) == 12, - OffsetOf_CompressedTexSubImage2D_xoffset_not_12); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, yoffset) == 16, - OffsetOf_CompressedTexSubImage2D_yoffset_not_16); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, width) == 20, - OffsetOf_CompressedTexSubImage2D_width_not_20); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, height) == 24, - OffsetOf_CompressedTexSubImage2D_height_not_24); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, format) == 28, - OffsetOf_CompressedTexSubImage2D_format_not_28); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, imageSize) == 32, - OffsetOf_CompressedTexSubImage2D_imageSize_not_32); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, data_shm_id) == 36, - OffsetOf_CompressedTexSubImage2D_data_shm_id_not_36); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, data_shm_offset) == 40, - OffsetOf_CompressedTexSubImage2D_data_shm_offset_not_40); - -struct CompressedTexSubImage2DImmediate { - typedef CompressedTexSubImage2DImmediate ValueType; - static const CommandId kCmdId = kCompressedTexSubImage2DImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - void Init( - GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize) { - uint32 total_size = ComputeSize(_imageSize); - SetHeader(total_size); - target = _target; - level = _level; - xoffset = _xoffset; - yoffset = _yoffset; - width = _width; - height = _height; - format = _format; - imageSize = _imageSize; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize) { - uint32 total_size = ComputeSize(_imageSize); - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _xoffset, _yoffset, _width, _height, _format, - _imageSize); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 xoffset; - uint32 yoffset; - uint32 width; - uint32 height; - uint32 format; - uint32 imageSize; -}; - -COMPILE_ASSERT(sizeof(CompressedTexSubImage2DImmediate) == 36, - Sizeof_CompressedTexSubImage2DImmediate_is_not_36); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, header) == 0, - OffsetOf_CompressedTexSubImage2DImmediate_header_not_0); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, target) == 4, - OffsetOf_CompressedTexSubImage2DImmediate_target_not_4); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, level) == 8, - OffsetOf_CompressedTexSubImage2DImmediate_level_not_8); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, xoffset) == 12, - OffsetOf_CompressedTexSubImage2DImmediate_xoffset_not_12); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, yoffset) == 16, - OffsetOf_CompressedTexSubImage2DImmediate_yoffset_not_16); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, width) == 20, - OffsetOf_CompressedTexSubImage2DImmediate_width_not_20); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, height) == 24, - OffsetOf_CompressedTexSubImage2DImmediate_height_not_24); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, format) == 28, - OffsetOf_CompressedTexSubImage2DImmediate_format_not_28); -COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, imageSize) == 32, - OffsetOf_CompressedTexSubImage2DImmediate_imageSize_not_32); - -struct CopyTexImage2D { - typedef CopyTexImage2D ValueType; - static const CommandId kCmdId = kCopyTexImage2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLint _level, GLenum _internalformat, GLint _x, GLint _y, - GLsizei _width, GLsizei _height, GLint _border) { - SetHeader(); - target = _target; - level = _level; - internalformat = _internalformat; - x = _x; - y = _y; - width = _width; - height = _height; - border = _border; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLenum _internalformat, GLint _x, - GLint _y, GLsizei _width, GLsizei _height, GLint _border) { - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _internalformat, _x, _y, _width, _height, - _border); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 internalformat; - uint32 x; - uint32 y; - uint32 width; - uint32 height; - uint32 border; -}; - -COMPILE_ASSERT(sizeof(CopyTexImage2D) == 36, - Sizeof_CopyTexImage2D_is_not_36); -COMPILE_ASSERT(offsetof(CopyTexImage2D, header) == 0, - OffsetOf_CopyTexImage2D_header_not_0); -COMPILE_ASSERT(offsetof(CopyTexImage2D, target) == 4, - OffsetOf_CopyTexImage2D_target_not_4); -COMPILE_ASSERT(offsetof(CopyTexImage2D, level) == 8, - OffsetOf_CopyTexImage2D_level_not_8); -COMPILE_ASSERT(offsetof(CopyTexImage2D, internalformat) == 12, - OffsetOf_CopyTexImage2D_internalformat_not_12); -COMPILE_ASSERT(offsetof(CopyTexImage2D, x) == 16, - OffsetOf_CopyTexImage2D_x_not_16); -COMPILE_ASSERT(offsetof(CopyTexImage2D, y) == 20, - OffsetOf_CopyTexImage2D_y_not_20); -COMPILE_ASSERT(offsetof(CopyTexImage2D, width) == 24, - OffsetOf_CopyTexImage2D_width_not_24); -COMPILE_ASSERT(offsetof(CopyTexImage2D, height) == 28, - OffsetOf_CopyTexImage2D_height_not_28); -COMPILE_ASSERT(offsetof(CopyTexImage2D, border) == 32, - OffsetOf_CopyTexImage2D_border_not_32); - -struct CopyTexSubImage2D { - typedef CopyTexSubImage2D ValueType; - static const CommandId kCmdId = kCopyTexSubImage2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _x, - GLint _y, GLsizei _width, GLsizei _height) { - SetHeader(); - target = _target; - level = _level; - xoffset = _xoffset; - yoffset = _yoffset; - x = _x; - y = _y; - width = _width; - height = _height; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLint _x, GLint _y, GLsizei _width, GLsizei _height) { - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _xoffset, _yoffset, _x, _y, _width, _height); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 xoffset; - uint32 yoffset; - uint32 x; - uint32 y; - uint32 width; - uint32 height; -}; - -COMPILE_ASSERT(sizeof(CopyTexSubImage2D) == 36, - Sizeof_CopyTexSubImage2D_is_not_36); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, header) == 0, - OffsetOf_CopyTexSubImage2D_header_not_0); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, target) == 4, - OffsetOf_CopyTexSubImage2D_target_not_4); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, level) == 8, - OffsetOf_CopyTexSubImage2D_level_not_8); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, xoffset) == 12, - OffsetOf_CopyTexSubImage2D_xoffset_not_12); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, yoffset) == 16, - OffsetOf_CopyTexSubImage2D_yoffset_not_16); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, x) == 20, - OffsetOf_CopyTexSubImage2D_x_not_20); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, y) == 24, - OffsetOf_CopyTexSubImage2D_y_not_24); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, width) == 28, - OffsetOf_CopyTexSubImage2D_width_not_28); -COMPILE_ASSERT(offsetof(CopyTexSubImage2D, height) == 32, - OffsetOf_CopyTexSubImage2D_height_not_32); - -struct CreateProgram { - typedef CreateProgram ValueType; - static const CommandId kCmdId = kCreateProgram; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(uint32 _client_id) { - SetHeader(); - client_id = _client_id; - } - - void* Set(void* cmd, uint32 _client_id) { - static_cast<ValueType*>(cmd)->Init(_client_id); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 client_id; -}; - -COMPILE_ASSERT(sizeof(CreateProgram) == 8, - Sizeof_CreateProgram_is_not_8); -COMPILE_ASSERT(offsetof(CreateProgram, header) == 0, - OffsetOf_CreateProgram_header_not_0); -COMPILE_ASSERT(offsetof(CreateProgram, client_id) == 4, - OffsetOf_CreateProgram_client_id_not_4); - -struct CreateShader { - typedef CreateShader ValueType; - static const CommandId kCmdId = kCreateShader; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _type, uint32 _client_id) { - SetHeader(); - type = _type; - client_id = _client_id; - } - - void* Set(void* cmd, GLenum _type, uint32 _client_id) { - static_cast<ValueType*>(cmd)->Init(_type, _client_id); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 type; - uint32 client_id; -}; - -COMPILE_ASSERT(sizeof(CreateShader) == 12, - Sizeof_CreateShader_is_not_12); -COMPILE_ASSERT(offsetof(CreateShader, header) == 0, - OffsetOf_CreateShader_header_not_0); -COMPILE_ASSERT(offsetof(CreateShader, type) == 4, - OffsetOf_CreateShader_type_not_4); -COMPILE_ASSERT(offsetof(CreateShader, client_id) == 8, - OffsetOf_CreateShader_client_id_not_8); - -struct CullFace { - typedef CullFace ValueType; - static const CommandId kCmdId = kCullFace; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _mode) { - SetHeader(); - mode = _mode; - } - - void* Set(void* cmd, GLenum _mode) { - static_cast<ValueType*>(cmd)->Init(_mode); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mode; -}; - -COMPILE_ASSERT(sizeof(CullFace) == 8, - Sizeof_CullFace_is_not_8); -COMPILE_ASSERT(offsetof(CullFace, header) == 0, - OffsetOf_CullFace_header_not_0); -COMPILE_ASSERT(offsetof(CullFace, mode) == 4, - OffsetOf_CullFace_mode_not_4); - -struct DeleteBuffers { - typedef DeleteBuffers ValueType; - static const CommandId kCmdId = kDeleteBuffers; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLsizei _n, uint32 _buffers_shm_id, uint32 _buffers_shm_offset) { - SetHeader(); - n = _n; - buffers_shm_id = _buffers_shm_id; - buffers_shm_offset = _buffers_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _buffers_shm_id, - uint32 _buffers_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _buffers_shm_id, _buffers_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 buffers_shm_id; - uint32 buffers_shm_offset; -}; - -COMPILE_ASSERT(sizeof(DeleteBuffers) == 16, - Sizeof_DeleteBuffers_is_not_16); -COMPILE_ASSERT(offsetof(DeleteBuffers, header) == 0, - OffsetOf_DeleteBuffers_header_not_0); -COMPILE_ASSERT(offsetof(DeleteBuffers, n) == 4, - OffsetOf_DeleteBuffers_n_not_4); -COMPILE_ASSERT(offsetof(DeleteBuffers, buffers_shm_id) == 8, - OffsetOf_DeleteBuffers_buffers_shm_id_not_8); -COMPILE_ASSERT(offsetof(DeleteBuffers, buffers_shm_offset) == 12, - OffsetOf_DeleteBuffers_buffers_shm_offset_not_12); - -struct DeleteBuffersImmediate { - typedef DeleteBuffersImmediate ValueType; - static const CommandId kCmdId = kDeleteBuffersImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, const GLuint* _buffers) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _buffers, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, const GLuint* _buffers) { - static_cast<ValueType*>(cmd)->Init(_n, _buffers); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(DeleteBuffersImmediate) == 8, - Sizeof_DeleteBuffersImmediate_is_not_8); -COMPILE_ASSERT(offsetof(DeleteBuffersImmediate, header) == 0, - OffsetOf_DeleteBuffersImmediate_header_not_0); -COMPILE_ASSERT(offsetof(DeleteBuffersImmediate, n) == 4, - OffsetOf_DeleteBuffersImmediate_n_not_4); - -struct DeleteFramebuffers { - typedef DeleteFramebuffers ValueType; - static const CommandId kCmdId = kDeleteFramebuffers; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLsizei _n, uint32 _framebuffers_shm_id, - uint32 _framebuffers_shm_offset) { - SetHeader(); - n = _n; - framebuffers_shm_id = _framebuffers_shm_id; - framebuffers_shm_offset = _framebuffers_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _framebuffers_shm_id, - uint32 _framebuffers_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _framebuffers_shm_id, _framebuffers_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 framebuffers_shm_id; - uint32 framebuffers_shm_offset; -}; - -COMPILE_ASSERT(sizeof(DeleteFramebuffers) == 16, - Sizeof_DeleteFramebuffers_is_not_16); -COMPILE_ASSERT(offsetof(DeleteFramebuffers, header) == 0, - OffsetOf_DeleteFramebuffers_header_not_0); -COMPILE_ASSERT(offsetof(DeleteFramebuffers, n) == 4, - OffsetOf_DeleteFramebuffers_n_not_4); -COMPILE_ASSERT(offsetof(DeleteFramebuffers, framebuffers_shm_id) == 8, - OffsetOf_DeleteFramebuffers_framebuffers_shm_id_not_8); -COMPILE_ASSERT(offsetof(DeleteFramebuffers, framebuffers_shm_offset) == 12, - OffsetOf_DeleteFramebuffers_framebuffers_shm_offset_not_12); - -struct DeleteFramebuffersImmediate { - typedef DeleteFramebuffersImmediate ValueType; - static const CommandId kCmdId = kDeleteFramebuffersImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, const GLuint* _framebuffers) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _framebuffers, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, const GLuint* _framebuffers) { - static_cast<ValueType*>(cmd)->Init(_n, _framebuffers); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(DeleteFramebuffersImmediate) == 8, - Sizeof_DeleteFramebuffersImmediate_is_not_8); -COMPILE_ASSERT(offsetof(DeleteFramebuffersImmediate, header) == 0, - OffsetOf_DeleteFramebuffersImmediate_header_not_0); -COMPILE_ASSERT(offsetof(DeleteFramebuffersImmediate, n) == 4, - OffsetOf_DeleteFramebuffersImmediate_n_not_4); - -struct DeleteProgram { - typedef DeleteProgram ValueType; - static const CommandId kCmdId = kDeleteProgram; - 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) { - SetHeader(); - program = _program; - } - - void* Set(void* cmd, GLuint _program) { - static_cast<ValueType*>(cmd)->Init(_program); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; -}; - -COMPILE_ASSERT(sizeof(DeleteProgram) == 8, - Sizeof_DeleteProgram_is_not_8); -COMPILE_ASSERT(offsetof(DeleteProgram, header) == 0, - OffsetOf_DeleteProgram_header_not_0); -COMPILE_ASSERT(offsetof(DeleteProgram, program) == 4, - OffsetOf_DeleteProgram_program_not_4); - -struct DeleteRenderbuffers { - typedef DeleteRenderbuffers ValueType; - static const CommandId kCmdId = kDeleteRenderbuffers; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLsizei _n, uint32 _renderbuffers_shm_id, - uint32 _renderbuffers_shm_offset) { - SetHeader(); - n = _n; - renderbuffers_shm_id = _renderbuffers_shm_id; - renderbuffers_shm_offset = _renderbuffers_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _renderbuffers_shm_id, - uint32 _renderbuffers_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _renderbuffers_shm_id, _renderbuffers_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 renderbuffers_shm_id; - uint32 renderbuffers_shm_offset; -}; - -COMPILE_ASSERT(sizeof(DeleteRenderbuffers) == 16, - Sizeof_DeleteRenderbuffers_is_not_16); -COMPILE_ASSERT(offsetof(DeleteRenderbuffers, header) == 0, - OffsetOf_DeleteRenderbuffers_header_not_0); -COMPILE_ASSERT(offsetof(DeleteRenderbuffers, n) == 4, - OffsetOf_DeleteRenderbuffers_n_not_4); -COMPILE_ASSERT(offsetof(DeleteRenderbuffers, renderbuffers_shm_id) == 8, - OffsetOf_DeleteRenderbuffers_renderbuffers_shm_id_not_8); -COMPILE_ASSERT(offsetof(DeleteRenderbuffers, renderbuffers_shm_offset) == 12, - OffsetOf_DeleteRenderbuffers_renderbuffers_shm_offset_not_12); - -struct DeleteRenderbuffersImmediate { - typedef DeleteRenderbuffersImmediate ValueType; - static const CommandId kCmdId = kDeleteRenderbuffersImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, const GLuint* _renderbuffers) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _renderbuffers, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, const GLuint* _renderbuffers) { - static_cast<ValueType*>(cmd)->Init(_n, _renderbuffers); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(DeleteRenderbuffersImmediate) == 8, - Sizeof_DeleteRenderbuffersImmediate_is_not_8); -COMPILE_ASSERT(offsetof(DeleteRenderbuffersImmediate, header) == 0, - OffsetOf_DeleteRenderbuffersImmediate_header_not_0); -COMPILE_ASSERT(offsetof(DeleteRenderbuffersImmediate, n) == 4, - OffsetOf_DeleteRenderbuffersImmediate_n_not_4); - -struct DeleteShader { - typedef DeleteShader ValueType; - static const CommandId kCmdId = kDeleteShader; - 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 _shader) { - SetHeader(); - shader = _shader; - } - - void* Set(void* cmd, GLuint _shader) { - static_cast<ValueType*>(cmd)->Init(_shader); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; -}; - -COMPILE_ASSERT(sizeof(DeleteShader) == 8, - Sizeof_DeleteShader_is_not_8); -COMPILE_ASSERT(offsetof(DeleteShader, header) == 0, - OffsetOf_DeleteShader_header_not_0); -COMPILE_ASSERT(offsetof(DeleteShader, shader) == 4, - OffsetOf_DeleteShader_shader_not_4); - -struct DeleteTextures { - typedef DeleteTextures ValueType; - static const CommandId kCmdId = kDeleteTextures; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLsizei _n, uint32 _textures_shm_id, uint32 _textures_shm_offset) { - SetHeader(); - n = _n; - textures_shm_id = _textures_shm_id; - textures_shm_offset = _textures_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _textures_shm_id, - uint32 _textures_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _textures_shm_id, _textures_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 textures_shm_id; - uint32 textures_shm_offset; -}; - -COMPILE_ASSERT(sizeof(DeleteTextures) == 16, - Sizeof_DeleteTextures_is_not_16); -COMPILE_ASSERT(offsetof(DeleteTextures, header) == 0, - OffsetOf_DeleteTextures_header_not_0); -COMPILE_ASSERT(offsetof(DeleteTextures, n) == 4, - OffsetOf_DeleteTextures_n_not_4); -COMPILE_ASSERT(offsetof(DeleteTextures, textures_shm_id) == 8, - OffsetOf_DeleteTextures_textures_shm_id_not_8); -COMPILE_ASSERT(offsetof(DeleteTextures, textures_shm_offset) == 12, - OffsetOf_DeleteTextures_textures_shm_offset_not_12); - -struct DeleteTexturesImmediate { - typedef DeleteTexturesImmediate ValueType; - static const CommandId kCmdId = kDeleteTexturesImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, const GLuint* _textures) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _textures, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, const GLuint* _textures) { - static_cast<ValueType*>(cmd)->Init(_n, _textures); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(DeleteTexturesImmediate) == 8, - Sizeof_DeleteTexturesImmediate_is_not_8); -COMPILE_ASSERT(offsetof(DeleteTexturesImmediate, header) == 0, - OffsetOf_DeleteTexturesImmediate_header_not_0); -COMPILE_ASSERT(offsetof(DeleteTexturesImmediate, n) == 4, - OffsetOf_DeleteTexturesImmediate_n_not_4); - -struct DepthFunc { - typedef DepthFunc ValueType; - static const CommandId kCmdId = kDepthFunc; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _func) { - SetHeader(); - func = _func; - } - - void* Set(void* cmd, GLenum _func) { - static_cast<ValueType*>(cmd)->Init(_func); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 func; -}; - -COMPILE_ASSERT(sizeof(DepthFunc) == 8, - Sizeof_DepthFunc_is_not_8); -COMPILE_ASSERT(offsetof(DepthFunc, header) == 0, - OffsetOf_DepthFunc_header_not_0); -COMPILE_ASSERT(offsetof(DepthFunc, func) == 4, - OffsetOf_DepthFunc_func_not_4); - -struct DepthMask { - typedef DepthMask ValueType; - static const CommandId kCmdId = kDepthMask; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLboolean _flag) { - SetHeader(); - flag = _flag; - } - - void* Set(void* cmd, GLboolean _flag) { - static_cast<ValueType*>(cmd)->Init(_flag); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 flag; -}; - -COMPILE_ASSERT(sizeof(DepthMask) == 8, - Sizeof_DepthMask_is_not_8); -COMPILE_ASSERT(offsetof(DepthMask, header) == 0, - OffsetOf_DepthMask_header_not_0); -COMPILE_ASSERT(offsetof(DepthMask, flag) == 4, - OffsetOf_DepthMask_flag_not_4); - -struct DepthRangef { - typedef DepthRangef ValueType; - static const CommandId kCmdId = kDepthRangef; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLclampf _zNear, GLclampf _zFar) { - SetHeader(); - zNear = _zNear; - zFar = _zFar; - } - - void* Set(void* cmd, GLclampf _zNear, GLclampf _zFar) { - static_cast<ValueType*>(cmd)->Init(_zNear, _zFar); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float zNear; - float zFar; -}; - -COMPILE_ASSERT(sizeof(DepthRangef) == 12, - Sizeof_DepthRangef_is_not_12); -COMPILE_ASSERT(offsetof(DepthRangef, header) == 0, - OffsetOf_DepthRangef_header_not_0); -COMPILE_ASSERT(offsetof(DepthRangef, zNear) == 4, - OffsetOf_DepthRangef_zNear_not_4); -COMPILE_ASSERT(offsetof(DepthRangef, zFar) == 8, - OffsetOf_DepthRangef_zFar_not_8); - -struct DetachShader { - typedef DetachShader ValueType; - static const CommandId kCmdId = kDetachShader; - 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, GLuint _shader) { - SetHeader(); - program = _program; - shader = _shader; - } - - void* Set(void* cmd, GLuint _program, GLuint _shader) { - static_cast<ValueType*>(cmd)->Init(_program, _shader); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 shader; -}; - -COMPILE_ASSERT(sizeof(DetachShader) == 12, - Sizeof_DetachShader_is_not_12); -COMPILE_ASSERT(offsetof(DetachShader, header) == 0, - OffsetOf_DetachShader_header_not_0); -COMPILE_ASSERT(offsetof(DetachShader, program) == 4, - OffsetOf_DetachShader_program_not_4); -COMPILE_ASSERT(offsetof(DetachShader, shader) == 8, - OffsetOf_DetachShader_shader_not_8); - -struct Disable { - typedef Disable ValueType; - static const CommandId kCmdId = kDisable; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _cap) { - SetHeader(); - cap = _cap; - } - - void* Set(void* cmd, GLenum _cap) { - static_cast<ValueType*>(cmd)->Init(_cap); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 cap; -}; - -COMPILE_ASSERT(sizeof(Disable) == 8, - Sizeof_Disable_is_not_8); -COMPILE_ASSERT(offsetof(Disable, header) == 0, - OffsetOf_Disable_header_not_0); -COMPILE_ASSERT(offsetof(Disable, cap) == 4, - OffsetOf_Disable_cap_not_4); - -struct DisableVertexAttribArray { - typedef DisableVertexAttribArray ValueType; - static const CommandId kCmdId = kDisableVertexAttribArray; - 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 _index) { - SetHeader(); - index = _index; - } - - void* Set(void* cmd, GLuint _index) { - static_cast<ValueType*>(cmd)->Init(_index); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 index; -}; - -COMPILE_ASSERT(sizeof(DisableVertexAttribArray) == 8, - Sizeof_DisableVertexAttribArray_is_not_8); -COMPILE_ASSERT(offsetof(DisableVertexAttribArray, header) == 0, - OffsetOf_DisableVertexAttribArray_header_not_0); -COMPILE_ASSERT(offsetof(DisableVertexAttribArray, index) == 4, - OffsetOf_DisableVertexAttribArray_index_not_4); - -struct DrawArrays { - typedef DrawArrays ValueType; - static const CommandId kCmdId = kDrawArrays; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _mode, GLint _first, GLsizei _count) { - SetHeader(); - mode = _mode; - first = _first; - count = _count; - } - - void* Set(void* cmd, GLenum _mode, GLint _first, GLsizei _count) { - static_cast<ValueType*>(cmd)->Init(_mode, _first, _count); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mode; - uint32 first; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(DrawArrays) == 16, - Sizeof_DrawArrays_is_not_16); -COMPILE_ASSERT(offsetof(DrawArrays, header) == 0, - OffsetOf_DrawArrays_header_not_0); -COMPILE_ASSERT(offsetof(DrawArrays, mode) == 4, - OffsetOf_DrawArrays_mode_not_4); -COMPILE_ASSERT(offsetof(DrawArrays, first) == 8, - OffsetOf_DrawArrays_first_not_8); -COMPILE_ASSERT(offsetof(DrawArrays, count) == 12, - OffsetOf_DrawArrays_count_not_12); - -struct DrawElements { - typedef DrawElements ValueType; - static const CommandId kCmdId = kDrawElements; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _mode, GLsizei _count, GLenum _type, GLuint _index_offset) { - SetHeader(); - mode = _mode; - count = _count; - type = _type; - index_offset = _index_offset; - } - - void* Set( - void* cmd, GLenum _mode, GLsizei _count, GLenum _type, - GLuint _index_offset) { - static_cast<ValueType*>(cmd)->Init(_mode, _count, _type, _index_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mode; - uint32 count; - uint32 type; - uint32 index_offset; -}; - -COMPILE_ASSERT(sizeof(DrawElements) == 20, - Sizeof_DrawElements_is_not_20); -COMPILE_ASSERT(offsetof(DrawElements, header) == 0, - OffsetOf_DrawElements_header_not_0); -COMPILE_ASSERT(offsetof(DrawElements, mode) == 4, - OffsetOf_DrawElements_mode_not_4); -COMPILE_ASSERT(offsetof(DrawElements, count) == 8, - OffsetOf_DrawElements_count_not_8); -COMPILE_ASSERT(offsetof(DrawElements, type) == 12, - OffsetOf_DrawElements_type_not_12); -COMPILE_ASSERT(offsetof(DrawElements, index_offset) == 16, - OffsetOf_DrawElements_index_offset_not_16); - -struct Enable { - typedef Enable ValueType; - static const CommandId kCmdId = kEnable; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _cap) { - SetHeader(); - cap = _cap; - } - - void* Set(void* cmd, GLenum _cap) { - static_cast<ValueType*>(cmd)->Init(_cap); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 cap; -}; - -COMPILE_ASSERT(sizeof(Enable) == 8, - Sizeof_Enable_is_not_8); -COMPILE_ASSERT(offsetof(Enable, header) == 0, - OffsetOf_Enable_header_not_0); -COMPILE_ASSERT(offsetof(Enable, cap) == 4, - OffsetOf_Enable_cap_not_4); - -struct EnableVertexAttribArray { - typedef EnableVertexAttribArray ValueType; - static const CommandId kCmdId = kEnableVertexAttribArray; - 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 _index) { - SetHeader(); - index = _index; - } - - void* Set(void* cmd, GLuint _index) { - static_cast<ValueType*>(cmd)->Init(_index); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 index; -}; - -COMPILE_ASSERT(sizeof(EnableVertexAttribArray) == 8, - Sizeof_EnableVertexAttribArray_is_not_8); -COMPILE_ASSERT(offsetof(EnableVertexAttribArray, header) == 0, - OffsetOf_EnableVertexAttribArray_header_not_0); -COMPILE_ASSERT(offsetof(EnableVertexAttribArray, index) == 4, - OffsetOf_EnableVertexAttribArray_index_not_4); - -struct Finish { - typedef Finish ValueType; - static const CommandId kCmdId = kFinish; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init() { - SetHeader(); - } - - void* Set(void* cmd) { - static_cast<ValueType*>(cmd)->Init(); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; -}; - -COMPILE_ASSERT(sizeof(Finish) == 4, - Sizeof_Finish_is_not_4); -COMPILE_ASSERT(offsetof(Finish, header) == 0, - OffsetOf_Finish_header_not_0); - -struct Flush { - typedef Flush ValueType; - static const CommandId kCmdId = kFlush; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init() { - SetHeader(); - } - - void* Set(void* cmd) { - static_cast<ValueType*>(cmd)->Init(); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; -}; - -COMPILE_ASSERT(sizeof(Flush) == 4, - Sizeof_Flush_is_not_4); -COMPILE_ASSERT(offsetof(Flush, header) == 0, - OffsetOf_Flush_header_not_0); - -struct FramebufferRenderbuffer { - typedef FramebufferRenderbuffer ValueType; - static const CommandId kCmdId = kFramebufferRenderbuffer; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _attachment, GLenum _renderbuffertarget, - GLuint _renderbuffer) { - SetHeader(); - target = _target; - attachment = _attachment; - renderbuffertarget = _renderbuffertarget; - renderbuffer = _renderbuffer; - } - - void* Set( - void* cmd, GLenum _target, GLenum _attachment, GLenum _renderbuffertarget, - GLuint _renderbuffer) { - static_cast<ValueType*>( - cmd)->Init(_target, _attachment, _renderbuffertarget, _renderbuffer); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 attachment; - uint32 renderbuffertarget; - uint32 renderbuffer; -}; - -COMPILE_ASSERT(sizeof(FramebufferRenderbuffer) == 20, - Sizeof_FramebufferRenderbuffer_is_not_20); -COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, header) == 0, - OffsetOf_FramebufferRenderbuffer_header_not_0); -COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, target) == 4, - OffsetOf_FramebufferRenderbuffer_target_not_4); -COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, attachment) == 8, - OffsetOf_FramebufferRenderbuffer_attachment_not_8); -COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, renderbuffertarget) == 12, - OffsetOf_FramebufferRenderbuffer_renderbuffertarget_not_12); -COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, renderbuffer) == 16, - OffsetOf_FramebufferRenderbuffer_renderbuffer_not_16); - -struct FramebufferTexture2D { - typedef FramebufferTexture2D ValueType; - static const CommandId kCmdId = kFramebufferTexture2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _attachment, GLenum _textarget, GLuint _texture, - GLint _level) { - SetHeader(); - target = _target; - attachment = _attachment; - textarget = _textarget; - texture = _texture; - level = _level; - } - - void* Set( - void* cmd, GLenum _target, GLenum _attachment, GLenum _textarget, - GLuint _texture, GLint _level) { - static_cast<ValueType*>( - cmd)->Init(_target, _attachment, _textarget, _texture, _level); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 attachment; - uint32 textarget; - uint32 texture; - uint32 level; -}; - -COMPILE_ASSERT(sizeof(FramebufferTexture2D) == 24, - Sizeof_FramebufferTexture2D_is_not_24); -COMPILE_ASSERT(offsetof(FramebufferTexture2D, header) == 0, - OffsetOf_FramebufferTexture2D_header_not_0); -COMPILE_ASSERT(offsetof(FramebufferTexture2D, target) == 4, - OffsetOf_FramebufferTexture2D_target_not_4); -COMPILE_ASSERT(offsetof(FramebufferTexture2D, attachment) == 8, - OffsetOf_FramebufferTexture2D_attachment_not_8); -COMPILE_ASSERT(offsetof(FramebufferTexture2D, textarget) == 12, - OffsetOf_FramebufferTexture2D_textarget_not_12); -COMPILE_ASSERT(offsetof(FramebufferTexture2D, texture) == 16, - OffsetOf_FramebufferTexture2D_texture_not_16); -COMPILE_ASSERT(offsetof(FramebufferTexture2D, level) == 20, - OffsetOf_FramebufferTexture2D_level_not_20); - -struct FrontFace { - typedef FrontFace ValueType; - static const CommandId kCmdId = kFrontFace; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _mode) { - SetHeader(); - mode = _mode; - } - - void* Set(void* cmd, GLenum _mode) { - static_cast<ValueType*>(cmd)->Init(_mode); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mode; -}; - -COMPILE_ASSERT(sizeof(FrontFace) == 8, - Sizeof_FrontFace_is_not_8); -COMPILE_ASSERT(offsetof(FrontFace, header) == 0, - OffsetOf_FrontFace_header_not_0); -COMPILE_ASSERT(offsetof(FrontFace, mode) == 4, - OffsetOf_FrontFace_mode_not_4); - -struct GenBuffers { - typedef GenBuffers ValueType; - static const CommandId kCmdId = kGenBuffers; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLsizei _n, uint32 _buffers_shm_id, uint32 _buffers_shm_offset) { - SetHeader(); - n = _n; - buffers_shm_id = _buffers_shm_id; - buffers_shm_offset = _buffers_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _buffers_shm_id, - uint32 _buffers_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _buffers_shm_id, _buffers_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 buffers_shm_id; - uint32 buffers_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GenBuffers) == 16, - Sizeof_GenBuffers_is_not_16); -COMPILE_ASSERT(offsetof(GenBuffers, header) == 0, - OffsetOf_GenBuffers_header_not_0); -COMPILE_ASSERT(offsetof(GenBuffers, n) == 4, - OffsetOf_GenBuffers_n_not_4); -COMPILE_ASSERT(offsetof(GenBuffers, buffers_shm_id) == 8, - OffsetOf_GenBuffers_buffers_shm_id_not_8); -COMPILE_ASSERT(offsetof(GenBuffers, buffers_shm_offset) == 12, - OffsetOf_GenBuffers_buffers_shm_offset_not_12); - -struct GenBuffersImmediate { - typedef GenBuffersImmediate ValueType; - static const CommandId kCmdId = kGenBuffersImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, GLuint* _buffers) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _buffers, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, GLuint* _buffers) { - static_cast<ValueType*>(cmd)->Init(_n, _buffers); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(GenBuffersImmediate) == 8, - Sizeof_GenBuffersImmediate_is_not_8); -COMPILE_ASSERT(offsetof(GenBuffersImmediate, header) == 0, - OffsetOf_GenBuffersImmediate_header_not_0); -COMPILE_ASSERT(offsetof(GenBuffersImmediate, n) == 4, - OffsetOf_GenBuffersImmediate_n_not_4); - -struct GenerateMipmap { - typedef GenerateMipmap ValueType; - static const CommandId kCmdId = kGenerateMipmap; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target) { - SetHeader(); - target = _target; - } - - void* Set(void* cmd, GLenum _target) { - static_cast<ValueType*>(cmd)->Init(_target); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; -}; - -COMPILE_ASSERT(sizeof(GenerateMipmap) == 8, - Sizeof_GenerateMipmap_is_not_8); -COMPILE_ASSERT(offsetof(GenerateMipmap, header) == 0, - OffsetOf_GenerateMipmap_header_not_0); -COMPILE_ASSERT(offsetof(GenerateMipmap, target) == 4, - OffsetOf_GenerateMipmap_target_not_4); - -struct GenFramebuffers { - typedef GenFramebuffers ValueType; - static const CommandId kCmdId = kGenFramebuffers; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLsizei _n, uint32 _framebuffers_shm_id, - uint32 _framebuffers_shm_offset) { - SetHeader(); - n = _n; - framebuffers_shm_id = _framebuffers_shm_id; - framebuffers_shm_offset = _framebuffers_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _framebuffers_shm_id, - uint32 _framebuffers_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _framebuffers_shm_id, _framebuffers_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 framebuffers_shm_id; - uint32 framebuffers_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GenFramebuffers) == 16, - Sizeof_GenFramebuffers_is_not_16); -COMPILE_ASSERT(offsetof(GenFramebuffers, header) == 0, - OffsetOf_GenFramebuffers_header_not_0); -COMPILE_ASSERT(offsetof(GenFramebuffers, n) == 4, - OffsetOf_GenFramebuffers_n_not_4); -COMPILE_ASSERT(offsetof(GenFramebuffers, framebuffers_shm_id) == 8, - OffsetOf_GenFramebuffers_framebuffers_shm_id_not_8); -COMPILE_ASSERT(offsetof(GenFramebuffers, framebuffers_shm_offset) == 12, - OffsetOf_GenFramebuffers_framebuffers_shm_offset_not_12); - -struct GenFramebuffersImmediate { - typedef GenFramebuffersImmediate ValueType; - static const CommandId kCmdId = kGenFramebuffersImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, GLuint* _framebuffers) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _framebuffers, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, GLuint* _framebuffers) { - static_cast<ValueType*>(cmd)->Init(_n, _framebuffers); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(GenFramebuffersImmediate) == 8, - Sizeof_GenFramebuffersImmediate_is_not_8); -COMPILE_ASSERT(offsetof(GenFramebuffersImmediate, header) == 0, - OffsetOf_GenFramebuffersImmediate_header_not_0); -COMPILE_ASSERT(offsetof(GenFramebuffersImmediate, n) == 4, - OffsetOf_GenFramebuffersImmediate_n_not_4); - -struct GenRenderbuffers { - typedef GenRenderbuffers ValueType; - static const CommandId kCmdId = kGenRenderbuffers; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLsizei _n, uint32 _renderbuffers_shm_id, - uint32 _renderbuffers_shm_offset) { - SetHeader(); - n = _n; - renderbuffers_shm_id = _renderbuffers_shm_id; - renderbuffers_shm_offset = _renderbuffers_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _renderbuffers_shm_id, - uint32 _renderbuffers_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _renderbuffers_shm_id, _renderbuffers_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 renderbuffers_shm_id; - uint32 renderbuffers_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GenRenderbuffers) == 16, - Sizeof_GenRenderbuffers_is_not_16); -COMPILE_ASSERT(offsetof(GenRenderbuffers, header) == 0, - OffsetOf_GenRenderbuffers_header_not_0); -COMPILE_ASSERT(offsetof(GenRenderbuffers, n) == 4, - OffsetOf_GenRenderbuffers_n_not_4); -COMPILE_ASSERT(offsetof(GenRenderbuffers, renderbuffers_shm_id) == 8, - OffsetOf_GenRenderbuffers_renderbuffers_shm_id_not_8); -COMPILE_ASSERT(offsetof(GenRenderbuffers, renderbuffers_shm_offset) == 12, - OffsetOf_GenRenderbuffers_renderbuffers_shm_offset_not_12); - -struct GenRenderbuffersImmediate { - typedef GenRenderbuffersImmediate ValueType; - static const CommandId kCmdId = kGenRenderbuffersImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, GLuint* _renderbuffers) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _renderbuffers, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, GLuint* _renderbuffers) { - static_cast<ValueType*>(cmd)->Init(_n, _renderbuffers); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(GenRenderbuffersImmediate) == 8, - Sizeof_GenRenderbuffersImmediate_is_not_8); -COMPILE_ASSERT(offsetof(GenRenderbuffersImmediate, header) == 0, - OffsetOf_GenRenderbuffersImmediate_header_not_0); -COMPILE_ASSERT(offsetof(GenRenderbuffersImmediate, n) == 4, - OffsetOf_GenRenderbuffersImmediate_n_not_4); - -struct GenTextures { - typedef GenTextures ValueType; - static const CommandId kCmdId = kGenTextures; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLsizei _n, uint32 _textures_shm_id, uint32 _textures_shm_offset) { - SetHeader(); - n = _n; - textures_shm_id = _textures_shm_id; - textures_shm_offset = _textures_shm_offset; - } - - void* Set( - void* cmd, GLsizei _n, uint32 _textures_shm_id, - uint32 _textures_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_n, _textures_shm_id, _textures_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 n; - uint32 textures_shm_id; - uint32 textures_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GenTextures) == 16, - Sizeof_GenTextures_is_not_16); -COMPILE_ASSERT(offsetof(GenTextures, header) == 0, - OffsetOf_GenTextures_header_not_0); -COMPILE_ASSERT(offsetof(GenTextures, n) == 4, - OffsetOf_GenTextures_n_not_4); -COMPILE_ASSERT(offsetof(GenTextures, textures_shm_id) == 8, - OffsetOf_GenTextures_textures_shm_id_not_8); -COMPILE_ASSERT(offsetof(GenTextures, textures_shm_offset) == 12, - OffsetOf_GenTextures_textures_shm_offset_not_12); - -struct GenTexturesImmediate { - typedef GenTexturesImmediate ValueType; - static const CommandId kCmdId = kGenTexturesImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei n) { - return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT - } - - static uint32 ComputeSize(GLsizei n) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(n)); // NOLINT - } - - void SetHeader(GLsizei n) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); - } - - void Init(GLsizei _n, GLuint* _textures) { - SetHeader(_n); - n = _n; - memcpy(ImmediateDataAddress(this), - _textures, ComputeDataSize(_n)); - } - - void* Set(void* cmd, GLsizei _n, GLuint* _textures) { - static_cast<ValueType*>(cmd)->Init(_n, _textures); - const uint32 size = ComputeSize(_n); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 n; -}; - -COMPILE_ASSERT(sizeof(GenTexturesImmediate) == 8, - Sizeof_GenTexturesImmediate_is_not_8); -COMPILE_ASSERT(offsetof(GenTexturesImmediate, header) == 0, - OffsetOf_GenTexturesImmediate_header_not_0); -COMPILE_ASSERT(offsetof(GenTexturesImmediate, n) == 4, - OffsetOf_GenTexturesImmediate_n_not_4); - -struct GetActiveAttrib { - typedef GetActiveAttrib ValueType; - static const CommandId kCmdId = kGetActiveAttrib; - 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, GLuint _index, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _size_shm_id, uint32 _size_shm_offset, - uint32 _type_shm_id, uint32 _type_shm_offset, uint32 _name_shm_id, - uint32 _name_shm_offset) { - SetHeader(); - program = _program; - index = _index; - bufsize = _bufsize; - length_shm_id = _length_shm_id; - length_shm_offset = _length_shm_offset; - size_shm_id = _size_shm_id; - size_shm_offset = _size_shm_offset; - type_shm_id = _type_shm_id; - type_shm_offset = _type_shm_offset; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLuint _index, GLsizei _bufsize, - uint32 _length_shm_id, uint32 _length_shm_offset, uint32 _size_shm_id, - uint32 _size_shm_offset, uint32 _type_shm_id, uint32 _type_shm_offset, - uint32 _name_shm_id, uint32 _name_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _program, _index, _bufsize, _length_shm_id, _length_shm_offset, - _size_shm_id, _size_shm_offset, _type_shm_id, _type_shm_offset, - _name_shm_id, _name_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 index; - uint32 bufsize; - uint32 length_shm_id; - uint32 length_shm_offset; - uint32 size_shm_id; - uint32 size_shm_offset; - uint32 type_shm_id; - uint32 type_shm_offset; - uint32 name_shm_id; - uint32 name_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetActiveAttrib) == 48, - Sizeof_GetActiveAttrib_is_not_48); -COMPILE_ASSERT(offsetof(GetActiveAttrib, header) == 0, - OffsetOf_GetActiveAttrib_header_not_0); -COMPILE_ASSERT(offsetof(GetActiveAttrib, program) == 4, - OffsetOf_GetActiveAttrib_program_not_4); -COMPILE_ASSERT(offsetof(GetActiveAttrib, index) == 8, - OffsetOf_GetActiveAttrib_index_not_8); -COMPILE_ASSERT(offsetof(GetActiveAttrib, bufsize) == 12, - OffsetOf_GetActiveAttrib_bufsize_not_12); -COMPILE_ASSERT(offsetof(GetActiveAttrib, length_shm_id) == 16, - OffsetOf_GetActiveAttrib_length_shm_id_not_16); -COMPILE_ASSERT(offsetof(GetActiveAttrib, length_shm_offset) == 20, - OffsetOf_GetActiveAttrib_length_shm_offset_not_20); -COMPILE_ASSERT(offsetof(GetActiveAttrib, size_shm_id) == 24, - OffsetOf_GetActiveAttrib_size_shm_id_not_24); -COMPILE_ASSERT(offsetof(GetActiveAttrib, size_shm_offset) == 28, - OffsetOf_GetActiveAttrib_size_shm_offset_not_28); -COMPILE_ASSERT(offsetof(GetActiveAttrib, type_shm_id) == 32, - OffsetOf_GetActiveAttrib_type_shm_id_not_32); -COMPILE_ASSERT(offsetof(GetActiveAttrib, type_shm_offset) == 36, - OffsetOf_GetActiveAttrib_type_shm_offset_not_36); -COMPILE_ASSERT(offsetof(GetActiveAttrib, name_shm_id) == 40, - OffsetOf_GetActiveAttrib_name_shm_id_not_40); -COMPILE_ASSERT(offsetof(GetActiveAttrib, name_shm_offset) == 44, - OffsetOf_GetActiveAttrib_name_shm_offset_not_44); - -struct GetActiveUniform { - typedef GetActiveUniform ValueType; - static const CommandId kCmdId = kGetActiveUniform; - 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, GLuint _index, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _size_shm_id, uint32 _size_shm_offset, - uint32 _type_shm_id, uint32 _type_shm_offset, uint32 _name_shm_id, - uint32 _name_shm_offset) { - SetHeader(); - program = _program; - index = _index; - bufsize = _bufsize; - length_shm_id = _length_shm_id; - length_shm_offset = _length_shm_offset; - size_shm_id = _size_shm_id; - size_shm_offset = _size_shm_offset; - type_shm_id = _type_shm_id; - type_shm_offset = _type_shm_offset; - name_shm_id = _name_shm_id; - name_shm_offset = _name_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLuint _index, GLsizei _bufsize, - uint32 _length_shm_id, uint32 _length_shm_offset, uint32 _size_shm_id, - uint32 _size_shm_offset, uint32 _type_shm_id, uint32 _type_shm_offset, - uint32 _name_shm_id, uint32 _name_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _program, _index, _bufsize, _length_shm_id, _length_shm_offset, - _size_shm_id, _size_shm_offset, _type_shm_id, _type_shm_offset, - _name_shm_id, _name_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 index; - uint32 bufsize; - uint32 length_shm_id; - uint32 length_shm_offset; - uint32 size_shm_id; - uint32 size_shm_offset; - uint32 type_shm_id; - uint32 type_shm_offset; - uint32 name_shm_id; - uint32 name_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetActiveUniform) == 48, - Sizeof_GetActiveUniform_is_not_48); -COMPILE_ASSERT(offsetof(GetActiveUniform, header) == 0, - OffsetOf_GetActiveUniform_header_not_0); -COMPILE_ASSERT(offsetof(GetActiveUniform, program) == 4, - OffsetOf_GetActiveUniform_program_not_4); -COMPILE_ASSERT(offsetof(GetActiveUniform, index) == 8, - OffsetOf_GetActiveUniform_index_not_8); -COMPILE_ASSERT(offsetof(GetActiveUniform, bufsize) == 12, - OffsetOf_GetActiveUniform_bufsize_not_12); -COMPILE_ASSERT(offsetof(GetActiveUniform, length_shm_id) == 16, - OffsetOf_GetActiveUniform_length_shm_id_not_16); -COMPILE_ASSERT(offsetof(GetActiveUniform, length_shm_offset) == 20, - OffsetOf_GetActiveUniform_length_shm_offset_not_20); -COMPILE_ASSERT(offsetof(GetActiveUniform, size_shm_id) == 24, - OffsetOf_GetActiveUniform_size_shm_id_not_24); -COMPILE_ASSERT(offsetof(GetActiveUniform, size_shm_offset) == 28, - OffsetOf_GetActiveUniform_size_shm_offset_not_28); -COMPILE_ASSERT(offsetof(GetActiveUniform, type_shm_id) == 32, - OffsetOf_GetActiveUniform_type_shm_id_not_32); -COMPILE_ASSERT(offsetof(GetActiveUniform, type_shm_offset) == 36, - OffsetOf_GetActiveUniform_type_shm_offset_not_36); -COMPILE_ASSERT(offsetof(GetActiveUniform, name_shm_id) == 40, - OffsetOf_GetActiveUniform_name_shm_id_not_40); -COMPILE_ASSERT(offsetof(GetActiveUniform, name_shm_offset) == 44, - OffsetOf_GetActiveUniform_name_shm_offset_not_44); - -struct GetAttachedShaders { - typedef GetAttachedShaders ValueType; - static const CommandId kCmdId = kGetAttachedShaders; - 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, GLsizei _maxcount, uint32 _count_shm_id, - uint32 _count_shm_offset, uint32 _shaders_shm_id, - uint32 _shaders_shm_offset) { - SetHeader(); - program = _program; - maxcount = _maxcount; - count_shm_id = _count_shm_id; - count_shm_offset = _count_shm_offset; - shaders_shm_id = _shaders_shm_id; - shaders_shm_offset = _shaders_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLsizei _maxcount, uint32 _count_shm_id, - uint32 _count_shm_offset, uint32 _shaders_shm_id, - uint32 _shaders_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _program, _maxcount, _count_shm_id, _count_shm_offset, - _shaders_shm_id, _shaders_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 maxcount; - uint32 count_shm_id; - uint32 count_shm_offset; - uint32 shaders_shm_id; - uint32 shaders_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetAttachedShaders) == 28, - Sizeof_GetAttachedShaders_is_not_28); -COMPILE_ASSERT(offsetof(GetAttachedShaders, header) == 0, - OffsetOf_GetAttachedShaders_header_not_0); -COMPILE_ASSERT(offsetof(GetAttachedShaders, program) == 4, - OffsetOf_GetAttachedShaders_program_not_4); -COMPILE_ASSERT(offsetof(GetAttachedShaders, maxcount) == 8, - OffsetOf_GetAttachedShaders_maxcount_not_8); -COMPILE_ASSERT(offsetof(GetAttachedShaders, count_shm_id) == 12, - OffsetOf_GetAttachedShaders_count_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetAttachedShaders, count_shm_offset) == 16, - OffsetOf_GetAttachedShaders_count_shm_offset_not_16); -COMPILE_ASSERT(offsetof(GetAttachedShaders, shaders_shm_id) == 20, - OffsetOf_GetAttachedShaders_shaders_shm_id_not_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; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _pname, uint32 _params_shm_id, uint32 _params_shm_offset) { - SetHeader(); - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetBooleanv) == 16, - Sizeof_GetBooleanv_is_not_16); -COMPILE_ASSERT(offsetof(GetBooleanv, header) == 0, - OffsetOf_GetBooleanv_header_not_0); -COMPILE_ASSERT(offsetof(GetBooleanv, pname) == 4, - OffsetOf_GetBooleanv_pname_not_4); -COMPILE_ASSERT(offsetof(GetBooleanv, params_shm_id) == 8, - OffsetOf_GetBooleanv_params_shm_id_not_8); -COMPILE_ASSERT(offsetof(GetBooleanv, params_shm_offset) == 12, - OffsetOf_GetBooleanv_params_shm_offset_not_12); - -struct GetBufferParameteriv { - typedef GetBufferParameteriv ValueType; - static const CommandId kCmdId = kGetBufferParameteriv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetBufferParameteriv) == 20, - Sizeof_GetBufferParameteriv_is_not_20); -COMPILE_ASSERT(offsetof(GetBufferParameteriv, header) == 0, - OffsetOf_GetBufferParameteriv_header_not_0); -COMPILE_ASSERT(offsetof(GetBufferParameteriv, target) == 4, - OffsetOf_GetBufferParameteriv_target_not_4); -COMPILE_ASSERT(offsetof(GetBufferParameteriv, pname) == 8, - OffsetOf_GetBufferParameteriv_pname_not_8); -COMPILE_ASSERT(offsetof(GetBufferParameteriv, params_shm_id) == 12, - OffsetOf_GetBufferParameteriv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetBufferParameteriv, params_shm_offset) == 16, - OffsetOf_GetBufferParameteriv_params_shm_offset_not_16); - -struct GetError { - typedef GetError ValueType; - static const CommandId kCmdId = kGetError; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set(void* cmd, uint32 _result_shm_id, uint32 _result_shm_offset) { - static_cast<ValueType*>(cmd)->Init(_result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetError) == 12, - Sizeof_GetError_is_not_12); -COMPILE_ASSERT(offsetof(GetError, header) == 0, - OffsetOf_GetError_header_not_0); -COMPILE_ASSERT(offsetof(GetError, result_shm_id) == 4, - OffsetOf_GetError_result_shm_id_not_4); -COMPILE_ASSERT(offsetof(GetError, result_shm_offset) == 8, - OffsetOf_GetError_result_shm_offset_not_8); - -struct GetFloatv { - typedef GetFloatv ValueType; - static const CommandId kCmdId = kGetFloatv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _pname, uint32 _params_shm_id, uint32 _params_shm_offset) { - SetHeader(); - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetFloatv) == 16, - Sizeof_GetFloatv_is_not_16); -COMPILE_ASSERT(offsetof(GetFloatv, header) == 0, - OffsetOf_GetFloatv_header_not_0); -COMPILE_ASSERT(offsetof(GetFloatv, pname) == 4, - OffsetOf_GetFloatv_pname_not_4); -COMPILE_ASSERT(offsetof(GetFloatv, params_shm_id) == 8, - OffsetOf_GetFloatv_params_shm_id_not_8); -COMPILE_ASSERT(offsetof(GetFloatv, params_shm_offset) == 12, - OffsetOf_GetFloatv_params_shm_offset_not_12); - -struct GetFramebufferAttachmentParameteriv { - typedef GetFramebufferAttachmentParameteriv ValueType; - static const CommandId kCmdId = kGetFramebufferAttachmentParameteriv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _attachment, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - attachment = _attachment; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _attachment, GLenum _pname, - uint32 _params_shm_id, uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _target, _attachment, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 attachment; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetFramebufferAttachmentParameteriv) == 24, - Sizeof_GetFramebufferAttachmentParameteriv_is_not_24); -COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, header) == 0, - OffsetOf_GetFramebufferAttachmentParameteriv_header_not_0); -COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, target) == 4, - OffsetOf_GetFramebufferAttachmentParameteriv_target_not_4); -COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, attachment) == 8, - OffsetOf_GetFramebufferAttachmentParameteriv_attachment_not_8); -COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, pname) == 12, - OffsetOf_GetFramebufferAttachmentParameteriv_pname_not_12); -COMPILE_ASSERT( - offsetof(GetFramebufferAttachmentParameteriv, params_shm_id) == 16, - OffsetOf_GetFramebufferAttachmentParameteriv_params_shm_id_not_16); -COMPILE_ASSERT( - offsetof(GetFramebufferAttachmentParameteriv, params_shm_offset) == 20, - OffsetOf_GetFramebufferAttachmentParameteriv_params_shm_offset_not_20); - -struct GetIntegerv { - typedef GetIntegerv ValueType; - static const CommandId kCmdId = kGetIntegerv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _pname, uint32 _params_shm_id, uint32 _params_shm_offset) { - SetHeader(); - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetIntegerv) == 16, - Sizeof_GetIntegerv_is_not_16); -COMPILE_ASSERT(offsetof(GetIntegerv, header) == 0, - OffsetOf_GetIntegerv_header_not_0); -COMPILE_ASSERT(offsetof(GetIntegerv, pname) == 4, - OffsetOf_GetIntegerv_pname_not_4); -COMPILE_ASSERT(offsetof(GetIntegerv, params_shm_id) == 8, - OffsetOf_GetIntegerv_params_shm_id_not_8); -COMPILE_ASSERT(offsetof(GetIntegerv, params_shm_offset) == 12, - OffsetOf_GetIntegerv_params_shm_offset_not_12); - -struct GetProgramiv { - typedef GetProgramiv ValueType; - static const CommandId kCmdId = kGetProgramiv; - 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, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - program = _program; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_program, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetProgramiv) == 20, - Sizeof_GetProgramiv_is_not_20); -COMPILE_ASSERT(offsetof(GetProgramiv, header) == 0, - OffsetOf_GetProgramiv_header_not_0); -COMPILE_ASSERT(offsetof(GetProgramiv, program) == 4, - OffsetOf_GetProgramiv_program_not_4); -COMPILE_ASSERT(offsetof(GetProgramiv, pname) == 8, - OffsetOf_GetProgramiv_pname_not_8); -COMPILE_ASSERT(offsetof(GetProgramiv, params_shm_id) == 12, - OffsetOf_GetProgramiv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetProgramiv, params_shm_offset) == 16, - OffsetOf_GetProgramiv_params_shm_offset_not_16); - -struct GetProgramInfoLog { - typedef GetProgramInfoLog ValueType; - static const CommandId kCmdId = kGetProgramInfoLog; - 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, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _infolog_shm_id, - uint32 _infolog_shm_offset) { - SetHeader(); - program = _program; - bufsize = _bufsize; - length_shm_id = _length_shm_id; - length_shm_offset = _length_shm_offset; - infolog_shm_id = _infolog_shm_id; - infolog_shm_offset = _infolog_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _infolog_shm_id, - uint32 _infolog_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _program, _bufsize, _length_shm_id, _length_shm_offset, - _infolog_shm_id, _infolog_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 bufsize; - uint32 length_shm_id; - uint32 length_shm_offset; - uint32 infolog_shm_id; - uint32 infolog_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetProgramInfoLog) == 28, - Sizeof_GetProgramInfoLog_is_not_28); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, header) == 0, - OffsetOf_GetProgramInfoLog_header_not_0); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, program) == 4, - OffsetOf_GetProgramInfoLog_program_not_4); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, bufsize) == 8, - OffsetOf_GetProgramInfoLog_bufsize_not_8); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, length_shm_id) == 12, - OffsetOf_GetProgramInfoLog_length_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, length_shm_offset) == 16, - OffsetOf_GetProgramInfoLog_length_shm_offset_not_16); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, infolog_shm_id) == 20, - OffsetOf_GetProgramInfoLog_infolog_shm_id_not_20); -COMPILE_ASSERT(offsetof(GetProgramInfoLog, infolog_shm_offset) == 24, - OffsetOf_GetProgramInfoLog_infolog_shm_offset_not_24); - -struct GetRenderbufferParameteriv { - typedef GetRenderbufferParameteriv ValueType; - static const CommandId kCmdId = kGetRenderbufferParameteriv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetRenderbufferParameteriv) == 20, - Sizeof_GetRenderbufferParameteriv_is_not_20); -COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, header) == 0, - OffsetOf_GetRenderbufferParameteriv_header_not_0); -COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, target) == 4, - OffsetOf_GetRenderbufferParameteriv_target_not_4); -COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, pname) == 8, - OffsetOf_GetRenderbufferParameteriv_pname_not_8); -COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, params_shm_id) == 12, - OffsetOf_GetRenderbufferParameteriv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, params_shm_offset) == 16, - OffsetOf_GetRenderbufferParameteriv_params_shm_offset_not_16); - -struct GetShaderiv { - typedef GetShaderiv ValueType; - static const CommandId kCmdId = kGetShaderiv; - 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 _shader, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - shader = _shader; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLuint _shader, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_shader, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetShaderiv) == 20, - Sizeof_GetShaderiv_is_not_20); -COMPILE_ASSERT(offsetof(GetShaderiv, header) == 0, - OffsetOf_GetShaderiv_header_not_0); -COMPILE_ASSERT(offsetof(GetShaderiv, shader) == 4, - OffsetOf_GetShaderiv_shader_not_4); -COMPILE_ASSERT(offsetof(GetShaderiv, pname) == 8, - OffsetOf_GetShaderiv_pname_not_8); -COMPILE_ASSERT(offsetof(GetShaderiv, params_shm_id) == 12, - OffsetOf_GetShaderiv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetShaderiv, params_shm_offset) == 16, - OffsetOf_GetShaderiv_params_shm_offset_not_16); - -struct GetShaderInfoLog { - typedef GetShaderInfoLog ValueType; - static const CommandId kCmdId = kGetShaderInfoLog; - 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 _shader, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _infolog_shm_id, - uint32 _infolog_shm_offset) { - SetHeader(); - shader = _shader; - bufsize = _bufsize; - length_shm_id = _length_shm_id; - length_shm_offset = _length_shm_offset; - infolog_shm_id = _infolog_shm_id; - infolog_shm_offset = _infolog_shm_offset; - } - - void* Set( - void* cmd, GLuint _shader, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _infolog_shm_id, - uint32 _infolog_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _shader, _bufsize, _length_shm_id, _length_shm_offset, - _infolog_shm_id, _infolog_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; - uint32 bufsize; - uint32 length_shm_id; - uint32 length_shm_offset; - uint32 infolog_shm_id; - uint32 infolog_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetShaderInfoLog) == 28, - Sizeof_GetShaderInfoLog_is_not_28); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, header) == 0, - OffsetOf_GetShaderInfoLog_header_not_0); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, shader) == 4, - OffsetOf_GetShaderInfoLog_shader_not_4); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, bufsize) == 8, - OffsetOf_GetShaderInfoLog_bufsize_not_8); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, length_shm_id) == 12, - OffsetOf_GetShaderInfoLog_length_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, length_shm_offset) == 16, - OffsetOf_GetShaderInfoLog_length_shm_offset_not_16); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, infolog_shm_id) == 20, - OffsetOf_GetShaderInfoLog_infolog_shm_id_not_20); -COMPILE_ASSERT(offsetof(GetShaderInfoLog, infolog_shm_offset) == 24, - OffsetOf_GetShaderInfoLog_infolog_shm_offset_not_24); - -struct GetShaderPrecisionFormat { - typedef GetShaderPrecisionFormat ValueType; - static const CommandId kCmdId = kGetShaderPrecisionFormat; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _shadertype, GLenum _precisiontype, uint32 _range_shm_id, - uint32 _range_shm_offset, uint32 _precision_shm_id, - uint32 _precision_shm_offset) { - SetHeader(); - shadertype = _shadertype; - precisiontype = _precisiontype; - range_shm_id = _range_shm_id; - range_shm_offset = _range_shm_offset; - precision_shm_id = _precision_shm_id; - precision_shm_offset = _precision_shm_offset; - } - - void* Set( - void* cmd, GLenum _shadertype, GLenum _precisiontype, - uint32 _range_shm_id, uint32 _range_shm_offset, uint32 _precision_shm_id, - uint32 _precision_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _shadertype, _precisiontype, _range_shm_id, _range_shm_offset, - _precision_shm_id, _precision_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shadertype; - uint32 precisiontype; - uint32 range_shm_id; - uint32 range_shm_offset; - uint32 precision_shm_id; - uint32 precision_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetShaderPrecisionFormat) == 28, - Sizeof_GetShaderPrecisionFormat_is_not_28); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, header) == 0, - OffsetOf_GetShaderPrecisionFormat_header_not_0); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, shadertype) == 4, - OffsetOf_GetShaderPrecisionFormat_shadertype_not_4); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, precisiontype) == 8, - OffsetOf_GetShaderPrecisionFormat_precisiontype_not_8); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, range_shm_id) == 12, - OffsetOf_GetShaderPrecisionFormat_range_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, range_shm_offset) == 16, - OffsetOf_GetShaderPrecisionFormat_range_shm_offset_not_16); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, precision_shm_id) == 20, - OffsetOf_GetShaderPrecisionFormat_precision_shm_id_not_20); -COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, precision_shm_offset) == 24, - OffsetOf_GetShaderPrecisionFormat_precision_shm_offset_not_24); - -struct GetShaderSource { - typedef GetShaderSource ValueType; - static const CommandId kCmdId = kGetShaderSource; - 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 _shader, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _source_shm_id, - uint32 _source_shm_offset) { - SetHeader(); - shader = _shader; - bufsize = _bufsize; - length_shm_id = _length_shm_id; - length_shm_offset = _length_shm_offset; - source_shm_id = _source_shm_id; - source_shm_offset = _source_shm_offset; - } - - void* Set( - void* cmd, GLuint _shader, GLsizei _bufsize, uint32 _length_shm_id, - uint32 _length_shm_offset, uint32 _source_shm_id, - uint32 _source_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _shader, _bufsize, _length_shm_id, _length_shm_offset, - _source_shm_id, _source_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; - uint32 bufsize; - uint32 length_shm_id; - uint32 length_shm_offset; - uint32 source_shm_id; - uint32 source_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetShaderSource) == 28, - Sizeof_GetShaderSource_is_not_28); -COMPILE_ASSERT(offsetof(GetShaderSource, header) == 0, - OffsetOf_GetShaderSource_header_not_0); -COMPILE_ASSERT(offsetof(GetShaderSource, shader) == 4, - OffsetOf_GetShaderSource_shader_not_4); -COMPILE_ASSERT(offsetof(GetShaderSource, bufsize) == 8, - OffsetOf_GetShaderSource_bufsize_not_8); -COMPILE_ASSERT(offsetof(GetShaderSource, length_shm_id) == 12, - OffsetOf_GetShaderSource_length_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetShaderSource, length_shm_offset) == 16, - OffsetOf_GetShaderSource_length_shm_offset_not_16); -COMPILE_ASSERT(offsetof(GetShaderSource, source_shm_id) == 20, - OffsetOf_GetShaderSource_source_shm_id_not_20); -COMPILE_ASSERT(offsetof(GetShaderSource, source_shm_offset) == 24, - OffsetOf_GetShaderSource_source_shm_offset_not_24); - -struct GetString { - typedef GetString ValueType; - static const CommandId kCmdId = kGetString; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _name) { - SetHeader(); - name = _name; - } - - void* Set(void* cmd, GLenum _name) { - static_cast<ValueType*>(cmd)->Init(_name); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 name; -}; - -COMPILE_ASSERT(sizeof(GetString) == 8, - Sizeof_GetString_is_not_8); -COMPILE_ASSERT(offsetof(GetString, header) == 0, - OffsetOf_GetString_header_not_0); -COMPILE_ASSERT(offsetof(GetString, name) == 4, - OffsetOf_GetString_name_not_4); - -struct GetTexParameterfv { - typedef GetTexParameterfv ValueType; - static const CommandId kCmdId = kGetTexParameterfv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetTexParameterfv) == 20, - Sizeof_GetTexParameterfv_is_not_20); -COMPILE_ASSERT(offsetof(GetTexParameterfv, header) == 0, - OffsetOf_GetTexParameterfv_header_not_0); -COMPILE_ASSERT(offsetof(GetTexParameterfv, target) == 4, - OffsetOf_GetTexParameterfv_target_not_4); -COMPILE_ASSERT(offsetof(GetTexParameterfv, pname) == 8, - OffsetOf_GetTexParameterfv_pname_not_8); -COMPILE_ASSERT(offsetof(GetTexParameterfv, params_shm_id) == 12, - OffsetOf_GetTexParameterfv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetTexParameterfv, params_shm_offset) == 16, - OffsetOf_GetTexParameterfv_params_shm_offset_not_16); - -struct GetTexParameteriv { - typedef GetTexParameteriv ValueType; - static const CommandId kCmdId = kGetTexParameteriv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetTexParameteriv) == 20, - Sizeof_GetTexParameteriv_is_not_20); -COMPILE_ASSERT(offsetof(GetTexParameteriv, header) == 0, - OffsetOf_GetTexParameteriv_header_not_0); -COMPILE_ASSERT(offsetof(GetTexParameteriv, target) == 4, - OffsetOf_GetTexParameteriv_target_not_4); -COMPILE_ASSERT(offsetof(GetTexParameteriv, pname) == 8, - OffsetOf_GetTexParameteriv_pname_not_8); -COMPILE_ASSERT(offsetof(GetTexParameteriv, params_shm_id) == 12, - OffsetOf_GetTexParameteriv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetTexParameteriv, params_shm_offset) == 16, - OffsetOf_GetTexParameteriv_params_shm_offset_not_16); - -struct GetUniformfv { - typedef GetUniformfv ValueType; - static const CommandId kCmdId = kGetUniformfv; - 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, GLint _location, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - program = _program; - location = _location; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLint _location, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_program, _location, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 location; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetUniformfv) == 20, - Sizeof_GetUniformfv_is_not_20); -COMPILE_ASSERT(offsetof(GetUniformfv, header) == 0, - OffsetOf_GetUniformfv_header_not_0); -COMPILE_ASSERT(offsetof(GetUniformfv, program) == 4, - OffsetOf_GetUniformfv_program_not_4); -COMPILE_ASSERT(offsetof(GetUniformfv, location) == 8, - OffsetOf_GetUniformfv_location_not_8); -COMPILE_ASSERT(offsetof(GetUniformfv, params_shm_id) == 12, - OffsetOf_GetUniformfv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetUniformfv, params_shm_offset) == 16, - OffsetOf_GetUniformfv_params_shm_offset_not_16); - -struct GetUniformiv { - typedef GetUniformiv ValueType; - static const CommandId kCmdId = kGetUniformiv; - 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, GLint _location, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - program = _program; - location = _location; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, GLint _location, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_program, _location, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 location; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetUniformiv) == 20, - Sizeof_GetUniformiv_is_not_20); -COMPILE_ASSERT(offsetof(GetUniformiv, header) == 0, - OffsetOf_GetUniformiv_header_not_0); -COMPILE_ASSERT(offsetof(GetUniformiv, program) == 4, - OffsetOf_GetUniformiv_program_not_4); -COMPILE_ASSERT(offsetof(GetUniformiv, location) == 8, - OffsetOf_GetUniformiv_location_not_8); -COMPILE_ASSERT(offsetof(GetUniformiv, params_shm_id) == 12, - OffsetOf_GetUniformiv_params_shm_id_not_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; - 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 _index, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - index = _index; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLuint _index, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_index, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 index; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetVertexAttribfv) == 20, - Sizeof_GetVertexAttribfv_is_not_20); -COMPILE_ASSERT(offsetof(GetVertexAttribfv, header) == 0, - OffsetOf_GetVertexAttribfv_header_not_0); -COMPILE_ASSERT(offsetof(GetVertexAttribfv, index) == 4, - OffsetOf_GetVertexAttribfv_index_not_4); -COMPILE_ASSERT(offsetof(GetVertexAttribfv, pname) == 8, - OffsetOf_GetVertexAttribfv_pname_not_8); -COMPILE_ASSERT(offsetof(GetVertexAttribfv, params_shm_id) == 12, - OffsetOf_GetVertexAttribfv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetVertexAttribfv, params_shm_offset) == 16, - OffsetOf_GetVertexAttribfv_params_shm_offset_not_16); - -struct GetVertexAttribiv { - typedef GetVertexAttribiv ValueType; - static const CommandId kCmdId = kGetVertexAttribiv; - 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 _index, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - index = _index; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLuint _index, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_index, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 index; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetVertexAttribiv) == 20, - Sizeof_GetVertexAttribiv_is_not_20); -COMPILE_ASSERT(offsetof(GetVertexAttribiv, header) == 0, - OffsetOf_GetVertexAttribiv_header_not_0); -COMPILE_ASSERT(offsetof(GetVertexAttribiv, index) == 4, - OffsetOf_GetVertexAttribiv_index_not_4); -COMPILE_ASSERT(offsetof(GetVertexAttribiv, pname) == 8, - OffsetOf_GetVertexAttribiv_pname_not_8); -COMPILE_ASSERT(offsetof(GetVertexAttribiv, params_shm_id) == 12, - OffsetOf_GetVertexAttribiv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetVertexAttribiv, params_shm_offset) == 16, - OffsetOf_GetVertexAttribiv_params_shm_offset_not_16); - -struct GetVertexAttribPointerv { - typedef GetVertexAttribPointerv ValueType; - static const CommandId kCmdId = kGetVertexAttribPointerv; - 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 _index, GLenum _pname, uint32 _pointer_shm_id, - uint32 _pointer_shm_offset) { - SetHeader(); - index = _index; - pname = _pname; - pointer_shm_id = _pointer_shm_id; - pointer_shm_offset = _pointer_shm_offset; - } - - void* Set( - void* cmd, GLuint _index, GLenum _pname, uint32 _pointer_shm_id, - uint32 _pointer_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_index, _pname, _pointer_shm_id, _pointer_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 index; - uint32 pname; - uint32 pointer_shm_id; - uint32 pointer_shm_offset; -}; - -COMPILE_ASSERT(sizeof(GetVertexAttribPointerv) == 20, - Sizeof_GetVertexAttribPointerv_is_not_20); -COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, header) == 0, - OffsetOf_GetVertexAttribPointerv_header_not_0); -COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, index) == 4, - OffsetOf_GetVertexAttribPointerv_index_not_4); -COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, pname) == 8, - OffsetOf_GetVertexAttribPointerv_pname_not_8); -COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, pointer_shm_id) == 12, - OffsetOf_GetVertexAttribPointerv_pointer_shm_id_not_12); -COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, pointer_shm_offset) == 16, - OffsetOf_GetVertexAttribPointerv_pointer_shm_offset_not_16); - -struct Hint { - typedef Hint ValueType; - static const CommandId kCmdId = kHint; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLenum _mode) { - SetHeader(); - target = _target; - mode = _mode; - } - - void* Set(void* cmd, GLenum _target, GLenum _mode) { - static_cast<ValueType*>(cmd)->Init(_target, _mode); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 mode; -}; - -COMPILE_ASSERT(sizeof(Hint) == 12, - Sizeof_Hint_is_not_12); -COMPILE_ASSERT(offsetof(Hint, header) == 0, - OffsetOf_Hint_header_not_0); -COMPILE_ASSERT(offsetof(Hint, target) == 4, - OffsetOf_Hint_target_not_4); -COMPILE_ASSERT(offsetof(Hint, mode) == 8, - OffsetOf_Hint_mode_not_8); - -struct IsBuffer { - typedef IsBuffer ValueType; - static const CommandId kCmdId = kIsBuffer; - 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 _buffer, uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - buffer = _buffer; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLuint _buffer, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_buffer, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 buffer; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsBuffer) == 16, - Sizeof_IsBuffer_is_not_16); -COMPILE_ASSERT(offsetof(IsBuffer, header) == 0, - OffsetOf_IsBuffer_header_not_0); -COMPILE_ASSERT(offsetof(IsBuffer, buffer) == 4, - OffsetOf_IsBuffer_buffer_not_4); -COMPILE_ASSERT(offsetof(IsBuffer, result_shm_id) == 8, - OffsetOf_IsBuffer_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsBuffer, result_shm_offset) == 12, - OffsetOf_IsBuffer_result_shm_offset_not_12); - -struct IsEnabled { - typedef IsEnabled ValueType; - static const CommandId kCmdId = kIsEnabled; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _cap, uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - cap = _cap; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLenum _cap, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_cap, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 cap; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsEnabled) == 16, - Sizeof_IsEnabled_is_not_16); -COMPILE_ASSERT(offsetof(IsEnabled, header) == 0, - OffsetOf_IsEnabled_header_not_0); -COMPILE_ASSERT(offsetof(IsEnabled, cap) == 4, - OffsetOf_IsEnabled_cap_not_4); -COMPILE_ASSERT(offsetof(IsEnabled, result_shm_id) == 8, - OffsetOf_IsEnabled_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsEnabled, result_shm_offset) == 12, - OffsetOf_IsEnabled_result_shm_offset_not_12); - -struct IsFramebuffer { - typedef IsFramebuffer ValueType; - static const CommandId kCmdId = kIsFramebuffer; - 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 _framebuffer, uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - framebuffer = _framebuffer; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLuint _framebuffer, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_framebuffer, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 framebuffer; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsFramebuffer) == 16, - Sizeof_IsFramebuffer_is_not_16); -COMPILE_ASSERT(offsetof(IsFramebuffer, header) == 0, - OffsetOf_IsFramebuffer_header_not_0); -COMPILE_ASSERT(offsetof(IsFramebuffer, framebuffer) == 4, - OffsetOf_IsFramebuffer_framebuffer_not_4); -COMPILE_ASSERT(offsetof(IsFramebuffer, result_shm_id) == 8, - OffsetOf_IsFramebuffer_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsFramebuffer, result_shm_offset) == 12, - OffsetOf_IsFramebuffer_result_shm_offset_not_12); - -struct IsProgram { - typedef IsProgram ValueType; - static const CommandId kCmdId = kIsProgram; - 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 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - program = _program; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLuint _program, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_program, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsProgram) == 16, - Sizeof_IsProgram_is_not_16); -COMPILE_ASSERT(offsetof(IsProgram, header) == 0, - OffsetOf_IsProgram_header_not_0); -COMPILE_ASSERT(offsetof(IsProgram, program) == 4, - OffsetOf_IsProgram_program_not_4); -COMPILE_ASSERT(offsetof(IsProgram, result_shm_id) == 8, - OffsetOf_IsProgram_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsProgram, result_shm_offset) == 12, - OffsetOf_IsProgram_result_shm_offset_not_12); - -struct IsRenderbuffer { - typedef IsRenderbuffer ValueType; - static const CommandId kCmdId = kIsRenderbuffer; - 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 _renderbuffer, uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - renderbuffer = _renderbuffer; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLuint _renderbuffer, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_renderbuffer, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 renderbuffer; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsRenderbuffer) == 16, - Sizeof_IsRenderbuffer_is_not_16); -COMPILE_ASSERT(offsetof(IsRenderbuffer, header) == 0, - OffsetOf_IsRenderbuffer_header_not_0); -COMPILE_ASSERT(offsetof(IsRenderbuffer, renderbuffer) == 4, - OffsetOf_IsRenderbuffer_renderbuffer_not_4); -COMPILE_ASSERT(offsetof(IsRenderbuffer, result_shm_id) == 8, - OffsetOf_IsRenderbuffer_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsRenderbuffer, result_shm_offset) == 12, - OffsetOf_IsRenderbuffer_result_shm_offset_not_12); - -struct IsShader { - typedef IsShader ValueType; - static const CommandId kCmdId = kIsShader; - 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 _shader, uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - shader = _shader; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLuint _shader, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_shader, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsShader) == 16, - Sizeof_IsShader_is_not_16); -COMPILE_ASSERT(offsetof(IsShader, header) == 0, - OffsetOf_IsShader_header_not_0); -COMPILE_ASSERT(offsetof(IsShader, shader) == 4, - OffsetOf_IsShader_shader_not_4); -COMPILE_ASSERT(offsetof(IsShader, result_shm_id) == 8, - OffsetOf_IsShader_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsShader, result_shm_offset) == 12, - OffsetOf_IsShader_result_shm_offset_not_12); - -struct IsTexture { - typedef IsTexture ValueType; - static const CommandId kCmdId = kIsTexture; - 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 _texture, uint32 _result_shm_id, uint32 _result_shm_offset) { - SetHeader(); - texture = _texture; - result_shm_id = _result_shm_id; - result_shm_offset = _result_shm_offset; - } - - void* Set( - void* cmd, GLuint _texture, uint32 _result_shm_id, - uint32 _result_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_texture, _result_shm_id, _result_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 texture; - uint32 result_shm_id; - uint32 result_shm_offset; -}; - -COMPILE_ASSERT(sizeof(IsTexture) == 16, - Sizeof_IsTexture_is_not_16); -COMPILE_ASSERT(offsetof(IsTexture, header) == 0, - OffsetOf_IsTexture_header_not_0); -COMPILE_ASSERT(offsetof(IsTexture, texture) == 4, - OffsetOf_IsTexture_texture_not_4); -COMPILE_ASSERT(offsetof(IsTexture, result_shm_id) == 8, - OffsetOf_IsTexture_result_shm_id_not_8); -COMPILE_ASSERT(offsetof(IsTexture, result_shm_offset) == 12, - OffsetOf_IsTexture_result_shm_offset_not_12); - -struct LineWidth { - typedef LineWidth ValueType; - static const CommandId kCmdId = kLineWidth; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLfloat _width) { - SetHeader(); - width = _width; - } - - void* Set(void* cmd, GLfloat _width) { - static_cast<ValueType*>(cmd)->Init(_width); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float width; -}; - -COMPILE_ASSERT(sizeof(LineWidth) == 8, - Sizeof_LineWidth_is_not_8); -COMPILE_ASSERT(offsetof(LineWidth, header) == 0, - OffsetOf_LineWidth_header_not_0); -COMPILE_ASSERT(offsetof(LineWidth, width) == 4, - OffsetOf_LineWidth_width_not_4); - -struct LinkProgram { - typedef LinkProgram ValueType; - static const CommandId kCmdId = kLinkProgram; - 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) { - SetHeader(); - program = _program; - } - - void* Set(void* cmd, GLuint _program) { - static_cast<ValueType*>(cmd)->Init(_program); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; -}; - -COMPILE_ASSERT(sizeof(LinkProgram) == 8, - Sizeof_LinkProgram_is_not_8); -COMPILE_ASSERT(offsetof(LinkProgram, header) == 0, - OffsetOf_LinkProgram_header_not_0); -COMPILE_ASSERT(offsetof(LinkProgram, program) == 4, - OffsetOf_LinkProgram_program_not_4); - -struct PixelStorei { - typedef PixelStorei ValueType; - static const CommandId kCmdId = kPixelStorei; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _pname, GLint _param) { - SetHeader(); - pname = _pname; - param = _param; - } - - void* Set(void* cmd, GLenum _pname, GLint _param) { - static_cast<ValueType*>(cmd)->Init(_pname, _param); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 pname; - uint32 param; -}; - -COMPILE_ASSERT(sizeof(PixelStorei) == 12, - Sizeof_PixelStorei_is_not_12); -COMPILE_ASSERT(offsetof(PixelStorei, header) == 0, - OffsetOf_PixelStorei_header_not_0); -COMPILE_ASSERT(offsetof(PixelStorei, pname) == 4, - OffsetOf_PixelStorei_pname_not_4); -COMPILE_ASSERT(offsetof(PixelStorei, param) == 8, - OffsetOf_PixelStorei_param_not_8); - -struct PolygonOffset { - typedef PolygonOffset ValueType; - static const CommandId kCmdId = kPolygonOffset; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLfloat _factor, GLfloat _units) { - SetHeader(); - factor = _factor; - units = _units; - } - - void* Set(void* cmd, GLfloat _factor, GLfloat _units) { - static_cast<ValueType*>(cmd)->Init(_factor, _units); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float factor; - float units; -}; - -COMPILE_ASSERT(sizeof(PolygonOffset) == 12, - Sizeof_PolygonOffset_is_not_12); -COMPILE_ASSERT(offsetof(PolygonOffset, header) == 0, - OffsetOf_PolygonOffset_header_not_0); -COMPILE_ASSERT(offsetof(PolygonOffset, factor) == 4, - OffsetOf_PolygonOffset_factor_not_4); -COMPILE_ASSERT(offsetof(PolygonOffset, units) == 8, - OffsetOf_PolygonOffset_units_not_8); - -struct ReadPixels { - typedef ReadPixels ValueType; - static const CommandId kCmdId = kReadPixels; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _x, GLint _y, GLsizei _width, GLsizei _height, GLenum _format, - GLenum _type, uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { - SetHeader(); - x = _x; - y = _y; - width = _width; - height = _height; - format = _format; - type = _type; - pixels_shm_id = _pixels_shm_id; - pixels_shm_offset = _pixels_shm_offset; - } - - void* Set( - void* cmd, GLint _x, GLint _y, GLsizei _width, GLsizei _height, - GLenum _format, GLenum _type, uint32 _pixels_shm_id, - uint32 _pixels_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _x, _y, _width, _height, _format, _type, _pixels_shm_id, - _pixels_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 x; - uint32 y; - uint32 width; - uint32 height; - uint32 format; - uint32 type; - uint32 pixels_shm_id; - uint32 pixels_shm_offset; -}; - -COMPILE_ASSERT(sizeof(ReadPixels) == 36, - Sizeof_ReadPixels_is_not_36); -COMPILE_ASSERT(offsetof(ReadPixels, header) == 0, - OffsetOf_ReadPixels_header_not_0); -COMPILE_ASSERT(offsetof(ReadPixels, x) == 4, - OffsetOf_ReadPixels_x_not_4); -COMPILE_ASSERT(offsetof(ReadPixels, y) == 8, - OffsetOf_ReadPixels_y_not_8); -COMPILE_ASSERT(offsetof(ReadPixels, width) == 12, - OffsetOf_ReadPixels_width_not_12); -COMPILE_ASSERT(offsetof(ReadPixels, height) == 16, - OffsetOf_ReadPixels_height_not_16); -COMPILE_ASSERT(offsetof(ReadPixels, format) == 20, - OffsetOf_ReadPixels_format_not_20); -COMPILE_ASSERT(offsetof(ReadPixels, type) == 24, - OffsetOf_ReadPixels_type_not_24); -COMPILE_ASSERT(offsetof(ReadPixels, pixels_shm_id) == 28, - OffsetOf_ReadPixels_pixels_shm_id_not_28); -COMPILE_ASSERT(offsetof(ReadPixels, pixels_shm_offset) == 32, - OffsetOf_ReadPixels_pixels_shm_offset_not_32); - -struct RenderbufferStorage { - typedef RenderbufferStorage ValueType; - static const CommandId kCmdId = kRenderbufferStorage; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _internalformat, GLsizei _width, - GLsizei _height) { - SetHeader(); - target = _target; - internalformat = _internalformat; - width = _width; - height = _height; - } - - void* Set( - void* cmd, GLenum _target, GLenum _internalformat, GLsizei _width, - GLsizei _height) { - static_cast<ValueType*>( - cmd)->Init(_target, _internalformat, _width, _height); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 internalformat; - uint32 width; - uint32 height; -}; - -COMPILE_ASSERT(sizeof(RenderbufferStorage) == 20, - Sizeof_RenderbufferStorage_is_not_20); -COMPILE_ASSERT(offsetof(RenderbufferStorage, header) == 0, - OffsetOf_RenderbufferStorage_header_not_0); -COMPILE_ASSERT(offsetof(RenderbufferStorage, target) == 4, - OffsetOf_RenderbufferStorage_target_not_4); -COMPILE_ASSERT(offsetof(RenderbufferStorage, internalformat) == 8, - OffsetOf_RenderbufferStorage_internalformat_not_8); -COMPILE_ASSERT(offsetof(RenderbufferStorage, width) == 12, - OffsetOf_RenderbufferStorage_width_not_12); -COMPILE_ASSERT(offsetof(RenderbufferStorage, height) == 16, - OffsetOf_RenderbufferStorage_height_not_16); - -struct SampleCoverage { - typedef SampleCoverage ValueType; - static const CommandId kCmdId = kSampleCoverage; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLclampf _value, GLboolean _invert) { - SetHeader(); - value = _value; - invert = _invert; - } - - void* Set(void* cmd, GLclampf _value, GLboolean _invert) { - static_cast<ValueType*>(cmd)->Init(_value, _invert); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - float value; - uint32 invert; -}; - -COMPILE_ASSERT(sizeof(SampleCoverage) == 12, - Sizeof_SampleCoverage_is_not_12); -COMPILE_ASSERT(offsetof(SampleCoverage, header) == 0, - OffsetOf_SampleCoverage_header_not_0); -COMPILE_ASSERT(offsetof(SampleCoverage, value) == 4, - OffsetOf_SampleCoverage_value_not_4); -COMPILE_ASSERT(offsetof(SampleCoverage, invert) == 8, - OffsetOf_SampleCoverage_invert_not_8); - -struct Scissor { - typedef Scissor ValueType; - static const CommandId kCmdId = kScissor; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _x, GLint _y, GLsizei _width, GLsizei _height) { - SetHeader(); - x = _x; - y = _y; - width = _width; - height = _height; - } - - void* Set(void* cmd, GLint _x, GLint _y, GLsizei _width, GLsizei _height) { - static_cast<ValueType*>(cmd)->Init(_x, _y, _width, _height); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 x; - uint32 y; - uint32 width; - uint32 height; -}; - -COMPILE_ASSERT(sizeof(Scissor) == 20, - Sizeof_Scissor_is_not_20); -COMPILE_ASSERT(offsetof(Scissor, header) == 0, - OffsetOf_Scissor_header_not_0); -COMPILE_ASSERT(offsetof(Scissor, x) == 4, - OffsetOf_Scissor_x_not_4); -COMPILE_ASSERT(offsetof(Scissor, y) == 8, - OffsetOf_Scissor_y_not_8); -COMPILE_ASSERT(offsetof(Scissor, width) == 12, - OffsetOf_Scissor_width_not_12); -COMPILE_ASSERT(offsetof(Scissor, height) == 16, - OffsetOf_Scissor_height_not_16); - -struct ShaderSource { - typedef ShaderSource ValueType; - static const CommandId kCmdId = kShaderSource; - 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 _shader, GLsizei _count, uint32 _data_shm_id, - uint32 _data_shm_offset, uint32 _data_size) { - SetHeader(); - shader = _shader; - count = _count; - data_shm_id = _data_shm_id; - data_shm_offset = _data_shm_offset; - data_size = _data_size; - } - - void* Set( - void* cmd, GLuint _shader, GLsizei _count, uint32 _data_shm_id, - uint32 _data_shm_offset, uint32 _data_size) { - static_cast<ValueType*>( - cmd)->Init( - _shader, _count, _data_shm_id, _data_shm_offset, _data_size); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 shader; - uint32 count; - uint32 data_shm_id; - uint32 data_shm_offset; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(ShaderSource) == 24, - Sizeof_ShaderSource_is_not_24); -COMPILE_ASSERT(offsetof(ShaderSource, header) == 0, - OffsetOf_ShaderSource_header_not_0); -COMPILE_ASSERT(offsetof(ShaderSource, shader) == 4, - OffsetOf_ShaderSource_shader_not_4); -COMPILE_ASSERT(offsetof(ShaderSource, count) == 8, - OffsetOf_ShaderSource_count_not_8); -COMPILE_ASSERT(offsetof(ShaderSource, data_shm_id) == 12, - OffsetOf_ShaderSource_data_shm_id_not_12); -COMPILE_ASSERT(offsetof(ShaderSource, data_shm_offset) == 16, - OffsetOf_ShaderSource_data_shm_offset_not_16); -COMPILE_ASSERT(offsetof(ShaderSource, data_size) == 20, - OffsetOf_ShaderSource_data_size_not_20); - -struct ShaderSourceImmediate { - typedef ShaderSourceImmediate ValueType; - static const CommandId kCmdId = kShaderSourceImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - void Init(GLuint _shader, GLsizei _count, uint32 _data_size) { - uint32 total_size = ComputeSize(_data_size); - SetHeader(total_size); - shader = _shader; - count = _count; - data_size = _data_size; - } - - void* Set(void* cmd, GLuint _shader, GLsizei _count, uint32 _data_size) { - uint32 total_size = ComputeSize(_data_size); - static_cast<ValueType*>(cmd)->Init(_shader, _count, _data_size); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 shader; - uint32 count; - uint32 data_size; -}; - -COMPILE_ASSERT(sizeof(ShaderSourceImmediate) == 16, - Sizeof_ShaderSourceImmediate_is_not_16); -COMPILE_ASSERT(offsetof(ShaderSourceImmediate, header) == 0, - OffsetOf_ShaderSourceImmediate_header_not_0); -COMPILE_ASSERT(offsetof(ShaderSourceImmediate, shader) == 4, - OffsetOf_ShaderSourceImmediate_shader_not_4); -COMPILE_ASSERT(offsetof(ShaderSourceImmediate, count) == 8, - OffsetOf_ShaderSourceImmediate_count_not_8); -COMPILE_ASSERT(offsetof(ShaderSourceImmediate, data_size) == 12, - OffsetOf_ShaderSourceImmediate_data_size_not_12); - -struct StencilFunc { - typedef StencilFunc ValueType; - static const CommandId kCmdId = kStencilFunc; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _func, GLint _ref, GLuint _mask) { - SetHeader(); - func = _func; - ref = _ref; - mask = _mask; - } - - void* Set(void* cmd, GLenum _func, GLint _ref, GLuint _mask) { - static_cast<ValueType*>(cmd)->Init(_func, _ref, _mask); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 func; - uint32 ref; - uint32 mask; -}; - -COMPILE_ASSERT(sizeof(StencilFunc) == 16, - Sizeof_StencilFunc_is_not_16); -COMPILE_ASSERT(offsetof(StencilFunc, header) == 0, - OffsetOf_StencilFunc_header_not_0); -COMPILE_ASSERT(offsetof(StencilFunc, func) == 4, - OffsetOf_StencilFunc_func_not_4); -COMPILE_ASSERT(offsetof(StencilFunc, ref) == 8, - OffsetOf_StencilFunc_ref_not_8); -COMPILE_ASSERT(offsetof(StencilFunc, mask) == 12, - OffsetOf_StencilFunc_mask_not_12); - -struct StencilFuncSeparate { - typedef StencilFuncSeparate ValueType; - static const CommandId kCmdId = kStencilFuncSeparate; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _face, GLenum _func, GLint _ref, GLuint _mask) { - SetHeader(); - face = _face; - func = _func; - ref = _ref; - mask = _mask; - } - - void* Set(void* cmd, GLenum _face, GLenum _func, GLint _ref, GLuint _mask) { - static_cast<ValueType*>(cmd)->Init(_face, _func, _ref, _mask); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 face; - uint32 func; - uint32 ref; - uint32 mask; -}; - -COMPILE_ASSERT(sizeof(StencilFuncSeparate) == 20, - Sizeof_StencilFuncSeparate_is_not_20); -COMPILE_ASSERT(offsetof(StencilFuncSeparate, header) == 0, - OffsetOf_StencilFuncSeparate_header_not_0); -COMPILE_ASSERT(offsetof(StencilFuncSeparate, face) == 4, - OffsetOf_StencilFuncSeparate_face_not_4); -COMPILE_ASSERT(offsetof(StencilFuncSeparate, func) == 8, - OffsetOf_StencilFuncSeparate_func_not_8); -COMPILE_ASSERT(offsetof(StencilFuncSeparate, ref) == 12, - OffsetOf_StencilFuncSeparate_ref_not_12); -COMPILE_ASSERT(offsetof(StencilFuncSeparate, mask) == 16, - OffsetOf_StencilFuncSeparate_mask_not_16); - -struct StencilMask { - typedef StencilMask ValueType; - static const CommandId kCmdId = kStencilMask; - 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 _mask) { - SetHeader(); - mask = _mask; - } - - void* Set(void* cmd, GLuint _mask) { - static_cast<ValueType*>(cmd)->Init(_mask); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 mask; -}; - -COMPILE_ASSERT(sizeof(StencilMask) == 8, - Sizeof_StencilMask_is_not_8); -COMPILE_ASSERT(offsetof(StencilMask, header) == 0, - OffsetOf_StencilMask_header_not_0); -COMPILE_ASSERT(offsetof(StencilMask, mask) == 4, - OffsetOf_StencilMask_mask_not_4); - -struct StencilMaskSeparate { - typedef StencilMaskSeparate ValueType; - static const CommandId kCmdId = kStencilMaskSeparate; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _face, GLuint _mask) { - SetHeader(); - face = _face; - mask = _mask; - } - - void* Set(void* cmd, GLenum _face, GLuint _mask) { - static_cast<ValueType*>(cmd)->Init(_face, _mask); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 face; - uint32 mask; -}; - -COMPILE_ASSERT(sizeof(StencilMaskSeparate) == 12, - Sizeof_StencilMaskSeparate_is_not_12); -COMPILE_ASSERT(offsetof(StencilMaskSeparate, header) == 0, - OffsetOf_StencilMaskSeparate_header_not_0); -COMPILE_ASSERT(offsetof(StencilMaskSeparate, face) == 4, - OffsetOf_StencilMaskSeparate_face_not_4); -COMPILE_ASSERT(offsetof(StencilMaskSeparate, mask) == 8, - OffsetOf_StencilMaskSeparate_mask_not_8); - -struct StencilOp { - typedef StencilOp ValueType; - static const CommandId kCmdId = kStencilOp; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _fail, GLenum _zfail, GLenum _zpass) { - SetHeader(); - fail = _fail; - zfail = _zfail; - zpass = _zpass; - } - - void* Set(void* cmd, GLenum _fail, GLenum _zfail, GLenum _zpass) { - static_cast<ValueType*>(cmd)->Init(_fail, _zfail, _zpass); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 fail; - uint32 zfail; - uint32 zpass; -}; - -COMPILE_ASSERT(sizeof(StencilOp) == 16, - Sizeof_StencilOp_is_not_16); -COMPILE_ASSERT(offsetof(StencilOp, header) == 0, - OffsetOf_StencilOp_header_not_0); -COMPILE_ASSERT(offsetof(StencilOp, fail) == 4, - OffsetOf_StencilOp_fail_not_4); -COMPILE_ASSERT(offsetof(StencilOp, zfail) == 8, - OffsetOf_StencilOp_zfail_not_8); -COMPILE_ASSERT(offsetof(StencilOp, zpass) == 12, - OffsetOf_StencilOp_zpass_not_12); - -struct StencilOpSeparate { - typedef StencilOpSeparate ValueType; - static const CommandId kCmdId = kStencilOpSeparate; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _face, GLenum _fail, GLenum _zfail, GLenum _zpass) { - SetHeader(); - face = _face; - fail = _fail; - zfail = _zfail; - zpass = _zpass; - } - - void* Set( - void* cmd, GLenum _face, GLenum _fail, GLenum _zfail, GLenum _zpass) { - static_cast<ValueType*>(cmd)->Init(_face, _fail, _zfail, _zpass); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 face; - uint32 fail; - uint32 zfail; - uint32 zpass; -}; - -COMPILE_ASSERT(sizeof(StencilOpSeparate) == 20, - Sizeof_StencilOpSeparate_is_not_20); -COMPILE_ASSERT(offsetof(StencilOpSeparate, header) == 0, - OffsetOf_StencilOpSeparate_header_not_0); -COMPILE_ASSERT(offsetof(StencilOpSeparate, face) == 4, - OffsetOf_StencilOpSeparate_face_not_4); -COMPILE_ASSERT(offsetof(StencilOpSeparate, fail) == 8, - OffsetOf_StencilOpSeparate_fail_not_8); -COMPILE_ASSERT(offsetof(StencilOpSeparate, zfail) == 12, - OffsetOf_StencilOpSeparate_zfail_not_12); -COMPILE_ASSERT(offsetof(StencilOpSeparate, zpass) == 16, - OffsetOf_StencilOpSeparate_zpass_not_16); - -struct TexImage2D { - typedef TexImage2D ValueType; - static const CommandId kCmdId = kTexImage2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLint _level, GLint _internalformat, GLsizei _width, - GLsizei _height, GLint _border, GLenum _format, GLenum _type, - uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { - SetHeader(); - target = _target; - level = _level; - internalformat = _internalformat; - width = _width; - height = _height; - border = _border; - format = _format; - type = _type; - pixels_shm_id = _pixels_shm_id; - pixels_shm_offset = _pixels_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLint _internalformat, - GLsizei _width, GLsizei _height, GLint _border, GLenum _format, - GLenum _type, uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _internalformat, _width, _height, _border, _format, - _type, _pixels_shm_id, _pixels_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 internalformat; - uint32 width; - uint32 height; - uint32 border; - uint32 format; - uint32 type; - uint32 pixels_shm_id; - uint32 pixels_shm_offset; -}; - -COMPILE_ASSERT(sizeof(TexImage2D) == 44, - Sizeof_TexImage2D_is_not_44); -COMPILE_ASSERT(offsetof(TexImage2D, header) == 0, - OffsetOf_TexImage2D_header_not_0); -COMPILE_ASSERT(offsetof(TexImage2D, target) == 4, - OffsetOf_TexImage2D_target_not_4); -COMPILE_ASSERT(offsetof(TexImage2D, level) == 8, - OffsetOf_TexImage2D_level_not_8); -COMPILE_ASSERT(offsetof(TexImage2D, internalformat) == 12, - OffsetOf_TexImage2D_internalformat_not_12); -COMPILE_ASSERT(offsetof(TexImage2D, width) == 16, - OffsetOf_TexImage2D_width_not_16); -COMPILE_ASSERT(offsetof(TexImage2D, height) == 20, - OffsetOf_TexImage2D_height_not_20); -COMPILE_ASSERT(offsetof(TexImage2D, border) == 24, - OffsetOf_TexImage2D_border_not_24); -COMPILE_ASSERT(offsetof(TexImage2D, format) == 28, - OffsetOf_TexImage2D_format_not_28); -COMPILE_ASSERT(offsetof(TexImage2D, type) == 32, - OffsetOf_TexImage2D_type_not_32); -COMPILE_ASSERT(offsetof(TexImage2D, pixels_shm_id) == 36, - OffsetOf_TexImage2D_pixels_shm_id_not_36); -COMPILE_ASSERT(offsetof(TexImage2D, pixels_shm_offset) == 40, - OffsetOf_TexImage2D_pixels_shm_offset_not_40); - -struct TexImage2DImmediate { - typedef TexImage2DImmediate ValueType; - static const CommandId kCmdId = kTexImage2DImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - 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 - SetHeader(total_size); - target = _target; - level = _level; - internalformat = _internalformat; - width = _width; - height = _height; - border = _border; - format = _format; - type = _type; - } - - void* Set( - 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 - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _internalformat, _width, _height, _border, _format, - _type); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 internalformat; - uint32 width; - uint32 height; - uint32 border; - uint32 format; - uint32 type; -}; - -COMPILE_ASSERT(sizeof(TexImage2DImmediate) == 36, - Sizeof_TexImage2DImmediate_is_not_36); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, header) == 0, - OffsetOf_TexImage2DImmediate_header_not_0); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, target) == 4, - OffsetOf_TexImage2DImmediate_target_not_4); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, level) == 8, - OffsetOf_TexImage2DImmediate_level_not_8); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, internalformat) == 12, - OffsetOf_TexImage2DImmediate_internalformat_not_12); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, width) == 16, - OffsetOf_TexImage2DImmediate_width_not_16); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, height) == 20, - OffsetOf_TexImage2DImmediate_height_not_20); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, border) == 24, - OffsetOf_TexImage2DImmediate_border_not_24); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, format) == 28, - OffsetOf_TexImage2DImmediate_format_not_28); -COMPILE_ASSERT(offsetof(TexImage2DImmediate, type) == 32, - OffsetOf_TexImage2DImmediate_type_not_32); - -struct TexParameterf { - typedef TexParameterf ValueType; - static const CommandId kCmdId = kTexParameterf; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLenum _pname, GLfloat _param) { - SetHeader(); - target = _target; - pname = _pname; - param = _param; - } - - void* Set(void* cmd, GLenum _target, GLenum _pname, GLfloat _param) { - static_cast<ValueType*>(cmd)->Init(_target, _pname, _param); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - float param; -}; - -COMPILE_ASSERT(sizeof(TexParameterf) == 16, - Sizeof_TexParameterf_is_not_16); -COMPILE_ASSERT(offsetof(TexParameterf, header) == 0, - OffsetOf_TexParameterf_header_not_0); -COMPILE_ASSERT(offsetof(TexParameterf, target) == 4, - OffsetOf_TexParameterf_target_not_4); -COMPILE_ASSERT(offsetof(TexParameterf, pname) == 8, - OffsetOf_TexParameterf_pname_not_8); -COMPILE_ASSERT(offsetof(TexParameterf, param) == 12, - OffsetOf_TexParameterf_param_not_12); - -struct TexParameterfv { - typedef TexParameterfv ValueType; - static const CommandId kCmdId = kTexParameterfv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(TexParameterfv) == 20, - Sizeof_TexParameterfv_is_not_20); -COMPILE_ASSERT(offsetof(TexParameterfv, header) == 0, - OffsetOf_TexParameterfv_header_not_0); -COMPILE_ASSERT(offsetof(TexParameterfv, target) == 4, - OffsetOf_TexParameterfv_target_not_4); -COMPILE_ASSERT(offsetof(TexParameterfv, pname) == 8, - OffsetOf_TexParameterfv_pname_not_8); -COMPILE_ASSERT(offsetof(TexParameterfv, params_shm_id) == 12, - OffsetOf_TexParameterfv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(TexParameterfv, params_shm_offset) == 16, - OffsetOf_TexParameterfv_params_shm_offset_not_16); - -struct TexParameterfvImmediate { - typedef TexParameterfvImmediate ValueType; - static const CommandId kCmdId = kTexParameterfvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize() { - return static_cast<uint32>( - sizeof(GLfloat) * 1); // NOLINT - } - - static uint32 ComputeSize() { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize()); // NOLINT - } - - void SetHeader() { - header.SetCmdByTotalSize<ValueType>(ComputeSize()); - } - - void Init(GLenum _target, GLenum _pname, const GLfloat* _params) { - SetHeader(); - target = _target; - pname = _pname; - memcpy(ImmediateDataAddress(this), - _params, ComputeDataSize()); - } - - void* Set(void* cmd, GLenum _target, GLenum _pname, const GLfloat* _params) { - static_cast<ValueType*>(cmd)->Init(_target, _pname, _params); - const uint32 size = ComputeSize(); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; -}; - -COMPILE_ASSERT(sizeof(TexParameterfvImmediate) == 12, - Sizeof_TexParameterfvImmediate_is_not_12); -COMPILE_ASSERT(offsetof(TexParameterfvImmediate, header) == 0, - OffsetOf_TexParameterfvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(TexParameterfvImmediate, target) == 4, - OffsetOf_TexParameterfvImmediate_target_not_4); -COMPILE_ASSERT(offsetof(TexParameterfvImmediate, pname) == 8, - OffsetOf_TexParameterfvImmediate_pname_not_8); - -struct TexParameteri { - typedef TexParameteri ValueType; - static const CommandId kCmdId = kTexParameteri; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLenum _target, GLenum _pname, GLint _param) { - SetHeader(); - target = _target; - pname = _pname; - param = _param; - } - - void* Set(void* cmd, GLenum _target, GLenum _pname, GLint _param) { - static_cast<ValueType*>(cmd)->Init(_target, _pname, _param); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 param; -}; - -COMPILE_ASSERT(sizeof(TexParameteri) == 16, - Sizeof_TexParameteri_is_not_16); -COMPILE_ASSERT(offsetof(TexParameteri, header) == 0, - OffsetOf_TexParameteri_header_not_0); -COMPILE_ASSERT(offsetof(TexParameteri, target) == 4, - OffsetOf_TexParameteri_target_not_4); -COMPILE_ASSERT(offsetof(TexParameteri, pname) == 8, - OffsetOf_TexParameteri_pname_not_8); -COMPILE_ASSERT(offsetof(TexParameteri, param) == 12, - OffsetOf_TexParameteri_param_not_12); - -struct TexParameteriv { - typedef TexParameteriv ValueType; - static const CommandId kCmdId = kTexParameteriv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - SetHeader(); - target = _target; - pname = _pname; - params_shm_id = _params_shm_id; - params_shm_offset = _params_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, - uint32 _params_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; - uint32 params_shm_id; - uint32 params_shm_offset; -}; - -COMPILE_ASSERT(sizeof(TexParameteriv) == 20, - Sizeof_TexParameteriv_is_not_20); -COMPILE_ASSERT(offsetof(TexParameteriv, header) == 0, - OffsetOf_TexParameteriv_header_not_0); -COMPILE_ASSERT(offsetof(TexParameteriv, target) == 4, - OffsetOf_TexParameteriv_target_not_4); -COMPILE_ASSERT(offsetof(TexParameteriv, pname) == 8, - OffsetOf_TexParameteriv_pname_not_8); -COMPILE_ASSERT(offsetof(TexParameteriv, params_shm_id) == 12, - OffsetOf_TexParameteriv_params_shm_id_not_12); -COMPILE_ASSERT(offsetof(TexParameteriv, params_shm_offset) == 16, - OffsetOf_TexParameteriv_params_shm_offset_not_16); - -struct TexParameterivImmediate { - typedef TexParameterivImmediate ValueType; - static const CommandId kCmdId = kTexParameterivImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize() { - return static_cast<uint32>( - sizeof(GLint) * 1); // NOLINT - } - - static uint32 ComputeSize() { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize()); // NOLINT - } - - void SetHeader() { - header.SetCmdByTotalSize<ValueType>(ComputeSize()); - } - - void Init(GLenum _target, GLenum _pname, const GLint* _params) { - SetHeader(); - target = _target; - pname = _pname; - memcpy(ImmediateDataAddress(this), - _params, ComputeDataSize()); - } - - void* Set(void* cmd, GLenum _target, GLenum _pname, const GLint* _params) { - static_cast<ValueType*>(cmd)->Init(_target, _pname, _params); - const uint32 size = ComputeSize(); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 pname; -}; - -COMPILE_ASSERT(sizeof(TexParameterivImmediate) == 12, - Sizeof_TexParameterivImmediate_is_not_12); -COMPILE_ASSERT(offsetof(TexParameterivImmediate, header) == 0, - OffsetOf_TexParameterivImmediate_header_not_0); -COMPILE_ASSERT(offsetof(TexParameterivImmediate, target) == 4, - OffsetOf_TexParameterivImmediate_target_not_4); -COMPILE_ASSERT(offsetof(TexParameterivImmediate, pname) == 8, - OffsetOf_TexParameterivImmediate_pname_not_8); - -struct TexSubImage2D { - typedef TexSubImage2D ValueType; - static const CommandId kCmdId = kTexSubImage2D; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLenum _type, - uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { - SetHeader(); - target = _target; - level = _level; - xoffset = _xoffset; - yoffset = _yoffset; - width = _width; - height = _height; - format = _format; - type = _type; - pixels_shm_id = _pixels_shm_id; - pixels_shm_offset = _pixels_shm_offset; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLenum _type, - uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _xoffset, _yoffset, _width, _height, _format, - _type, _pixels_shm_id, _pixels_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 xoffset; - uint32 yoffset; - uint32 width; - uint32 height; - uint32 format; - uint32 type; - uint32 pixels_shm_id; - uint32 pixels_shm_offset; -}; - -COMPILE_ASSERT(sizeof(TexSubImage2D) == 44, - Sizeof_TexSubImage2D_is_not_44); -COMPILE_ASSERT(offsetof(TexSubImage2D, header) == 0, - OffsetOf_TexSubImage2D_header_not_0); -COMPILE_ASSERT(offsetof(TexSubImage2D, target) == 4, - OffsetOf_TexSubImage2D_target_not_4); -COMPILE_ASSERT(offsetof(TexSubImage2D, level) == 8, - OffsetOf_TexSubImage2D_level_not_8); -COMPILE_ASSERT(offsetof(TexSubImage2D, xoffset) == 12, - OffsetOf_TexSubImage2D_xoffset_not_12); -COMPILE_ASSERT(offsetof(TexSubImage2D, yoffset) == 16, - OffsetOf_TexSubImage2D_yoffset_not_16); -COMPILE_ASSERT(offsetof(TexSubImage2D, width) == 20, - OffsetOf_TexSubImage2D_width_not_20); -COMPILE_ASSERT(offsetof(TexSubImage2D, height) == 24, - OffsetOf_TexSubImage2D_height_not_24); -COMPILE_ASSERT(offsetof(TexSubImage2D, format) == 28, - OffsetOf_TexSubImage2D_format_not_28); -COMPILE_ASSERT(offsetof(TexSubImage2D, type) == 32, - OffsetOf_TexSubImage2D_type_not_32); -COMPILE_ASSERT(offsetof(TexSubImage2D, pixels_shm_id) == 36, - OffsetOf_TexSubImage2D_pixels_shm_id_not_36); -COMPILE_ASSERT(offsetof(TexSubImage2D, pixels_shm_offset) == 40, - OffsetOf_TexSubImage2D_pixels_shm_offset_not_40); - -struct TexSubImage2DImmediate { - typedef TexSubImage2DImmediate ValueType; - static const CommandId kCmdId = kTexSubImage2DImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeSize(uint32 size_in_bytes) { - return static_cast<uint32>( - sizeof(ValueType) + // NOLINT - RoundSizeToMultipleOfEntries(size_in_bytes)); - } - - void SetHeader(uint32 size_in_bytes) { - header.SetCmdByTotalSize<ValueType>(size_in_bytes); - } - - void Init( - GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLenum _type) { - uint32 total_size = 0; // TODO(gman): get correct size - SetHeader(total_size); - target = _target; - level = _level; - xoffset = _xoffset; - yoffset = _yoffset; - width = _width; - height = _height; - format = _format; - type = _type; - } - - void* Set( - void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, - GLsizei _width, GLsizei _height, GLenum _format, GLenum _type) { - uint32 total_size = 0; // TODO(gman): get correct size - static_cast<ValueType*>( - cmd)->Init( - _target, _level, _xoffset, _yoffset, _width, _height, _format, - _type); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); - } - - command_buffer::CommandHeader header; - uint32 target; - uint32 level; - uint32 xoffset; - uint32 yoffset; - uint32 width; - uint32 height; - uint32 format; - uint32 type; -}; - -COMPILE_ASSERT(sizeof(TexSubImage2DImmediate) == 36, - Sizeof_TexSubImage2DImmediate_is_not_36); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, header) == 0, - OffsetOf_TexSubImage2DImmediate_header_not_0); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, target) == 4, - OffsetOf_TexSubImage2DImmediate_target_not_4); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, level) == 8, - OffsetOf_TexSubImage2DImmediate_level_not_8); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, xoffset) == 12, - OffsetOf_TexSubImage2DImmediate_xoffset_not_12); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, yoffset) == 16, - OffsetOf_TexSubImage2DImmediate_yoffset_not_16); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, width) == 20, - OffsetOf_TexSubImage2DImmediate_width_not_20); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, height) == 24, - OffsetOf_TexSubImage2DImmediate_height_not_24); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, format) == 28, - OffsetOf_TexSubImage2DImmediate_format_not_28); -COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, type) == 32, - OffsetOf_TexSubImage2DImmediate_type_not_32); - -struct Uniform1f { - typedef Uniform1f ValueType; - static const CommandId kCmdId = kUniform1f; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLfloat _x) { - SetHeader(); - location = _location; - x = _x; - } - - void* Set(void* cmd, GLint _location, GLfloat _x) { - static_cast<ValueType*>(cmd)->Init(_location, _x); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - float x; -}; - -COMPILE_ASSERT(sizeof(Uniform1f) == 12, - Sizeof_Uniform1f_is_not_12); -COMPILE_ASSERT(offsetof(Uniform1f, header) == 0, - OffsetOf_Uniform1f_header_not_0); -COMPILE_ASSERT(offsetof(Uniform1f, location) == 4, - OffsetOf_Uniform1f_location_not_4); -COMPILE_ASSERT(offsetof(Uniform1f, x) == 8, - OffsetOf_Uniform1f_x_not_8); - -struct Uniform1fv { - typedef Uniform1fv ValueType; - static const CommandId kCmdId = kUniform1fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform1fv) == 20, - Sizeof_Uniform1fv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform1fv, header) == 0, - OffsetOf_Uniform1fv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform1fv, location) == 4, - OffsetOf_Uniform1fv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform1fv, count) == 8, - OffsetOf_Uniform1fv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform1fv, v_shm_id) == 12, - OffsetOf_Uniform1fv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform1fv, v_shm_offset) == 16, - OffsetOf_Uniform1fv_v_shm_offset_not_16); - -struct Uniform1fvImmediate { - typedef Uniform1fvImmediate ValueType; - static const CommandId kCmdId = kUniform1fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 1 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLfloat* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform1fvImmediate) == 12, - Sizeof_Uniform1fvImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform1fvImmediate, header) == 0, - OffsetOf_Uniform1fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform1fvImmediate, location) == 4, - OffsetOf_Uniform1fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform1fvImmediate, count) == 8, - OffsetOf_Uniform1fvImmediate_count_not_8); - -struct Uniform1i { - typedef Uniform1i ValueType; - static const CommandId kCmdId = kUniform1i; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLint _x) { - SetHeader(); - location = _location; - x = _x; - } - - void* Set(void* cmd, GLint _location, GLint _x) { - static_cast<ValueType*>(cmd)->Init(_location, _x); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 x; -}; - -COMPILE_ASSERT(sizeof(Uniform1i) == 12, - Sizeof_Uniform1i_is_not_12); -COMPILE_ASSERT(offsetof(Uniform1i, header) == 0, - OffsetOf_Uniform1i_header_not_0); -COMPILE_ASSERT(offsetof(Uniform1i, location) == 4, - OffsetOf_Uniform1i_location_not_4); -COMPILE_ASSERT(offsetof(Uniform1i, x) == 8, - OffsetOf_Uniform1i_x_not_8); - -struct Uniform1iv { - typedef Uniform1iv ValueType; - static const CommandId kCmdId = kUniform1iv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform1iv) == 20, - Sizeof_Uniform1iv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform1iv, header) == 0, - OffsetOf_Uniform1iv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform1iv, location) == 4, - OffsetOf_Uniform1iv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform1iv, count) == 8, - OffsetOf_Uniform1iv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform1iv, v_shm_id) == 12, - OffsetOf_Uniform1iv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform1iv, v_shm_offset) == 16, - OffsetOf_Uniform1iv_v_shm_offset_not_16); - -struct Uniform1ivImmediate { - typedef Uniform1ivImmediate ValueType; - static const CommandId kCmdId = kUniform1ivImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLint) * 1 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLint* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform1ivImmediate) == 12, - Sizeof_Uniform1ivImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform1ivImmediate, header) == 0, - OffsetOf_Uniform1ivImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform1ivImmediate, location) == 4, - OffsetOf_Uniform1ivImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform1ivImmediate, count) == 8, - OffsetOf_Uniform1ivImmediate_count_not_8); - -struct Uniform2f { - typedef Uniform2f ValueType; - static const CommandId kCmdId = kUniform2f; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLfloat _x, GLfloat _y) { - SetHeader(); - location = _location; - x = _x; - y = _y; - } - - void* Set(void* cmd, GLint _location, GLfloat _x, GLfloat _y) { - static_cast<ValueType*>(cmd)->Init(_location, _x, _y); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - float x; - float y; -}; - -COMPILE_ASSERT(sizeof(Uniform2f) == 16, - Sizeof_Uniform2f_is_not_16); -COMPILE_ASSERT(offsetof(Uniform2f, header) == 0, - OffsetOf_Uniform2f_header_not_0); -COMPILE_ASSERT(offsetof(Uniform2f, location) == 4, - OffsetOf_Uniform2f_location_not_4); -COMPILE_ASSERT(offsetof(Uniform2f, x) == 8, - OffsetOf_Uniform2f_x_not_8); -COMPILE_ASSERT(offsetof(Uniform2f, y) == 12, - OffsetOf_Uniform2f_y_not_12); - -struct Uniform2fv { - typedef Uniform2fv ValueType; - static const CommandId kCmdId = kUniform2fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform2fv) == 20, - Sizeof_Uniform2fv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform2fv, header) == 0, - OffsetOf_Uniform2fv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform2fv, location) == 4, - OffsetOf_Uniform2fv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform2fv, count) == 8, - OffsetOf_Uniform2fv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform2fv, v_shm_id) == 12, - OffsetOf_Uniform2fv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform2fv, v_shm_offset) == 16, - OffsetOf_Uniform2fv_v_shm_offset_not_16); - -struct Uniform2fvImmediate { - typedef Uniform2fvImmediate ValueType; - static const CommandId kCmdId = kUniform2fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 2 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLfloat* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform2fvImmediate) == 12, - Sizeof_Uniform2fvImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform2fvImmediate, header) == 0, - OffsetOf_Uniform2fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform2fvImmediate, location) == 4, - OffsetOf_Uniform2fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform2fvImmediate, count) == 8, - OffsetOf_Uniform2fvImmediate_count_not_8); - -struct Uniform2i { - typedef Uniform2i ValueType; - static const CommandId kCmdId = kUniform2i; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLint _x, GLint _y) { - SetHeader(); - location = _location; - x = _x; - y = _y; - } - - void* Set(void* cmd, GLint _location, GLint _x, GLint _y) { - static_cast<ValueType*>(cmd)->Init(_location, _x, _y); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 x; - uint32 y; -}; - -COMPILE_ASSERT(sizeof(Uniform2i) == 16, - Sizeof_Uniform2i_is_not_16); -COMPILE_ASSERT(offsetof(Uniform2i, header) == 0, - OffsetOf_Uniform2i_header_not_0); -COMPILE_ASSERT(offsetof(Uniform2i, location) == 4, - OffsetOf_Uniform2i_location_not_4); -COMPILE_ASSERT(offsetof(Uniform2i, x) == 8, - OffsetOf_Uniform2i_x_not_8); -COMPILE_ASSERT(offsetof(Uniform2i, y) == 12, - OffsetOf_Uniform2i_y_not_12); - -struct Uniform2iv { - typedef Uniform2iv ValueType; - static const CommandId kCmdId = kUniform2iv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform2iv) == 20, - Sizeof_Uniform2iv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform2iv, header) == 0, - OffsetOf_Uniform2iv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform2iv, location) == 4, - OffsetOf_Uniform2iv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform2iv, count) == 8, - OffsetOf_Uniform2iv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform2iv, v_shm_id) == 12, - OffsetOf_Uniform2iv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform2iv, v_shm_offset) == 16, - OffsetOf_Uniform2iv_v_shm_offset_not_16); - -struct Uniform2ivImmediate { - typedef Uniform2ivImmediate ValueType; - static const CommandId kCmdId = kUniform2ivImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLint) * 2 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLint* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform2ivImmediate) == 12, - Sizeof_Uniform2ivImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform2ivImmediate, header) == 0, - OffsetOf_Uniform2ivImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform2ivImmediate, location) == 4, - OffsetOf_Uniform2ivImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform2ivImmediate, count) == 8, - OffsetOf_Uniform2ivImmediate_count_not_8); - -struct Uniform3f { - typedef Uniform3f ValueType; - static const CommandId kCmdId = kUniform3f; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLfloat _x, GLfloat _y, GLfloat _z) { - SetHeader(); - location = _location; - x = _x; - y = _y; - z = _z; - } - - void* Set(void* cmd, GLint _location, GLfloat _x, GLfloat _y, GLfloat _z) { - static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - float x; - float y; - float z; -}; - -COMPILE_ASSERT(sizeof(Uniform3f) == 20, - Sizeof_Uniform3f_is_not_20); -COMPILE_ASSERT(offsetof(Uniform3f, header) == 0, - OffsetOf_Uniform3f_header_not_0); -COMPILE_ASSERT(offsetof(Uniform3f, location) == 4, - OffsetOf_Uniform3f_location_not_4); -COMPILE_ASSERT(offsetof(Uniform3f, x) == 8, - OffsetOf_Uniform3f_x_not_8); -COMPILE_ASSERT(offsetof(Uniform3f, y) == 12, - OffsetOf_Uniform3f_y_not_12); -COMPILE_ASSERT(offsetof(Uniform3f, z) == 16, - OffsetOf_Uniform3f_z_not_16); - -struct Uniform3fv { - typedef Uniform3fv ValueType; - static const CommandId kCmdId = kUniform3fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform3fv) == 20, - Sizeof_Uniform3fv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform3fv, header) == 0, - OffsetOf_Uniform3fv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform3fv, location) == 4, - OffsetOf_Uniform3fv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform3fv, count) == 8, - OffsetOf_Uniform3fv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform3fv, v_shm_id) == 12, - OffsetOf_Uniform3fv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform3fv, v_shm_offset) == 16, - OffsetOf_Uniform3fv_v_shm_offset_not_16); - -struct Uniform3fvImmediate { - typedef Uniform3fvImmediate ValueType; - static const CommandId kCmdId = kUniform3fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 3 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLfloat* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform3fvImmediate) == 12, - Sizeof_Uniform3fvImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform3fvImmediate, header) == 0, - OffsetOf_Uniform3fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform3fvImmediate, location) == 4, - OffsetOf_Uniform3fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform3fvImmediate, count) == 8, - OffsetOf_Uniform3fvImmediate_count_not_8); - -struct Uniform3i { - typedef Uniform3i ValueType; - static const CommandId kCmdId = kUniform3i; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLint _x, GLint _y, GLint _z) { - SetHeader(); - location = _location; - x = _x; - y = _y; - z = _z; - } - - void* Set(void* cmd, GLint _location, GLint _x, GLint _y, GLint _z) { - static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 x; - uint32 y; - uint32 z; -}; - -COMPILE_ASSERT(sizeof(Uniform3i) == 20, - Sizeof_Uniform3i_is_not_20); -COMPILE_ASSERT(offsetof(Uniform3i, header) == 0, - OffsetOf_Uniform3i_header_not_0); -COMPILE_ASSERT(offsetof(Uniform3i, location) == 4, - OffsetOf_Uniform3i_location_not_4); -COMPILE_ASSERT(offsetof(Uniform3i, x) == 8, - OffsetOf_Uniform3i_x_not_8); -COMPILE_ASSERT(offsetof(Uniform3i, y) == 12, - OffsetOf_Uniform3i_y_not_12); -COMPILE_ASSERT(offsetof(Uniform3i, z) == 16, - OffsetOf_Uniform3i_z_not_16); - -struct Uniform3iv { - typedef Uniform3iv ValueType; - static const CommandId kCmdId = kUniform3iv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform3iv) == 20, - Sizeof_Uniform3iv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform3iv, header) == 0, - OffsetOf_Uniform3iv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform3iv, location) == 4, - OffsetOf_Uniform3iv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform3iv, count) == 8, - OffsetOf_Uniform3iv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform3iv, v_shm_id) == 12, - OffsetOf_Uniform3iv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform3iv, v_shm_offset) == 16, - OffsetOf_Uniform3iv_v_shm_offset_not_16); - -struct Uniform3ivImmediate { - typedef Uniform3ivImmediate ValueType; - static const CommandId kCmdId = kUniform3ivImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLint) * 3 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLint* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform3ivImmediate) == 12, - Sizeof_Uniform3ivImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform3ivImmediate, header) == 0, - OffsetOf_Uniform3ivImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform3ivImmediate, location) == 4, - OffsetOf_Uniform3ivImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform3ivImmediate, count) == 8, - OffsetOf_Uniform3ivImmediate_count_not_8); - -struct Uniform4f { - typedef Uniform4f ValueType; - static const CommandId kCmdId = kUniform4f; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLfloat _x, GLfloat _y, GLfloat _z, GLfloat _w) { - SetHeader(); - location = _location; - x = _x; - y = _y; - z = _z; - w = _w; - } - - void* Set( - void* cmd, GLint _location, GLfloat _x, GLfloat _y, GLfloat _z, - GLfloat _w) { - static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z, _w); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - float x; - float y; - float z; - float w; -}; - -COMPILE_ASSERT(sizeof(Uniform4f) == 24, - Sizeof_Uniform4f_is_not_24); -COMPILE_ASSERT(offsetof(Uniform4f, header) == 0, - OffsetOf_Uniform4f_header_not_0); -COMPILE_ASSERT(offsetof(Uniform4f, location) == 4, - OffsetOf_Uniform4f_location_not_4); -COMPILE_ASSERT(offsetof(Uniform4f, x) == 8, - OffsetOf_Uniform4f_x_not_8); -COMPILE_ASSERT(offsetof(Uniform4f, y) == 12, - OffsetOf_Uniform4f_y_not_12); -COMPILE_ASSERT(offsetof(Uniform4f, z) == 16, - OffsetOf_Uniform4f_z_not_16); -COMPILE_ASSERT(offsetof(Uniform4f, w) == 20, - OffsetOf_Uniform4f_w_not_20); - -struct Uniform4fv { - typedef Uniform4fv ValueType; - static const CommandId kCmdId = kUniform4fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform4fv) == 20, - Sizeof_Uniform4fv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform4fv, header) == 0, - OffsetOf_Uniform4fv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform4fv, location) == 4, - OffsetOf_Uniform4fv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform4fv, count) == 8, - OffsetOf_Uniform4fv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform4fv, v_shm_id) == 12, - OffsetOf_Uniform4fv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform4fv, v_shm_offset) == 16, - OffsetOf_Uniform4fv_v_shm_offset_not_16); - -struct Uniform4fvImmediate { - typedef Uniform4fvImmediate ValueType; - static const CommandId kCmdId = kUniform4fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 4 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLfloat* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform4fvImmediate) == 12, - Sizeof_Uniform4fvImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform4fvImmediate, header) == 0, - OffsetOf_Uniform4fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform4fvImmediate, location) == 4, - OffsetOf_Uniform4fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform4fvImmediate, count) == 8, - OffsetOf_Uniform4fvImmediate_count_not_8); - -struct Uniform4i { - typedef Uniform4i ValueType; - static const CommandId kCmdId = kUniform4i; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _location, GLint _x, GLint _y, GLint _z, GLint _w) { - SetHeader(); - location = _location; - x = _x; - y = _y; - z = _z; - w = _w; - } - - void* Set( - void* cmd, GLint _location, GLint _x, GLint _y, GLint _z, GLint _w) { - static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z, _w); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 x; - uint32 y; - uint32 z; - uint32 w; -}; - -COMPILE_ASSERT(sizeof(Uniform4i) == 24, - Sizeof_Uniform4i_is_not_24); -COMPILE_ASSERT(offsetof(Uniform4i, header) == 0, - OffsetOf_Uniform4i_header_not_0); -COMPILE_ASSERT(offsetof(Uniform4i, location) == 4, - OffsetOf_Uniform4i_location_not_4); -COMPILE_ASSERT(offsetof(Uniform4i, x) == 8, - OffsetOf_Uniform4i_x_not_8); -COMPILE_ASSERT(offsetof(Uniform4i, y) == 12, - OffsetOf_Uniform4i_y_not_12); -COMPILE_ASSERT(offsetof(Uniform4i, z) == 16, - OffsetOf_Uniform4i_z_not_16); -COMPILE_ASSERT(offsetof(Uniform4i, w) == 20, - OffsetOf_Uniform4i_w_not_20); - -struct Uniform4iv { - typedef Uniform4iv ValueType; - static const CommandId kCmdId = kUniform4iv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - SetHeader(); - location = _location; - count = _count; - v_shm_id = _v_shm_id; - v_shm_offset = _v_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, - uint32 _v_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 v_shm_id; - uint32 v_shm_offset; -}; - -COMPILE_ASSERT(sizeof(Uniform4iv) == 20, - Sizeof_Uniform4iv_is_not_20); -COMPILE_ASSERT(offsetof(Uniform4iv, header) == 0, - OffsetOf_Uniform4iv_header_not_0); -COMPILE_ASSERT(offsetof(Uniform4iv, location) == 4, - OffsetOf_Uniform4iv_location_not_4); -COMPILE_ASSERT(offsetof(Uniform4iv, count) == 8, - OffsetOf_Uniform4iv_count_not_8); -COMPILE_ASSERT(offsetof(Uniform4iv, v_shm_id) == 12, - OffsetOf_Uniform4iv_v_shm_id_not_12); -COMPILE_ASSERT(offsetof(Uniform4iv, v_shm_offset) == 16, - OffsetOf_Uniform4iv_v_shm_offset_not_16); - -struct Uniform4ivImmediate { - typedef Uniform4ivImmediate ValueType; - static const CommandId kCmdId = kUniform4ivImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLint) * 4 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init(GLint _location, GLsizei _count, const GLint* _v) { - SetHeader(_count); - location = _location; - count = _count; - memcpy(ImmediateDataAddress(this), - _v, ComputeDataSize(_count)); - } - - void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _v); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; -}; - -COMPILE_ASSERT(sizeof(Uniform4ivImmediate) == 12, - Sizeof_Uniform4ivImmediate_is_not_12); -COMPILE_ASSERT(offsetof(Uniform4ivImmediate, header) == 0, - OffsetOf_Uniform4ivImmediate_header_not_0); -COMPILE_ASSERT(offsetof(Uniform4ivImmediate, location) == 4, - OffsetOf_Uniform4ivImmediate_location_not_4); -COMPILE_ASSERT(offsetof(Uniform4ivImmediate, count) == 8, - OffsetOf_Uniform4ivImmediate_count_not_8); - -struct UniformMatrix2fv { - typedef UniformMatrix2fv ValueType; - static const CommandId kCmdId = kUniformMatrix2fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, GLboolean _transpose, - uint32 _value_shm_id, uint32 _value_shm_offset) { - SetHeader(); - location = _location; - count = _count; - transpose = _transpose; - value_shm_id = _value_shm_id; - value_shm_offset = _value_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, - uint32 _value_shm_id, uint32 _value_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _location, _count, _transpose, _value_shm_id, _value_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 transpose; - uint32 value_shm_id; - uint32 value_shm_offset; -}; - -COMPILE_ASSERT(sizeof(UniformMatrix2fv) == 24, - Sizeof_UniformMatrix2fv_is_not_24); -COMPILE_ASSERT(offsetof(UniformMatrix2fv, header) == 0, - OffsetOf_UniformMatrix2fv_header_not_0); -COMPILE_ASSERT(offsetof(UniformMatrix2fv, location) == 4, - OffsetOf_UniformMatrix2fv_location_not_4); -COMPILE_ASSERT(offsetof(UniformMatrix2fv, count) == 8, - OffsetOf_UniformMatrix2fv_count_not_8); -COMPILE_ASSERT(offsetof(UniformMatrix2fv, transpose) == 12, - OffsetOf_UniformMatrix2fv_transpose_not_12); -COMPILE_ASSERT(offsetof(UniformMatrix2fv, value_shm_id) == 16, - OffsetOf_UniformMatrix2fv_value_shm_id_not_16); -COMPILE_ASSERT(offsetof(UniformMatrix2fv, value_shm_offset) == 20, - OffsetOf_UniformMatrix2fv_value_shm_offset_not_20); - -struct UniformMatrix2fvImmediate { - typedef UniformMatrix2fvImmediate ValueType; - static const CommandId kCmdId = kUniformMatrix2fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 4 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init( - GLint _location, GLsizei _count, GLboolean _transpose, - const GLfloat* _value) { - SetHeader(_count); - location = _location; - count = _count; - transpose = _transpose; - memcpy(ImmediateDataAddress(this), - _value, ComputeDataSize(_count)); - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, - const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 transpose; -}; - -COMPILE_ASSERT(sizeof(UniformMatrix2fvImmediate) == 16, - Sizeof_UniformMatrix2fvImmediate_is_not_16); -COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, header) == 0, - OffsetOf_UniformMatrix2fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, location) == 4, - OffsetOf_UniformMatrix2fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, count) == 8, - OffsetOf_UniformMatrix2fvImmediate_count_not_8); -COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, transpose) == 12, - OffsetOf_UniformMatrix2fvImmediate_transpose_not_12); - -struct UniformMatrix3fv { - typedef UniformMatrix3fv ValueType; - static const CommandId kCmdId = kUniformMatrix3fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, GLboolean _transpose, - uint32 _value_shm_id, uint32 _value_shm_offset) { - SetHeader(); - location = _location; - count = _count; - transpose = _transpose; - value_shm_id = _value_shm_id; - value_shm_offset = _value_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, - uint32 _value_shm_id, uint32 _value_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _location, _count, _transpose, _value_shm_id, _value_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 transpose; - uint32 value_shm_id; - uint32 value_shm_offset; -}; - -COMPILE_ASSERT(sizeof(UniformMatrix3fv) == 24, - Sizeof_UniformMatrix3fv_is_not_24); -COMPILE_ASSERT(offsetof(UniformMatrix3fv, header) == 0, - OffsetOf_UniformMatrix3fv_header_not_0); -COMPILE_ASSERT(offsetof(UniformMatrix3fv, location) == 4, - OffsetOf_UniformMatrix3fv_location_not_4); -COMPILE_ASSERT(offsetof(UniformMatrix3fv, count) == 8, - OffsetOf_UniformMatrix3fv_count_not_8); -COMPILE_ASSERT(offsetof(UniformMatrix3fv, transpose) == 12, - OffsetOf_UniformMatrix3fv_transpose_not_12); -COMPILE_ASSERT(offsetof(UniformMatrix3fv, value_shm_id) == 16, - OffsetOf_UniformMatrix3fv_value_shm_id_not_16); -COMPILE_ASSERT(offsetof(UniformMatrix3fv, value_shm_offset) == 20, - OffsetOf_UniformMatrix3fv_value_shm_offset_not_20); - -struct UniformMatrix3fvImmediate { - typedef UniformMatrix3fvImmediate ValueType; - static const CommandId kCmdId = kUniformMatrix3fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 9 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init( - GLint _location, GLsizei _count, GLboolean _transpose, - const GLfloat* _value) { - SetHeader(_count); - location = _location; - count = _count; - transpose = _transpose; - memcpy(ImmediateDataAddress(this), - _value, ComputeDataSize(_count)); - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, - const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 transpose; -}; - -COMPILE_ASSERT(sizeof(UniformMatrix3fvImmediate) == 16, - Sizeof_UniformMatrix3fvImmediate_is_not_16); -COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, header) == 0, - OffsetOf_UniformMatrix3fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, location) == 4, - OffsetOf_UniformMatrix3fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, count) == 8, - OffsetOf_UniformMatrix3fvImmediate_count_not_8); -COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, transpose) == 12, - OffsetOf_UniformMatrix3fvImmediate_transpose_not_12); - -struct UniformMatrix4fv { - typedef UniformMatrix4fv ValueType; - static const CommandId kCmdId = kUniformMatrix4fv; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init( - GLint _location, GLsizei _count, GLboolean _transpose, - uint32 _value_shm_id, uint32 _value_shm_offset) { - SetHeader(); - location = _location; - count = _count; - transpose = _transpose; - value_shm_id = _value_shm_id; - value_shm_offset = _value_shm_offset; - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, - uint32 _value_shm_id, uint32 _value_shm_offset) { - static_cast<ValueType*>( - cmd)->Init( - _location, _count, _transpose, _value_shm_id, _value_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 transpose; - uint32 value_shm_id; - uint32 value_shm_offset; -}; - -COMPILE_ASSERT(sizeof(UniformMatrix4fv) == 24, - Sizeof_UniformMatrix4fv_is_not_24); -COMPILE_ASSERT(offsetof(UniformMatrix4fv, header) == 0, - OffsetOf_UniformMatrix4fv_header_not_0); -COMPILE_ASSERT(offsetof(UniformMatrix4fv, location) == 4, - OffsetOf_UniformMatrix4fv_location_not_4); -COMPILE_ASSERT(offsetof(UniformMatrix4fv, count) == 8, - OffsetOf_UniformMatrix4fv_count_not_8); -COMPILE_ASSERT(offsetof(UniformMatrix4fv, transpose) == 12, - OffsetOf_UniformMatrix4fv_transpose_not_12); -COMPILE_ASSERT(offsetof(UniformMatrix4fv, value_shm_id) == 16, - OffsetOf_UniformMatrix4fv_value_shm_id_not_16); -COMPILE_ASSERT(offsetof(UniformMatrix4fv, value_shm_offset) == 20, - OffsetOf_UniformMatrix4fv_value_shm_offset_not_20); - -struct UniformMatrix4fvImmediate { - typedef UniformMatrix4fvImmediate ValueType; - static const CommandId kCmdId = kUniformMatrix4fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize(GLsizei count) { - return static_cast<uint32>( - sizeof(GLfloat) * 16 * count); // NOLINT - } - - static uint32 ComputeSize(GLsizei count) { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize(count)); // NOLINT - } - - void SetHeader(GLsizei count) { - header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); - } - - void Init( - GLint _location, GLsizei _count, GLboolean _transpose, - const GLfloat* _value) { - SetHeader(_count); - location = _location; - count = _count; - transpose = _transpose; - memcpy(ImmediateDataAddress(this), - _value, ComputeDataSize(_count)); - } - - void* Set( - void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, - const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); - const uint32 size = ComputeSize(_count); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 location; - uint32 count; - uint32 transpose; -}; - -COMPILE_ASSERT(sizeof(UniformMatrix4fvImmediate) == 16, - Sizeof_UniformMatrix4fvImmediate_is_not_16); -COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, header) == 0, - OffsetOf_UniformMatrix4fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, location) == 4, - OffsetOf_UniformMatrix4fvImmediate_location_not_4); -COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, count) == 8, - OffsetOf_UniformMatrix4fvImmediate_count_not_8); -COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, transpose) == 12, - OffsetOf_UniformMatrix4fvImmediate_transpose_not_12); - -struct UseProgram { - typedef UseProgram ValueType; - static const CommandId kCmdId = kUseProgram; - 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) { - SetHeader(); - program = _program; - } - - void* Set(void* cmd, GLuint _program) { - static_cast<ValueType*>(cmd)->Init(_program); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; -}; - -COMPILE_ASSERT(sizeof(UseProgram) == 8, - Sizeof_UseProgram_is_not_8); -COMPILE_ASSERT(offsetof(UseProgram, header) == 0, - OffsetOf_UseProgram_header_not_0); -COMPILE_ASSERT(offsetof(UseProgram, program) == 4, - OffsetOf_UseProgram_program_not_4); - -struct ValidateProgram { - typedef ValidateProgram ValueType; - static const CommandId kCmdId = kValidateProgram; - 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) { - SetHeader(); - program = _program; - } - - void* Set(void* cmd, GLuint _program) { - static_cast<ValueType*>(cmd)->Init(_program); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 program; -}; - -COMPILE_ASSERT(sizeof(ValidateProgram) == 8, - Sizeof_ValidateProgram_is_not_8); -COMPILE_ASSERT(offsetof(ValidateProgram, header) == 0, - OffsetOf_ValidateProgram_header_not_0); -COMPILE_ASSERT(offsetof(ValidateProgram, program) == 4, - OffsetOf_ValidateProgram_program_not_4); - -struct VertexAttrib1f { - typedef VertexAttrib1f ValueType; - static const CommandId kCmdId = kVertexAttrib1f; - 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 _indx, GLfloat _x) { - SetHeader(); - indx = _indx; - x = _x; - } - - void* Set(void* cmd, GLuint _indx, GLfloat _x) { - static_cast<ValueType*>(cmd)->Init(_indx, _x); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - float x; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib1f) == 12, - Sizeof_VertexAttrib1f_is_not_12); -COMPILE_ASSERT(offsetof(VertexAttrib1f, header) == 0, - OffsetOf_VertexAttrib1f_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib1f, indx) == 4, - OffsetOf_VertexAttrib1f_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib1f, x) == 8, - OffsetOf_VertexAttrib1f_x_not_8); - -struct VertexAttrib1fv { - typedef VertexAttrib1fv ValueType; - static const CommandId kCmdId = kVertexAttrib1fv; - 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { - SetHeader(); - indx = _indx; - values_shm_id = _values_shm_id; - values_shm_offset = _values_shm_offset; - } - - void* Set( - void* cmd, GLuint _indx, uint32 _values_shm_id, - uint32 _values_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_indx, _values_shm_id, _values_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - uint32 values_shm_id; - uint32 values_shm_offset; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib1fv) == 16, - Sizeof_VertexAttrib1fv_is_not_16); -COMPILE_ASSERT(offsetof(VertexAttrib1fv, header) == 0, - OffsetOf_VertexAttrib1fv_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib1fv, indx) == 4, - OffsetOf_VertexAttrib1fv_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib1fv, values_shm_id) == 8, - OffsetOf_VertexAttrib1fv_values_shm_id_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib1fv, values_shm_offset) == 12, - OffsetOf_VertexAttrib1fv_values_shm_offset_not_12); - -struct VertexAttrib1fvImmediate { - typedef VertexAttrib1fvImmediate ValueType; - static const CommandId kCmdId = kVertexAttrib1fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize() { - return static_cast<uint32>( - sizeof(GLfloat) * 1); // NOLINT - } - - static uint32 ComputeSize() { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize()); // NOLINT - } - - void SetHeader() { - header.SetCmdByTotalSize<ValueType>(ComputeSize()); - } - - void Init(GLuint _indx, const GLfloat* _values) { - SetHeader(); - indx = _indx; - memcpy(ImmediateDataAddress(this), - _values, ComputeDataSize()); - } - - void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { - static_cast<ValueType*>(cmd)->Init(_indx, _values); - const uint32 size = ComputeSize(); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 indx; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib1fvImmediate) == 8, - Sizeof_VertexAttrib1fvImmediate_is_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib1fvImmediate, header) == 0, - OffsetOf_VertexAttrib1fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib1fvImmediate, indx) == 4, - OffsetOf_VertexAttrib1fvImmediate_indx_not_4); - -struct VertexAttrib2f { - typedef VertexAttrib2f ValueType; - static const CommandId kCmdId = kVertexAttrib2f; - 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 _indx, GLfloat _x, GLfloat _y) { - SetHeader(); - indx = _indx; - x = _x; - y = _y; - } - - void* Set(void* cmd, GLuint _indx, GLfloat _x, GLfloat _y) { - static_cast<ValueType*>(cmd)->Init(_indx, _x, _y); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - float x; - float y; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib2f) == 16, - Sizeof_VertexAttrib2f_is_not_16); -COMPILE_ASSERT(offsetof(VertexAttrib2f, header) == 0, - OffsetOf_VertexAttrib2f_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib2f, indx) == 4, - OffsetOf_VertexAttrib2f_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib2f, x) == 8, - OffsetOf_VertexAttrib2f_x_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib2f, y) == 12, - OffsetOf_VertexAttrib2f_y_not_12); - -struct VertexAttrib2fv { - typedef VertexAttrib2fv ValueType; - static const CommandId kCmdId = kVertexAttrib2fv; - 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { - SetHeader(); - indx = _indx; - values_shm_id = _values_shm_id; - values_shm_offset = _values_shm_offset; - } - - void* Set( - void* cmd, GLuint _indx, uint32 _values_shm_id, - uint32 _values_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_indx, _values_shm_id, _values_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - uint32 values_shm_id; - uint32 values_shm_offset; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib2fv) == 16, - Sizeof_VertexAttrib2fv_is_not_16); -COMPILE_ASSERT(offsetof(VertexAttrib2fv, header) == 0, - OffsetOf_VertexAttrib2fv_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib2fv, indx) == 4, - OffsetOf_VertexAttrib2fv_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib2fv, values_shm_id) == 8, - OffsetOf_VertexAttrib2fv_values_shm_id_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib2fv, values_shm_offset) == 12, - OffsetOf_VertexAttrib2fv_values_shm_offset_not_12); - -struct VertexAttrib2fvImmediate { - typedef VertexAttrib2fvImmediate ValueType; - static const CommandId kCmdId = kVertexAttrib2fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize() { - return static_cast<uint32>( - sizeof(GLfloat) * 2); // NOLINT - } - - static uint32 ComputeSize() { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize()); // NOLINT - } - - void SetHeader() { - header.SetCmdByTotalSize<ValueType>(ComputeSize()); - } - - void Init(GLuint _indx, const GLfloat* _values) { - SetHeader(); - indx = _indx; - memcpy(ImmediateDataAddress(this), - _values, ComputeDataSize()); - } - - void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { - static_cast<ValueType*>(cmd)->Init(_indx, _values); - const uint32 size = ComputeSize(); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 indx; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib2fvImmediate) == 8, - Sizeof_VertexAttrib2fvImmediate_is_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib2fvImmediate, header) == 0, - OffsetOf_VertexAttrib2fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib2fvImmediate, indx) == 4, - OffsetOf_VertexAttrib2fvImmediate_indx_not_4); - -struct VertexAttrib3f { - typedef VertexAttrib3f ValueType; - static const CommandId kCmdId = kVertexAttrib3f; - 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 _indx, GLfloat _x, GLfloat _y, GLfloat _z) { - SetHeader(); - indx = _indx; - x = _x; - y = _y; - z = _z; - } - - void* Set(void* cmd, GLuint _indx, GLfloat _x, GLfloat _y, GLfloat _z) { - static_cast<ValueType*>(cmd)->Init(_indx, _x, _y, _z); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - float x; - float y; - float z; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib3f) == 20, - Sizeof_VertexAttrib3f_is_not_20); -COMPILE_ASSERT(offsetof(VertexAttrib3f, header) == 0, - OffsetOf_VertexAttrib3f_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib3f, indx) == 4, - OffsetOf_VertexAttrib3f_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib3f, x) == 8, - OffsetOf_VertexAttrib3f_x_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib3f, y) == 12, - OffsetOf_VertexAttrib3f_y_not_12); -COMPILE_ASSERT(offsetof(VertexAttrib3f, z) == 16, - OffsetOf_VertexAttrib3f_z_not_16); - -struct VertexAttrib3fv { - typedef VertexAttrib3fv ValueType; - static const CommandId kCmdId = kVertexAttrib3fv; - 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { - SetHeader(); - indx = _indx; - values_shm_id = _values_shm_id; - values_shm_offset = _values_shm_offset; - } - - void* Set( - void* cmd, GLuint _indx, uint32 _values_shm_id, - uint32 _values_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_indx, _values_shm_id, _values_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - uint32 values_shm_id; - uint32 values_shm_offset; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib3fv) == 16, - Sizeof_VertexAttrib3fv_is_not_16); -COMPILE_ASSERT(offsetof(VertexAttrib3fv, header) == 0, - OffsetOf_VertexAttrib3fv_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib3fv, indx) == 4, - OffsetOf_VertexAttrib3fv_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib3fv, values_shm_id) == 8, - OffsetOf_VertexAttrib3fv_values_shm_id_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib3fv, values_shm_offset) == 12, - OffsetOf_VertexAttrib3fv_values_shm_offset_not_12); - -struct VertexAttrib3fvImmediate { - typedef VertexAttrib3fvImmediate ValueType; - static const CommandId kCmdId = kVertexAttrib3fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize() { - return static_cast<uint32>( - sizeof(GLfloat) * 3); // NOLINT - } - - static uint32 ComputeSize() { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize()); // NOLINT - } - - void SetHeader() { - header.SetCmdByTotalSize<ValueType>(ComputeSize()); - } - - void Init(GLuint _indx, const GLfloat* _values) { - SetHeader(); - indx = _indx; - memcpy(ImmediateDataAddress(this), - _values, ComputeDataSize()); - } - - void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { - static_cast<ValueType*>(cmd)->Init(_indx, _values); - const uint32 size = ComputeSize(); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 indx; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib3fvImmediate) == 8, - Sizeof_VertexAttrib3fvImmediate_is_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib3fvImmediate, header) == 0, - OffsetOf_VertexAttrib3fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib3fvImmediate, indx) == 4, - OffsetOf_VertexAttrib3fvImmediate_indx_not_4); - -struct VertexAttrib4f { - typedef VertexAttrib4f ValueType; - static const CommandId kCmdId = kVertexAttrib4f; - 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 _indx, GLfloat _x, GLfloat _y, GLfloat _z, GLfloat _w) { - SetHeader(); - indx = _indx; - x = _x; - y = _y; - z = _z; - w = _w; - } - - void* Set( - void* cmd, GLuint _indx, GLfloat _x, GLfloat _y, GLfloat _z, - GLfloat _w) { - static_cast<ValueType*>(cmd)->Init(_indx, _x, _y, _z, _w); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - float x; - float y; - float z; - float w; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib4f) == 24, - Sizeof_VertexAttrib4f_is_not_24); -COMPILE_ASSERT(offsetof(VertexAttrib4f, header) == 0, - OffsetOf_VertexAttrib4f_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib4f, indx) == 4, - OffsetOf_VertexAttrib4f_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib4f, x) == 8, - OffsetOf_VertexAttrib4f_x_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib4f, y) == 12, - OffsetOf_VertexAttrib4f_y_not_12); -COMPILE_ASSERT(offsetof(VertexAttrib4f, z) == 16, - OffsetOf_VertexAttrib4f_z_not_16); -COMPILE_ASSERT(offsetof(VertexAttrib4f, w) == 20, - OffsetOf_VertexAttrib4f_w_not_20); - -struct VertexAttrib4fv { - typedef VertexAttrib4fv ValueType; - static const CommandId kCmdId = kVertexAttrib4fv; - 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { - SetHeader(); - indx = _indx; - values_shm_id = _values_shm_id; - values_shm_offset = _values_shm_offset; - } - - void* Set( - void* cmd, GLuint _indx, uint32 _values_shm_id, - uint32 _values_shm_offset) { - static_cast<ValueType*>( - cmd)->Init(_indx, _values_shm_id, _values_shm_offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - uint32 values_shm_id; - uint32 values_shm_offset; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib4fv) == 16, - Sizeof_VertexAttrib4fv_is_not_16); -COMPILE_ASSERT(offsetof(VertexAttrib4fv, header) == 0, - OffsetOf_VertexAttrib4fv_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib4fv, indx) == 4, - OffsetOf_VertexAttrib4fv_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttrib4fv, values_shm_id) == 8, - OffsetOf_VertexAttrib4fv_values_shm_id_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib4fv, values_shm_offset) == 12, - OffsetOf_VertexAttrib4fv_values_shm_offset_not_12); - -struct VertexAttrib4fvImmediate { - typedef VertexAttrib4fvImmediate ValueType; - static const CommandId kCmdId = kVertexAttrib4fvImmediate; - static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; - - static uint32 ComputeDataSize() { - return static_cast<uint32>( - sizeof(GLfloat) * 4); // NOLINT - } - - static uint32 ComputeSize() { - return static_cast<uint32>( - sizeof(ValueType) + ComputeDataSize()); // NOLINT - } - - void SetHeader() { - header.SetCmdByTotalSize<ValueType>(ComputeSize()); - } - - void Init(GLuint _indx, const GLfloat* _values) { - SetHeader(); - indx = _indx; - memcpy(ImmediateDataAddress(this), - _values, ComputeDataSize()); - } - - void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { - static_cast<ValueType*>(cmd)->Init(_indx, _values); - const uint32 size = ComputeSize(); - return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); - } - - command_buffer::CommandHeader header; - uint32 indx; -}; - -COMPILE_ASSERT(sizeof(VertexAttrib4fvImmediate) == 8, - Sizeof_VertexAttrib4fvImmediate_is_not_8); -COMPILE_ASSERT(offsetof(VertexAttrib4fvImmediate, header) == 0, - OffsetOf_VertexAttrib4fvImmediate_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttrib4fvImmediate, indx) == 4, - OffsetOf_VertexAttrib4fvImmediate_indx_not_4); - -struct VertexAttribPointer { - typedef VertexAttribPointer ValueType; - static const CommandId kCmdId = kVertexAttribPointer; - 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 _indx, GLint _size, GLenum _type, GLboolean _normalized, - GLsizei _stride, GLuint _offset) { - SetHeader(); - indx = _indx; - size = _size; - type = _type; - normalized = _normalized; - stride = _stride; - offset = _offset; - } - - void* Set( - void* cmd, GLuint _indx, GLint _size, GLenum _type, GLboolean _normalized, - GLsizei _stride, GLuint _offset) { - static_cast<ValueType*>( - cmd)->Init(_indx, _size, _type, _normalized, _stride, _offset); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 indx; - uint32 size; - uint32 type; - uint32 normalized; - uint32 stride; - uint32 offset; -}; - -COMPILE_ASSERT(sizeof(VertexAttribPointer) == 28, - Sizeof_VertexAttribPointer_is_not_28); -COMPILE_ASSERT(offsetof(VertexAttribPointer, header) == 0, - OffsetOf_VertexAttribPointer_header_not_0); -COMPILE_ASSERT(offsetof(VertexAttribPointer, indx) == 4, - OffsetOf_VertexAttribPointer_indx_not_4); -COMPILE_ASSERT(offsetof(VertexAttribPointer, size) == 8, - OffsetOf_VertexAttribPointer_size_not_8); -COMPILE_ASSERT(offsetof(VertexAttribPointer, type) == 12, - OffsetOf_VertexAttribPointer_type_not_12); -COMPILE_ASSERT(offsetof(VertexAttribPointer, normalized) == 16, - OffsetOf_VertexAttribPointer_normalized_not_16); -COMPILE_ASSERT(offsetof(VertexAttribPointer, stride) == 20, - OffsetOf_VertexAttribPointer_stride_not_20); -COMPILE_ASSERT(offsetof(VertexAttribPointer, offset) == 24, - OffsetOf_VertexAttribPointer_offset_not_24); - -struct Viewport { - typedef Viewport ValueType; - static const CommandId kCmdId = kViewport; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - - static uint32 ComputeSize() { - return static_cast<uint32>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { - header.SetCmd<ValueType>(); - } - - void Init(GLint _x, GLint _y, GLsizei _width, GLsizei _height) { - SetHeader(); - x = _x; - y = _y; - width = _width; - height = _height; - } - - void* Set(void* cmd, GLint _x, GLint _y, GLsizei _width, GLsizei _height) { - static_cast<ValueType*>(cmd)->Init(_x, _y, _width, _height); - return NextCmdAddress<ValueType>(cmd); - } - - command_buffer::CommandHeader header; - uint32 x; - uint32 y; - uint32 width; - uint32 height; -}; - -COMPILE_ASSERT(sizeof(Viewport) == 20, - Sizeof_Viewport_is_not_20); -COMPILE_ASSERT(offsetof(Viewport, header) == 0, - OffsetOf_Viewport_header_not_0); -COMPILE_ASSERT(offsetof(Viewport, x) == 4, - OffsetOf_Viewport_x_not_4); -COMPILE_ASSERT(offsetof(Viewport, y) == 8, - OffsetOf_Viewport_y_not_8); -COMPILE_ASSERT(offsetof(Viewport, width) == 12, - OffsetOf_Viewport_width_not_12); -COMPILE_ASSERT(offsetof(Viewport, height) == 16, - OffsetOf_Viewport_height_not_16); +#include "gpu/command_buffer/common/gles2_cmd_format_autogen.h" } // namespace gles2 } // namespace command_buffer -#pragma pack(pop) +#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H -#endif // O3D_SPUD_O3D_GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/o3d/gpu/command_buffer/common/gles2_cmd_format_autogen.h new file mode 100644 index 0000000..88ccec0 --- /dev/null +++ b/o3d/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -0,0 +1,8248 @@ +// This file is auto-generated. DO NOT EDIT! + +#pragma pack(push, 1) + +struct ActiveTexture { + typedef ActiveTexture ValueType; + static const CommandId kCmdId = kActiveTexture; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _texture) { + SetHeader(); + texture = _texture; + } + + void* Set(void* cmd, GLenum _texture) { + static_cast<ValueType*>(cmd)->Init(_texture); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 texture; +}; + +COMPILE_ASSERT(sizeof(ActiveTexture) == 8, + Sizeof_ActiveTexture_is_not_8); +COMPILE_ASSERT(offsetof(ActiveTexture, header) == 0, + OffsetOf_ActiveTexture_header_not_0); +COMPILE_ASSERT(offsetof(ActiveTexture, texture) == 4, + OffsetOf_ActiveTexture_texture_not_4); + +struct AttachShader { + typedef AttachShader ValueType; + static const CommandId kCmdId = kAttachShader; + 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, GLuint _shader) { + SetHeader(); + program = _program; + shader = _shader; + } + + void* Set(void* cmd, GLuint _program, GLuint _shader) { + static_cast<ValueType*>(cmd)->Init(_program, _shader); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 shader; +}; + +COMPILE_ASSERT(sizeof(AttachShader) == 12, + Sizeof_AttachShader_is_not_12); +COMPILE_ASSERT(offsetof(AttachShader, header) == 0, + OffsetOf_AttachShader_header_not_0); +COMPILE_ASSERT(offsetof(AttachShader, program) == 4, + OffsetOf_AttachShader_program_not_4); +COMPILE_ASSERT(offsetof(AttachShader, shader) == 8, + OffsetOf_AttachShader_shader_not_8); + +struct BindAttribLocation { + typedef BindAttribLocation ValueType; + static const CommandId kCmdId = kBindAttribLocation; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLuint _program, GLuint _index, uint32 _name_shm_id, + uint32 _name_shm_offset, uint32 _data_size) { + SetHeader(); + program = _program; + index = _index; + name_shm_id = _name_shm_id; + name_shm_offset = _name_shm_offset; + data_size = _data_size; + } + + void* Set( + void* cmd, GLuint _program, GLuint _index, uint32 _name_shm_id, + uint32 _name_shm_offset, uint32 _data_size) { + static_cast<ValueType*>( + cmd)->Init( + _program, _index, _name_shm_id, _name_shm_offset, _data_size); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 index; + uint32 name_shm_id; + uint32 name_shm_offset; + uint32 data_size; +}; + +COMPILE_ASSERT(sizeof(BindAttribLocation) == 24, + Sizeof_BindAttribLocation_is_not_24); +COMPILE_ASSERT(offsetof(BindAttribLocation, header) == 0, + OffsetOf_BindAttribLocation_header_not_0); +COMPILE_ASSERT(offsetof(BindAttribLocation, program) == 4, + OffsetOf_BindAttribLocation_program_not_4); +COMPILE_ASSERT(offsetof(BindAttribLocation, index) == 8, + OffsetOf_BindAttribLocation_index_not_8); +COMPILE_ASSERT(offsetof(BindAttribLocation, name_shm_id) == 12, + OffsetOf_BindAttribLocation_name_shm_id_not_12); +COMPILE_ASSERT(offsetof(BindAttribLocation, name_shm_offset) == 16, + OffsetOf_BindAttribLocation_name_shm_offset_not_16); +COMPILE_ASSERT(offsetof(BindAttribLocation, data_size) == 20, + OffsetOf_BindAttribLocation_data_size_not_20); + +struct BindAttribLocationImmediate { + typedef BindAttribLocationImmediate ValueType; + static const CommandId kCmdId = kBindAttribLocationImmediate; + 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, GLuint _index, const char* _name) { + SetHeader(_name); + program = _program; + index = _index; + data_size = strlen(_name); + memcpy(ImmediateDataAddress(this), _name, data_size); + } + + void* Set(void* cmd, GLuint _program, GLuint _index, const char* _name) { + static_cast<ValueType*>(cmd)->Init(_program, _index, _name); + const uint32 size = ComputeSize(_name); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 index; + uint32 data_size; +}; + +COMPILE_ASSERT(sizeof(BindAttribLocationImmediate) == 16, + Sizeof_BindAttribLocationImmediate_is_not_16); +COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, header) == 0, + OffsetOf_BindAttribLocationImmediate_header_not_0); +COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, program) == 4, + OffsetOf_BindAttribLocationImmediate_program_not_4); +COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, index) == 8, + OffsetOf_BindAttribLocationImmediate_index_not_8); +COMPILE_ASSERT(offsetof(BindAttribLocationImmediate, data_size) == 12, + OffsetOf_BindAttribLocationImmediate_data_size_not_12); + +struct BindBuffer { + typedef BindBuffer ValueType; + static const CommandId kCmdId = kBindBuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLuint _buffer) { + SetHeader(); + target = _target; + buffer = _buffer; + } + + void* Set(void* cmd, GLenum _target, GLuint _buffer) { + static_cast<ValueType*>(cmd)->Init(_target, _buffer); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 buffer; +}; + +COMPILE_ASSERT(sizeof(BindBuffer) == 12, + Sizeof_BindBuffer_is_not_12); +COMPILE_ASSERT(offsetof(BindBuffer, header) == 0, + OffsetOf_BindBuffer_header_not_0); +COMPILE_ASSERT(offsetof(BindBuffer, target) == 4, + OffsetOf_BindBuffer_target_not_4); +COMPILE_ASSERT(offsetof(BindBuffer, buffer) == 8, + OffsetOf_BindBuffer_buffer_not_8); + +struct BindFramebuffer { + typedef BindFramebuffer ValueType; + static const CommandId kCmdId = kBindFramebuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLuint _framebuffer) { + SetHeader(); + target = _target; + framebuffer = _framebuffer; + } + + void* Set(void* cmd, GLenum _target, GLuint _framebuffer) { + static_cast<ValueType*>(cmd)->Init(_target, _framebuffer); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 framebuffer; +}; + +COMPILE_ASSERT(sizeof(BindFramebuffer) == 12, + Sizeof_BindFramebuffer_is_not_12); +COMPILE_ASSERT(offsetof(BindFramebuffer, header) == 0, + OffsetOf_BindFramebuffer_header_not_0); +COMPILE_ASSERT(offsetof(BindFramebuffer, target) == 4, + OffsetOf_BindFramebuffer_target_not_4); +COMPILE_ASSERT(offsetof(BindFramebuffer, framebuffer) == 8, + OffsetOf_BindFramebuffer_framebuffer_not_8); + +struct BindRenderbuffer { + typedef BindRenderbuffer ValueType; + static const CommandId kCmdId = kBindRenderbuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLuint _renderbuffer) { + SetHeader(); + target = _target; + renderbuffer = _renderbuffer; + } + + void* Set(void* cmd, GLenum _target, GLuint _renderbuffer) { + static_cast<ValueType*>(cmd)->Init(_target, _renderbuffer); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 renderbuffer; +}; + +COMPILE_ASSERT(sizeof(BindRenderbuffer) == 12, + Sizeof_BindRenderbuffer_is_not_12); +COMPILE_ASSERT(offsetof(BindRenderbuffer, header) == 0, + OffsetOf_BindRenderbuffer_header_not_0); +COMPILE_ASSERT(offsetof(BindRenderbuffer, target) == 4, + OffsetOf_BindRenderbuffer_target_not_4); +COMPILE_ASSERT(offsetof(BindRenderbuffer, renderbuffer) == 8, + OffsetOf_BindRenderbuffer_renderbuffer_not_8); + +struct BindTexture { + typedef BindTexture ValueType; + static const CommandId kCmdId = kBindTexture; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLuint _texture) { + SetHeader(); + target = _target; + texture = _texture; + } + + void* Set(void* cmd, GLenum _target, GLuint _texture) { + static_cast<ValueType*>(cmd)->Init(_target, _texture); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 texture; +}; + +COMPILE_ASSERT(sizeof(BindTexture) == 12, + Sizeof_BindTexture_is_not_12); +COMPILE_ASSERT(offsetof(BindTexture, header) == 0, + OffsetOf_BindTexture_header_not_0); +COMPILE_ASSERT(offsetof(BindTexture, target) == 4, + OffsetOf_BindTexture_target_not_4); +COMPILE_ASSERT(offsetof(BindTexture, texture) == 8, + OffsetOf_BindTexture_texture_not_8); + +struct BlendColor { + typedef BlendColor ValueType; + static const CommandId kCmdId = kBlendColor; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLclampf _red, GLclampf _green, GLclampf _blue, GLclampf _alpha) { + SetHeader(); + red = _red; + green = _green; + blue = _blue; + alpha = _alpha; + } + + void* Set( + void* cmd, GLclampf _red, GLclampf _green, GLclampf _blue, + GLclampf _alpha) { + static_cast<ValueType*>(cmd)->Init(_red, _green, _blue, _alpha); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float red; + float green; + float blue; + float alpha; +}; + +COMPILE_ASSERT(sizeof(BlendColor) == 20, + Sizeof_BlendColor_is_not_20); +COMPILE_ASSERT(offsetof(BlendColor, header) == 0, + OffsetOf_BlendColor_header_not_0); +COMPILE_ASSERT(offsetof(BlendColor, red) == 4, + OffsetOf_BlendColor_red_not_4); +COMPILE_ASSERT(offsetof(BlendColor, green) == 8, + OffsetOf_BlendColor_green_not_8); +COMPILE_ASSERT(offsetof(BlendColor, blue) == 12, + OffsetOf_BlendColor_blue_not_12); +COMPILE_ASSERT(offsetof(BlendColor, alpha) == 16, + OffsetOf_BlendColor_alpha_not_16); + +struct BlendEquation { + typedef BlendEquation ValueType; + static const CommandId kCmdId = kBlendEquation; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _mode) { + SetHeader(); + mode = _mode; + } + + void* Set(void* cmd, GLenum _mode) { + static_cast<ValueType*>(cmd)->Init(_mode); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mode; +}; + +COMPILE_ASSERT(sizeof(BlendEquation) == 8, + Sizeof_BlendEquation_is_not_8); +COMPILE_ASSERT(offsetof(BlendEquation, header) == 0, + OffsetOf_BlendEquation_header_not_0); +COMPILE_ASSERT(offsetof(BlendEquation, mode) == 4, + OffsetOf_BlendEquation_mode_not_4); + +struct BlendEquationSeparate { + typedef BlendEquationSeparate ValueType; + static const CommandId kCmdId = kBlendEquationSeparate; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _modeRGB, GLenum _modeAlpha) { + SetHeader(); + modeRGB = _modeRGB; + modeAlpha = _modeAlpha; + } + + void* Set(void* cmd, GLenum _modeRGB, GLenum _modeAlpha) { + static_cast<ValueType*>(cmd)->Init(_modeRGB, _modeAlpha); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 modeRGB; + uint32 modeAlpha; +}; + +COMPILE_ASSERT(sizeof(BlendEquationSeparate) == 12, + Sizeof_BlendEquationSeparate_is_not_12); +COMPILE_ASSERT(offsetof(BlendEquationSeparate, header) == 0, + OffsetOf_BlendEquationSeparate_header_not_0); +COMPILE_ASSERT(offsetof(BlendEquationSeparate, modeRGB) == 4, + OffsetOf_BlendEquationSeparate_modeRGB_not_4); +COMPILE_ASSERT(offsetof(BlendEquationSeparate, modeAlpha) == 8, + OffsetOf_BlendEquationSeparate_modeAlpha_not_8); + +struct BlendFunc { + typedef BlendFunc ValueType; + static const CommandId kCmdId = kBlendFunc; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _sfactor, GLenum _dfactor) { + SetHeader(); + sfactor = _sfactor; + dfactor = _dfactor; + } + + void* Set(void* cmd, GLenum _sfactor, GLenum _dfactor) { + static_cast<ValueType*>(cmd)->Init(_sfactor, _dfactor); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 sfactor; + uint32 dfactor; +}; + +COMPILE_ASSERT(sizeof(BlendFunc) == 12, + Sizeof_BlendFunc_is_not_12); +COMPILE_ASSERT(offsetof(BlendFunc, header) == 0, + OffsetOf_BlendFunc_header_not_0); +COMPILE_ASSERT(offsetof(BlendFunc, sfactor) == 4, + OffsetOf_BlendFunc_sfactor_not_4); +COMPILE_ASSERT(offsetof(BlendFunc, dfactor) == 8, + OffsetOf_BlendFunc_dfactor_not_8); + +struct BlendFuncSeparate { + typedef BlendFuncSeparate ValueType; + static const CommandId kCmdId = kBlendFuncSeparate; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha, GLenum _dstAlpha) { + SetHeader(); + srcRGB = _srcRGB; + dstRGB = _dstRGB; + srcAlpha = _srcAlpha; + dstAlpha = _dstAlpha; + } + + void* Set( + void* cmd, GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha, + GLenum _dstAlpha) { + static_cast<ValueType*>(cmd)->Init(_srcRGB, _dstRGB, _srcAlpha, _dstAlpha); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 srcRGB; + uint32 dstRGB; + uint32 srcAlpha; + uint32 dstAlpha; +}; + +COMPILE_ASSERT(sizeof(BlendFuncSeparate) == 20, + Sizeof_BlendFuncSeparate_is_not_20); +COMPILE_ASSERT(offsetof(BlendFuncSeparate, header) == 0, + OffsetOf_BlendFuncSeparate_header_not_0); +COMPILE_ASSERT(offsetof(BlendFuncSeparate, srcRGB) == 4, + OffsetOf_BlendFuncSeparate_srcRGB_not_4); +COMPILE_ASSERT(offsetof(BlendFuncSeparate, dstRGB) == 8, + OffsetOf_BlendFuncSeparate_dstRGB_not_8); +COMPILE_ASSERT(offsetof(BlendFuncSeparate, srcAlpha) == 12, + OffsetOf_BlendFuncSeparate_srcAlpha_not_12); +COMPILE_ASSERT(offsetof(BlendFuncSeparate, dstAlpha) == 16, + OffsetOf_BlendFuncSeparate_dstAlpha_not_16); + +struct BufferData { + typedef BufferData ValueType; + static const CommandId kCmdId = kBufferData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLsizeiptr _size, uint32 _data_shm_id, + uint32 _data_shm_offset, GLenum _usage) { + SetHeader(); + target = _target; + size = _size; + data_shm_id = _data_shm_id; + data_shm_offset = _data_shm_offset; + usage = _usage; + } + + void* Set( + void* cmd, GLenum _target, GLsizeiptr _size, uint32 _data_shm_id, + uint32 _data_shm_offset, GLenum _usage) { + static_cast<ValueType*>( + cmd)->Init(_target, _size, _data_shm_id, _data_shm_offset, _usage); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 size; + uint32 data_shm_id; + uint32 data_shm_offset; + uint32 usage; +}; + +COMPILE_ASSERT(sizeof(BufferData) == 24, + Sizeof_BufferData_is_not_24); +COMPILE_ASSERT(offsetof(BufferData, header) == 0, + OffsetOf_BufferData_header_not_0); +COMPILE_ASSERT(offsetof(BufferData, target) == 4, + OffsetOf_BufferData_target_not_4); +COMPILE_ASSERT(offsetof(BufferData, size) == 8, + OffsetOf_BufferData_size_not_8); +COMPILE_ASSERT(offsetof(BufferData, data_shm_id) == 12, + OffsetOf_BufferData_data_shm_id_not_12); +COMPILE_ASSERT(offsetof(BufferData, data_shm_offset) == 16, + OffsetOf_BufferData_data_shm_offset_not_16); +COMPILE_ASSERT(offsetof(BufferData, usage) == 20, + OffsetOf_BufferData_usage_not_20); + +struct BufferDataImmediate { + typedef BufferDataImmediate ValueType; + static const CommandId kCmdId = kBufferDataImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + void Init(GLenum _target, GLsizeiptr _size, GLenum _usage) { + uint32 total_size = ComputeSize(_size); + SetHeader(total_size); + target = _target; + size = _size; + usage = _usage; + } + + void* Set(void* cmd, GLenum _target, GLsizeiptr _size, GLenum _usage) { + uint32 total_size = ComputeSize(_size); + static_cast<ValueType*>(cmd)->Init(_target, _size, _usage); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 size; + uint32 usage; +}; + +COMPILE_ASSERT(sizeof(BufferDataImmediate) == 16, + Sizeof_BufferDataImmediate_is_not_16); +COMPILE_ASSERT(offsetof(BufferDataImmediate, header) == 0, + OffsetOf_BufferDataImmediate_header_not_0); +COMPILE_ASSERT(offsetof(BufferDataImmediate, target) == 4, + OffsetOf_BufferDataImmediate_target_not_4); +COMPILE_ASSERT(offsetof(BufferDataImmediate, size) == 8, + OffsetOf_BufferDataImmediate_size_not_8); +COMPILE_ASSERT(offsetof(BufferDataImmediate, usage) == 12, + OffsetOf_BufferDataImmediate_usage_not_12); + +struct BufferSubData { + typedef BufferSubData ValueType; + static const CommandId kCmdId = kBufferSubData; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLintptr _offset, GLsizeiptr _size, uint32 _data_shm_id, + uint32 _data_shm_offset) { + SetHeader(); + target = _target; + offset = _offset; + size = _size; + data_shm_id = _data_shm_id; + data_shm_offset = _data_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLintptr _offset, GLsizeiptr _size, + uint32 _data_shm_id, uint32 _data_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _offset, _size, _data_shm_id, _data_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 offset; + uint32 size; + uint32 data_shm_id; + uint32 data_shm_offset; +}; + +COMPILE_ASSERT(sizeof(BufferSubData) == 24, + Sizeof_BufferSubData_is_not_24); +COMPILE_ASSERT(offsetof(BufferSubData, header) == 0, + OffsetOf_BufferSubData_header_not_0); +COMPILE_ASSERT(offsetof(BufferSubData, target) == 4, + OffsetOf_BufferSubData_target_not_4); +COMPILE_ASSERT(offsetof(BufferSubData, offset) == 8, + OffsetOf_BufferSubData_offset_not_8); +COMPILE_ASSERT(offsetof(BufferSubData, size) == 12, + OffsetOf_BufferSubData_size_not_12); +COMPILE_ASSERT(offsetof(BufferSubData, data_shm_id) == 16, + OffsetOf_BufferSubData_data_shm_id_not_16); +COMPILE_ASSERT(offsetof(BufferSubData, data_shm_offset) == 20, + OffsetOf_BufferSubData_data_shm_offset_not_20); + +struct BufferSubDataImmediate { + typedef BufferSubDataImmediate ValueType; + static const CommandId kCmdId = kBufferSubDataImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + void Init(GLenum _target, GLintptr _offset, GLsizeiptr _size) { + uint32 total_size = ComputeSize(_size); + SetHeader(total_size); + target = _target; + offset = _offset; + size = _size; + } + + void* Set(void* cmd, GLenum _target, GLintptr _offset, GLsizeiptr _size) { + uint32 total_size = ComputeSize(_size); + static_cast<ValueType*>(cmd)->Init(_target, _offset, _size); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 offset; + uint32 size; +}; + +COMPILE_ASSERT(sizeof(BufferSubDataImmediate) == 16, + Sizeof_BufferSubDataImmediate_is_not_16); +COMPILE_ASSERT(offsetof(BufferSubDataImmediate, header) == 0, + OffsetOf_BufferSubDataImmediate_header_not_0); +COMPILE_ASSERT(offsetof(BufferSubDataImmediate, target) == 4, + OffsetOf_BufferSubDataImmediate_target_not_4); +COMPILE_ASSERT(offsetof(BufferSubDataImmediate, offset) == 8, + OffsetOf_BufferSubDataImmediate_offset_not_8); +COMPILE_ASSERT(offsetof(BufferSubDataImmediate, size) == 12, + OffsetOf_BufferSubDataImmediate_size_not_12); + +struct CheckFramebufferStatus { + typedef CheckFramebufferStatus ValueType; + static const CommandId kCmdId = kCheckFramebufferStatus; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target) { + SetHeader(); + target = _target; + } + + void* Set(void* cmd, GLenum _target) { + static_cast<ValueType*>(cmd)->Init(_target); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; +}; + +COMPILE_ASSERT(sizeof(CheckFramebufferStatus) == 8, + Sizeof_CheckFramebufferStatus_is_not_8); +COMPILE_ASSERT(offsetof(CheckFramebufferStatus, header) == 0, + OffsetOf_CheckFramebufferStatus_header_not_0); +COMPILE_ASSERT(offsetof(CheckFramebufferStatus, target) == 4, + OffsetOf_CheckFramebufferStatus_target_not_4); + +struct Clear { + typedef Clear ValueType; + static const CommandId kCmdId = kClear; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLbitfield _mask) { + SetHeader(); + mask = _mask; + } + + void* Set(void* cmd, GLbitfield _mask) { + static_cast<ValueType*>(cmd)->Init(_mask); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mask; +}; + +COMPILE_ASSERT(sizeof(Clear) == 8, + Sizeof_Clear_is_not_8); +COMPILE_ASSERT(offsetof(Clear, header) == 0, + OffsetOf_Clear_header_not_0); +COMPILE_ASSERT(offsetof(Clear, mask) == 4, + OffsetOf_Clear_mask_not_4); + +struct ClearColor { + typedef ClearColor ValueType; + static const CommandId kCmdId = kClearColor; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLclampf _red, GLclampf _green, GLclampf _blue, GLclampf _alpha) { + SetHeader(); + red = _red; + green = _green; + blue = _blue; + alpha = _alpha; + } + + void* Set( + void* cmd, GLclampf _red, GLclampf _green, GLclampf _blue, + GLclampf _alpha) { + static_cast<ValueType*>(cmd)->Init(_red, _green, _blue, _alpha); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float red; + float green; + float blue; + float alpha; +}; + +COMPILE_ASSERT(sizeof(ClearColor) == 20, + Sizeof_ClearColor_is_not_20); +COMPILE_ASSERT(offsetof(ClearColor, header) == 0, + OffsetOf_ClearColor_header_not_0); +COMPILE_ASSERT(offsetof(ClearColor, red) == 4, + OffsetOf_ClearColor_red_not_4); +COMPILE_ASSERT(offsetof(ClearColor, green) == 8, + OffsetOf_ClearColor_green_not_8); +COMPILE_ASSERT(offsetof(ClearColor, blue) == 12, + OffsetOf_ClearColor_blue_not_12); +COMPILE_ASSERT(offsetof(ClearColor, alpha) == 16, + OffsetOf_ClearColor_alpha_not_16); + +struct ClearDepthf { + typedef ClearDepthf ValueType; + static const CommandId kCmdId = kClearDepthf; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLclampf _depth) { + SetHeader(); + depth = _depth; + } + + void* Set(void* cmd, GLclampf _depth) { + static_cast<ValueType*>(cmd)->Init(_depth); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float depth; +}; + +COMPILE_ASSERT(sizeof(ClearDepthf) == 8, + Sizeof_ClearDepthf_is_not_8); +COMPILE_ASSERT(offsetof(ClearDepthf, header) == 0, + OffsetOf_ClearDepthf_header_not_0); +COMPILE_ASSERT(offsetof(ClearDepthf, depth) == 4, + OffsetOf_ClearDepthf_depth_not_4); + +struct ClearStencil { + typedef ClearStencil ValueType; + static const CommandId kCmdId = kClearStencil; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _s) { + SetHeader(); + s = _s; + } + + void* Set(void* cmd, GLint _s) { + static_cast<ValueType*>(cmd)->Init(_s); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 s; +}; + +COMPILE_ASSERT(sizeof(ClearStencil) == 8, + Sizeof_ClearStencil_is_not_8); +COMPILE_ASSERT(offsetof(ClearStencil, header) == 0, + OffsetOf_ClearStencil_header_not_0); +COMPILE_ASSERT(offsetof(ClearStencil, s) == 4, + OffsetOf_ClearStencil_s_not_4); + +struct ColorMask { + typedef ColorMask ValueType; + static const CommandId kCmdId = kColorMask; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLboolean _red, GLboolean _green, GLboolean _blue, GLboolean _alpha) { + SetHeader(); + red = _red; + green = _green; + blue = _blue; + alpha = _alpha; + } + + void* Set( + void* cmd, GLboolean _red, GLboolean _green, GLboolean _blue, + GLboolean _alpha) { + static_cast<ValueType*>(cmd)->Init(_red, _green, _blue, _alpha); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 red; + uint32 green; + uint32 blue; + uint32 alpha; +}; + +COMPILE_ASSERT(sizeof(ColorMask) == 20, + Sizeof_ColorMask_is_not_20); +COMPILE_ASSERT(offsetof(ColorMask, header) == 0, + OffsetOf_ColorMask_header_not_0); +COMPILE_ASSERT(offsetof(ColorMask, red) == 4, + OffsetOf_ColorMask_red_not_4); +COMPILE_ASSERT(offsetof(ColorMask, green) == 8, + OffsetOf_ColorMask_green_not_8); +COMPILE_ASSERT(offsetof(ColorMask, blue) == 12, + OffsetOf_ColorMask_blue_not_12); +COMPILE_ASSERT(offsetof(ColorMask, alpha) == 16, + OffsetOf_ColorMask_alpha_not_16); + +struct CompileShader { + typedef CompileShader ValueType; + static const CommandId kCmdId = kCompileShader; + 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 _shader) { + SetHeader(); + shader = _shader; + } + + void* Set(void* cmd, GLuint _shader) { + static_cast<ValueType*>(cmd)->Init(_shader); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; +}; + +COMPILE_ASSERT(sizeof(CompileShader) == 8, + Sizeof_CompileShader_is_not_8); +COMPILE_ASSERT(offsetof(CompileShader, header) == 0, + OffsetOf_CompileShader_header_not_0); +COMPILE_ASSERT(offsetof(CompileShader, shader) == 4, + OffsetOf_CompileShader_shader_not_4); + +struct CompressedTexImage2D { + typedef CompressedTexImage2D ValueType; + static const CommandId kCmdId = kCompressedTexImage2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, + GLsizei _height, GLint _border, GLsizei _imageSize, uint32 _data_shm_id, + uint32 _data_shm_offset) { + SetHeader(); + target = _target; + level = _level; + internalformat = _internalformat; + width = _width; + height = _height; + border = _border; + imageSize = _imageSize; + data_shm_id = _data_shm_id; + data_shm_offset = _data_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLenum _internalformat, + GLsizei _width, GLsizei _height, GLint _border, GLsizei _imageSize, + uint32 _data_shm_id, uint32 _data_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _internalformat, _width, _height, _border, + _imageSize, _data_shm_id, _data_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 internalformat; + uint32 width; + uint32 height; + uint32 border; + uint32 imageSize; + uint32 data_shm_id; + uint32 data_shm_offset; +}; + +COMPILE_ASSERT(sizeof(CompressedTexImage2D) == 40, + Sizeof_CompressedTexImage2D_is_not_40); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, header) == 0, + OffsetOf_CompressedTexImage2D_header_not_0); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, target) == 4, + OffsetOf_CompressedTexImage2D_target_not_4); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, level) == 8, + OffsetOf_CompressedTexImage2D_level_not_8); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, internalformat) == 12, + OffsetOf_CompressedTexImage2D_internalformat_not_12); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, width) == 16, + OffsetOf_CompressedTexImage2D_width_not_16); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, height) == 20, + OffsetOf_CompressedTexImage2D_height_not_20); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, border) == 24, + OffsetOf_CompressedTexImage2D_border_not_24); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, imageSize) == 28, + OffsetOf_CompressedTexImage2D_imageSize_not_28); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, data_shm_id) == 32, + OffsetOf_CompressedTexImage2D_data_shm_id_not_32); +COMPILE_ASSERT(offsetof(CompressedTexImage2D, data_shm_offset) == 36, + OffsetOf_CompressedTexImage2D_data_shm_offset_not_36); + +struct CompressedTexImage2DImmediate { + typedef CompressedTexImage2DImmediate ValueType; + static const CommandId kCmdId = kCompressedTexImage2DImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + void Init( + GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, + GLsizei _height, GLint _border, GLsizei _imageSize) { + uint32 total_size = ComputeSize(_imageSize); + SetHeader(total_size); + target = _target; + level = _level; + internalformat = _internalformat; + width = _width; + height = _height; + border = _border; + imageSize = _imageSize; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLenum _internalformat, + GLsizei _width, GLsizei _height, GLint _border, GLsizei _imageSize) { + uint32 total_size = ComputeSize(_imageSize); + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _internalformat, _width, _height, _border, + _imageSize); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 internalformat; + uint32 width; + uint32 height; + uint32 border; + uint32 imageSize; +}; + +COMPILE_ASSERT(sizeof(CompressedTexImage2DImmediate) == 32, + Sizeof_CompressedTexImage2DImmediate_is_not_32); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, header) == 0, + OffsetOf_CompressedTexImage2DImmediate_header_not_0); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, target) == 4, + OffsetOf_CompressedTexImage2DImmediate_target_not_4); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, level) == 8, + OffsetOf_CompressedTexImage2DImmediate_level_not_8); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, internalformat) == 12, + OffsetOf_CompressedTexImage2DImmediate_internalformat_not_12); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, width) == 16, + OffsetOf_CompressedTexImage2DImmediate_width_not_16); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, height) == 20, + OffsetOf_CompressedTexImage2DImmediate_height_not_20); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, border) == 24, + OffsetOf_CompressedTexImage2DImmediate_border_not_24); +COMPILE_ASSERT(offsetof(CompressedTexImage2DImmediate, imageSize) == 28, + OffsetOf_CompressedTexImage2DImmediate_imageSize_not_28); + +struct CompressedTexSubImage2D { + typedef CompressedTexSubImage2D ValueType; + static const CommandId kCmdId = kCompressedTexSubImage2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize, + uint32 _data_shm_id, uint32 _data_shm_offset) { + SetHeader(); + target = _target; + level = _level; + xoffset = _xoffset; + yoffset = _yoffset; + width = _width; + height = _height; + format = _format; + imageSize = _imageSize; + data_shm_id = _data_shm_id; + data_shm_offset = _data_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize, + uint32 _data_shm_id, uint32 _data_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _xoffset, _yoffset, _width, _height, _format, + _imageSize, _data_shm_id, _data_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 xoffset; + uint32 yoffset; + uint32 width; + uint32 height; + uint32 format; + uint32 imageSize; + uint32 data_shm_id; + uint32 data_shm_offset; +}; + +COMPILE_ASSERT(sizeof(CompressedTexSubImage2D) == 44, + Sizeof_CompressedTexSubImage2D_is_not_44); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, header) == 0, + OffsetOf_CompressedTexSubImage2D_header_not_0); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, target) == 4, + OffsetOf_CompressedTexSubImage2D_target_not_4); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, level) == 8, + OffsetOf_CompressedTexSubImage2D_level_not_8); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, xoffset) == 12, + OffsetOf_CompressedTexSubImage2D_xoffset_not_12); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, yoffset) == 16, + OffsetOf_CompressedTexSubImage2D_yoffset_not_16); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, width) == 20, + OffsetOf_CompressedTexSubImage2D_width_not_20); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, height) == 24, + OffsetOf_CompressedTexSubImage2D_height_not_24); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, format) == 28, + OffsetOf_CompressedTexSubImage2D_format_not_28); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, imageSize) == 32, + OffsetOf_CompressedTexSubImage2D_imageSize_not_32); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, data_shm_id) == 36, + OffsetOf_CompressedTexSubImage2D_data_shm_id_not_36); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2D, data_shm_offset) == 40, + OffsetOf_CompressedTexSubImage2D_data_shm_offset_not_40); + +struct CompressedTexSubImage2DImmediate { + typedef CompressedTexSubImage2DImmediate ValueType; + static const CommandId kCmdId = kCompressedTexSubImage2DImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + void Init( + GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize) { + uint32 total_size = ComputeSize(_imageSize); + SetHeader(total_size); + target = _target; + level = _level; + xoffset = _xoffset; + yoffset = _yoffset; + width = _width; + height = _height; + format = _format; + imageSize = _imageSize; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLsizei _imageSize) { + uint32 total_size = ComputeSize(_imageSize); + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _xoffset, _yoffset, _width, _height, _format, + _imageSize); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 xoffset; + uint32 yoffset; + uint32 width; + uint32 height; + uint32 format; + uint32 imageSize; +}; + +COMPILE_ASSERT(sizeof(CompressedTexSubImage2DImmediate) == 36, + Sizeof_CompressedTexSubImage2DImmediate_is_not_36); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, header) == 0, + OffsetOf_CompressedTexSubImage2DImmediate_header_not_0); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, target) == 4, + OffsetOf_CompressedTexSubImage2DImmediate_target_not_4); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, level) == 8, + OffsetOf_CompressedTexSubImage2DImmediate_level_not_8); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, xoffset) == 12, + OffsetOf_CompressedTexSubImage2DImmediate_xoffset_not_12); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, yoffset) == 16, + OffsetOf_CompressedTexSubImage2DImmediate_yoffset_not_16); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, width) == 20, + OffsetOf_CompressedTexSubImage2DImmediate_width_not_20); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, height) == 24, + OffsetOf_CompressedTexSubImage2DImmediate_height_not_24); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, format) == 28, + OffsetOf_CompressedTexSubImage2DImmediate_format_not_28); +COMPILE_ASSERT(offsetof(CompressedTexSubImage2DImmediate, imageSize) == 32, + OffsetOf_CompressedTexSubImage2DImmediate_imageSize_not_32); + +struct CopyTexImage2D { + typedef CopyTexImage2D ValueType; + static const CommandId kCmdId = kCopyTexImage2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLint _level, GLenum _internalformat, GLint _x, GLint _y, + GLsizei _width, GLsizei _height, GLint _border) { + SetHeader(); + target = _target; + level = _level; + internalformat = _internalformat; + x = _x; + y = _y; + width = _width; + height = _height; + border = _border; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLenum _internalformat, GLint _x, + GLint _y, GLsizei _width, GLsizei _height, GLint _border) { + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _internalformat, _x, _y, _width, _height, + _border); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 internalformat; + uint32 x; + uint32 y; + uint32 width; + uint32 height; + uint32 border; +}; + +COMPILE_ASSERT(sizeof(CopyTexImage2D) == 36, + Sizeof_CopyTexImage2D_is_not_36); +COMPILE_ASSERT(offsetof(CopyTexImage2D, header) == 0, + OffsetOf_CopyTexImage2D_header_not_0); +COMPILE_ASSERT(offsetof(CopyTexImage2D, target) == 4, + OffsetOf_CopyTexImage2D_target_not_4); +COMPILE_ASSERT(offsetof(CopyTexImage2D, level) == 8, + OffsetOf_CopyTexImage2D_level_not_8); +COMPILE_ASSERT(offsetof(CopyTexImage2D, internalformat) == 12, + OffsetOf_CopyTexImage2D_internalformat_not_12); +COMPILE_ASSERT(offsetof(CopyTexImage2D, x) == 16, + OffsetOf_CopyTexImage2D_x_not_16); +COMPILE_ASSERT(offsetof(CopyTexImage2D, y) == 20, + OffsetOf_CopyTexImage2D_y_not_20); +COMPILE_ASSERT(offsetof(CopyTexImage2D, width) == 24, + OffsetOf_CopyTexImage2D_width_not_24); +COMPILE_ASSERT(offsetof(CopyTexImage2D, height) == 28, + OffsetOf_CopyTexImage2D_height_not_28); +COMPILE_ASSERT(offsetof(CopyTexImage2D, border) == 32, + OffsetOf_CopyTexImage2D_border_not_32); + +struct CopyTexSubImage2D { + typedef CopyTexSubImage2D ValueType; + static const CommandId kCmdId = kCopyTexSubImage2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _x, + GLint _y, GLsizei _width, GLsizei _height) { + SetHeader(); + target = _target; + level = _level; + xoffset = _xoffset; + yoffset = _yoffset; + x = _x; + y = _y; + width = _width; + height = _height; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLint _x, GLint _y, GLsizei _width, GLsizei _height) { + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _xoffset, _yoffset, _x, _y, _width, _height); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 xoffset; + uint32 yoffset; + uint32 x; + uint32 y; + uint32 width; + uint32 height; +}; + +COMPILE_ASSERT(sizeof(CopyTexSubImage2D) == 36, + Sizeof_CopyTexSubImage2D_is_not_36); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, header) == 0, + OffsetOf_CopyTexSubImage2D_header_not_0); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, target) == 4, + OffsetOf_CopyTexSubImage2D_target_not_4); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, level) == 8, + OffsetOf_CopyTexSubImage2D_level_not_8); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, xoffset) == 12, + OffsetOf_CopyTexSubImage2D_xoffset_not_12); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, yoffset) == 16, + OffsetOf_CopyTexSubImage2D_yoffset_not_16); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, x) == 20, + OffsetOf_CopyTexSubImage2D_x_not_20); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, y) == 24, + OffsetOf_CopyTexSubImage2D_y_not_24); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, width) == 28, + OffsetOf_CopyTexSubImage2D_width_not_28); +COMPILE_ASSERT(offsetof(CopyTexSubImage2D, height) == 32, + OffsetOf_CopyTexSubImage2D_height_not_32); + +struct CreateProgram { + typedef CreateProgram ValueType; + static const CommandId kCmdId = kCreateProgram; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(uint32 _client_id) { + SetHeader(); + client_id = _client_id; + } + + void* Set(void* cmd, uint32 _client_id) { + static_cast<ValueType*>(cmd)->Init(_client_id); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 client_id; +}; + +COMPILE_ASSERT(sizeof(CreateProgram) == 8, + Sizeof_CreateProgram_is_not_8); +COMPILE_ASSERT(offsetof(CreateProgram, header) == 0, + OffsetOf_CreateProgram_header_not_0); +COMPILE_ASSERT(offsetof(CreateProgram, client_id) == 4, + OffsetOf_CreateProgram_client_id_not_4); + +struct CreateShader { + typedef CreateShader ValueType; + static const CommandId kCmdId = kCreateShader; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _type, uint32 _client_id) { + SetHeader(); + type = _type; + client_id = _client_id; + } + + void* Set(void* cmd, GLenum _type, uint32 _client_id) { + static_cast<ValueType*>(cmd)->Init(_type, _client_id); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 type; + uint32 client_id; +}; + +COMPILE_ASSERT(sizeof(CreateShader) == 12, + Sizeof_CreateShader_is_not_12); +COMPILE_ASSERT(offsetof(CreateShader, header) == 0, + OffsetOf_CreateShader_header_not_0); +COMPILE_ASSERT(offsetof(CreateShader, type) == 4, + OffsetOf_CreateShader_type_not_4); +COMPILE_ASSERT(offsetof(CreateShader, client_id) == 8, + OffsetOf_CreateShader_client_id_not_8); + +struct CullFace { + typedef CullFace ValueType; + static const CommandId kCmdId = kCullFace; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _mode) { + SetHeader(); + mode = _mode; + } + + void* Set(void* cmd, GLenum _mode) { + static_cast<ValueType*>(cmd)->Init(_mode); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mode; +}; + +COMPILE_ASSERT(sizeof(CullFace) == 8, + Sizeof_CullFace_is_not_8); +COMPILE_ASSERT(offsetof(CullFace, header) == 0, + OffsetOf_CullFace_header_not_0); +COMPILE_ASSERT(offsetof(CullFace, mode) == 4, + OffsetOf_CullFace_mode_not_4); + +struct DeleteBuffers { + typedef DeleteBuffers ValueType; + static const CommandId kCmdId = kDeleteBuffers; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLsizei _n, uint32 _buffers_shm_id, uint32 _buffers_shm_offset) { + SetHeader(); + n = _n; + buffers_shm_id = _buffers_shm_id; + buffers_shm_offset = _buffers_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _buffers_shm_id, + uint32 _buffers_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _buffers_shm_id, _buffers_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 buffers_shm_id; + uint32 buffers_shm_offset; +}; + +COMPILE_ASSERT(sizeof(DeleteBuffers) == 16, + Sizeof_DeleteBuffers_is_not_16); +COMPILE_ASSERT(offsetof(DeleteBuffers, header) == 0, + OffsetOf_DeleteBuffers_header_not_0); +COMPILE_ASSERT(offsetof(DeleteBuffers, n) == 4, + OffsetOf_DeleteBuffers_n_not_4); +COMPILE_ASSERT(offsetof(DeleteBuffers, buffers_shm_id) == 8, + OffsetOf_DeleteBuffers_buffers_shm_id_not_8); +COMPILE_ASSERT(offsetof(DeleteBuffers, buffers_shm_offset) == 12, + OffsetOf_DeleteBuffers_buffers_shm_offset_not_12); + +struct DeleteBuffersImmediate { + typedef DeleteBuffersImmediate ValueType; + static const CommandId kCmdId = kDeleteBuffersImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, const GLuint* _buffers) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _buffers, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, const GLuint* _buffers) { + static_cast<ValueType*>(cmd)->Init(_n, _buffers); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(DeleteBuffersImmediate) == 8, + Sizeof_DeleteBuffersImmediate_is_not_8); +COMPILE_ASSERT(offsetof(DeleteBuffersImmediate, header) == 0, + OffsetOf_DeleteBuffersImmediate_header_not_0); +COMPILE_ASSERT(offsetof(DeleteBuffersImmediate, n) == 4, + OffsetOf_DeleteBuffersImmediate_n_not_4); + +struct DeleteFramebuffers { + typedef DeleteFramebuffers ValueType; + static const CommandId kCmdId = kDeleteFramebuffers; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLsizei _n, uint32 _framebuffers_shm_id, + uint32 _framebuffers_shm_offset) { + SetHeader(); + n = _n; + framebuffers_shm_id = _framebuffers_shm_id; + framebuffers_shm_offset = _framebuffers_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _framebuffers_shm_id, + uint32 _framebuffers_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _framebuffers_shm_id, _framebuffers_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 framebuffers_shm_id; + uint32 framebuffers_shm_offset; +}; + +COMPILE_ASSERT(sizeof(DeleteFramebuffers) == 16, + Sizeof_DeleteFramebuffers_is_not_16); +COMPILE_ASSERT(offsetof(DeleteFramebuffers, header) == 0, + OffsetOf_DeleteFramebuffers_header_not_0); +COMPILE_ASSERT(offsetof(DeleteFramebuffers, n) == 4, + OffsetOf_DeleteFramebuffers_n_not_4); +COMPILE_ASSERT(offsetof(DeleteFramebuffers, framebuffers_shm_id) == 8, + OffsetOf_DeleteFramebuffers_framebuffers_shm_id_not_8); +COMPILE_ASSERT(offsetof(DeleteFramebuffers, framebuffers_shm_offset) == 12, + OffsetOf_DeleteFramebuffers_framebuffers_shm_offset_not_12); + +struct DeleteFramebuffersImmediate { + typedef DeleteFramebuffersImmediate ValueType; + static const CommandId kCmdId = kDeleteFramebuffersImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, const GLuint* _framebuffers) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _framebuffers, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, const GLuint* _framebuffers) { + static_cast<ValueType*>(cmd)->Init(_n, _framebuffers); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(DeleteFramebuffersImmediate) == 8, + Sizeof_DeleteFramebuffersImmediate_is_not_8); +COMPILE_ASSERT(offsetof(DeleteFramebuffersImmediate, header) == 0, + OffsetOf_DeleteFramebuffersImmediate_header_not_0); +COMPILE_ASSERT(offsetof(DeleteFramebuffersImmediate, n) == 4, + OffsetOf_DeleteFramebuffersImmediate_n_not_4); + +struct DeleteProgram { + typedef DeleteProgram ValueType; + static const CommandId kCmdId = kDeleteProgram; + 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) { + SetHeader(); + program = _program; + } + + void* Set(void* cmd, GLuint _program) { + static_cast<ValueType*>(cmd)->Init(_program); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; +}; + +COMPILE_ASSERT(sizeof(DeleteProgram) == 8, + Sizeof_DeleteProgram_is_not_8); +COMPILE_ASSERT(offsetof(DeleteProgram, header) == 0, + OffsetOf_DeleteProgram_header_not_0); +COMPILE_ASSERT(offsetof(DeleteProgram, program) == 4, + OffsetOf_DeleteProgram_program_not_4); + +struct DeleteRenderbuffers { + typedef DeleteRenderbuffers ValueType; + static const CommandId kCmdId = kDeleteRenderbuffers; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLsizei _n, uint32 _renderbuffers_shm_id, + uint32 _renderbuffers_shm_offset) { + SetHeader(); + n = _n; + renderbuffers_shm_id = _renderbuffers_shm_id; + renderbuffers_shm_offset = _renderbuffers_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _renderbuffers_shm_id, + uint32 _renderbuffers_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _renderbuffers_shm_id, _renderbuffers_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 renderbuffers_shm_id; + uint32 renderbuffers_shm_offset; +}; + +COMPILE_ASSERT(sizeof(DeleteRenderbuffers) == 16, + Sizeof_DeleteRenderbuffers_is_not_16); +COMPILE_ASSERT(offsetof(DeleteRenderbuffers, header) == 0, + OffsetOf_DeleteRenderbuffers_header_not_0); +COMPILE_ASSERT(offsetof(DeleteRenderbuffers, n) == 4, + OffsetOf_DeleteRenderbuffers_n_not_4); +COMPILE_ASSERT(offsetof(DeleteRenderbuffers, renderbuffers_shm_id) == 8, + OffsetOf_DeleteRenderbuffers_renderbuffers_shm_id_not_8); +COMPILE_ASSERT(offsetof(DeleteRenderbuffers, renderbuffers_shm_offset) == 12, + OffsetOf_DeleteRenderbuffers_renderbuffers_shm_offset_not_12); + +struct DeleteRenderbuffersImmediate { + typedef DeleteRenderbuffersImmediate ValueType; + static const CommandId kCmdId = kDeleteRenderbuffersImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, const GLuint* _renderbuffers) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _renderbuffers, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, const GLuint* _renderbuffers) { + static_cast<ValueType*>(cmd)->Init(_n, _renderbuffers); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(DeleteRenderbuffersImmediate) == 8, + Sizeof_DeleteRenderbuffersImmediate_is_not_8); +COMPILE_ASSERT(offsetof(DeleteRenderbuffersImmediate, header) == 0, + OffsetOf_DeleteRenderbuffersImmediate_header_not_0); +COMPILE_ASSERT(offsetof(DeleteRenderbuffersImmediate, n) == 4, + OffsetOf_DeleteRenderbuffersImmediate_n_not_4); + +struct DeleteShader { + typedef DeleteShader ValueType; + static const CommandId kCmdId = kDeleteShader; + 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 _shader) { + SetHeader(); + shader = _shader; + } + + void* Set(void* cmd, GLuint _shader) { + static_cast<ValueType*>(cmd)->Init(_shader); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; +}; + +COMPILE_ASSERT(sizeof(DeleteShader) == 8, + Sizeof_DeleteShader_is_not_8); +COMPILE_ASSERT(offsetof(DeleteShader, header) == 0, + OffsetOf_DeleteShader_header_not_0); +COMPILE_ASSERT(offsetof(DeleteShader, shader) == 4, + OffsetOf_DeleteShader_shader_not_4); + +struct DeleteTextures { + typedef DeleteTextures ValueType; + static const CommandId kCmdId = kDeleteTextures; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLsizei _n, uint32 _textures_shm_id, uint32 _textures_shm_offset) { + SetHeader(); + n = _n; + textures_shm_id = _textures_shm_id; + textures_shm_offset = _textures_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _textures_shm_id, + uint32 _textures_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _textures_shm_id, _textures_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 textures_shm_id; + uint32 textures_shm_offset; +}; + +COMPILE_ASSERT(sizeof(DeleteTextures) == 16, + Sizeof_DeleteTextures_is_not_16); +COMPILE_ASSERT(offsetof(DeleteTextures, header) == 0, + OffsetOf_DeleteTextures_header_not_0); +COMPILE_ASSERT(offsetof(DeleteTextures, n) == 4, + OffsetOf_DeleteTextures_n_not_4); +COMPILE_ASSERT(offsetof(DeleteTextures, textures_shm_id) == 8, + OffsetOf_DeleteTextures_textures_shm_id_not_8); +COMPILE_ASSERT(offsetof(DeleteTextures, textures_shm_offset) == 12, + OffsetOf_DeleteTextures_textures_shm_offset_not_12); + +struct DeleteTexturesImmediate { + typedef DeleteTexturesImmediate ValueType; + static const CommandId kCmdId = kDeleteTexturesImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, const GLuint* _textures) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _textures, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, const GLuint* _textures) { + static_cast<ValueType*>(cmd)->Init(_n, _textures); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(DeleteTexturesImmediate) == 8, + Sizeof_DeleteTexturesImmediate_is_not_8); +COMPILE_ASSERT(offsetof(DeleteTexturesImmediate, header) == 0, + OffsetOf_DeleteTexturesImmediate_header_not_0); +COMPILE_ASSERT(offsetof(DeleteTexturesImmediate, n) == 4, + OffsetOf_DeleteTexturesImmediate_n_not_4); + +struct DepthFunc { + typedef DepthFunc ValueType; + static const CommandId kCmdId = kDepthFunc; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _func) { + SetHeader(); + func = _func; + } + + void* Set(void* cmd, GLenum _func) { + static_cast<ValueType*>(cmd)->Init(_func); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 func; +}; + +COMPILE_ASSERT(sizeof(DepthFunc) == 8, + Sizeof_DepthFunc_is_not_8); +COMPILE_ASSERT(offsetof(DepthFunc, header) == 0, + OffsetOf_DepthFunc_header_not_0); +COMPILE_ASSERT(offsetof(DepthFunc, func) == 4, + OffsetOf_DepthFunc_func_not_4); + +struct DepthMask { + typedef DepthMask ValueType; + static const CommandId kCmdId = kDepthMask; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLboolean _flag) { + SetHeader(); + flag = _flag; + } + + void* Set(void* cmd, GLboolean _flag) { + static_cast<ValueType*>(cmd)->Init(_flag); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 flag; +}; + +COMPILE_ASSERT(sizeof(DepthMask) == 8, + Sizeof_DepthMask_is_not_8); +COMPILE_ASSERT(offsetof(DepthMask, header) == 0, + OffsetOf_DepthMask_header_not_0); +COMPILE_ASSERT(offsetof(DepthMask, flag) == 4, + OffsetOf_DepthMask_flag_not_4); + +struct DepthRangef { + typedef DepthRangef ValueType; + static const CommandId kCmdId = kDepthRangef; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLclampf _zNear, GLclampf _zFar) { + SetHeader(); + zNear = _zNear; + zFar = _zFar; + } + + void* Set(void* cmd, GLclampf _zNear, GLclampf _zFar) { + static_cast<ValueType*>(cmd)->Init(_zNear, _zFar); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float zNear; + float zFar; +}; + +COMPILE_ASSERT(sizeof(DepthRangef) == 12, + Sizeof_DepthRangef_is_not_12); +COMPILE_ASSERT(offsetof(DepthRangef, header) == 0, + OffsetOf_DepthRangef_header_not_0); +COMPILE_ASSERT(offsetof(DepthRangef, zNear) == 4, + OffsetOf_DepthRangef_zNear_not_4); +COMPILE_ASSERT(offsetof(DepthRangef, zFar) == 8, + OffsetOf_DepthRangef_zFar_not_8); + +struct DetachShader { + typedef DetachShader ValueType; + static const CommandId kCmdId = kDetachShader; + 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, GLuint _shader) { + SetHeader(); + program = _program; + shader = _shader; + } + + void* Set(void* cmd, GLuint _program, GLuint _shader) { + static_cast<ValueType*>(cmd)->Init(_program, _shader); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 shader; +}; + +COMPILE_ASSERT(sizeof(DetachShader) == 12, + Sizeof_DetachShader_is_not_12); +COMPILE_ASSERT(offsetof(DetachShader, header) == 0, + OffsetOf_DetachShader_header_not_0); +COMPILE_ASSERT(offsetof(DetachShader, program) == 4, + OffsetOf_DetachShader_program_not_4); +COMPILE_ASSERT(offsetof(DetachShader, shader) == 8, + OffsetOf_DetachShader_shader_not_8); + +struct Disable { + typedef Disable ValueType; + static const CommandId kCmdId = kDisable; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _cap) { + SetHeader(); + cap = _cap; + } + + void* Set(void* cmd, GLenum _cap) { + static_cast<ValueType*>(cmd)->Init(_cap); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 cap; +}; + +COMPILE_ASSERT(sizeof(Disable) == 8, + Sizeof_Disable_is_not_8); +COMPILE_ASSERT(offsetof(Disable, header) == 0, + OffsetOf_Disable_header_not_0); +COMPILE_ASSERT(offsetof(Disable, cap) == 4, + OffsetOf_Disable_cap_not_4); + +struct DisableVertexAttribArray { + typedef DisableVertexAttribArray ValueType; + static const CommandId kCmdId = kDisableVertexAttribArray; + 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 _index) { + SetHeader(); + index = _index; + } + + void* Set(void* cmd, GLuint _index) { + static_cast<ValueType*>(cmd)->Init(_index); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 index; +}; + +COMPILE_ASSERT(sizeof(DisableVertexAttribArray) == 8, + Sizeof_DisableVertexAttribArray_is_not_8); +COMPILE_ASSERT(offsetof(DisableVertexAttribArray, header) == 0, + OffsetOf_DisableVertexAttribArray_header_not_0); +COMPILE_ASSERT(offsetof(DisableVertexAttribArray, index) == 4, + OffsetOf_DisableVertexAttribArray_index_not_4); + +struct DrawArrays { + typedef DrawArrays ValueType; + static const CommandId kCmdId = kDrawArrays; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _mode, GLint _first, GLsizei _count) { + SetHeader(); + mode = _mode; + first = _first; + count = _count; + } + + void* Set(void* cmd, GLenum _mode, GLint _first, GLsizei _count) { + static_cast<ValueType*>(cmd)->Init(_mode, _first, _count); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mode; + uint32 first; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(DrawArrays) == 16, + Sizeof_DrawArrays_is_not_16); +COMPILE_ASSERT(offsetof(DrawArrays, header) == 0, + OffsetOf_DrawArrays_header_not_0); +COMPILE_ASSERT(offsetof(DrawArrays, mode) == 4, + OffsetOf_DrawArrays_mode_not_4); +COMPILE_ASSERT(offsetof(DrawArrays, first) == 8, + OffsetOf_DrawArrays_first_not_8); +COMPILE_ASSERT(offsetof(DrawArrays, count) == 12, + OffsetOf_DrawArrays_count_not_12); + +struct DrawElements { + typedef DrawElements ValueType; + static const CommandId kCmdId = kDrawElements; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _mode, GLsizei _count, GLenum _type, GLuint _index_offset) { + SetHeader(); + mode = _mode; + count = _count; + type = _type; + index_offset = _index_offset; + } + + void* Set( + void* cmd, GLenum _mode, GLsizei _count, GLenum _type, + GLuint _index_offset) { + static_cast<ValueType*>(cmd)->Init(_mode, _count, _type, _index_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mode; + uint32 count; + uint32 type; + uint32 index_offset; +}; + +COMPILE_ASSERT(sizeof(DrawElements) == 20, + Sizeof_DrawElements_is_not_20); +COMPILE_ASSERT(offsetof(DrawElements, header) == 0, + OffsetOf_DrawElements_header_not_0); +COMPILE_ASSERT(offsetof(DrawElements, mode) == 4, + OffsetOf_DrawElements_mode_not_4); +COMPILE_ASSERT(offsetof(DrawElements, count) == 8, + OffsetOf_DrawElements_count_not_8); +COMPILE_ASSERT(offsetof(DrawElements, type) == 12, + OffsetOf_DrawElements_type_not_12); +COMPILE_ASSERT(offsetof(DrawElements, index_offset) == 16, + OffsetOf_DrawElements_index_offset_not_16); + +struct Enable { + typedef Enable ValueType; + static const CommandId kCmdId = kEnable; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _cap) { + SetHeader(); + cap = _cap; + } + + void* Set(void* cmd, GLenum _cap) { + static_cast<ValueType*>(cmd)->Init(_cap); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 cap; +}; + +COMPILE_ASSERT(sizeof(Enable) == 8, + Sizeof_Enable_is_not_8); +COMPILE_ASSERT(offsetof(Enable, header) == 0, + OffsetOf_Enable_header_not_0); +COMPILE_ASSERT(offsetof(Enable, cap) == 4, + OffsetOf_Enable_cap_not_4); + +struct EnableVertexAttribArray { + typedef EnableVertexAttribArray ValueType; + static const CommandId kCmdId = kEnableVertexAttribArray; + 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 _index) { + SetHeader(); + index = _index; + } + + void* Set(void* cmd, GLuint _index) { + static_cast<ValueType*>(cmd)->Init(_index); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 index; +}; + +COMPILE_ASSERT(sizeof(EnableVertexAttribArray) == 8, + Sizeof_EnableVertexAttribArray_is_not_8); +COMPILE_ASSERT(offsetof(EnableVertexAttribArray, header) == 0, + OffsetOf_EnableVertexAttribArray_header_not_0); +COMPILE_ASSERT(offsetof(EnableVertexAttribArray, index) == 4, + OffsetOf_EnableVertexAttribArray_index_not_4); + +struct Finish { + typedef Finish ValueType; + static const CommandId kCmdId = kFinish; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init() { + SetHeader(); + } + + void* Set(void* cmd) { + static_cast<ValueType*>(cmd)->Init(); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; +}; + +COMPILE_ASSERT(sizeof(Finish) == 4, + Sizeof_Finish_is_not_4); +COMPILE_ASSERT(offsetof(Finish, header) == 0, + OffsetOf_Finish_header_not_0); + +struct Flush { + typedef Flush ValueType; + static const CommandId kCmdId = kFlush; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init() { + SetHeader(); + } + + void* Set(void* cmd) { + static_cast<ValueType*>(cmd)->Init(); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; +}; + +COMPILE_ASSERT(sizeof(Flush) == 4, + Sizeof_Flush_is_not_4); +COMPILE_ASSERT(offsetof(Flush, header) == 0, + OffsetOf_Flush_header_not_0); + +struct FramebufferRenderbuffer { + typedef FramebufferRenderbuffer ValueType; + static const CommandId kCmdId = kFramebufferRenderbuffer; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _attachment, GLenum _renderbuffertarget, + GLuint _renderbuffer) { + SetHeader(); + target = _target; + attachment = _attachment; + renderbuffertarget = _renderbuffertarget; + renderbuffer = _renderbuffer; + } + + void* Set( + void* cmd, GLenum _target, GLenum _attachment, GLenum _renderbuffertarget, + GLuint _renderbuffer) { + static_cast<ValueType*>( + cmd)->Init(_target, _attachment, _renderbuffertarget, _renderbuffer); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 attachment; + uint32 renderbuffertarget; + uint32 renderbuffer; +}; + +COMPILE_ASSERT(sizeof(FramebufferRenderbuffer) == 20, + Sizeof_FramebufferRenderbuffer_is_not_20); +COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, header) == 0, + OffsetOf_FramebufferRenderbuffer_header_not_0); +COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, target) == 4, + OffsetOf_FramebufferRenderbuffer_target_not_4); +COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, attachment) == 8, + OffsetOf_FramebufferRenderbuffer_attachment_not_8); +COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, renderbuffertarget) == 12, + OffsetOf_FramebufferRenderbuffer_renderbuffertarget_not_12); +COMPILE_ASSERT(offsetof(FramebufferRenderbuffer, renderbuffer) == 16, + OffsetOf_FramebufferRenderbuffer_renderbuffer_not_16); + +struct FramebufferTexture2D { + typedef FramebufferTexture2D ValueType; + static const CommandId kCmdId = kFramebufferTexture2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _attachment, GLenum _textarget, GLuint _texture, + GLint _level) { + SetHeader(); + target = _target; + attachment = _attachment; + textarget = _textarget; + texture = _texture; + level = _level; + } + + void* Set( + void* cmd, GLenum _target, GLenum _attachment, GLenum _textarget, + GLuint _texture, GLint _level) { + static_cast<ValueType*>( + cmd)->Init(_target, _attachment, _textarget, _texture, _level); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 attachment; + uint32 textarget; + uint32 texture; + uint32 level; +}; + +COMPILE_ASSERT(sizeof(FramebufferTexture2D) == 24, + Sizeof_FramebufferTexture2D_is_not_24); +COMPILE_ASSERT(offsetof(FramebufferTexture2D, header) == 0, + OffsetOf_FramebufferTexture2D_header_not_0); +COMPILE_ASSERT(offsetof(FramebufferTexture2D, target) == 4, + OffsetOf_FramebufferTexture2D_target_not_4); +COMPILE_ASSERT(offsetof(FramebufferTexture2D, attachment) == 8, + OffsetOf_FramebufferTexture2D_attachment_not_8); +COMPILE_ASSERT(offsetof(FramebufferTexture2D, textarget) == 12, + OffsetOf_FramebufferTexture2D_textarget_not_12); +COMPILE_ASSERT(offsetof(FramebufferTexture2D, texture) == 16, + OffsetOf_FramebufferTexture2D_texture_not_16); +COMPILE_ASSERT(offsetof(FramebufferTexture2D, level) == 20, + OffsetOf_FramebufferTexture2D_level_not_20); + +struct FrontFace { + typedef FrontFace ValueType; + static const CommandId kCmdId = kFrontFace; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _mode) { + SetHeader(); + mode = _mode; + } + + void* Set(void* cmd, GLenum _mode) { + static_cast<ValueType*>(cmd)->Init(_mode); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mode; +}; + +COMPILE_ASSERT(sizeof(FrontFace) == 8, + Sizeof_FrontFace_is_not_8); +COMPILE_ASSERT(offsetof(FrontFace, header) == 0, + OffsetOf_FrontFace_header_not_0); +COMPILE_ASSERT(offsetof(FrontFace, mode) == 4, + OffsetOf_FrontFace_mode_not_4); + +struct GenBuffers { + typedef GenBuffers ValueType; + static const CommandId kCmdId = kGenBuffers; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLsizei _n, uint32 _buffers_shm_id, uint32 _buffers_shm_offset) { + SetHeader(); + n = _n; + buffers_shm_id = _buffers_shm_id; + buffers_shm_offset = _buffers_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _buffers_shm_id, + uint32 _buffers_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _buffers_shm_id, _buffers_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 buffers_shm_id; + uint32 buffers_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GenBuffers) == 16, + Sizeof_GenBuffers_is_not_16); +COMPILE_ASSERT(offsetof(GenBuffers, header) == 0, + OffsetOf_GenBuffers_header_not_0); +COMPILE_ASSERT(offsetof(GenBuffers, n) == 4, + OffsetOf_GenBuffers_n_not_4); +COMPILE_ASSERT(offsetof(GenBuffers, buffers_shm_id) == 8, + OffsetOf_GenBuffers_buffers_shm_id_not_8); +COMPILE_ASSERT(offsetof(GenBuffers, buffers_shm_offset) == 12, + OffsetOf_GenBuffers_buffers_shm_offset_not_12); + +struct GenBuffersImmediate { + typedef GenBuffersImmediate ValueType; + static const CommandId kCmdId = kGenBuffersImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, GLuint* _buffers) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _buffers, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, GLuint* _buffers) { + static_cast<ValueType*>(cmd)->Init(_n, _buffers); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(GenBuffersImmediate) == 8, + Sizeof_GenBuffersImmediate_is_not_8); +COMPILE_ASSERT(offsetof(GenBuffersImmediate, header) == 0, + OffsetOf_GenBuffersImmediate_header_not_0); +COMPILE_ASSERT(offsetof(GenBuffersImmediate, n) == 4, + OffsetOf_GenBuffersImmediate_n_not_4); + +struct GenerateMipmap { + typedef GenerateMipmap ValueType; + static const CommandId kCmdId = kGenerateMipmap; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target) { + SetHeader(); + target = _target; + } + + void* Set(void* cmd, GLenum _target) { + static_cast<ValueType*>(cmd)->Init(_target); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; +}; + +COMPILE_ASSERT(sizeof(GenerateMipmap) == 8, + Sizeof_GenerateMipmap_is_not_8); +COMPILE_ASSERT(offsetof(GenerateMipmap, header) == 0, + OffsetOf_GenerateMipmap_header_not_0); +COMPILE_ASSERT(offsetof(GenerateMipmap, target) == 4, + OffsetOf_GenerateMipmap_target_not_4); + +struct GenFramebuffers { + typedef GenFramebuffers ValueType; + static const CommandId kCmdId = kGenFramebuffers; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLsizei _n, uint32 _framebuffers_shm_id, + uint32 _framebuffers_shm_offset) { + SetHeader(); + n = _n; + framebuffers_shm_id = _framebuffers_shm_id; + framebuffers_shm_offset = _framebuffers_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _framebuffers_shm_id, + uint32 _framebuffers_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _framebuffers_shm_id, _framebuffers_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 framebuffers_shm_id; + uint32 framebuffers_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GenFramebuffers) == 16, + Sizeof_GenFramebuffers_is_not_16); +COMPILE_ASSERT(offsetof(GenFramebuffers, header) == 0, + OffsetOf_GenFramebuffers_header_not_0); +COMPILE_ASSERT(offsetof(GenFramebuffers, n) == 4, + OffsetOf_GenFramebuffers_n_not_4); +COMPILE_ASSERT(offsetof(GenFramebuffers, framebuffers_shm_id) == 8, + OffsetOf_GenFramebuffers_framebuffers_shm_id_not_8); +COMPILE_ASSERT(offsetof(GenFramebuffers, framebuffers_shm_offset) == 12, + OffsetOf_GenFramebuffers_framebuffers_shm_offset_not_12); + +struct GenFramebuffersImmediate { + typedef GenFramebuffersImmediate ValueType; + static const CommandId kCmdId = kGenFramebuffersImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, GLuint* _framebuffers) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _framebuffers, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, GLuint* _framebuffers) { + static_cast<ValueType*>(cmd)->Init(_n, _framebuffers); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(GenFramebuffersImmediate) == 8, + Sizeof_GenFramebuffersImmediate_is_not_8); +COMPILE_ASSERT(offsetof(GenFramebuffersImmediate, header) == 0, + OffsetOf_GenFramebuffersImmediate_header_not_0); +COMPILE_ASSERT(offsetof(GenFramebuffersImmediate, n) == 4, + OffsetOf_GenFramebuffersImmediate_n_not_4); + +struct GenRenderbuffers { + typedef GenRenderbuffers ValueType; + static const CommandId kCmdId = kGenRenderbuffers; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLsizei _n, uint32 _renderbuffers_shm_id, + uint32 _renderbuffers_shm_offset) { + SetHeader(); + n = _n; + renderbuffers_shm_id = _renderbuffers_shm_id; + renderbuffers_shm_offset = _renderbuffers_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _renderbuffers_shm_id, + uint32 _renderbuffers_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _renderbuffers_shm_id, _renderbuffers_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 renderbuffers_shm_id; + uint32 renderbuffers_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GenRenderbuffers) == 16, + Sizeof_GenRenderbuffers_is_not_16); +COMPILE_ASSERT(offsetof(GenRenderbuffers, header) == 0, + OffsetOf_GenRenderbuffers_header_not_0); +COMPILE_ASSERT(offsetof(GenRenderbuffers, n) == 4, + OffsetOf_GenRenderbuffers_n_not_4); +COMPILE_ASSERT(offsetof(GenRenderbuffers, renderbuffers_shm_id) == 8, + OffsetOf_GenRenderbuffers_renderbuffers_shm_id_not_8); +COMPILE_ASSERT(offsetof(GenRenderbuffers, renderbuffers_shm_offset) == 12, + OffsetOf_GenRenderbuffers_renderbuffers_shm_offset_not_12); + +struct GenRenderbuffersImmediate { + typedef GenRenderbuffersImmediate ValueType; + static const CommandId kCmdId = kGenRenderbuffersImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, GLuint* _renderbuffers) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _renderbuffers, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, GLuint* _renderbuffers) { + static_cast<ValueType*>(cmd)->Init(_n, _renderbuffers); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(GenRenderbuffersImmediate) == 8, + Sizeof_GenRenderbuffersImmediate_is_not_8); +COMPILE_ASSERT(offsetof(GenRenderbuffersImmediate, header) == 0, + OffsetOf_GenRenderbuffersImmediate_header_not_0); +COMPILE_ASSERT(offsetof(GenRenderbuffersImmediate, n) == 4, + OffsetOf_GenRenderbuffersImmediate_n_not_4); + +struct GenTextures { + typedef GenTextures ValueType; + static const CommandId kCmdId = kGenTextures; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLsizei _n, uint32 _textures_shm_id, uint32 _textures_shm_offset) { + SetHeader(); + n = _n; + textures_shm_id = _textures_shm_id; + textures_shm_offset = _textures_shm_offset; + } + + void* Set( + void* cmd, GLsizei _n, uint32 _textures_shm_id, + uint32 _textures_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_n, _textures_shm_id, _textures_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 n; + uint32 textures_shm_id; + uint32 textures_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GenTextures) == 16, + Sizeof_GenTextures_is_not_16); +COMPILE_ASSERT(offsetof(GenTextures, header) == 0, + OffsetOf_GenTextures_header_not_0); +COMPILE_ASSERT(offsetof(GenTextures, n) == 4, + OffsetOf_GenTextures_n_not_4); +COMPILE_ASSERT(offsetof(GenTextures, textures_shm_id) == 8, + OffsetOf_GenTextures_textures_shm_id_not_8); +COMPILE_ASSERT(offsetof(GenTextures, textures_shm_offset) == 12, + OffsetOf_GenTextures_textures_shm_offset_not_12); + +struct GenTexturesImmediate { + typedef GenTexturesImmediate ValueType; + static const CommandId kCmdId = kGenTexturesImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei n) { + return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT + } + + static uint32 ComputeSize(GLsizei n) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(n)); // NOLINT + } + + void SetHeader(GLsizei n) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(n)); + } + + void Init(GLsizei _n, GLuint* _textures) { + SetHeader(_n); + n = _n; + memcpy(ImmediateDataAddress(this), + _textures, ComputeDataSize(_n)); + } + + void* Set(void* cmd, GLsizei _n, GLuint* _textures) { + static_cast<ValueType*>(cmd)->Init(_n, _textures); + const uint32 size = ComputeSize(_n); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 n; +}; + +COMPILE_ASSERT(sizeof(GenTexturesImmediate) == 8, + Sizeof_GenTexturesImmediate_is_not_8); +COMPILE_ASSERT(offsetof(GenTexturesImmediate, header) == 0, + OffsetOf_GenTexturesImmediate_header_not_0); +COMPILE_ASSERT(offsetof(GenTexturesImmediate, n) == 4, + OffsetOf_GenTexturesImmediate_n_not_4); + +struct GetActiveAttrib { + typedef GetActiveAttrib ValueType; + static const CommandId kCmdId = kGetActiveAttrib; + 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, GLuint _index, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _size_shm_id, uint32 _size_shm_offset, + uint32 _type_shm_id, uint32 _type_shm_offset, uint32 _name_shm_id, + uint32 _name_shm_offset) { + SetHeader(); + program = _program; + index = _index; + bufsize = _bufsize; + length_shm_id = _length_shm_id; + length_shm_offset = _length_shm_offset; + size_shm_id = _size_shm_id; + size_shm_offset = _size_shm_offset; + type_shm_id = _type_shm_id; + type_shm_offset = _type_shm_offset; + name_shm_id = _name_shm_id; + name_shm_offset = _name_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLuint _index, GLsizei _bufsize, + uint32 _length_shm_id, uint32 _length_shm_offset, uint32 _size_shm_id, + uint32 _size_shm_offset, uint32 _type_shm_id, uint32 _type_shm_offset, + uint32 _name_shm_id, uint32 _name_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _program, _index, _bufsize, _length_shm_id, _length_shm_offset, + _size_shm_id, _size_shm_offset, _type_shm_id, _type_shm_offset, + _name_shm_id, _name_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 index; + uint32 bufsize; + uint32 length_shm_id; + uint32 length_shm_offset; + uint32 size_shm_id; + uint32 size_shm_offset; + uint32 type_shm_id; + uint32 type_shm_offset; + uint32 name_shm_id; + uint32 name_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetActiveAttrib) == 48, + Sizeof_GetActiveAttrib_is_not_48); +COMPILE_ASSERT(offsetof(GetActiveAttrib, header) == 0, + OffsetOf_GetActiveAttrib_header_not_0); +COMPILE_ASSERT(offsetof(GetActiveAttrib, program) == 4, + OffsetOf_GetActiveAttrib_program_not_4); +COMPILE_ASSERT(offsetof(GetActiveAttrib, index) == 8, + OffsetOf_GetActiveAttrib_index_not_8); +COMPILE_ASSERT(offsetof(GetActiveAttrib, bufsize) == 12, + OffsetOf_GetActiveAttrib_bufsize_not_12); +COMPILE_ASSERT(offsetof(GetActiveAttrib, length_shm_id) == 16, + OffsetOf_GetActiveAttrib_length_shm_id_not_16); +COMPILE_ASSERT(offsetof(GetActiveAttrib, length_shm_offset) == 20, + OffsetOf_GetActiveAttrib_length_shm_offset_not_20); +COMPILE_ASSERT(offsetof(GetActiveAttrib, size_shm_id) == 24, + OffsetOf_GetActiveAttrib_size_shm_id_not_24); +COMPILE_ASSERT(offsetof(GetActiveAttrib, size_shm_offset) == 28, + OffsetOf_GetActiveAttrib_size_shm_offset_not_28); +COMPILE_ASSERT(offsetof(GetActiveAttrib, type_shm_id) == 32, + OffsetOf_GetActiveAttrib_type_shm_id_not_32); +COMPILE_ASSERT(offsetof(GetActiveAttrib, type_shm_offset) == 36, + OffsetOf_GetActiveAttrib_type_shm_offset_not_36); +COMPILE_ASSERT(offsetof(GetActiveAttrib, name_shm_id) == 40, + OffsetOf_GetActiveAttrib_name_shm_id_not_40); +COMPILE_ASSERT(offsetof(GetActiveAttrib, name_shm_offset) == 44, + OffsetOf_GetActiveAttrib_name_shm_offset_not_44); + +struct GetActiveUniform { + typedef GetActiveUniform ValueType; + static const CommandId kCmdId = kGetActiveUniform; + 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, GLuint _index, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _size_shm_id, uint32 _size_shm_offset, + uint32 _type_shm_id, uint32 _type_shm_offset, uint32 _name_shm_id, + uint32 _name_shm_offset) { + SetHeader(); + program = _program; + index = _index; + bufsize = _bufsize; + length_shm_id = _length_shm_id; + length_shm_offset = _length_shm_offset; + size_shm_id = _size_shm_id; + size_shm_offset = _size_shm_offset; + type_shm_id = _type_shm_id; + type_shm_offset = _type_shm_offset; + name_shm_id = _name_shm_id; + name_shm_offset = _name_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLuint _index, GLsizei _bufsize, + uint32 _length_shm_id, uint32 _length_shm_offset, uint32 _size_shm_id, + uint32 _size_shm_offset, uint32 _type_shm_id, uint32 _type_shm_offset, + uint32 _name_shm_id, uint32 _name_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _program, _index, _bufsize, _length_shm_id, _length_shm_offset, + _size_shm_id, _size_shm_offset, _type_shm_id, _type_shm_offset, + _name_shm_id, _name_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 index; + uint32 bufsize; + uint32 length_shm_id; + uint32 length_shm_offset; + uint32 size_shm_id; + uint32 size_shm_offset; + uint32 type_shm_id; + uint32 type_shm_offset; + uint32 name_shm_id; + uint32 name_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetActiveUniform) == 48, + Sizeof_GetActiveUniform_is_not_48); +COMPILE_ASSERT(offsetof(GetActiveUniform, header) == 0, + OffsetOf_GetActiveUniform_header_not_0); +COMPILE_ASSERT(offsetof(GetActiveUniform, program) == 4, + OffsetOf_GetActiveUniform_program_not_4); +COMPILE_ASSERT(offsetof(GetActiveUniform, index) == 8, + OffsetOf_GetActiveUniform_index_not_8); +COMPILE_ASSERT(offsetof(GetActiveUniform, bufsize) == 12, + OffsetOf_GetActiveUniform_bufsize_not_12); +COMPILE_ASSERT(offsetof(GetActiveUniform, length_shm_id) == 16, + OffsetOf_GetActiveUniform_length_shm_id_not_16); +COMPILE_ASSERT(offsetof(GetActiveUniform, length_shm_offset) == 20, + OffsetOf_GetActiveUniform_length_shm_offset_not_20); +COMPILE_ASSERT(offsetof(GetActiveUniform, size_shm_id) == 24, + OffsetOf_GetActiveUniform_size_shm_id_not_24); +COMPILE_ASSERT(offsetof(GetActiveUniform, size_shm_offset) == 28, + OffsetOf_GetActiveUniform_size_shm_offset_not_28); +COMPILE_ASSERT(offsetof(GetActiveUniform, type_shm_id) == 32, + OffsetOf_GetActiveUniform_type_shm_id_not_32); +COMPILE_ASSERT(offsetof(GetActiveUniform, type_shm_offset) == 36, + OffsetOf_GetActiveUniform_type_shm_offset_not_36); +COMPILE_ASSERT(offsetof(GetActiveUniform, name_shm_id) == 40, + OffsetOf_GetActiveUniform_name_shm_id_not_40); +COMPILE_ASSERT(offsetof(GetActiveUniform, name_shm_offset) == 44, + OffsetOf_GetActiveUniform_name_shm_offset_not_44); + +struct GetAttachedShaders { + typedef GetAttachedShaders ValueType; + static const CommandId kCmdId = kGetAttachedShaders; + 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, GLsizei _maxcount, uint32 _count_shm_id, + uint32 _count_shm_offset, uint32 _shaders_shm_id, + uint32 _shaders_shm_offset) { + SetHeader(); + program = _program; + maxcount = _maxcount; + count_shm_id = _count_shm_id; + count_shm_offset = _count_shm_offset; + shaders_shm_id = _shaders_shm_id; + shaders_shm_offset = _shaders_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLsizei _maxcount, uint32 _count_shm_id, + uint32 _count_shm_offset, uint32 _shaders_shm_id, + uint32 _shaders_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _program, _maxcount, _count_shm_id, _count_shm_offset, + _shaders_shm_id, _shaders_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 maxcount; + uint32 count_shm_id; + uint32 count_shm_offset; + uint32 shaders_shm_id; + uint32 shaders_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetAttachedShaders) == 28, + Sizeof_GetAttachedShaders_is_not_28); +COMPILE_ASSERT(offsetof(GetAttachedShaders, header) == 0, + OffsetOf_GetAttachedShaders_header_not_0); +COMPILE_ASSERT(offsetof(GetAttachedShaders, program) == 4, + OffsetOf_GetAttachedShaders_program_not_4); +COMPILE_ASSERT(offsetof(GetAttachedShaders, maxcount) == 8, + OffsetOf_GetAttachedShaders_maxcount_not_8); +COMPILE_ASSERT(offsetof(GetAttachedShaders, count_shm_id) == 12, + OffsetOf_GetAttachedShaders_count_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetAttachedShaders, count_shm_offset) == 16, + OffsetOf_GetAttachedShaders_count_shm_offset_not_16); +COMPILE_ASSERT(offsetof(GetAttachedShaders, shaders_shm_id) == 20, + OffsetOf_GetAttachedShaders_shaders_shm_id_not_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; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _pname, uint32 _params_shm_id, uint32 _params_shm_offset) { + SetHeader(); + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetBooleanv) == 16, + Sizeof_GetBooleanv_is_not_16); +COMPILE_ASSERT(offsetof(GetBooleanv, header) == 0, + OffsetOf_GetBooleanv_header_not_0); +COMPILE_ASSERT(offsetof(GetBooleanv, pname) == 4, + OffsetOf_GetBooleanv_pname_not_4); +COMPILE_ASSERT(offsetof(GetBooleanv, params_shm_id) == 8, + OffsetOf_GetBooleanv_params_shm_id_not_8); +COMPILE_ASSERT(offsetof(GetBooleanv, params_shm_offset) == 12, + OffsetOf_GetBooleanv_params_shm_offset_not_12); + +struct GetBufferParameteriv { + typedef GetBufferParameteriv ValueType; + static const CommandId kCmdId = kGetBufferParameteriv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetBufferParameteriv) == 20, + Sizeof_GetBufferParameteriv_is_not_20); +COMPILE_ASSERT(offsetof(GetBufferParameteriv, header) == 0, + OffsetOf_GetBufferParameteriv_header_not_0); +COMPILE_ASSERT(offsetof(GetBufferParameteriv, target) == 4, + OffsetOf_GetBufferParameteriv_target_not_4); +COMPILE_ASSERT(offsetof(GetBufferParameteriv, pname) == 8, + OffsetOf_GetBufferParameteriv_pname_not_8); +COMPILE_ASSERT(offsetof(GetBufferParameteriv, params_shm_id) == 12, + OffsetOf_GetBufferParameteriv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetBufferParameteriv, params_shm_offset) == 16, + OffsetOf_GetBufferParameteriv_params_shm_offset_not_16); + +struct GetError { + typedef GetError ValueType; + static const CommandId kCmdId = kGetError; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set(void* cmd, uint32 _result_shm_id, uint32 _result_shm_offset) { + static_cast<ValueType*>(cmd)->Init(_result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetError) == 12, + Sizeof_GetError_is_not_12); +COMPILE_ASSERT(offsetof(GetError, header) == 0, + OffsetOf_GetError_header_not_0); +COMPILE_ASSERT(offsetof(GetError, result_shm_id) == 4, + OffsetOf_GetError_result_shm_id_not_4); +COMPILE_ASSERT(offsetof(GetError, result_shm_offset) == 8, + OffsetOf_GetError_result_shm_offset_not_8); + +struct GetFloatv { + typedef GetFloatv ValueType; + static const CommandId kCmdId = kGetFloatv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _pname, uint32 _params_shm_id, uint32 _params_shm_offset) { + SetHeader(); + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetFloatv) == 16, + Sizeof_GetFloatv_is_not_16); +COMPILE_ASSERT(offsetof(GetFloatv, header) == 0, + OffsetOf_GetFloatv_header_not_0); +COMPILE_ASSERT(offsetof(GetFloatv, pname) == 4, + OffsetOf_GetFloatv_pname_not_4); +COMPILE_ASSERT(offsetof(GetFloatv, params_shm_id) == 8, + OffsetOf_GetFloatv_params_shm_id_not_8); +COMPILE_ASSERT(offsetof(GetFloatv, params_shm_offset) == 12, + OffsetOf_GetFloatv_params_shm_offset_not_12); + +struct GetFramebufferAttachmentParameteriv { + typedef GetFramebufferAttachmentParameteriv ValueType; + static const CommandId kCmdId = kGetFramebufferAttachmentParameteriv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _attachment, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + attachment = _attachment; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _attachment, GLenum _pname, + uint32 _params_shm_id, uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _target, _attachment, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 attachment; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetFramebufferAttachmentParameteriv) == 24, + Sizeof_GetFramebufferAttachmentParameteriv_is_not_24); +COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, header) == 0, + OffsetOf_GetFramebufferAttachmentParameteriv_header_not_0); +COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, target) == 4, + OffsetOf_GetFramebufferAttachmentParameteriv_target_not_4); +COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, attachment) == 8, + OffsetOf_GetFramebufferAttachmentParameteriv_attachment_not_8); +COMPILE_ASSERT(offsetof(GetFramebufferAttachmentParameteriv, pname) == 12, + OffsetOf_GetFramebufferAttachmentParameteriv_pname_not_12); +COMPILE_ASSERT( + offsetof(GetFramebufferAttachmentParameteriv, params_shm_id) == 16, + OffsetOf_GetFramebufferAttachmentParameteriv_params_shm_id_not_16); +COMPILE_ASSERT( + offsetof(GetFramebufferAttachmentParameteriv, params_shm_offset) == 20, + OffsetOf_GetFramebufferAttachmentParameteriv_params_shm_offset_not_20); + +struct GetIntegerv { + typedef GetIntegerv ValueType; + static const CommandId kCmdId = kGetIntegerv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _pname, uint32 _params_shm_id, uint32 _params_shm_offset) { + SetHeader(); + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetIntegerv) == 16, + Sizeof_GetIntegerv_is_not_16); +COMPILE_ASSERT(offsetof(GetIntegerv, header) == 0, + OffsetOf_GetIntegerv_header_not_0); +COMPILE_ASSERT(offsetof(GetIntegerv, pname) == 4, + OffsetOf_GetIntegerv_pname_not_4); +COMPILE_ASSERT(offsetof(GetIntegerv, params_shm_id) == 8, + OffsetOf_GetIntegerv_params_shm_id_not_8); +COMPILE_ASSERT(offsetof(GetIntegerv, params_shm_offset) == 12, + OffsetOf_GetIntegerv_params_shm_offset_not_12); + +struct GetProgramiv { + typedef GetProgramiv ValueType; + static const CommandId kCmdId = kGetProgramiv; + 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, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + program = _program; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_program, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetProgramiv) == 20, + Sizeof_GetProgramiv_is_not_20); +COMPILE_ASSERT(offsetof(GetProgramiv, header) == 0, + OffsetOf_GetProgramiv_header_not_0); +COMPILE_ASSERT(offsetof(GetProgramiv, program) == 4, + OffsetOf_GetProgramiv_program_not_4); +COMPILE_ASSERT(offsetof(GetProgramiv, pname) == 8, + OffsetOf_GetProgramiv_pname_not_8); +COMPILE_ASSERT(offsetof(GetProgramiv, params_shm_id) == 12, + OffsetOf_GetProgramiv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetProgramiv, params_shm_offset) == 16, + OffsetOf_GetProgramiv_params_shm_offset_not_16); + +struct GetProgramInfoLog { + typedef GetProgramInfoLog ValueType; + static const CommandId kCmdId = kGetProgramInfoLog; + 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, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _infolog_shm_id, + uint32 _infolog_shm_offset) { + SetHeader(); + program = _program; + bufsize = _bufsize; + length_shm_id = _length_shm_id; + length_shm_offset = _length_shm_offset; + infolog_shm_id = _infolog_shm_id; + infolog_shm_offset = _infolog_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _infolog_shm_id, + uint32 _infolog_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _program, _bufsize, _length_shm_id, _length_shm_offset, + _infolog_shm_id, _infolog_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 bufsize; + uint32 length_shm_id; + uint32 length_shm_offset; + uint32 infolog_shm_id; + uint32 infolog_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetProgramInfoLog) == 28, + Sizeof_GetProgramInfoLog_is_not_28); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, header) == 0, + OffsetOf_GetProgramInfoLog_header_not_0); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, program) == 4, + OffsetOf_GetProgramInfoLog_program_not_4); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, bufsize) == 8, + OffsetOf_GetProgramInfoLog_bufsize_not_8); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, length_shm_id) == 12, + OffsetOf_GetProgramInfoLog_length_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, length_shm_offset) == 16, + OffsetOf_GetProgramInfoLog_length_shm_offset_not_16); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, infolog_shm_id) == 20, + OffsetOf_GetProgramInfoLog_infolog_shm_id_not_20); +COMPILE_ASSERT(offsetof(GetProgramInfoLog, infolog_shm_offset) == 24, + OffsetOf_GetProgramInfoLog_infolog_shm_offset_not_24); + +struct GetRenderbufferParameteriv { + typedef GetRenderbufferParameteriv ValueType; + static const CommandId kCmdId = kGetRenderbufferParameteriv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetRenderbufferParameteriv) == 20, + Sizeof_GetRenderbufferParameteriv_is_not_20); +COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, header) == 0, + OffsetOf_GetRenderbufferParameteriv_header_not_0); +COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, target) == 4, + OffsetOf_GetRenderbufferParameteriv_target_not_4); +COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, pname) == 8, + OffsetOf_GetRenderbufferParameteriv_pname_not_8); +COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, params_shm_id) == 12, + OffsetOf_GetRenderbufferParameteriv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetRenderbufferParameteriv, params_shm_offset) == 16, + OffsetOf_GetRenderbufferParameteriv_params_shm_offset_not_16); + +struct GetShaderiv { + typedef GetShaderiv ValueType; + static const CommandId kCmdId = kGetShaderiv; + 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 _shader, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + shader = _shader; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLuint _shader, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_shader, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetShaderiv) == 20, + Sizeof_GetShaderiv_is_not_20); +COMPILE_ASSERT(offsetof(GetShaderiv, header) == 0, + OffsetOf_GetShaderiv_header_not_0); +COMPILE_ASSERT(offsetof(GetShaderiv, shader) == 4, + OffsetOf_GetShaderiv_shader_not_4); +COMPILE_ASSERT(offsetof(GetShaderiv, pname) == 8, + OffsetOf_GetShaderiv_pname_not_8); +COMPILE_ASSERT(offsetof(GetShaderiv, params_shm_id) == 12, + OffsetOf_GetShaderiv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetShaderiv, params_shm_offset) == 16, + OffsetOf_GetShaderiv_params_shm_offset_not_16); + +struct GetShaderInfoLog { + typedef GetShaderInfoLog ValueType; + static const CommandId kCmdId = kGetShaderInfoLog; + 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 _shader, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _infolog_shm_id, + uint32 _infolog_shm_offset) { + SetHeader(); + shader = _shader; + bufsize = _bufsize; + length_shm_id = _length_shm_id; + length_shm_offset = _length_shm_offset; + infolog_shm_id = _infolog_shm_id; + infolog_shm_offset = _infolog_shm_offset; + } + + void* Set( + void* cmd, GLuint _shader, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _infolog_shm_id, + uint32 _infolog_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _shader, _bufsize, _length_shm_id, _length_shm_offset, + _infolog_shm_id, _infolog_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; + uint32 bufsize; + uint32 length_shm_id; + uint32 length_shm_offset; + uint32 infolog_shm_id; + uint32 infolog_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetShaderInfoLog) == 28, + Sizeof_GetShaderInfoLog_is_not_28); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, header) == 0, + OffsetOf_GetShaderInfoLog_header_not_0); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, shader) == 4, + OffsetOf_GetShaderInfoLog_shader_not_4); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, bufsize) == 8, + OffsetOf_GetShaderInfoLog_bufsize_not_8); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, length_shm_id) == 12, + OffsetOf_GetShaderInfoLog_length_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, length_shm_offset) == 16, + OffsetOf_GetShaderInfoLog_length_shm_offset_not_16); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, infolog_shm_id) == 20, + OffsetOf_GetShaderInfoLog_infolog_shm_id_not_20); +COMPILE_ASSERT(offsetof(GetShaderInfoLog, infolog_shm_offset) == 24, + OffsetOf_GetShaderInfoLog_infolog_shm_offset_not_24); + +struct GetShaderPrecisionFormat { + typedef GetShaderPrecisionFormat ValueType; + static const CommandId kCmdId = kGetShaderPrecisionFormat; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _shadertype, GLenum _precisiontype, uint32 _range_shm_id, + uint32 _range_shm_offset, uint32 _precision_shm_id, + uint32 _precision_shm_offset) { + SetHeader(); + shadertype = _shadertype; + precisiontype = _precisiontype; + range_shm_id = _range_shm_id; + range_shm_offset = _range_shm_offset; + precision_shm_id = _precision_shm_id; + precision_shm_offset = _precision_shm_offset; + } + + void* Set( + void* cmd, GLenum _shadertype, GLenum _precisiontype, + uint32 _range_shm_id, uint32 _range_shm_offset, uint32 _precision_shm_id, + uint32 _precision_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _shadertype, _precisiontype, _range_shm_id, _range_shm_offset, + _precision_shm_id, _precision_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shadertype; + uint32 precisiontype; + uint32 range_shm_id; + uint32 range_shm_offset; + uint32 precision_shm_id; + uint32 precision_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetShaderPrecisionFormat) == 28, + Sizeof_GetShaderPrecisionFormat_is_not_28); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, header) == 0, + OffsetOf_GetShaderPrecisionFormat_header_not_0); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, shadertype) == 4, + OffsetOf_GetShaderPrecisionFormat_shadertype_not_4); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, precisiontype) == 8, + OffsetOf_GetShaderPrecisionFormat_precisiontype_not_8); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, range_shm_id) == 12, + OffsetOf_GetShaderPrecisionFormat_range_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, range_shm_offset) == 16, + OffsetOf_GetShaderPrecisionFormat_range_shm_offset_not_16); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, precision_shm_id) == 20, + OffsetOf_GetShaderPrecisionFormat_precision_shm_id_not_20); +COMPILE_ASSERT(offsetof(GetShaderPrecisionFormat, precision_shm_offset) == 24, + OffsetOf_GetShaderPrecisionFormat_precision_shm_offset_not_24); + +struct GetShaderSource { + typedef GetShaderSource ValueType; + static const CommandId kCmdId = kGetShaderSource; + 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 _shader, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _source_shm_id, + uint32 _source_shm_offset) { + SetHeader(); + shader = _shader; + bufsize = _bufsize; + length_shm_id = _length_shm_id; + length_shm_offset = _length_shm_offset; + source_shm_id = _source_shm_id; + source_shm_offset = _source_shm_offset; + } + + void* Set( + void* cmd, GLuint _shader, GLsizei _bufsize, uint32 _length_shm_id, + uint32 _length_shm_offset, uint32 _source_shm_id, + uint32 _source_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _shader, _bufsize, _length_shm_id, _length_shm_offset, + _source_shm_id, _source_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; + uint32 bufsize; + uint32 length_shm_id; + uint32 length_shm_offset; + uint32 source_shm_id; + uint32 source_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetShaderSource) == 28, + Sizeof_GetShaderSource_is_not_28); +COMPILE_ASSERT(offsetof(GetShaderSource, header) == 0, + OffsetOf_GetShaderSource_header_not_0); +COMPILE_ASSERT(offsetof(GetShaderSource, shader) == 4, + OffsetOf_GetShaderSource_shader_not_4); +COMPILE_ASSERT(offsetof(GetShaderSource, bufsize) == 8, + OffsetOf_GetShaderSource_bufsize_not_8); +COMPILE_ASSERT(offsetof(GetShaderSource, length_shm_id) == 12, + OffsetOf_GetShaderSource_length_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetShaderSource, length_shm_offset) == 16, + OffsetOf_GetShaderSource_length_shm_offset_not_16); +COMPILE_ASSERT(offsetof(GetShaderSource, source_shm_id) == 20, + OffsetOf_GetShaderSource_source_shm_id_not_20); +COMPILE_ASSERT(offsetof(GetShaderSource, source_shm_offset) == 24, + OffsetOf_GetShaderSource_source_shm_offset_not_24); + +struct GetString { + typedef GetString ValueType; + static const CommandId kCmdId = kGetString; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _name) { + SetHeader(); + name = _name; + } + + void* Set(void* cmd, GLenum _name) { + static_cast<ValueType*>(cmd)->Init(_name); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 name; +}; + +COMPILE_ASSERT(sizeof(GetString) == 8, + Sizeof_GetString_is_not_8); +COMPILE_ASSERT(offsetof(GetString, header) == 0, + OffsetOf_GetString_header_not_0); +COMPILE_ASSERT(offsetof(GetString, name) == 4, + OffsetOf_GetString_name_not_4); + +struct GetTexParameterfv { + typedef GetTexParameterfv ValueType; + static const CommandId kCmdId = kGetTexParameterfv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetTexParameterfv) == 20, + Sizeof_GetTexParameterfv_is_not_20); +COMPILE_ASSERT(offsetof(GetTexParameterfv, header) == 0, + OffsetOf_GetTexParameterfv_header_not_0); +COMPILE_ASSERT(offsetof(GetTexParameterfv, target) == 4, + OffsetOf_GetTexParameterfv_target_not_4); +COMPILE_ASSERT(offsetof(GetTexParameterfv, pname) == 8, + OffsetOf_GetTexParameterfv_pname_not_8); +COMPILE_ASSERT(offsetof(GetTexParameterfv, params_shm_id) == 12, + OffsetOf_GetTexParameterfv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetTexParameterfv, params_shm_offset) == 16, + OffsetOf_GetTexParameterfv_params_shm_offset_not_16); + +struct GetTexParameteriv { + typedef GetTexParameteriv ValueType; + static const CommandId kCmdId = kGetTexParameteriv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetTexParameteriv) == 20, + Sizeof_GetTexParameteriv_is_not_20); +COMPILE_ASSERT(offsetof(GetTexParameteriv, header) == 0, + OffsetOf_GetTexParameteriv_header_not_0); +COMPILE_ASSERT(offsetof(GetTexParameteriv, target) == 4, + OffsetOf_GetTexParameteriv_target_not_4); +COMPILE_ASSERT(offsetof(GetTexParameteriv, pname) == 8, + OffsetOf_GetTexParameteriv_pname_not_8); +COMPILE_ASSERT(offsetof(GetTexParameteriv, params_shm_id) == 12, + OffsetOf_GetTexParameteriv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetTexParameteriv, params_shm_offset) == 16, + OffsetOf_GetTexParameteriv_params_shm_offset_not_16); + +struct GetUniformfv { + typedef GetUniformfv ValueType; + static const CommandId kCmdId = kGetUniformfv; + 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, GLint _location, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + program = _program; + location = _location; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLint _location, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_program, _location, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 location; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetUniformfv) == 20, + Sizeof_GetUniformfv_is_not_20); +COMPILE_ASSERT(offsetof(GetUniformfv, header) == 0, + OffsetOf_GetUniformfv_header_not_0); +COMPILE_ASSERT(offsetof(GetUniformfv, program) == 4, + OffsetOf_GetUniformfv_program_not_4); +COMPILE_ASSERT(offsetof(GetUniformfv, location) == 8, + OffsetOf_GetUniformfv_location_not_8); +COMPILE_ASSERT(offsetof(GetUniformfv, params_shm_id) == 12, + OffsetOf_GetUniformfv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetUniformfv, params_shm_offset) == 16, + OffsetOf_GetUniformfv_params_shm_offset_not_16); + +struct GetUniformiv { + typedef GetUniformiv ValueType; + static const CommandId kCmdId = kGetUniformiv; + 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, GLint _location, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + program = _program; + location = _location; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, GLint _location, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_program, _location, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 location; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetUniformiv) == 20, + Sizeof_GetUniformiv_is_not_20); +COMPILE_ASSERT(offsetof(GetUniformiv, header) == 0, + OffsetOf_GetUniformiv_header_not_0); +COMPILE_ASSERT(offsetof(GetUniformiv, program) == 4, + OffsetOf_GetUniformiv_program_not_4); +COMPILE_ASSERT(offsetof(GetUniformiv, location) == 8, + OffsetOf_GetUniformiv_location_not_8); +COMPILE_ASSERT(offsetof(GetUniformiv, params_shm_id) == 12, + OffsetOf_GetUniformiv_params_shm_id_not_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; + 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 _index, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + index = _index; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLuint _index, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_index, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 index; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetVertexAttribfv) == 20, + Sizeof_GetVertexAttribfv_is_not_20); +COMPILE_ASSERT(offsetof(GetVertexAttribfv, header) == 0, + OffsetOf_GetVertexAttribfv_header_not_0); +COMPILE_ASSERT(offsetof(GetVertexAttribfv, index) == 4, + OffsetOf_GetVertexAttribfv_index_not_4); +COMPILE_ASSERT(offsetof(GetVertexAttribfv, pname) == 8, + OffsetOf_GetVertexAttribfv_pname_not_8); +COMPILE_ASSERT(offsetof(GetVertexAttribfv, params_shm_id) == 12, + OffsetOf_GetVertexAttribfv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetVertexAttribfv, params_shm_offset) == 16, + OffsetOf_GetVertexAttribfv_params_shm_offset_not_16); + +struct GetVertexAttribiv { + typedef GetVertexAttribiv ValueType; + static const CommandId kCmdId = kGetVertexAttribiv; + 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 _index, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + index = _index; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLuint _index, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_index, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 index; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetVertexAttribiv) == 20, + Sizeof_GetVertexAttribiv_is_not_20); +COMPILE_ASSERT(offsetof(GetVertexAttribiv, header) == 0, + OffsetOf_GetVertexAttribiv_header_not_0); +COMPILE_ASSERT(offsetof(GetVertexAttribiv, index) == 4, + OffsetOf_GetVertexAttribiv_index_not_4); +COMPILE_ASSERT(offsetof(GetVertexAttribiv, pname) == 8, + OffsetOf_GetVertexAttribiv_pname_not_8); +COMPILE_ASSERT(offsetof(GetVertexAttribiv, params_shm_id) == 12, + OffsetOf_GetVertexAttribiv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetVertexAttribiv, params_shm_offset) == 16, + OffsetOf_GetVertexAttribiv_params_shm_offset_not_16); + +struct GetVertexAttribPointerv { + typedef GetVertexAttribPointerv ValueType; + static const CommandId kCmdId = kGetVertexAttribPointerv; + 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 _index, GLenum _pname, uint32 _pointer_shm_id, + uint32 _pointer_shm_offset) { + SetHeader(); + index = _index; + pname = _pname; + pointer_shm_id = _pointer_shm_id; + pointer_shm_offset = _pointer_shm_offset; + } + + void* Set( + void* cmd, GLuint _index, GLenum _pname, uint32 _pointer_shm_id, + uint32 _pointer_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_index, _pname, _pointer_shm_id, _pointer_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 index; + uint32 pname; + uint32 pointer_shm_id; + uint32 pointer_shm_offset; +}; + +COMPILE_ASSERT(sizeof(GetVertexAttribPointerv) == 20, + Sizeof_GetVertexAttribPointerv_is_not_20); +COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, header) == 0, + OffsetOf_GetVertexAttribPointerv_header_not_0); +COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, index) == 4, + OffsetOf_GetVertexAttribPointerv_index_not_4); +COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, pname) == 8, + OffsetOf_GetVertexAttribPointerv_pname_not_8); +COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, pointer_shm_id) == 12, + OffsetOf_GetVertexAttribPointerv_pointer_shm_id_not_12); +COMPILE_ASSERT(offsetof(GetVertexAttribPointerv, pointer_shm_offset) == 16, + OffsetOf_GetVertexAttribPointerv_pointer_shm_offset_not_16); + +struct Hint { + typedef Hint ValueType; + static const CommandId kCmdId = kHint; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLenum _mode) { + SetHeader(); + target = _target; + mode = _mode; + } + + void* Set(void* cmd, GLenum _target, GLenum _mode) { + static_cast<ValueType*>(cmd)->Init(_target, _mode); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 mode; +}; + +COMPILE_ASSERT(sizeof(Hint) == 12, + Sizeof_Hint_is_not_12); +COMPILE_ASSERT(offsetof(Hint, header) == 0, + OffsetOf_Hint_header_not_0); +COMPILE_ASSERT(offsetof(Hint, target) == 4, + OffsetOf_Hint_target_not_4); +COMPILE_ASSERT(offsetof(Hint, mode) == 8, + OffsetOf_Hint_mode_not_8); + +struct IsBuffer { + typedef IsBuffer ValueType; + static const CommandId kCmdId = kIsBuffer; + 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 _buffer, uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + buffer = _buffer; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLuint _buffer, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_buffer, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 buffer; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsBuffer) == 16, + Sizeof_IsBuffer_is_not_16); +COMPILE_ASSERT(offsetof(IsBuffer, header) == 0, + OffsetOf_IsBuffer_header_not_0); +COMPILE_ASSERT(offsetof(IsBuffer, buffer) == 4, + OffsetOf_IsBuffer_buffer_not_4); +COMPILE_ASSERT(offsetof(IsBuffer, result_shm_id) == 8, + OffsetOf_IsBuffer_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsBuffer, result_shm_offset) == 12, + OffsetOf_IsBuffer_result_shm_offset_not_12); + +struct IsEnabled { + typedef IsEnabled ValueType; + static const CommandId kCmdId = kIsEnabled; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _cap, uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + cap = _cap; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLenum _cap, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_cap, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 cap; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsEnabled) == 16, + Sizeof_IsEnabled_is_not_16); +COMPILE_ASSERT(offsetof(IsEnabled, header) == 0, + OffsetOf_IsEnabled_header_not_0); +COMPILE_ASSERT(offsetof(IsEnabled, cap) == 4, + OffsetOf_IsEnabled_cap_not_4); +COMPILE_ASSERT(offsetof(IsEnabled, result_shm_id) == 8, + OffsetOf_IsEnabled_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsEnabled, result_shm_offset) == 12, + OffsetOf_IsEnabled_result_shm_offset_not_12); + +struct IsFramebuffer { + typedef IsFramebuffer ValueType; + static const CommandId kCmdId = kIsFramebuffer; + 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 _framebuffer, uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + framebuffer = _framebuffer; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLuint _framebuffer, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_framebuffer, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 framebuffer; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsFramebuffer) == 16, + Sizeof_IsFramebuffer_is_not_16); +COMPILE_ASSERT(offsetof(IsFramebuffer, header) == 0, + OffsetOf_IsFramebuffer_header_not_0); +COMPILE_ASSERT(offsetof(IsFramebuffer, framebuffer) == 4, + OffsetOf_IsFramebuffer_framebuffer_not_4); +COMPILE_ASSERT(offsetof(IsFramebuffer, result_shm_id) == 8, + OffsetOf_IsFramebuffer_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsFramebuffer, result_shm_offset) == 12, + OffsetOf_IsFramebuffer_result_shm_offset_not_12); + +struct IsProgram { + typedef IsProgram ValueType; + static const CommandId kCmdId = kIsProgram; + 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 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + program = _program; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLuint _program, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_program, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsProgram) == 16, + Sizeof_IsProgram_is_not_16); +COMPILE_ASSERT(offsetof(IsProgram, header) == 0, + OffsetOf_IsProgram_header_not_0); +COMPILE_ASSERT(offsetof(IsProgram, program) == 4, + OffsetOf_IsProgram_program_not_4); +COMPILE_ASSERT(offsetof(IsProgram, result_shm_id) == 8, + OffsetOf_IsProgram_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsProgram, result_shm_offset) == 12, + OffsetOf_IsProgram_result_shm_offset_not_12); + +struct IsRenderbuffer { + typedef IsRenderbuffer ValueType; + static const CommandId kCmdId = kIsRenderbuffer; + 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 _renderbuffer, uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + renderbuffer = _renderbuffer; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLuint _renderbuffer, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_renderbuffer, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 renderbuffer; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsRenderbuffer) == 16, + Sizeof_IsRenderbuffer_is_not_16); +COMPILE_ASSERT(offsetof(IsRenderbuffer, header) == 0, + OffsetOf_IsRenderbuffer_header_not_0); +COMPILE_ASSERT(offsetof(IsRenderbuffer, renderbuffer) == 4, + OffsetOf_IsRenderbuffer_renderbuffer_not_4); +COMPILE_ASSERT(offsetof(IsRenderbuffer, result_shm_id) == 8, + OffsetOf_IsRenderbuffer_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsRenderbuffer, result_shm_offset) == 12, + OffsetOf_IsRenderbuffer_result_shm_offset_not_12); + +struct IsShader { + typedef IsShader ValueType; + static const CommandId kCmdId = kIsShader; + 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 _shader, uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + shader = _shader; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLuint _shader, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_shader, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsShader) == 16, + Sizeof_IsShader_is_not_16); +COMPILE_ASSERT(offsetof(IsShader, header) == 0, + OffsetOf_IsShader_header_not_0); +COMPILE_ASSERT(offsetof(IsShader, shader) == 4, + OffsetOf_IsShader_shader_not_4); +COMPILE_ASSERT(offsetof(IsShader, result_shm_id) == 8, + OffsetOf_IsShader_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsShader, result_shm_offset) == 12, + OffsetOf_IsShader_result_shm_offset_not_12); + +struct IsTexture { + typedef IsTexture ValueType; + static const CommandId kCmdId = kIsTexture; + 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 _texture, uint32 _result_shm_id, uint32 _result_shm_offset) { + SetHeader(); + texture = _texture; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set( + void* cmd, GLuint _texture, uint32 _result_shm_id, + uint32 _result_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_texture, _result_shm_id, _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 texture; + uint32 result_shm_id; + uint32 result_shm_offset; +}; + +COMPILE_ASSERT(sizeof(IsTexture) == 16, + Sizeof_IsTexture_is_not_16); +COMPILE_ASSERT(offsetof(IsTexture, header) == 0, + OffsetOf_IsTexture_header_not_0); +COMPILE_ASSERT(offsetof(IsTexture, texture) == 4, + OffsetOf_IsTexture_texture_not_4); +COMPILE_ASSERT(offsetof(IsTexture, result_shm_id) == 8, + OffsetOf_IsTexture_result_shm_id_not_8); +COMPILE_ASSERT(offsetof(IsTexture, result_shm_offset) == 12, + OffsetOf_IsTexture_result_shm_offset_not_12); + +struct LineWidth { + typedef LineWidth ValueType; + static const CommandId kCmdId = kLineWidth; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLfloat _width) { + SetHeader(); + width = _width; + } + + void* Set(void* cmd, GLfloat _width) { + static_cast<ValueType*>(cmd)->Init(_width); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float width; +}; + +COMPILE_ASSERT(sizeof(LineWidth) == 8, + Sizeof_LineWidth_is_not_8); +COMPILE_ASSERT(offsetof(LineWidth, header) == 0, + OffsetOf_LineWidth_header_not_0); +COMPILE_ASSERT(offsetof(LineWidth, width) == 4, + OffsetOf_LineWidth_width_not_4); + +struct LinkProgram { + typedef LinkProgram ValueType; + static const CommandId kCmdId = kLinkProgram; + 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) { + SetHeader(); + program = _program; + } + + void* Set(void* cmd, GLuint _program) { + static_cast<ValueType*>(cmd)->Init(_program); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; +}; + +COMPILE_ASSERT(sizeof(LinkProgram) == 8, + Sizeof_LinkProgram_is_not_8); +COMPILE_ASSERT(offsetof(LinkProgram, header) == 0, + OffsetOf_LinkProgram_header_not_0); +COMPILE_ASSERT(offsetof(LinkProgram, program) == 4, + OffsetOf_LinkProgram_program_not_4); + +struct PixelStorei { + typedef PixelStorei ValueType; + static const CommandId kCmdId = kPixelStorei; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _pname, GLint _param) { + SetHeader(); + pname = _pname; + param = _param; + } + + void* Set(void* cmd, GLenum _pname, GLint _param) { + static_cast<ValueType*>(cmd)->Init(_pname, _param); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 pname; + uint32 param; +}; + +COMPILE_ASSERT(sizeof(PixelStorei) == 12, + Sizeof_PixelStorei_is_not_12); +COMPILE_ASSERT(offsetof(PixelStorei, header) == 0, + OffsetOf_PixelStorei_header_not_0); +COMPILE_ASSERT(offsetof(PixelStorei, pname) == 4, + OffsetOf_PixelStorei_pname_not_4); +COMPILE_ASSERT(offsetof(PixelStorei, param) == 8, + OffsetOf_PixelStorei_param_not_8); + +struct PolygonOffset { + typedef PolygonOffset ValueType; + static const CommandId kCmdId = kPolygonOffset; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLfloat _factor, GLfloat _units) { + SetHeader(); + factor = _factor; + units = _units; + } + + void* Set(void* cmd, GLfloat _factor, GLfloat _units) { + static_cast<ValueType*>(cmd)->Init(_factor, _units); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float factor; + float units; +}; + +COMPILE_ASSERT(sizeof(PolygonOffset) == 12, + Sizeof_PolygonOffset_is_not_12); +COMPILE_ASSERT(offsetof(PolygonOffset, header) == 0, + OffsetOf_PolygonOffset_header_not_0); +COMPILE_ASSERT(offsetof(PolygonOffset, factor) == 4, + OffsetOf_PolygonOffset_factor_not_4); +COMPILE_ASSERT(offsetof(PolygonOffset, units) == 8, + OffsetOf_PolygonOffset_units_not_8); + +struct ReadPixels { + typedef ReadPixels ValueType; + static const CommandId kCmdId = kReadPixels; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _x, GLint _y, GLsizei _width, GLsizei _height, GLenum _format, + GLenum _type, uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { + SetHeader(); + x = _x; + y = _y; + width = _width; + height = _height; + format = _format; + type = _type; + pixels_shm_id = _pixels_shm_id; + pixels_shm_offset = _pixels_shm_offset; + } + + void* Set( + void* cmd, GLint _x, GLint _y, GLsizei _width, GLsizei _height, + GLenum _format, GLenum _type, uint32 _pixels_shm_id, + uint32 _pixels_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _x, _y, _width, _height, _format, _type, _pixels_shm_id, + _pixels_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 x; + uint32 y; + uint32 width; + uint32 height; + uint32 format; + uint32 type; + uint32 pixels_shm_id; + uint32 pixels_shm_offset; +}; + +COMPILE_ASSERT(sizeof(ReadPixels) == 36, + Sizeof_ReadPixels_is_not_36); +COMPILE_ASSERT(offsetof(ReadPixels, header) == 0, + OffsetOf_ReadPixels_header_not_0); +COMPILE_ASSERT(offsetof(ReadPixels, x) == 4, + OffsetOf_ReadPixels_x_not_4); +COMPILE_ASSERT(offsetof(ReadPixels, y) == 8, + OffsetOf_ReadPixels_y_not_8); +COMPILE_ASSERT(offsetof(ReadPixels, width) == 12, + OffsetOf_ReadPixels_width_not_12); +COMPILE_ASSERT(offsetof(ReadPixels, height) == 16, + OffsetOf_ReadPixels_height_not_16); +COMPILE_ASSERT(offsetof(ReadPixels, format) == 20, + OffsetOf_ReadPixels_format_not_20); +COMPILE_ASSERT(offsetof(ReadPixels, type) == 24, + OffsetOf_ReadPixels_type_not_24); +COMPILE_ASSERT(offsetof(ReadPixels, pixels_shm_id) == 28, + OffsetOf_ReadPixels_pixels_shm_id_not_28); +COMPILE_ASSERT(offsetof(ReadPixels, pixels_shm_offset) == 32, + OffsetOf_ReadPixels_pixels_shm_offset_not_32); + +struct RenderbufferStorage { + typedef RenderbufferStorage ValueType; + static const CommandId kCmdId = kRenderbufferStorage; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _internalformat, GLsizei _width, + GLsizei _height) { + SetHeader(); + target = _target; + internalformat = _internalformat; + width = _width; + height = _height; + } + + void* Set( + void* cmd, GLenum _target, GLenum _internalformat, GLsizei _width, + GLsizei _height) { + static_cast<ValueType*>( + cmd)->Init(_target, _internalformat, _width, _height); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 internalformat; + uint32 width; + uint32 height; +}; + +COMPILE_ASSERT(sizeof(RenderbufferStorage) == 20, + Sizeof_RenderbufferStorage_is_not_20); +COMPILE_ASSERT(offsetof(RenderbufferStorage, header) == 0, + OffsetOf_RenderbufferStorage_header_not_0); +COMPILE_ASSERT(offsetof(RenderbufferStorage, target) == 4, + OffsetOf_RenderbufferStorage_target_not_4); +COMPILE_ASSERT(offsetof(RenderbufferStorage, internalformat) == 8, + OffsetOf_RenderbufferStorage_internalformat_not_8); +COMPILE_ASSERT(offsetof(RenderbufferStorage, width) == 12, + OffsetOf_RenderbufferStorage_width_not_12); +COMPILE_ASSERT(offsetof(RenderbufferStorage, height) == 16, + OffsetOf_RenderbufferStorage_height_not_16); + +struct SampleCoverage { + typedef SampleCoverage ValueType; + static const CommandId kCmdId = kSampleCoverage; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLclampf _value, GLboolean _invert) { + SetHeader(); + value = _value; + invert = _invert; + } + + void* Set(void* cmd, GLclampf _value, GLboolean _invert) { + static_cast<ValueType*>(cmd)->Init(_value, _invert); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + float value; + uint32 invert; +}; + +COMPILE_ASSERT(sizeof(SampleCoverage) == 12, + Sizeof_SampleCoverage_is_not_12); +COMPILE_ASSERT(offsetof(SampleCoverage, header) == 0, + OffsetOf_SampleCoverage_header_not_0); +COMPILE_ASSERT(offsetof(SampleCoverage, value) == 4, + OffsetOf_SampleCoverage_value_not_4); +COMPILE_ASSERT(offsetof(SampleCoverage, invert) == 8, + OffsetOf_SampleCoverage_invert_not_8); + +struct Scissor { + typedef Scissor ValueType; + static const CommandId kCmdId = kScissor; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _x, GLint _y, GLsizei _width, GLsizei _height) { + SetHeader(); + x = _x; + y = _y; + width = _width; + height = _height; + } + + void* Set(void* cmd, GLint _x, GLint _y, GLsizei _width, GLsizei _height) { + static_cast<ValueType*>(cmd)->Init(_x, _y, _width, _height); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 x; + uint32 y; + uint32 width; + uint32 height; +}; + +COMPILE_ASSERT(sizeof(Scissor) == 20, + Sizeof_Scissor_is_not_20); +COMPILE_ASSERT(offsetof(Scissor, header) == 0, + OffsetOf_Scissor_header_not_0); +COMPILE_ASSERT(offsetof(Scissor, x) == 4, + OffsetOf_Scissor_x_not_4); +COMPILE_ASSERT(offsetof(Scissor, y) == 8, + OffsetOf_Scissor_y_not_8); +COMPILE_ASSERT(offsetof(Scissor, width) == 12, + OffsetOf_Scissor_width_not_12); +COMPILE_ASSERT(offsetof(Scissor, height) == 16, + OffsetOf_Scissor_height_not_16); + +struct ShaderSource { + typedef ShaderSource ValueType; + static const CommandId kCmdId = kShaderSource; + 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 _shader, GLsizei _count, uint32 _data_shm_id, + uint32 _data_shm_offset, uint32 _data_size) { + SetHeader(); + shader = _shader; + count = _count; + data_shm_id = _data_shm_id; + data_shm_offset = _data_shm_offset; + data_size = _data_size; + } + + void* Set( + void* cmd, GLuint _shader, GLsizei _count, uint32 _data_shm_id, + uint32 _data_shm_offset, uint32 _data_size) { + static_cast<ValueType*>( + cmd)->Init( + _shader, _count, _data_shm_id, _data_shm_offset, _data_size); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 shader; + uint32 count; + uint32 data_shm_id; + uint32 data_shm_offset; + uint32 data_size; +}; + +COMPILE_ASSERT(sizeof(ShaderSource) == 24, + Sizeof_ShaderSource_is_not_24); +COMPILE_ASSERT(offsetof(ShaderSource, header) == 0, + OffsetOf_ShaderSource_header_not_0); +COMPILE_ASSERT(offsetof(ShaderSource, shader) == 4, + OffsetOf_ShaderSource_shader_not_4); +COMPILE_ASSERT(offsetof(ShaderSource, count) == 8, + OffsetOf_ShaderSource_count_not_8); +COMPILE_ASSERT(offsetof(ShaderSource, data_shm_id) == 12, + OffsetOf_ShaderSource_data_shm_id_not_12); +COMPILE_ASSERT(offsetof(ShaderSource, data_shm_offset) == 16, + OffsetOf_ShaderSource_data_shm_offset_not_16); +COMPILE_ASSERT(offsetof(ShaderSource, data_size) == 20, + OffsetOf_ShaderSource_data_size_not_20); + +struct ShaderSourceImmediate { + typedef ShaderSourceImmediate ValueType; + static const CommandId kCmdId = kShaderSourceImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + void Init(GLuint _shader, GLsizei _count, uint32 _data_size) { + uint32 total_size = ComputeSize(_data_size); + SetHeader(total_size); + shader = _shader; + count = _count; + data_size = _data_size; + } + + void* Set(void* cmd, GLuint _shader, GLsizei _count, uint32 _data_size) { + uint32 total_size = ComputeSize(_data_size); + static_cast<ValueType*>(cmd)->Init(_shader, _count, _data_size); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 shader; + uint32 count; + uint32 data_size; +}; + +COMPILE_ASSERT(sizeof(ShaderSourceImmediate) == 16, + Sizeof_ShaderSourceImmediate_is_not_16); +COMPILE_ASSERT(offsetof(ShaderSourceImmediate, header) == 0, + OffsetOf_ShaderSourceImmediate_header_not_0); +COMPILE_ASSERT(offsetof(ShaderSourceImmediate, shader) == 4, + OffsetOf_ShaderSourceImmediate_shader_not_4); +COMPILE_ASSERT(offsetof(ShaderSourceImmediate, count) == 8, + OffsetOf_ShaderSourceImmediate_count_not_8); +COMPILE_ASSERT(offsetof(ShaderSourceImmediate, data_size) == 12, + OffsetOf_ShaderSourceImmediate_data_size_not_12); + +struct StencilFunc { + typedef StencilFunc ValueType; + static const CommandId kCmdId = kStencilFunc; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _func, GLint _ref, GLuint _mask) { + SetHeader(); + func = _func; + ref = _ref; + mask = _mask; + } + + void* Set(void* cmd, GLenum _func, GLint _ref, GLuint _mask) { + static_cast<ValueType*>(cmd)->Init(_func, _ref, _mask); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 func; + uint32 ref; + uint32 mask; +}; + +COMPILE_ASSERT(sizeof(StencilFunc) == 16, + Sizeof_StencilFunc_is_not_16); +COMPILE_ASSERT(offsetof(StencilFunc, header) == 0, + OffsetOf_StencilFunc_header_not_0); +COMPILE_ASSERT(offsetof(StencilFunc, func) == 4, + OffsetOf_StencilFunc_func_not_4); +COMPILE_ASSERT(offsetof(StencilFunc, ref) == 8, + OffsetOf_StencilFunc_ref_not_8); +COMPILE_ASSERT(offsetof(StencilFunc, mask) == 12, + OffsetOf_StencilFunc_mask_not_12); + +struct StencilFuncSeparate { + typedef StencilFuncSeparate ValueType; + static const CommandId kCmdId = kStencilFuncSeparate; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _face, GLenum _func, GLint _ref, GLuint _mask) { + SetHeader(); + face = _face; + func = _func; + ref = _ref; + mask = _mask; + } + + void* Set(void* cmd, GLenum _face, GLenum _func, GLint _ref, GLuint _mask) { + static_cast<ValueType*>(cmd)->Init(_face, _func, _ref, _mask); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 face; + uint32 func; + uint32 ref; + uint32 mask; +}; + +COMPILE_ASSERT(sizeof(StencilFuncSeparate) == 20, + Sizeof_StencilFuncSeparate_is_not_20); +COMPILE_ASSERT(offsetof(StencilFuncSeparate, header) == 0, + OffsetOf_StencilFuncSeparate_header_not_0); +COMPILE_ASSERT(offsetof(StencilFuncSeparate, face) == 4, + OffsetOf_StencilFuncSeparate_face_not_4); +COMPILE_ASSERT(offsetof(StencilFuncSeparate, func) == 8, + OffsetOf_StencilFuncSeparate_func_not_8); +COMPILE_ASSERT(offsetof(StencilFuncSeparate, ref) == 12, + OffsetOf_StencilFuncSeparate_ref_not_12); +COMPILE_ASSERT(offsetof(StencilFuncSeparate, mask) == 16, + OffsetOf_StencilFuncSeparate_mask_not_16); + +struct StencilMask { + typedef StencilMask ValueType; + static const CommandId kCmdId = kStencilMask; + 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 _mask) { + SetHeader(); + mask = _mask; + } + + void* Set(void* cmd, GLuint _mask) { + static_cast<ValueType*>(cmd)->Init(_mask); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 mask; +}; + +COMPILE_ASSERT(sizeof(StencilMask) == 8, + Sizeof_StencilMask_is_not_8); +COMPILE_ASSERT(offsetof(StencilMask, header) == 0, + OffsetOf_StencilMask_header_not_0); +COMPILE_ASSERT(offsetof(StencilMask, mask) == 4, + OffsetOf_StencilMask_mask_not_4); + +struct StencilMaskSeparate { + typedef StencilMaskSeparate ValueType; + static const CommandId kCmdId = kStencilMaskSeparate; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _face, GLuint _mask) { + SetHeader(); + face = _face; + mask = _mask; + } + + void* Set(void* cmd, GLenum _face, GLuint _mask) { + static_cast<ValueType*>(cmd)->Init(_face, _mask); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 face; + uint32 mask; +}; + +COMPILE_ASSERT(sizeof(StencilMaskSeparate) == 12, + Sizeof_StencilMaskSeparate_is_not_12); +COMPILE_ASSERT(offsetof(StencilMaskSeparate, header) == 0, + OffsetOf_StencilMaskSeparate_header_not_0); +COMPILE_ASSERT(offsetof(StencilMaskSeparate, face) == 4, + OffsetOf_StencilMaskSeparate_face_not_4); +COMPILE_ASSERT(offsetof(StencilMaskSeparate, mask) == 8, + OffsetOf_StencilMaskSeparate_mask_not_8); + +struct StencilOp { + typedef StencilOp ValueType; + static const CommandId kCmdId = kStencilOp; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _fail, GLenum _zfail, GLenum _zpass) { + SetHeader(); + fail = _fail; + zfail = _zfail; + zpass = _zpass; + } + + void* Set(void* cmd, GLenum _fail, GLenum _zfail, GLenum _zpass) { + static_cast<ValueType*>(cmd)->Init(_fail, _zfail, _zpass); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 fail; + uint32 zfail; + uint32 zpass; +}; + +COMPILE_ASSERT(sizeof(StencilOp) == 16, + Sizeof_StencilOp_is_not_16); +COMPILE_ASSERT(offsetof(StencilOp, header) == 0, + OffsetOf_StencilOp_header_not_0); +COMPILE_ASSERT(offsetof(StencilOp, fail) == 4, + OffsetOf_StencilOp_fail_not_4); +COMPILE_ASSERT(offsetof(StencilOp, zfail) == 8, + OffsetOf_StencilOp_zfail_not_8); +COMPILE_ASSERT(offsetof(StencilOp, zpass) == 12, + OffsetOf_StencilOp_zpass_not_12); + +struct StencilOpSeparate { + typedef StencilOpSeparate ValueType; + static const CommandId kCmdId = kStencilOpSeparate; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _face, GLenum _fail, GLenum _zfail, GLenum _zpass) { + SetHeader(); + face = _face; + fail = _fail; + zfail = _zfail; + zpass = _zpass; + } + + void* Set( + void* cmd, GLenum _face, GLenum _fail, GLenum _zfail, GLenum _zpass) { + static_cast<ValueType*>(cmd)->Init(_face, _fail, _zfail, _zpass); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 face; + uint32 fail; + uint32 zfail; + uint32 zpass; +}; + +COMPILE_ASSERT(sizeof(StencilOpSeparate) == 20, + Sizeof_StencilOpSeparate_is_not_20); +COMPILE_ASSERT(offsetof(StencilOpSeparate, header) == 0, + OffsetOf_StencilOpSeparate_header_not_0); +COMPILE_ASSERT(offsetof(StencilOpSeparate, face) == 4, + OffsetOf_StencilOpSeparate_face_not_4); +COMPILE_ASSERT(offsetof(StencilOpSeparate, fail) == 8, + OffsetOf_StencilOpSeparate_fail_not_8); +COMPILE_ASSERT(offsetof(StencilOpSeparate, zfail) == 12, + OffsetOf_StencilOpSeparate_zfail_not_12); +COMPILE_ASSERT(offsetof(StencilOpSeparate, zpass) == 16, + OffsetOf_StencilOpSeparate_zpass_not_16); + +struct TexImage2D { + typedef TexImage2D ValueType; + static const CommandId kCmdId = kTexImage2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLint _level, GLint _internalformat, GLsizei _width, + GLsizei _height, GLint _border, GLenum _format, GLenum _type, + uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { + SetHeader(); + target = _target; + level = _level; + internalformat = _internalformat; + width = _width; + height = _height; + border = _border; + format = _format; + type = _type; + pixels_shm_id = _pixels_shm_id; + pixels_shm_offset = _pixels_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLint _internalformat, + GLsizei _width, GLsizei _height, GLint _border, GLenum _format, + GLenum _type, uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _internalformat, _width, _height, _border, _format, + _type, _pixels_shm_id, _pixels_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 internalformat; + uint32 width; + uint32 height; + uint32 border; + uint32 format; + uint32 type; + uint32 pixels_shm_id; + uint32 pixels_shm_offset; +}; + +COMPILE_ASSERT(sizeof(TexImage2D) == 44, + Sizeof_TexImage2D_is_not_44); +COMPILE_ASSERT(offsetof(TexImage2D, header) == 0, + OffsetOf_TexImage2D_header_not_0); +COMPILE_ASSERT(offsetof(TexImage2D, target) == 4, + OffsetOf_TexImage2D_target_not_4); +COMPILE_ASSERT(offsetof(TexImage2D, level) == 8, + OffsetOf_TexImage2D_level_not_8); +COMPILE_ASSERT(offsetof(TexImage2D, internalformat) == 12, + OffsetOf_TexImage2D_internalformat_not_12); +COMPILE_ASSERT(offsetof(TexImage2D, width) == 16, + OffsetOf_TexImage2D_width_not_16); +COMPILE_ASSERT(offsetof(TexImage2D, height) == 20, + OffsetOf_TexImage2D_height_not_20); +COMPILE_ASSERT(offsetof(TexImage2D, border) == 24, + OffsetOf_TexImage2D_border_not_24); +COMPILE_ASSERT(offsetof(TexImage2D, format) == 28, + OffsetOf_TexImage2D_format_not_28); +COMPILE_ASSERT(offsetof(TexImage2D, type) == 32, + OffsetOf_TexImage2D_type_not_32); +COMPILE_ASSERT(offsetof(TexImage2D, pixels_shm_id) == 36, + OffsetOf_TexImage2D_pixels_shm_id_not_36); +COMPILE_ASSERT(offsetof(TexImage2D, pixels_shm_offset) == 40, + OffsetOf_TexImage2D_pixels_shm_offset_not_40); + +struct TexImage2DImmediate { + typedef TexImage2DImmediate ValueType; + static const CommandId kCmdId = kTexImage2DImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + 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 + SetHeader(total_size); + target = _target; + level = _level; + internalformat = _internalformat; + width = _width; + height = _height; + border = _border; + format = _format; + type = _type; + } + + void* Set( + 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 + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _internalformat, _width, _height, _border, _format, + _type); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 internalformat; + uint32 width; + uint32 height; + uint32 border; + uint32 format; + uint32 type; +}; + +COMPILE_ASSERT(sizeof(TexImage2DImmediate) == 36, + Sizeof_TexImage2DImmediate_is_not_36); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, header) == 0, + OffsetOf_TexImage2DImmediate_header_not_0); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, target) == 4, + OffsetOf_TexImage2DImmediate_target_not_4); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, level) == 8, + OffsetOf_TexImage2DImmediate_level_not_8); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, internalformat) == 12, + OffsetOf_TexImage2DImmediate_internalformat_not_12); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, width) == 16, + OffsetOf_TexImage2DImmediate_width_not_16); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, height) == 20, + OffsetOf_TexImage2DImmediate_height_not_20); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, border) == 24, + OffsetOf_TexImage2DImmediate_border_not_24); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, format) == 28, + OffsetOf_TexImage2DImmediate_format_not_28); +COMPILE_ASSERT(offsetof(TexImage2DImmediate, type) == 32, + OffsetOf_TexImage2DImmediate_type_not_32); + +struct TexParameterf { + typedef TexParameterf ValueType; + static const CommandId kCmdId = kTexParameterf; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLenum _pname, GLfloat _param) { + SetHeader(); + target = _target; + pname = _pname; + param = _param; + } + + void* Set(void* cmd, GLenum _target, GLenum _pname, GLfloat _param) { + static_cast<ValueType*>(cmd)->Init(_target, _pname, _param); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + float param; +}; + +COMPILE_ASSERT(sizeof(TexParameterf) == 16, + Sizeof_TexParameterf_is_not_16); +COMPILE_ASSERT(offsetof(TexParameterf, header) == 0, + OffsetOf_TexParameterf_header_not_0); +COMPILE_ASSERT(offsetof(TexParameterf, target) == 4, + OffsetOf_TexParameterf_target_not_4); +COMPILE_ASSERT(offsetof(TexParameterf, pname) == 8, + OffsetOf_TexParameterf_pname_not_8); +COMPILE_ASSERT(offsetof(TexParameterf, param) == 12, + OffsetOf_TexParameterf_param_not_12); + +struct TexParameterfv { + typedef TexParameterfv ValueType; + static const CommandId kCmdId = kTexParameterfv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(TexParameterfv) == 20, + Sizeof_TexParameterfv_is_not_20); +COMPILE_ASSERT(offsetof(TexParameterfv, header) == 0, + OffsetOf_TexParameterfv_header_not_0); +COMPILE_ASSERT(offsetof(TexParameterfv, target) == 4, + OffsetOf_TexParameterfv_target_not_4); +COMPILE_ASSERT(offsetof(TexParameterfv, pname) == 8, + OffsetOf_TexParameterfv_pname_not_8); +COMPILE_ASSERT(offsetof(TexParameterfv, params_shm_id) == 12, + OffsetOf_TexParameterfv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(TexParameterfv, params_shm_offset) == 16, + OffsetOf_TexParameterfv_params_shm_offset_not_16); + +struct TexParameterfvImmediate { + typedef TexParameterfvImmediate ValueType; + static const CommandId kCmdId = kTexParameterfvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize() { + return static_cast<uint32>( + sizeof(GLfloat) * 1); // NOLINT + } + + static uint32 ComputeSize() { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize()); // NOLINT + } + + void SetHeader() { + header.SetCmdByTotalSize<ValueType>(ComputeSize()); + } + + void Init(GLenum _target, GLenum _pname, const GLfloat* _params) { + SetHeader(); + target = _target; + pname = _pname; + memcpy(ImmediateDataAddress(this), + _params, ComputeDataSize()); + } + + void* Set(void* cmd, GLenum _target, GLenum _pname, const GLfloat* _params) { + static_cast<ValueType*>(cmd)->Init(_target, _pname, _params); + const uint32 size = ComputeSize(); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; +}; + +COMPILE_ASSERT(sizeof(TexParameterfvImmediate) == 12, + Sizeof_TexParameterfvImmediate_is_not_12); +COMPILE_ASSERT(offsetof(TexParameterfvImmediate, header) == 0, + OffsetOf_TexParameterfvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(TexParameterfvImmediate, target) == 4, + OffsetOf_TexParameterfvImmediate_target_not_4); +COMPILE_ASSERT(offsetof(TexParameterfvImmediate, pname) == 8, + OffsetOf_TexParameterfvImmediate_pname_not_8); + +struct TexParameteri { + typedef TexParameteri ValueType; + static const CommandId kCmdId = kTexParameteri; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLenum _target, GLenum _pname, GLint _param) { + SetHeader(); + target = _target; + pname = _pname; + param = _param; + } + + void* Set(void* cmd, GLenum _target, GLenum _pname, GLint _param) { + static_cast<ValueType*>(cmd)->Init(_target, _pname, _param); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 param; +}; + +COMPILE_ASSERT(sizeof(TexParameteri) == 16, + Sizeof_TexParameteri_is_not_16); +COMPILE_ASSERT(offsetof(TexParameteri, header) == 0, + OffsetOf_TexParameteri_header_not_0); +COMPILE_ASSERT(offsetof(TexParameteri, target) == 4, + OffsetOf_TexParameteri_target_not_4); +COMPILE_ASSERT(offsetof(TexParameteri, pname) == 8, + OffsetOf_TexParameteri_pname_not_8); +COMPILE_ASSERT(offsetof(TexParameteri, param) == 12, + OffsetOf_TexParameteri_param_not_12); + +struct TexParameteriv { + typedef TexParameteriv ValueType; + static const CommandId kCmdId = kTexParameteriv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + SetHeader(); + target = _target; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLenum _pname, uint32 _params_shm_id, + uint32 _params_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_target, _pname, _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; + uint32 params_shm_id; + uint32 params_shm_offset; +}; + +COMPILE_ASSERT(sizeof(TexParameteriv) == 20, + Sizeof_TexParameteriv_is_not_20); +COMPILE_ASSERT(offsetof(TexParameteriv, header) == 0, + OffsetOf_TexParameteriv_header_not_0); +COMPILE_ASSERT(offsetof(TexParameteriv, target) == 4, + OffsetOf_TexParameteriv_target_not_4); +COMPILE_ASSERT(offsetof(TexParameteriv, pname) == 8, + OffsetOf_TexParameteriv_pname_not_8); +COMPILE_ASSERT(offsetof(TexParameteriv, params_shm_id) == 12, + OffsetOf_TexParameteriv_params_shm_id_not_12); +COMPILE_ASSERT(offsetof(TexParameteriv, params_shm_offset) == 16, + OffsetOf_TexParameteriv_params_shm_offset_not_16); + +struct TexParameterivImmediate { + typedef TexParameterivImmediate ValueType; + static const CommandId kCmdId = kTexParameterivImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize() { + return static_cast<uint32>( + sizeof(GLint) * 1); // NOLINT + } + + static uint32 ComputeSize() { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize()); // NOLINT + } + + void SetHeader() { + header.SetCmdByTotalSize<ValueType>(ComputeSize()); + } + + void Init(GLenum _target, GLenum _pname, const GLint* _params) { + SetHeader(); + target = _target; + pname = _pname; + memcpy(ImmediateDataAddress(this), + _params, ComputeDataSize()); + } + + void* Set(void* cmd, GLenum _target, GLenum _pname, const GLint* _params) { + static_cast<ValueType*>(cmd)->Init(_target, _pname, _params); + const uint32 size = ComputeSize(); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 pname; +}; + +COMPILE_ASSERT(sizeof(TexParameterivImmediate) == 12, + Sizeof_TexParameterivImmediate_is_not_12); +COMPILE_ASSERT(offsetof(TexParameterivImmediate, header) == 0, + OffsetOf_TexParameterivImmediate_header_not_0); +COMPILE_ASSERT(offsetof(TexParameterivImmediate, target) == 4, + OffsetOf_TexParameterivImmediate_target_not_4); +COMPILE_ASSERT(offsetof(TexParameterivImmediate, pname) == 8, + OffsetOf_TexParameterivImmediate_pname_not_8); + +struct TexSubImage2D { + typedef TexSubImage2D ValueType; + static const CommandId kCmdId = kTexSubImage2D; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLenum _type, + uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { + SetHeader(); + target = _target; + level = _level; + xoffset = _xoffset; + yoffset = _yoffset; + width = _width; + height = _height; + format = _format; + type = _type; + pixels_shm_id = _pixels_shm_id; + pixels_shm_offset = _pixels_shm_offset; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLenum _type, + uint32 _pixels_shm_id, uint32 _pixels_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _xoffset, _yoffset, _width, _height, _format, + _type, _pixels_shm_id, _pixels_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 xoffset; + uint32 yoffset; + uint32 width; + uint32 height; + uint32 format; + uint32 type; + uint32 pixels_shm_id; + uint32 pixels_shm_offset; +}; + +COMPILE_ASSERT(sizeof(TexSubImage2D) == 44, + Sizeof_TexSubImage2D_is_not_44); +COMPILE_ASSERT(offsetof(TexSubImage2D, header) == 0, + OffsetOf_TexSubImage2D_header_not_0); +COMPILE_ASSERT(offsetof(TexSubImage2D, target) == 4, + OffsetOf_TexSubImage2D_target_not_4); +COMPILE_ASSERT(offsetof(TexSubImage2D, level) == 8, + OffsetOf_TexSubImage2D_level_not_8); +COMPILE_ASSERT(offsetof(TexSubImage2D, xoffset) == 12, + OffsetOf_TexSubImage2D_xoffset_not_12); +COMPILE_ASSERT(offsetof(TexSubImage2D, yoffset) == 16, + OffsetOf_TexSubImage2D_yoffset_not_16); +COMPILE_ASSERT(offsetof(TexSubImage2D, width) == 20, + OffsetOf_TexSubImage2D_width_not_20); +COMPILE_ASSERT(offsetof(TexSubImage2D, height) == 24, + OffsetOf_TexSubImage2D_height_not_24); +COMPILE_ASSERT(offsetof(TexSubImage2D, format) == 28, + OffsetOf_TexSubImage2D_format_not_28); +COMPILE_ASSERT(offsetof(TexSubImage2D, type) == 32, + OffsetOf_TexSubImage2D_type_not_32); +COMPILE_ASSERT(offsetof(TexSubImage2D, pixels_shm_id) == 36, + OffsetOf_TexSubImage2D_pixels_shm_id_not_36); +COMPILE_ASSERT(offsetof(TexSubImage2D, pixels_shm_offset) == 40, + OffsetOf_TexSubImage2D_pixels_shm_offset_not_40); + +struct TexSubImage2DImmediate { + typedef TexSubImage2DImmediate ValueType; + static const CommandId kCmdId = kTexSubImage2DImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeSize(uint32 size_in_bytes) { + return static_cast<uint32>( + sizeof(ValueType) + // NOLINT + RoundSizeToMultipleOfEntries(size_in_bytes)); + } + + void SetHeader(uint32 size_in_bytes) { + header.SetCmdByTotalSize<ValueType>(size_in_bytes); + } + + void Init( + GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLenum _type) { + uint32 total_size = 0; // TODO(gman): get correct size + SetHeader(total_size); + target = _target; + level = _level; + xoffset = _xoffset; + yoffset = _yoffset; + width = _width; + height = _height; + format = _format; + type = _type; + } + + void* Set( + void* cmd, GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, + GLsizei _width, GLsizei _height, GLenum _format, GLenum _type) { + uint32 total_size = 0; // TODO(gman): get correct size + static_cast<ValueType*>( + cmd)->Init( + _target, _level, _xoffset, _yoffset, _width, _height, _format, + _type); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, total_size); + } + + command_buffer::CommandHeader header; + uint32 target; + uint32 level; + uint32 xoffset; + uint32 yoffset; + uint32 width; + uint32 height; + uint32 format; + uint32 type; +}; + +COMPILE_ASSERT(sizeof(TexSubImage2DImmediate) == 36, + Sizeof_TexSubImage2DImmediate_is_not_36); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, header) == 0, + OffsetOf_TexSubImage2DImmediate_header_not_0); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, target) == 4, + OffsetOf_TexSubImage2DImmediate_target_not_4); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, level) == 8, + OffsetOf_TexSubImage2DImmediate_level_not_8); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, xoffset) == 12, + OffsetOf_TexSubImage2DImmediate_xoffset_not_12); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, yoffset) == 16, + OffsetOf_TexSubImage2DImmediate_yoffset_not_16); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, width) == 20, + OffsetOf_TexSubImage2DImmediate_width_not_20); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, height) == 24, + OffsetOf_TexSubImage2DImmediate_height_not_24); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, format) == 28, + OffsetOf_TexSubImage2DImmediate_format_not_28); +COMPILE_ASSERT(offsetof(TexSubImage2DImmediate, type) == 32, + OffsetOf_TexSubImage2DImmediate_type_not_32); + +struct Uniform1f { + typedef Uniform1f ValueType; + static const CommandId kCmdId = kUniform1f; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLfloat _x) { + SetHeader(); + location = _location; + x = _x; + } + + void* Set(void* cmd, GLint _location, GLfloat _x) { + static_cast<ValueType*>(cmd)->Init(_location, _x); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + float x; +}; + +COMPILE_ASSERT(sizeof(Uniform1f) == 12, + Sizeof_Uniform1f_is_not_12); +COMPILE_ASSERT(offsetof(Uniform1f, header) == 0, + OffsetOf_Uniform1f_header_not_0); +COMPILE_ASSERT(offsetof(Uniform1f, location) == 4, + OffsetOf_Uniform1f_location_not_4); +COMPILE_ASSERT(offsetof(Uniform1f, x) == 8, + OffsetOf_Uniform1f_x_not_8); + +struct Uniform1fv { + typedef Uniform1fv ValueType; + static const CommandId kCmdId = kUniform1fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform1fv) == 20, + Sizeof_Uniform1fv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform1fv, header) == 0, + OffsetOf_Uniform1fv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform1fv, location) == 4, + OffsetOf_Uniform1fv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform1fv, count) == 8, + OffsetOf_Uniform1fv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform1fv, v_shm_id) == 12, + OffsetOf_Uniform1fv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform1fv, v_shm_offset) == 16, + OffsetOf_Uniform1fv_v_shm_offset_not_16); + +struct Uniform1fvImmediate { + typedef Uniform1fvImmediate ValueType; + static const CommandId kCmdId = kUniform1fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 1 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLfloat* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform1fvImmediate) == 12, + Sizeof_Uniform1fvImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform1fvImmediate, header) == 0, + OffsetOf_Uniform1fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform1fvImmediate, location) == 4, + OffsetOf_Uniform1fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform1fvImmediate, count) == 8, + OffsetOf_Uniform1fvImmediate_count_not_8); + +struct Uniform1i { + typedef Uniform1i ValueType; + static const CommandId kCmdId = kUniform1i; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLint _x) { + SetHeader(); + location = _location; + x = _x; + } + + void* Set(void* cmd, GLint _location, GLint _x) { + static_cast<ValueType*>(cmd)->Init(_location, _x); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 x; +}; + +COMPILE_ASSERT(sizeof(Uniform1i) == 12, + Sizeof_Uniform1i_is_not_12); +COMPILE_ASSERT(offsetof(Uniform1i, header) == 0, + OffsetOf_Uniform1i_header_not_0); +COMPILE_ASSERT(offsetof(Uniform1i, location) == 4, + OffsetOf_Uniform1i_location_not_4); +COMPILE_ASSERT(offsetof(Uniform1i, x) == 8, + OffsetOf_Uniform1i_x_not_8); + +struct Uniform1iv { + typedef Uniform1iv ValueType; + static const CommandId kCmdId = kUniform1iv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform1iv) == 20, + Sizeof_Uniform1iv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform1iv, header) == 0, + OffsetOf_Uniform1iv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform1iv, location) == 4, + OffsetOf_Uniform1iv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform1iv, count) == 8, + OffsetOf_Uniform1iv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform1iv, v_shm_id) == 12, + OffsetOf_Uniform1iv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform1iv, v_shm_offset) == 16, + OffsetOf_Uniform1iv_v_shm_offset_not_16); + +struct Uniform1ivImmediate { + typedef Uniform1ivImmediate ValueType; + static const CommandId kCmdId = kUniform1ivImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLint) * 1 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLint* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform1ivImmediate) == 12, + Sizeof_Uniform1ivImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform1ivImmediate, header) == 0, + OffsetOf_Uniform1ivImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform1ivImmediate, location) == 4, + OffsetOf_Uniform1ivImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform1ivImmediate, count) == 8, + OffsetOf_Uniform1ivImmediate_count_not_8); + +struct Uniform2f { + typedef Uniform2f ValueType; + static const CommandId kCmdId = kUniform2f; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLfloat _x, GLfloat _y) { + SetHeader(); + location = _location; + x = _x; + y = _y; + } + + void* Set(void* cmd, GLint _location, GLfloat _x, GLfloat _y) { + static_cast<ValueType*>(cmd)->Init(_location, _x, _y); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + float x; + float y; +}; + +COMPILE_ASSERT(sizeof(Uniform2f) == 16, + Sizeof_Uniform2f_is_not_16); +COMPILE_ASSERT(offsetof(Uniform2f, header) == 0, + OffsetOf_Uniform2f_header_not_0); +COMPILE_ASSERT(offsetof(Uniform2f, location) == 4, + OffsetOf_Uniform2f_location_not_4); +COMPILE_ASSERT(offsetof(Uniform2f, x) == 8, + OffsetOf_Uniform2f_x_not_8); +COMPILE_ASSERT(offsetof(Uniform2f, y) == 12, + OffsetOf_Uniform2f_y_not_12); + +struct Uniform2fv { + typedef Uniform2fv ValueType; + static const CommandId kCmdId = kUniform2fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform2fv) == 20, + Sizeof_Uniform2fv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform2fv, header) == 0, + OffsetOf_Uniform2fv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform2fv, location) == 4, + OffsetOf_Uniform2fv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform2fv, count) == 8, + OffsetOf_Uniform2fv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform2fv, v_shm_id) == 12, + OffsetOf_Uniform2fv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform2fv, v_shm_offset) == 16, + OffsetOf_Uniform2fv_v_shm_offset_not_16); + +struct Uniform2fvImmediate { + typedef Uniform2fvImmediate ValueType; + static const CommandId kCmdId = kUniform2fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 2 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLfloat* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform2fvImmediate) == 12, + Sizeof_Uniform2fvImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform2fvImmediate, header) == 0, + OffsetOf_Uniform2fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform2fvImmediate, location) == 4, + OffsetOf_Uniform2fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform2fvImmediate, count) == 8, + OffsetOf_Uniform2fvImmediate_count_not_8); + +struct Uniform2i { + typedef Uniform2i ValueType; + static const CommandId kCmdId = kUniform2i; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLint _x, GLint _y) { + SetHeader(); + location = _location; + x = _x; + y = _y; + } + + void* Set(void* cmd, GLint _location, GLint _x, GLint _y) { + static_cast<ValueType*>(cmd)->Init(_location, _x, _y); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 x; + uint32 y; +}; + +COMPILE_ASSERT(sizeof(Uniform2i) == 16, + Sizeof_Uniform2i_is_not_16); +COMPILE_ASSERT(offsetof(Uniform2i, header) == 0, + OffsetOf_Uniform2i_header_not_0); +COMPILE_ASSERT(offsetof(Uniform2i, location) == 4, + OffsetOf_Uniform2i_location_not_4); +COMPILE_ASSERT(offsetof(Uniform2i, x) == 8, + OffsetOf_Uniform2i_x_not_8); +COMPILE_ASSERT(offsetof(Uniform2i, y) == 12, + OffsetOf_Uniform2i_y_not_12); + +struct Uniform2iv { + typedef Uniform2iv ValueType; + static const CommandId kCmdId = kUniform2iv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform2iv) == 20, + Sizeof_Uniform2iv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform2iv, header) == 0, + OffsetOf_Uniform2iv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform2iv, location) == 4, + OffsetOf_Uniform2iv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform2iv, count) == 8, + OffsetOf_Uniform2iv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform2iv, v_shm_id) == 12, + OffsetOf_Uniform2iv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform2iv, v_shm_offset) == 16, + OffsetOf_Uniform2iv_v_shm_offset_not_16); + +struct Uniform2ivImmediate { + typedef Uniform2ivImmediate ValueType; + static const CommandId kCmdId = kUniform2ivImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLint) * 2 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLint* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform2ivImmediate) == 12, + Sizeof_Uniform2ivImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform2ivImmediate, header) == 0, + OffsetOf_Uniform2ivImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform2ivImmediate, location) == 4, + OffsetOf_Uniform2ivImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform2ivImmediate, count) == 8, + OffsetOf_Uniform2ivImmediate_count_not_8); + +struct Uniform3f { + typedef Uniform3f ValueType; + static const CommandId kCmdId = kUniform3f; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLfloat _x, GLfloat _y, GLfloat _z) { + SetHeader(); + location = _location; + x = _x; + y = _y; + z = _z; + } + + void* Set(void* cmd, GLint _location, GLfloat _x, GLfloat _y, GLfloat _z) { + static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + float x; + float y; + float z; +}; + +COMPILE_ASSERT(sizeof(Uniform3f) == 20, + Sizeof_Uniform3f_is_not_20); +COMPILE_ASSERT(offsetof(Uniform3f, header) == 0, + OffsetOf_Uniform3f_header_not_0); +COMPILE_ASSERT(offsetof(Uniform3f, location) == 4, + OffsetOf_Uniform3f_location_not_4); +COMPILE_ASSERT(offsetof(Uniform3f, x) == 8, + OffsetOf_Uniform3f_x_not_8); +COMPILE_ASSERT(offsetof(Uniform3f, y) == 12, + OffsetOf_Uniform3f_y_not_12); +COMPILE_ASSERT(offsetof(Uniform3f, z) == 16, + OffsetOf_Uniform3f_z_not_16); + +struct Uniform3fv { + typedef Uniform3fv ValueType; + static const CommandId kCmdId = kUniform3fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform3fv) == 20, + Sizeof_Uniform3fv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform3fv, header) == 0, + OffsetOf_Uniform3fv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform3fv, location) == 4, + OffsetOf_Uniform3fv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform3fv, count) == 8, + OffsetOf_Uniform3fv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform3fv, v_shm_id) == 12, + OffsetOf_Uniform3fv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform3fv, v_shm_offset) == 16, + OffsetOf_Uniform3fv_v_shm_offset_not_16); + +struct Uniform3fvImmediate { + typedef Uniform3fvImmediate ValueType; + static const CommandId kCmdId = kUniform3fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 3 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLfloat* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform3fvImmediate) == 12, + Sizeof_Uniform3fvImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform3fvImmediate, header) == 0, + OffsetOf_Uniform3fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform3fvImmediate, location) == 4, + OffsetOf_Uniform3fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform3fvImmediate, count) == 8, + OffsetOf_Uniform3fvImmediate_count_not_8); + +struct Uniform3i { + typedef Uniform3i ValueType; + static const CommandId kCmdId = kUniform3i; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLint _x, GLint _y, GLint _z) { + SetHeader(); + location = _location; + x = _x; + y = _y; + z = _z; + } + + void* Set(void* cmd, GLint _location, GLint _x, GLint _y, GLint _z) { + static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 x; + uint32 y; + uint32 z; +}; + +COMPILE_ASSERT(sizeof(Uniform3i) == 20, + Sizeof_Uniform3i_is_not_20); +COMPILE_ASSERT(offsetof(Uniform3i, header) == 0, + OffsetOf_Uniform3i_header_not_0); +COMPILE_ASSERT(offsetof(Uniform3i, location) == 4, + OffsetOf_Uniform3i_location_not_4); +COMPILE_ASSERT(offsetof(Uniform3i, x) == 8, + OffsetOf_Uniform3i_x_not_8); +COMPILE_ASSERT(offsetof(Uniform3i, y) == 12, + OffsetOf_Uniform3i_y_not_12); +COMPILE_ASSERT(offsetof(Uniform3i, z) == 16, + OffsetOf_Uniform3i_z_not_16); + +struct Uniform3iv { + typedef Uniform3iv ValueType; + static const CommandId kCmdId = kUniform3iv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform3iv) == 20, + Sizeof_Uniform3iv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform3iv, header) == 0, + OffsetOf_Uniform3iv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform3iv, location) == 4, + OffsetOf_Uniform3iv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform3iv, count) == 8, + OffsetOf_Uniform3iv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform3iv, v_shm_id) == 12, + OffsetOf_Uniform3iv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform3iv, v_shm_offset) == 16, + OffsetOf_Uniform3iv_v_shm_offset_not_16); + +struct Uniform3ivImmediate { + typedef Uniform3ivImmediate ValueType; + static const CommandId kCmdId = kUniform3ivImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLint) * 3 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLint* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform3ivImmediate) == 12, + Sizeof_Uniform3ivImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform3ivImmediate, header) == 0, + OffsetOf_Uniform3ivImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform3ivImmediate, location) == 4, + OffsetOf_Uniform3ivImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform3ivImmediate, count) == 8, + OffsetOf_Uniform3ivImmediate_count_not_8); + +struct Uniform4f { + typedef Uniform4f ValueType; + static const CommandId kCmdId = kUniform4f; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLfloat _x, GLfloat _y, GLfloat _z, GLfloat _w) { + SetHeader(); + location = _location; + x = _x; + y = _y; + z = _z; + w = _w; + } + + void* Set( + void* cmd, GLint _location, GLfloat _x, GLfloat _y, GLfloat _z, + GLfloat _w) { + static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z, _w); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + float x; + float y; + float z; + float w; +}; + +COMPILE_ASSERT(sizeof(Uniform4f) == 24, + Sizeof_Uniform4f_is_not_24); +COMPILE_ASSERT(offsetof(Uniform4f, header) == 0, + OffsetOf_Uniform4f_header_not_0); +COMPILE_ASSERT(offsetof(Uniform4f, location) == 4, + OffsetOf_Uniform4f_location_not_4); +COMPILE_ASSERT(offsetof(Uniform4f, x) == 8, + OffsetOf_Uniform4f_x_not_8); +COMPILE_ASSERT(offsetof(Uniform4f, y) == 12, + OffsetOf_Uniform4f_y_not_12); +COMPILE_ASSERT(offsetof(Uniform4f, z) == 16, + OffsetOf_Uniform4f_z_not_16); +COMPILE_ASSERT(offsetof(Uniform4f, w) == 20, + OffsetOf_Uniform4f_w_not_20); + +struct Uniform4fv { + typedef Uniform4fv ValueType; + static const CommandId kCmdId = kUniform4fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform4fv) == 20, + Sizeof_Uniform4fv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform4fv, header) == 0, + OffsetOf_Uniform4fv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform4fv, location) == 4, + OffsetOf_Uniform4fv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform4fv, count) == 8, + OffsetOf_Uniform4fv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform4fv, v_shm_id) == 12, + OffsetOf_Uniform4fv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform4fv, v_shm_offset) == 16, + OffsetOf_Uniform4fv_v_shm_offset_not_16); + +struct Uniform4fvImmediate { + typedef Uniform4fvImmediate ValueType; + static const CommandId kCmdId = kUniform4fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 4 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLfloat* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform4fvImmediate) == 12, + Sizeof_Uniform4fvImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform4fvImmediate, header) == 0, + OffsetOf_Uniform4fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform4fvImmediate, location) == 4, + OffsetOf_Uniform4fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform4fvImmediate, count) == 8, + OffsetOf_Uniform4fvImmediate_count_not_8); + +struct Uniform4i { + typedef Uniform4i ValueType; + static const CommandId kCmdId = kUniform4i; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _location, GLint _x, GLint _y, GLint _z, GLint _w) { + SetHeader(); + location = _location; + x = _x; + y = _y; + z = _z; + w = _w; + } + + void* Set( + void* cmd, GLint _location, GLint _x, GLint _y, GLint _z, GLint _w) { + static_cast<ValueType*>(cmd)->Init(_location, _x, _y, _z, _w); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 x; + uint32 y; + uint32 z; + uint32 w; +}; + +COMPILE_ASSERT(sizeof(Uniform4i) == 24, + Sizeof_Uniform4i_is_not_24); +COMPILE_ASSERT(offsetof(Uniform4i, header) == 0, + OffsetOf_Uniform4i_header_not_0); +COMPILE_ASSERT(offsetof(Uniform4i, location) == 4, + OffsetOf_Uniform4i_location_not_4); +COMPILE_ASSERT(offsetof(Uniform4i, x) == 8, + OffsetOf_Uniform4i_x_not_8); +COMPILE_ASSERT(offsetof(Uniform4i, y) == 12, + OffsetOf_Uniform4i_y_not_12); +COMPILE_ASSERT(offsetof(Uniform4i, z) == 16, + OffsetOf_Uniform4i_z_not_16); +COMPILE_ASSERT(offsetof(Uniform4i, w) == 20, + OffsetOf_Uniform4i_w_not_20); + +struct Uniform4iv { + typedef Uniform4iv ValueType; + static const CommandId kCmdId = kUniform4iv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + SetHeader(); + location = _location; + count = _count; + v_shm_id = _v_shm_id; + v_shm_offset = _v_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, uint32 _v_shm_id, + uint32 _v_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_location, _count, _v_shm_id, _v_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 v_shm_id; + uint32 v_shm_offset; +}; + +COMPILE_ASSERT(sizeof(Uniform4iv) == 20, + Sizeof_Uniform4iv_is_not_20); +COMPILE_ASSERT(offsetof(Uniform4iv, header) == 0, + OffsetOf_Uniform4iv_header_not_0); +COMPILE_ASSERT(offsetof(Uniform4iv, location) == 4, + OffsetOf_Uniform4iv_location_not_4); +COMPILE_ASSERT(offsetof(Uniform4iv, count) == 8, + OffsetOf_Uniform4iv_count_not_8); +COMPILE_ASSERT(offsetof(Uniform4iv, v_shm_id) == 12, + OffsetOf_Uniform4iv_v_shm_id_not_12); +COMPILE_ASSERT(offsetof(Uniform4iv, v_shm_offset) == 16, + OffsetOf_Uniform4iv_v_shm_offset_not_16); + +struct Uniform4ivImmediate { + typedef Uniform4ivImmediate ValueType; + static const CommandId kCmdId = kUniform4ivImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLint) * 4 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init(GLint _location, GLsizei _count, const GLint* _v) { + SetHeader(_count); + location = _location; + count = _count; + memcpy(ImmediateDataAddress(this), + _v, ComputeDataSize(_count)); + } + + void* Set(void* cmd, GLint _location, GLsizei _count, const GLint* _v) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _v); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; +}; + +COMPILE_ASSERT(sizeof(Uniform4ivImmediate) == 12, + Sizeof_Uniform4ivImmediate_is_not_12); +COMPILE_ASSERT(offsetof(Uniform4ivImmediate, header) == 0, + OffsetOf_Uniform4ivImmediate_header_not_0); +COMPILE_ASSERT(offsetof(Uniform4ivImmediate, location) == 4, + OffsetOf_Uniform4ivImmediate_location_not_4); +COMPILE_ASSERT(offsetof(Uniform4ivImmediate, count) == 8, + OffsetOf_Uniform4ivImmediate_count_not_8); + +struct UniformMatrix2fv { + typedef UniformMatrix2fv ValueType; + static const CommandId kCmdId = kUniformMatrix2fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, GLboolean _transpose, + uint32 _value_shm_id, uint32 _value_shm_offset) { + SetHeader(); + location = _location; + count = _count; + transpose = _transpose; + value_shm_id = _value_shm_id; + value_shm_offset = _value_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, + uint32 _value_shm_id, uint32 _value_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _location, _count, _transpose, _value_shm_id, _value_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 transpose; + uint32 value_shm_id; + uint32 value_shm_offset; +}; + +COMPILE_ASSERT(sizeof(UniformMatrix2fv) == 24, + Sizeof_UniformMatrix2fv_is_not_24); +COMPILE_ASSERT(offsetof(UniformMatrix2fv, header) == 0, + OffsetOf_UniformMatrix2fv_header_not_0); +COMPILE_ASSERT(offsetof(UniformMatrix2fv, location) == 4, + OffsetOf_UniformMatrix2fv_location_not_4); +COMPILE_ASSERT(offsetof(UniformMatrix2fv, count) == 8, + OffsetOf_UniformMatrix2fv_count_not_8); +COMPILE_ASSERT(offsetof(UniformMatrix2fv, transpose) == 12, + OffsetOf_UniformMatrix2fv_transpose_not_12); +COMPILE_ASSERT(offsetof(UniformMatrix2fv, value_shm_id) == 16, + OffsetOf_UniformMatrix2fv_value_shm_id_not_16); +COMPILE_ASSERT(offsetof(UniformMatrix2fv, value_shm_offset) == 20, + OffsetOf_UniformMatrix2fv_value_shm_offset_not_20); + +struct UniformMatrix2fvImmediate { + typedef UniformMatrix2fvImmediate ValueType; + static const CommandId kCmdId = kUniformMatrix2fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 4 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init( + GLint _location, GLsizei _count, GLboolean _transpose, + const GLfloat* _value) { + SetHeader(_count); + location = _location; + count = _count; + transpose = _transpose; + memcpy(ImmediateDataAddress(this), + _value, ComputeDataSize(_count)); + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 transpose; +}; + +COMPILE_ASSERT(sizeof(UniformMatrix2fvImmediate) == 16, + Sizeof_UniformMatrix2fvImmediate_is_not_16); +COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, header) == 0, + OffsetOf_UniformMatrix2fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, location) == 4, + OffsetOf_UniformMatrix2fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, count) == 8, + OffsetOf_UniformMatrix2fvImmediate_count_not_8); +COMPILE_ASSERT(offsetof(UniformMatrix2fvImmediate, transpose) == 12, + OffsetOf_UniformMatrix2fvImmediate_transpose_not_12); + +struct UniformMatrix3fv { + typedef UniformMatrix3fv ValueType; + static const CommandId kCmdId = kUniformMatrix3fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, GLboolean _transpose, + uint32 _value_shm_id, uint32 _value_shm_offset) { + SetHeader(); + location = _location; + count = _count; + transpose = _transpose; + value_shm_id = _value_shm_id; + value_shm_offset = _value_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, + uint32 _value_shm_id, uint32 _value_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _location, _count, _transpose, _value_shm_id, _value_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 transpose; + uint32 value_shm_id; + uint32 value_shm_offset; +}; + +COMPILE_ASSERT(sizeof(UniformMatrix3fv) == 24, + Sizeof_UniformMatrix3fv_is_not_24); +COMPILE_ASSERT(offsetof(UniformMatrix3fv, header) == 0, + OffsetOf_UniformMatrix3fv_header_not_0); +COMPILE_ASSERT(offsetof(UniformMatrix3fv, location) == 4, + OffsetOf_UniformMatrix3fv_location_not_4); +COMPILE_ASSERT(offsetof(UniformMatrix3fv, count) == 8, + OffsetOf_UniformMatrix3fv_count_not_8); +COMPILE_ASSERT(offsetof(UniformMatrix3fv, transpose) == 12, + OffsetOf_UniformMatrix3fv_transpose_not_12); +COMPILE_ASSERT(offsetof(UniformMatrix3fv, value_shm_id) == 16, + OffsetOf_UniformMatrix3fv_value_shm_id_not_16); +COMPILE_ASSERT(offsetof(UniformMatrix3fv, value_shm_offset) == 20, + OffsetOf_UniformMatrix3fv_value_shm_offset_not_20); + +struct UniformMatrix3fvImmediate { + typedef UniformMatrix3fvImmediate ValueType; + static const CommandId kCmdId = kUniformMatrix3fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 9 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init( + GLint _location, GLsizei _count, GLboolean _transpose, + const GLfloat* _value) { + SetHeader(_count); + location = _location; + count = _count; + transpose = _transpose; + memcpy(ImmediateDataAddress(this), + _value, ComputeDataSize(_count)); + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 transpose; +}; + +COMPILE_ASSERT(sizeof(UniformMatrix3fvImmediate) == 16, + Sizeof_UniformMatrix3fvImmediate_is_not_16); +COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, header) == 0, + OffsetOf_UniformMatrix3fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, location) == 4, + OffsetOf_UniformMatrix3fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, count) == 8, + OffsetOf_UniformMatrix3fvImmediate_count_not_8); +COMPILE_ASSERT(offsetof(UniformMatrix3fvImmediate, transpose) == 12, + OffsetOf_UniformMatrix3fvImmediate_transpose_not_12); + +struct UniformMatrix4fv { + typedef UniformMatrix4fv ValueType; + static const CommandId kCmdId = kUniformMatrix4fv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init( + GLint _location, GLsizei _count, GLboolean _transpose, + uint32 _value_shm_id, uint32 _value_shm_offset) { + SetHeader(); + location = _location; + count = _count; + transpose = _transpose; + value_shm_id = _value_shm_id; + value_shm_offset = _value_shm_offset; + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, + uint32 _value_shm_id, uint32 _value_shm_offset) { + static_cast<ValueType*>( + cmd)->Init( + _location, _count, _transpose, _value_shm_id, _value_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 transpose; + uint32 value_shm_id; + uint32 value_shm_offset; +}; + +COMPILE_ASSERT(sizeof(UniformMatrix4fv) == 24, + Sizeof_UniformMatrix4fv_is_not_24); +COMPILE_ASSERT(offsetof(UniformMatrix4fv, header) == 0, + OffsetOf_UniformMatrix4fv_header_not_0); +COMPILE_ASSERT(offsetof(UniformMatrix4fv, location) == 4, + OffsetOf_UniformMatrix4fv_location_not_4); +COMPILE_ASSERT(offsetof(UniformMatrix4fv, count) == 8, + OffsetOf_UniformMatrix4fv_count_not_8); +COMPILE_ASSERT(offsetof(UniformMatrix4fv, transpose) == 12, + OffsetOf_UniformMatrix4fv_transpose_not_12); +COMPILE_ASSERT(offsetof(UniformMatrix4fv, value_shm_id) == 16, + OffsetOf_UniformMatrix4fv_value_shm_id_not_16); +COMPILE_ASSERT(offsetof(UniformMatrix4fv, value_shm_offset) == 20, + OffsetOf_UniformMatrix4fv_value_shm_offset_not_20); + +struct UniformMatrix4fvImmediate { + typedef UniformMatrix4fvImmediate ValueType; + static const CommandId kCmdId = kUniformMatrix4fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize(GLsizei count) { + return static_cast<uint32>( + sizeof(GLfloat) * 16 * count); // NOLINT + } + + static uint32 ComputeSize(GLsizei count) { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize(count)); // NOLINT + } + + void SetHeader(GLsizei count) { + header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); + } + + void Init( + GLint _location, GLsizei _count, GLboolean _transpose, + const GLfloat* _value) { + SetHeader(_count); + location = _location; + count = _count; + transpose = _transpose; + memcpy(ImmediateDataAddress(this), + _value, ComputeDataSize(_count)); + } + + void* Set( + void* cmd, GLint _location, GLsizei _count, GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); + const uint32 size = ComputeSize(_count); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 location; + uint32 count; + uint32 transpose; +}; + +COMPILE_ASSERT(sizeof(UniformMatrix4fvImmediate) == 16, + Sizeof_UniformMatrix4fvImmediate_is_not_16); +COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, header) == 0, + OffsetOf_UniformMatrix4fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, location) == 4, + OffsetOf_UniformMatrix4fvImmediate_location_not_4); +COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, count) == 8, + OffsetOf_UniformMatrix4fvImmediate_count_not_8); +COMPILE_ASSERT(offsetof(UniformMatrix4fvImmediate, transpose) == 12, + OffsetOf_UniformMatrix4fvImmediate_transpose_not_12); + +struct UseProgram { + typedef UseProgram ValueType; + static const CommandId kCmdId = kUseProgram; + 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) { + SetHeader(); + program = _program; + } + + void* Set(void* cmd, GLuint _program) { + static_cast<ValueType*>(cmd)->Init(_program); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; +}; + +COMPILE_ASSERT(sizeof(UseProgram) == 8, + Sizeof_UseProgram_is_not_8); +COMPILE_ASSERT(offsetof(UseProgram, header) == 0, + OffsetOf_UseProgram_header_not_0); +COMPILE_ASSERT(offsetof(UseProgram, program) == 4, + OffsetOf_UseProgram_program_not_4); + +struct ValidateProgram { + typedef ValidateProgram ValueType; + static const CommandId kCmdId = kValidateProgram; + 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) { + SetHeader(); + program = _program; + } + + void* Set(void* cmd, GLuint _program) { + static_cast<ValueType*>(cmd)->Init(_program); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 program; +}; + +COMPILE_ASSERT(sizeof(ValidateProgram) == 8, + Sizeof_ValidateProgram_is_not_8); +COMPILE_ASSERT(offsetof(ValidateProgram, header) == 0, + OffsetOf_ValidateProgram_header_not_0); +COMPILE_ASSERT(offsetof(ValidateProgram, program) == 4, + OffsetOf_ValidateProgram_program_not_4); + +struct VertexAttrib1f { + typedef VertexAttrib1f ValueType; + static const CommandId kCmdId = kVertexAttrib1f; + 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 _indx, GLfloat _x) { + SetHeader(); + indx = _indx; + x = _x; + } + + void* Set(void* cmd, GLuint _indx, GLfloat _x) { + static_cast<ValueType*>(cmd)->Init(_indx, _x); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + float x; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib1f) == 12, + Sizeof_VertexAttrib1f_is_not_12); +COMPILE_ASSERT(offsetof(VertexAttrib1f, header) == 0, + OffsetOf_VertexAttrib1f_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib1f, indx) == 4, + OffsetOf_VertexAttrib1f_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib1f, x) == 8, + OffsetOf_VertexAttrib1f_x_not_8); + +struct VertexAttrib1fv { + typedef VertexAttrib1fv ValueType; + static const CommandId kCmdId = kVertexAttrib1fv; + 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { + SetHeader(); + indx = _indx; + values_shm_id = _values_shm_id; + values_shm_offset = _values_shm_offset; + } + + void* Set( + void* cmd, GLuint _indx, uint32 _values_shm_id, + uint32 _values_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_indx, _values_shm_id, _values_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + uint32 values_shm_id; + uint32 values_shm_offset; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib1fv) == 16, + Sizeof_VertexAttrib1fv_is_not_16); +COMPILE_ASSERT(offsetof(VertexAttrib1fv, header) == 0, + OffsetOf_VertexAttrib1fv_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib1fv, indx) == 4, + OffsetOf_VertexAttrib1fv_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib1fv, values_shm_id) == 8, + OffsetOf_VertexAttrib1fv_values_shm_id_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib1fv, values_shm_offset) == 12, + OffsetOf_VertexAttrib1fv_values_shm_offset_not_12); + +struct VertexAttrib1fvImmediate { + typedef VertexAttrib1fvImmediate ValueType; + static const CommandId kCmdId = kVertexAttrib1fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize() { + return static_cast<uint32>( + sizeof(GLfloat) * 1); // NOLINT + } + + static uint32 ComputeSize() { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize()); // NOLINT + } + + void SetHeader() { + header.SetCmdByTotalSize<ValueType>(ComputeSize()); + } + + void Init(GLuint _indx, const GLfloat* _values) { + SetHeader(); + indx = _indx; + memcpy(ImmediateDataAddress(this), + _values, ComputeDataSize()); + } + + void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { + static_cast<ValueType*>(cmd)->Init(_indx, _values); + const uint32 size = ComputeSize(); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 indx; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib1fvImmediate) == 8, + Sizeof_VertexAttrib1fvImmediate_is_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib1fvImmediate, header) == 0, + OffsetOf_VertexAttrib1fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib1fvImmediate, indx) == 4, + OffsetOf_VertexAttrib1fvImmediate_indx_not_4); + +struct VertexAttrib2f { + typedef VertexAttrib2f ValueType; + static const CommandId kCmdId = kVertexAttrib2f; + 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 _indx, GLfloat _x, GLfloat _y) { + SetHeader(); + indx = _indx; + x = _x; + y = _y; + } + + void* Set(void* cmd, GLuint _indx, GLfloat _x, GLfloat _y) { + static_cast<ValueType*>(cmd)->Init(_indx, _x, _y); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + float x; + float y; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib2f) == 16, + Sizeof_VertexAttrib2f_is_not_16); +COMPILE_ASSERT(offsetof(VertexAttrib2f, header) == 0, + OffsetOf_VertexAttrib2f_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib2f, indx) == 4, + OffsetOf_VertexAttrib2f_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib2f, x) == 8, + OffsetOf_VertexAttrib2f_x_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib2f, y) == 12, + OffsetOf_VertexAttrib2f_y_not_12); + +struct VertexAttrib2fv { + typedef VertexAttrib2fv ValueType; + static const CommandId kCmdId = kVertexAttrib2fv; + 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { + SetHeader(); + indx = _indx; + values_shm_id = _values_shm_id; + values_shm_offset = _values_shm_offset; + } + + void* Set( + void* cmd, GLuint _indx, uint32 _values_shm_id, + uint32 _values_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_indx, _values_shm_id, _values_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + uint32 values_shm_id; + uint32 values_shm_offset; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib2fv) == 16, + Sizeof_VertexAttrib2fv_is_not_16); +COMPILE_ASSERT(offsetof(VertexAttrib2fv, header) == 0, + OffsetOf_VertexAttrib2fv_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib2fv, indx) == 4, + OffsetOf_VertexAttrib2fv_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib2fv, values_shm_id) == 8, + OffsetOf_VertexAttrib2fv_values_shm_id_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib2fv, values_shm_offset) == 12, + OffsetOf_VertexAttrib2fv_values_shm_offset_not_12); + +struct VertexAttrib2fvImmediate { + typedef VertexAttrib2fvImmediate ValueType; + static const CommandId kCmdId = kVertexAttrib2fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize() { + return static_cast<uint32>( + sizeof(GLfloat) * 2); // NOLINT + } + + static uint32 ComputeSize() { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize()); // NOLINT + } + + void SetHeader() { + header.SetCmdByTotalSize<ValueType>(ComputeSize()); + } + + void Init(GLuint _indx, const GLfloat* _values) { + SetHeader(); + indx = _indx; + memcpy(ImmediateDataAddress(this), + _values, ComputeDataSize()); + } + + void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { + static_cast<ValueType*>(cmd)->Init(_indx, _values); + const uint32 size = ComputeSize(); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 indx; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib2fvImmediate) == 8, + Sizeof_VertexAttrib2fvImmediate_is_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib2fvImmediate, header) == 0, + OffsetOf_VertexAttrib2fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib2fvImmediate, indx) == 4, + OffsetOf_VertexAttrib2fvImmediate_indx_not_4); + +struct VertexAttrib3f { + typedef VertexAttrib3f ValueType; + static const CommandId kCmdId = kVertexAttrib3f; + 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 _indx, GLfloat _x, GLfloat _y, GLfloat _z) { + SetHeader(); + indx = _indx; + x = _x; + y = _y; + z = _z; + } + + void* Set(void* cmd, GLuint _indx, GLfloat _x, GLfloat _y, GLfloat _z) { + static_cast<ValueType*>(cmd)->Init(_indx, _x, _y, _z); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + float x; + float y; + float z; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib3f) == 20, + Sizeof_VertexAttrib3f_is_not_20); +COMPILE_ASSERT(offsetof(VertexAttrib3f, header) == 0, + OffsetOf_VertexAttrib3f_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib3f, indx) == 4, + OffsetOf_VertexAttrib3f_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib3f, x) == 8, + OffsetOf_VertexAttrib3f_x_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib3f, y) == 12, + OffsetOf_VertexAttrib3f_y_not_12); +COMPILE_ASSERT(offsetof(VertexAttrib3f, z) == 16, + OffsetOf_VertexAttrib3f_z_not_16); + +struct VertexAttrib3fv { + typedef VertexAttrib3fv ValueType; + static const CommandId kCmdId = kVertexAttrib3fv; + 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { + SetHeader(); + indx = _indx; + values_shm_id = _values_shm_id; + values_shm_offset = _values_shm_offset; + } + + void* Set( + void* cmd, GLuint _indx, uint32 _values_shm_id, + uint32 _values_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_indx, _values_shm_id, _values_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + uint32 values_shm_id; + uint32 values_shm_offset; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib3fv) == 16, + Sizeof_VertexAttrib3fv_is_not_16); +COMPILE_ASSERT(offsetof(VertexAttrib3fv, header) == 0, + OffsetOf_VertexAttrib3fv_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib3fv, indx) == 4, + OffsetOf_VertexAttrib3fv_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib3fv, values_shm_id) == 8, + OffsetOf_VertexAttrib3fv_values_shm_id_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib3fv, values_shm_offset) == 12, + OffsetOf_VertexAttrib3fv_values_shm_offset_not_12); + +struct VertexAttrib3fvImmediate { + typedef VertexAttrib3fvImmediate ValueType; + static const CommandId kCmdId = kVertexAttrib3fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize() { + return static_cast<uint32>( + sizeof(GLfloat) * 3); // NOLINT + } + + static uint32 ComputeSize() { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize()); // NOLINT + } + + void SetHeader() { + header.SetCmdByTotalSize<ValueType>(ComputeSize()); + } + + void Init(GLuint _indx, const GLfloat* _values) { + SetHeader(); + indx = _indx; + memcpy(ImmediateDataAddress(this), + _values, ComputeDataSize()); + } + + void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { + static_cast<ValueType*>(cmd)->Init(_indx, _values); + const uint32 size = ComputeSize(); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 indx; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib3fvImmediate) == 8, + Sizeof_VertexAttrib3fvImmediate_is_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib3fvImmediate, header) == 0, + OffsetOf_VertexAttrib3fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib3fvImmediate, indx) == 4, + OffsetOf_VertexAttrib3fvImmediate_indx_not_4); + +struct VertexAttrib4f { + typedef VertexAttrib4f ValueType; + static const CommandId kCmdId = kVertexAttrib4f; + 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 _indx, GLfloat _x, GLfloat _y, GLfloat _z, GLfloat _w) { + SetHeader(); + indx = _indx; + x = _x; + y = _y; + z = _z; + w = _w; + } + + void* Set( + void* cmd, GLuint _indx, GLfloat _x, GLfloat _y, GLfloat _z, + GLfloat _w) { + static_cast<ValueType*>(cmd)->Init(_indx, _x, _y, _z, _w); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + float x; + float y; + float z; + float w; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib4f) == 24, + Sizeof_VertexAttrib4f_is_not_24); +COMPILE_ASSERT(offsetof(VertexAttrib4f, header) == 0, + OffsetOf_VertexAttrib4f_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib4f, indx) == 4, + OffsetOf_VertexAttrib4f_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib4f, x) == 8, + OffsetOf_VertexAttrib4f_x_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib4f, y) == 12, + OffsetOf_VertexAttrib4f_y_not_12); +COMPILE_ASSERT(offsetof(VertexAttrib4f, z) == 16, + OffsetOf_VertexAttrib4f_z_not_16); +COMPILE_ASSERT(offsetof(VertexAttrib4f, w) == 20, + OffsetOf_VertexAttrib4f_w_not_20); + +struct VertexAttrib4fv { + typedef VertexAttrib4fv ValueType; + static const CommandId kCmdId = kVertexAttrib4fv; + 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 _indx, uint32 _values_shm_id, uint32 _values_shm_offset) { + SetHeader(); + indx = _indx; + values_shm_id = _values_shm_id; + values_shm_offset = _values_shm_offset; + } + + void* Set( + void* cmd, GLuint _indx, uint32 _values_shm_id, + uint32 _values_shm_offset) { + static_cast<ValueType*>( + cmd)->Init(_indx, _values_shm_id, _values_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + uint32 values_shm_id; + uint32 values_shm_offset; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib4fv) == 16, + Sizeof_VertexAttrib4fv_is_not_16); +COMPILE_ASSERT(offsetof(VertexAttrib4fv, header) == 0, + OffsetOf_VertexAttrib4fv_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib4fv, indx) == 4, + OffsetOf_VertexAttrib4fv_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttrib4fv, values_shm_id) == 8, + OffsetOf_VertexAttrib4fv_values_shm_id_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib4fv, values_shm_offset) == 12, + OffsetOf_VertexAttrib4fv_values_shm_offset_not_12); + +struct VertexAttrib4fvImmediate { + typedef VertexAttrib4fvImmediate ValueType; + static const CommandId kCmdId = kVertexAttrib4fvImmediate; + static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN; + + static uint32 ComputeDataSize() { + return static_cast<uint32>( + sizeof(GLfloat) * 4); // NOLINT + } + + static uint32 ComputeSize() { + return static_cast<uint32>( + sizeof(ValueType) + ComputeDataSize()); // NOLINT + } + + void SetHeader() { + header.SetCmdByTotalSize<ValueType>(ComputeSize()); + } + + void Init(GLuint _indx, const GLfloat* _values) { + SetHeader(); + indx = _indx; + memcpy(ImmediateDataAddress(this), + _values, ComputeDataSize()); + } + + void* Set(void* cmd, GLuint _indx, const GLfloat* _values) { + static_cast<ValueType*>(cmd)->Init(_indx, _values); + const uint32 size = ComputeSize(); + return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); + } + + command_buffer::CommandHeader header; + uint32 indx; +}; + +COMPILE_ASSERT(sizeof(VertexAttrib4fvImmediate) == 8, + Sizeof_VertexAttrib4fvImmediate_is_not_8); +COMPILE_ASSERT(offsetof(VertexAttrib4fvImmediate, header) == 0, + OffsetOf_VertexAttrib4fvImmediate_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttrib4fvImmediate, indx) == 4, + OffsetOf_VertexAttrib4fvImmediate_indx_not_4); + +struct VertexAttribPointer { + typedef VertexAttribPointer ValueType; + static const CommandId kCmdId = kVertexAttribPointer; + 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 _indx, GLint _size, GLenum _type, GLboolean _normalized, + GLsizei _stride, GLuint _offset) { + SetHeader(); + indx = _indx; + size = _size; + type = _type; + normalized = _normalized; + stride = _stride; + offset = _offset; + } + + void* Set( + void* cmd, GLuint _indx, GLint _size, GLenum _type, GLboolean _normalized, + GLsizei _stride, GLuint _offset) { + static_cast<ValueType*>( + cmd)->Init(_indx, _size, _type, _normalized, _stride, _offset); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 indx; + uint32 size; + uint32 type; + uint32 normalized; + uint32 stride; + uint32 offset; +}; + +COMPILE_ASSERT(sizeof(VertexAttribPointer) == 28, + Sizeof_VertexAttribPointer_is_not_28); +COMPILE_ASSERT(offsetof(VertexAttribPointer, header) == 0, + OffsetOf_VertexAttribPointer_header_not_0); +COMPILE_ASSERT(offsetof(VertexAttribPointer, indx) == 4, + OffsetOf_VertexAttribPointer_indx_not_4); +COMPILE_ASSERT(offsetof(VertexAttribPointer, size) == 8, + OffsetOf_VertexAttribPointer_size_not_8); +COMPILE_ASSERT(offsetof(VertexAttribPointer, type) == 12, + OffsetOf_VertexAttribPointer_type_not_12); +COMPILE_ASSERT(offsetof(VertexAttribPointer, normalized) == 16, + OffsetOf_VertexAttribPointer_normalized_not_16); +COMPILE_ASSERT(offsetof(VertexAttribPointer, stride) == 20, + OffsetOf_VertexAttribPointer_stride_not_20); +COMPILE_ASSERT(offsetof(VertexAttribPointer, offset) == 24, + OffsetOf_VertexAttribPointer_offset_not_24); + +struct Viewport { + typedef Viewport ValueType; + static const CommandId kCmdId = kViewport; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + + static uint32 ComputeSize() { + return static_cast<uint32>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { + header.SetCmd<ValueType>(); + } + + void Init(GLint _x, GLint _y, GLsizei _width, GLsizei _height) { + SetHeader(); + x = _x; + y = _y; + width = _width; + height = _height; + } + + void* Set(void* cmd, GLint _x, GLint _y, GLsizei _width, GLsizei _height) { + static_cast<ValueType*>(cmd)->Init(_x, _y, _width, _height); + return NextCmdAddress<ValueType>(cmd); + } + + command_buffer::CommandHeader header; + uint32 x; + uint32 y; + uint32 width; + uint32 height; +}; + +COMPILE_ASSERT(sizeof(Viewport) == 20, + Sizeof_Viewport_is_not_20); +COMPILE_ASSERT(offsetof(Viewport, header) == 0, + OffsetOf_Viewport_header_not_0); +COMPILE_ASSERT(offsetof(Viewport, x) == 4, + OffsetOf_Viewport_x_not_4); +COMPILE_ASSERT(offsetof(Viewport, y) == 8, + OffsetOf_Viewport_y_not_8); +COMPILE_ASSERT(offsetof(Viewport, width) == 12, + OffsetOf_Viewport_width_not_12); +COMPILE_ASSERT(offsetof(Viewport, height) == 16, + OffsetOf_Viewport_height_not_16); + +#pragma pack(pop) + diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_ids.h b/o3d/gpu/command_buffer/common/gles2_cmd_ids.h new file mode 100644 index 0000000..130fce9 --- /dev/null +++ b/o3d/gpu/command_buffer/common/gles2_cmd_ids.h @@ -0,0 +1,23 @@ +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file defines the GLES2 command buffer commands. + +#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_H +#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_H + +#include "gpu/command_buffer/common/cmd_buffer_common.h" + +namespace command_buffer { +namespace gles2 { + +#include "gpu/command_buffer/common/gles2_cmd_ids_autogen.h" + +const char* GetCommandName(CommandId command_id); + +} // namespace gles2 +} // namespace command_buffer + +#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_H + diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/o3d/gpu/command_buffer/common/gles2_cmd_ids_autogen.h new file mode 100644 index 0000000..3fee2f9 --- /dev/null +++ b/o3d/gpu/command_buffer/common/gles2_cmd_ids_autogen.h @@ -0,0 +1,187 @@ +// This file is auto-generated. DO NOT EDIT! + +#define GLES2_COMMAND_LIST(OP) \ + OP(ActiveTexture) /* 1024 */ \ + OP(AttachShader) /* 1025 */ \ + OP(BindAttribLocation) /* 1026 */ \ + OP(BindAttribLocationImmediate) /* 1027 */ \ + OP(BindBuffer) /* 1028 */ \ + OP(BindFramebuffer) /* 1029 */ \ + OP(BindRenderbuffer) /* 1030 */ \ + OP(BindTexture) /* 1031 */ \ + OP(BlendColor) /* 1032 */ \ + OP(BlendEquation) /* 1033 */ \ + OP(BlendEquationSeparate) /* 1034 */ \ + OP(BlendFunc) /* 1035 */ \ + OP(BlendFuncSeparate) /* 1036 */ \ + OP(BufferData) /* 1037 */ \ + OP(BufferDataImmediate) /* 1038 */ \ + OP(BufferSubData) /* 1039 */ \ + OP(BufferSubDataImmediate) /* 1040 */ \ + OP(CheckFramebufferStatus) /* 1041 */ \ + OP(Clear) /* 1042 */ \ + OP(ClearColor) /* 1043 */ \ + OP(ClearDepthf) /* 1044 */ \ + OP(ClearStencil) /* 1045 */ \ + OP(ColorMask) /* 1046 */ \ + OP(CompileShader) /* 1047 */ \ + OP(CompressedTexImage2D) /* 1048 */ \ + OP(CompressedTexImage2DImmediate) /* 1049 */ \ + OP(CompressedTexSubImage2D) /* 1050 */ \ + OP(CompressedTexSubImage2DImmediate) /* 1051 */ \ + OP(CopyTexImage2D) /* 1052 */ \ + OP(CopyTexSubImage2D) /* 1053 */ \ + OP(CreateProgram) /* 1054 */ \ + OP(CreateShader) /* 1055 */ \ + OP(CullFace) /* 1056 */ \ + OP(DeleteBuffers) /* 1057 */ \ + OP(DeleteBuffersImmediate) /* 1058 */ \ + OP(DeleteFramebuffers) /* 1059 */ \ + OP(DeleteFramebuffersImmediate) /* 1060 */ \ + OP(DeleteProgram) /* 1061 */ \ + OP(DeleteRenderbuffers) /* 1062 */ \ + OP(DeleteRenderbuffersImmediate) /* 1063 */ \ + OP(DeleteShader) /* 1064 */ \ + OP(DeleteTextures) /* 1065 */ \ + OP(DeleteTexturesImmediate) /* 1066 */ \ + OP(DepthFunc) /* 1067 */ \ + OP(DepthMask) /* 1068 */ \ + OP(DepthRangef) /* 1069 */ \ + OP(DetachShader) /* 1070 */ \ + OP(Disable) /* 1071 */ \ + OP(DisableVertexAttribArray) /* 1072 */ \ + OP(DrawArrays) /* 1073 */ \ + OP(DrawElements) /* 1074 */ \ + OP(Enable) /* 1075 */ \ + OP(EnableVertexAttribArray) /* 1076 */ \ + OP(Finish) /* 1077 */ \ + OP(Flush) /* 1078 */ \ + OP(FramebufferRenderbuffer) /* 1079 */ \ + OP(FramebufferTexture2D) /* 1080 */ \ + OP(FrontFace) /* 1081 */ \ + OP(GenBuffers) /* 1082 */ \ + OP(GenBuffersImmediate) /* 1083 */ \ + OP(GenerateMipmap) /* 1084 */ \ + OP(GenFramebuffers) /* 1085 */ \ + OP(GenFramebuffersImmediate) /* 1086 */ \ + OP(GenRenderbuffers) /* 1087 */ \ + OP(GenRenderbuffersImmediate) /* 1088 */ \ + OP(GenTextures) /* 1089 */ \ + OP(GenTexturesImmediate) /* 1090 */ \ + OP(GetActiveAttrib) /* 1091 */ \ + OP(GetActiveUniform) /* 1092 */ \ + OP(GetAttachedShaders) /* 1093 */ \ + OP(GetAttribLocation) /* 1094 */ \ + OP(GetAttribLocationImmediate) /* 1095 */ \ + OP(GetBooleanv) /* 1096 */ \ + OP(GetBufferParameteriv) /* 1097 */ \ + OP(GetError) /* 1098 */ \ + OP(GetFloatv) /* 1099 */ \ + OP(GetFramebufferAttachmentParameteriv) /* 1100 */ \ + OP(GetIntegerv) /* 1101 */ \ + OP(GetProgramiv) /* 1102 */ \ + OP(GetProgramInfoLog) /* 1103 */ \ + OP(GetRenderbufferParameteriv) /* 1104 */ \ + OP(GetShaderiv) /* 1105 */ \ + OP(GetShaderInfoLog) /* 1106 */ \ + OP(GetShaderPrecisionFormat) /* 1107 */ \ + OP(GetShaderSource) /* 1108 */ \ + OP(GetString) /* 1109 */ \ + OP(GetTexParameterfv) /* 1110 */ \ + OP(GetTexParameteriv) /* 1111 */ \ + OP(GetUniformfv) /* 1112 */ \ + OP(GetUniformiv) /* 1113 */ \ + OP(GetUniformLocation) /* 1114 */ \ + OP(GetUniformLocationImmediate) /* 1115 */ \ + OP(GetVertexAttribfv) /* 1116 */ \ + OP(GetVertexAttribiv) /* 1117 */ \ + OP(GetVertexAttribPointerv) /* 1118 */ \ + OP(Hint) /* 1119 */ \ + OP(IsBuffer) /* 1120 */ \ + OP(IsEnabled) /* 1121 */ \ + OP(IsFramebuffer) /* 1122 */ \ + OP(IsProgram) /* 1123 */ \ + OP(IsRenderbuffer) /* 1124 */ \ + OP(IsShader) /* 1125 */ \ + OP(IsTexture) /* 1126 */ \ + OP(LineWidth) /* 1127 */ \ + OP(LinkProgram) /* 1128 */ \ + OP(PixelStorei) /* 1129 */ \ + OP(PolygonOffset) /* 1130 */ \ + OP(ReadPixels) /* 1131 */ \ + OP(RenderbufferStorage) /* 1132 */ \ + OP(SampleCoverage) /* 1133 */ \ + OP(Scissor) /* 1134 */ \ + OP(ShaderSource) /* 1135 */ \ + OP(ShaderSourceImmediate) /* 1136 */ \ + OP(StencilFunc) /* 1137 */ \ + OP(StencilFuncSeparate) /* 1138 */ \ + OP(StencilMask) /* 1139 */ \ + OP(StencilMaskSeparate) /* 1140 */ \ + OP(StencilOp) /* 1141 */ \ + OP(StencilOpSeparate) /* 1142 */ \ + OP(TexImage2D) /* 1143 */ \ + OP(TexImage2DImmediate) /* 1144 */ \ + OP(TexParameterf) /* 1145 */ \ + OP(TexParameterfv) /* 1146 */ \ + OP(TexParameterfvImmediate) /* 1147 */ \ + OP(TexParameteri) /* 1148 */ \ + OP(TexParameteriv) /* 1149 */ \ + OP(TexParameterivImmediate) /* 1150 */ \ + OP(TexSubImage2D) /* 1151 */ \ + OP(TexSubImage2DImmediate) /* 1152 */ \ + OP(Uniform1f) /* 1153 */ \ + OP(Uniform1fv) /* 1154 */ \ + OP(Uniform1fvImmediate) /* 1155 */ \ + OP(Uniform1i) /* 1156 */ \ + OP(Uniform1iv) /* 1157 */ \ + OP(Uniform1ivImmediate) /* 1158 */ \ + OP(Uniform2f) /* 1159 */ \ + OP(Uniform2fv) /* 1160 */ \ + OP(Uniform2fvImmediate) /* 1161 */ \ + OP(Uniform2i) /* 1162 */ \ + OP(Uniform2iv) /* 1163 */ \ + OP(Uniform2ivImmediate) /* 1164 */ \ + OP(Uniform3f) /* 1165 */ \ + OP(Uniform3fv) /* 1166 */ \ + OP(Uniform3fvImmediate) /* 1167 */ \ + OP(Uniform3i) /* 1168 */ \ + OP(Uniform3iv) /* 1169 */ \ + OP(Uniform3ivImmediate) /* 1170 */ \ + OP(Uniform4f) /* 1171 */ \ + OP(Uniform4fv) /* 1172 */ \ + OP(Uniform4fvImmediate) /* 1173 */ \ + OP(Uniform4i) /* 1174 */ \ + OP(Uniform4iv) /* 1175 */ \ + OP(Uniform4ivImmediate) /* 1176 */ \ + OP(UniformMatrix2fv) /* 1177 */ \ + OP(UniformMatrix2fvImmediate) /* 1178 */ \ + OP(UniformMatrix3fv) /* 1179 */ \ + OP(UniformMatrix3fvImmediate) /* 1180 */ \ + OP(UniformMatrix4fv) /* 1181 */ \ + OP(UniformMatrix4fvImmediate) /* 1182 */ \ + OP(UseProgram) /* 1183 */ \ + OP(ValidateProgram) /* 1184 */ \ + OP(VertexAttrib1f) /* 1185 */ \ + OP(VertexAttrib1fv) /* 1186 */ \ + OP(VertexAttrib1fvImmediate) /* 1187 */ \ + OP(VertexAttrib2f) /* 1188 */ \ + OP(VertexAttrib2fv) /* 1189 */ \ + OP(VertexAttrib2fvImmediate) /* 1190 */ \ + OP(VertexAttrib3f) /* 1191 */ \ + OP(VertexAttrib3fv) /* 1192 */ \ + OP(VertexAttrib3fvImmediate) /* 1193 */ \ + OP(VertexAttrib4f) /* 1194 */ \ + OP(VertexAttrib4fv) /* 1195 */ \ + OP(VertexAttrib4fvImmediate) /* 1196 */ \ + OP(VertexAttribPointer) /* 1197 */ \ + OP(Viewport) /* 1198 */ \ + +enum CommandId { + kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. +#define GLES2_CMD_OP(name) k ## name, + GLES2_COMMAND_LIST(GLES2_CMD_OP) +#undef GLES2_CMD_OP + kNumCommands +}; + diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_utils.cc b/o3d/gpu/command_buffer/common/gles2_cmd_utils.cc index eb5b95b..6aa2d54 100644 --- a/o3d/gpu/command_buffer/common/gles2_cmd_utils.cc +++ b/o3d/gpu/command_buffer/common/gles2_cmd_utils.cc @@ -6,11 +6,12 @@ // includes where appropriate. #include "gpu/command_buffer/common/gles2_cmd_utils.h" +#include "gpu/command_buffer/common/gles2_client_base.h" namespace command_buffer { namespace gles2 { -GLsizei GLES2Util::GLGetNumValuesReturned(GLenum id) const { +int GLES2Util::GLGetNumValuesReturned(int id) const { switch (id) { // -- glGetBooleanv, glGetFloatv, glGetIntergerv case GL_ACTIVE_TEXTURE: @@ -284,7 +285,7 @@ GLsizei GLES2Util::GLGetNumValuesReturned(GLenum id) const { namespace { // Return the number of elements per group of a specified format. -GLint ElementsPerGroup(GLenum format, GLenum type) { +int ElementsPerGroup(int format, int type) { switch (type) { case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_4_4_4_4: @@ -310,7 +311,7 @@ GLint ElementsPerGroup(GLenum format, GLenum type) { } // Return the number of bytes per element, based on the element type. -GLint BytesPerElement(GLenum type) { +int BytesPerElement(int type) { switch (type) { case GL_UNSIGNED_SHORT: case GL_SHORT: @@ -330,8 +331,7 @@ GLint BytesPerElement(GLenum type) { // Returns the amount of data glTexImage2D or glTexSubImage2D will access. uint32 GLES2Util::ComputeImageDataSize( - GLsizei width, GLsizei height, GLenum format, GLenum type, - GLint unpack_alignment) { + int width, int height, int format, int type, int unpack_alignment) { uint32 bytes_per_group = BytesPerElement(ElementsPerGroup(format, type)); uint32 row_size = width * bytes_per_group; if (height > 1) { diff --git a/o3d/gpu/command_buffer/common/gles2_cmd_utils.h b/o3d/gpu/command_buffer/common/gles2_cmd_utils.h index 0e6b2f2..a73b029 100644 --- a/o3d/gpu/command_buffer/common/gles2_cmd_utils.h +++ b/o3d/gpu/command_buffer/common/gles2_cmd_utils.h @@ -8,18 +8,8 @@ #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H -// The GPU Service needs to include the OS's GL headers. -#ifdef GPU_SERVICE -#include <GL/glew.h> -#if defined(OS_WIN) -#include <GL/wglew.h> -#endif -#else -#include <GLES2/gl2.h> -#endif #include "base/basictypes.h" #include "gpu/command_buffer/common/types.h" -#include "gpu/command_buffer/common/bitfield_helpers.h" namespace command_buffer { namespace gles2 { @@ -28,21 +18,20 @@ namespace gles2 { class GLES2Util { public: explicit GLES2Util( - GLsizei num_compressed_texture_formats) + int num_compressed_texture_formats) : num_compressed_texture_formats_(num_compressed_texture_formats) { } // Gets the number of values a particular id will return when a glGet // function is called. If 0 is returned the id is invalid. - GLsizei GLGetNumValuesReturned(GLenum id) const; + int GLGetNumValuesReturned(int id) const; // Computes the size of image data for TexImage2D and TexSubImage2D. static uint32 GLES2Util::ComputeImageDataSize( - GLsizei width, GLsizei height, GLenum format, GLenum type, - GLint unpack_alignment); + int width, int height, int format, int type, int unpack_alignment); private: - GLsizei num_compressed_texture_formats_; + int num_compressed_texture_formats_; }; } // namespace gles2 diff --git a/o3d/gpu/command_buffer/service/gles2_cmd_decoder.cc b/o3d/gpu/command_buffer/service/gles2_cmd_decoder.cc index 4881dff..7936713 100644 --- a/o3d/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/o3d/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -4,52 +4,19 @@ #include <vector> #include <string> -#include "gpu/command_buffer/service/gles2_cmd_decoder.h" +#include <map> +#include <build/build_config.h> +#include "base/scoped_ptr.h" +#define GLES2_GPU_SERVICE 1 #include "gpu/command_buffer/common/gles2_cmd_format.h" +#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/service/cmd_buffer_engine.h" +#include "gpu/command_buffer/service/gl_utils.h" +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" namespace command_buffer { namespace gles2 { -bool IdMap::AddMapping(GLuint client_id, GLuint service_id) { - std::pair<MapType::iterator, bool> result = id_map_.insert( - std::make_pair(client_id, service_id)); - return result.second; -} - -bool IdMap::RemoveMapping(GLuint client_id, GLuint service_id) { - MapType::iterator iter = id_map_.find(client_id); - if (iter != id_map_.end() && iter->second == service_id) { - id_map_.erase(iter); - return true; - } - return false; -} - -bool IdMap::GetServiceId(GLuint client_id, GLuint* service_id) { - DCHECK(service_id); - MapType::iterator iter = id_map_.find(client_id); - if (iter != id_map_.end()) { - *service_id = iter->second; - return true; - } - return false; -} - -bool IdMap::GetClientId(GLuint service_id, GLuint* client_id) { - DCHECK(client_id); - MapType::iterator end(id_map_.end()); - for (MapType::iterator iter(id_map_.begin()); - iter != end; - ++iter) { - if (iter->second == service_id) { - *client_id = iter->first; - return true; - } - } - return false; -} - namespace { // Returns the address of the first byte after a struct. @@ -102,15 +69,15 @@ const CommandInfo g_command_info[] = { // These commands convert from c calls to local os calls. void GLGenBuffersHelper(GLsizei n, GLuint* ids) { - glGenBuffers(n, ids); + glGenBuffersARB(n, ids); } void GLGenFramebuffersHelper(GLsizei n, GLuint* ids) { - glGenFramebuffers(n, ids); + glGenFramebuffersEXT(n, ids); } void GLGenRenderbuffersHelper(GLsizei n, GLuint* ids) { - glGenRenderbuffers(n, ids); + glGenRenderbuffersEXT(n, ids); } void GLGenTexturesHelper(GLsizei n, GLuint* ids) { @@ -118,15 +85,15 @@ void GLGenTexturesHelper(GLsizei n, GLuint* ids) { } void GLDeleteBuffersHelper(GLsizei n, GLuint* ids) { - glDeleteBuffers(n, ids); + glDeleteBuffersARB(n, ids); } void GLDeleteFramebuffersHelper(GLsizei n, GLuint* ids) { - glDeleteFramebuffers(n, ids); + glDeleteFramebuffersEXT(n, ids); } void GLDeleteRenderbuffersHelper(GLsizei n, GLuint* ids) { - glDeleteRenderbuffers(n, ids); + glDeleteRenderbuffersEXT(n, ids); } void GLDeleteTexturesHelper(GLsizei n, GLuint* ids) { @@ -136,19 +103,507 @@ void GLDeleteTexturesHelper(GLsizei n, GLuint* ids) { } // anonymous namespace. GLES2Decoder::GLES2Decoder() - : util_(0), // TODO(gman): Set to actual num compress texture formats. +#ifdef OS_LINUX + : window_(NULL) { +#endif +#ifdef OS_WIN + : hwnd_(NULL) { +#endif +} + +// This class maps one set of ids to another. +class IdMap { + public: + // Maps a client_id to a service_id. Return false if the client_id or + // service_id are already mapped to something else. + bool AddMapping(GLuint client_id, GLuint service_id); + + // Unmaps a pair of ids. Returns false if the pair were not previously mapped. + bool RemoveMapping(GLuint client_id, GLuint service_id); + + // Gets the corresponding service_id for the given client_id. + // Returns false if there is no corresponding service_id. + bool GetServiceId(GLuint client_id, GLuint* service_id); + + // Gets the corresponding client_id for the given service_id. + // Returns false if there is no corresponding client_id. + bool GetClientId(GLuint service_id, GLuint* client_id); + + private: + // TODO(gman): Replace with faster implementation. + typedef std::map<GLuint, GLuint> MapType; + MapType id_map_; +}; + +bool IdMap::AddMapping(GLuint client_id, GLuint service_id) { + std::pair<MapType::iterator, bool> result = id_map_.insert( + std::make_pair(client_id, service_id)); + return result.second; +} + +bool IdMap::RemoveMapping(GLuint client_id, GLuint service_id) { + MapType::iterator iter = id_map_.find(client_id); + if (iter != id_map_.end() && iter->second == service_id) { + id_map_.erase(iter); + return true; + } + return false; +} + +bool IdMap::GetServiceId(GLuint client_id, GLuint* service_id) { + DCHECK(service_id); + MapType::iterator iter = id_map_.find(client_id); + if (iter != id_map_.end()) { + *service_id = iter->second; + return true; + } + return false; +} + +bool IdMap::GetClientId(GLuint service_id, GLuint* client_id) { + DCHECK(client_id); + MapType::iterator end(id_map_.end()); + for (MapType::iterator iter(id_map_.begin()); + iter != end; + ++iter) { + if (iter->second == service_id) { + *client_id = iter->first; + return true; + } + } + return false; +} + +// This class implements GLES2Decoder so we don't have to expose all the GLES2 +// cmd stuff to outside this class. +class GLES2DecoderImpl : public GLES2Decoder { + public: + GLES2DecoderImpl(); + + // Overridden from AsyncAPIInterface. + virtual ParseError DoCommand(unsigned int command, + unsigned int arg_count, + const void* args); + + // Overridden from AsyncAPIInterface. + virtual const char* GetCommandName(unsigned int command_id) const; + + // Overridden from GLES2Decoder. + virtual bool Initialize(); + + // Overridden from GLES2Decoder. + virtual void Destroy(); + + private: + bool InitPlatformSpecific(); + bool InitGlew(); + + // Typed version of GetAddressAndCheckSize. + template <typename T> + T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, + unsigned int size) { + return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size)); + } + + // Template to help call glGenXXX functions. + template <void gl_gen_function(GLsizei, GLuint*)> + bool GenGLObjects(GLsizei n, const GLuint* client_ids) { + // TODO(gman): Verify client ids are unused. + scoped_array<GLuint>temp(new GLuint[n]); + gl_gen_function(n, temp.get()); + // TODO(gman): check for success before copying results. + for (GLsizei ii = 0; ii < n; ++ii) { + if (!id_map_.AddMapping(client_ids[ii], temp[ii])) { + // TODO(gman): fail. + } + } + return true; + } + + // Template to help call glDeleteXXX functions. + template <void gl_delete_function(GLsizei, GLuint*)> + bool DeleteGLObjects(GLsizei n, const GLuint* client_ids) { + scoped_array<GLuint>temp(new GLuint[n]); + // TODO(gman): check for success before copying results. + for (GLsizei ii = 0; ii < n; ++ii) { + if (id_map_.GetServiceId(client_ids[ii], &temp[ii])) { + id_map_.RemoveMapping(client_ids[ii], temp[ii]); + } else { + temp[ii] = 0; + } + } + gl_delete_function(n, temp.get()); + return true; + } + + // Wrapper for glCreateProgram + void CreateProgramHelper(GLuint client_id); + + // Wrapper for glCreateShader + void CreateShaderHelper(GLenum type, GLuint client_id); + + // Wrapper for glBindBuffer since we need to track the current targets. + void DoBindBuffer(GLenum target, GLuint buffer); + + // Wrapper for glDeleteProgram. + void DoDeleteProgram(GLuint program); + + // Wrapper for glDeleteShader. + void DoDeleteShader(GLuint shader); + + // Generate a member function prototype for each command in an automated and + // typesafe way. + #define GLES2_CMD_OP(name) \ + ParseError Handle ## name( \ + unsigned int arg_count, \ + const gles2::name& args); \ + + GLES2_COMMAND_LIST(GLES2_CMD_OP) + + #undef GLES2_CMD_OP + + // Map of client ids to GL ids. + IdMap id_map_; + GLES2Util util_; + + // pack alignment as last set by glPixelStorei + GLint pack_alignment_; + + // unpack alignment as last set by glPixelStorei + GLint unpack_alignment_; + + // The currently bound array buffer. If this is 0 it is illegal to call + // glVertexAttribPointer. + GLuint bound_array_buffer_; + + // The currently bound element array buffer. If this is 0 it is illegal + // to call glDrawElements. + GLuint bound_element_array_buffer_; + +#if defined(OS_WIN) + HDC device_context_; + HGLRC gl_context_; +#endif + + bool anti_aliased_; + + DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); +}; + +GLES2Decoder* GLES2Decoder::Create() { + return new GLES2DecoderImpl(); +} + +GLES2DecoderImpl::GLES2DecoderImpl() + : GLES2Decoder(), + util_(0), // TODO(gman): Set to actual num compress texture formats. pack_alignment_(4), unpack_alignment_(4), bound_array_buffer_(0), - bound_element_array_buffer_(0) { + bound_element_array_buffer_(0), +#ifdef OS_WIN + device_context_(NULL), + gl_context_(NULL), +#endif + anti_aliased_(false) { } -// Decode command with its arguments, and call the corresponding GAPIInterface -// method. +bool GLES2DecoderImpl::Initialize() { + if (!InitPlatformSpecific()) + return false; + if (!InitGlew()) + return false; + CHECK_GL_ERROR(); + + //glBindFramebuffer(0, 0); + return true; +} + +#if defined(OS_WIN) +namespace { + +const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { + sizeof(kPixelFormatDescriptor), // Size of structure. + 1, // Default version. + PFD_DRAW_TO_WINDOW | // Window drawing support. + PFD_SUPPORT_OPENGL | // OpenGL support. + PFD_DOUBLEBUFFER, // Double buffering support (not stereo). + PFD_TYPE_RGBA, // RGBA color mode (not indexed). + 24, // 24 bit color mode. + 0, 0, 0, 0, 0, 0, // Don't set RGB bits & shifts. + 8, 0, // 8 bit alpha + 0, // No accumulation buffer. + 0, 0, 0, 0, // Ignore accumulation bits. + 24, // 24 bit z-buffer size. + 8, // 8-bit stencil buffer. + 0, // No aux buffer. + PFD_MAIN_PLANE, // Main drawing plane (not overlay). + 0, // Reserved. + 0, 0, 0, // Layer masks ignored. +}; + +LRESULT CALLBACK IntermediateWindowProc(HWND window, + UINT message, + WPARAM w_param, + LPARAM l_param) { + return ::DefWindowProc(window, message, w_param, l_param); +} + +// Helper routine that returns the highest quality pixel format supported on +// the current platform. Returns true upon success. +bool GetWindowsPixelFormat(HWND window, + bool anti_aliased, + int* pixel_format) { + // We must initialize a GL context before we can determine the multi-sampling + // supported on the current hardware, so we create an intermediate window + // and context here. + HINSTANCE module_handle; + if (!::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | + GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + reinterpret_cast<wchar_t*>(IntermediateWindowProc), + &module_handle)) { + return false; + } + + WNDCLASS intermediate_class; + intermediate_class.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; + intermediate_class.lpfnWndProc = IntermediateWindowProc; + intermediate_class.cbClsExtra = 0; + intermediate_class.cbWndExtra = 0; + intermediate_class.hInstance = module_handle; + intermediate_class.hIcon = LoadIcon(NULL, IDI_APPLICATION); + intermediate_class.hCursor = LoadCursor(NULL, IDC_ARROW); + intermediate_class.hbrBackground = NULL; + intermediate_class.lpszMenuName = NULL; + intermediate_class.lpszClassName = L"Intermediate GL Window"; + + ATOM class_registration = ::RegisterClass(&intermediate_class); + if (!class_registration) { + return false; + } + + HWND intermediate_window = ::CreateWindow( + reinterpret_cast<wchar_t*>(class_registration), + L"", + WS_OVERLAPPEDWINDOW, + 0, 0, + CW_USEDEFAULT, CW_USEDEFAULT, + NULL, + NULL, + NULL, + NULL); + + if (!intermediate_window) { + ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), + module_handle); + return false; + } + + HDC intermediate_dc = ::GetDC(intermediate_window); + int format_index = ::ChoosePixelFormat(intermediate_dc, + &kPixelFormatDescriptor); + if (format_index == 0) { + DLOG(ERROR) << "Unable to get the pixel format for GL context."; + ::ReleaseDC(intermediate_window, intermediate_dc); + ::DestroyWindow(intermediate_window); + ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), + module_handle); + return false; + } + if (!::SetPixelFormat(intermediate_dc, format_index, + &kPixelFormatDescriptor)) { + DLOG(ERROR) << "Unable to set the pixel format for GL context."; + ::ReleaseDC(intermediate_window, intermediate_dc); + ::DestroyWindow(intermediate_window); + ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), + module_handle); + return false; + } + + // Store the pixel format without multisampling. + *pixel_format = format_index; + HGLRC gl_context = ::wglCreateContext(intermediate_dc); + if (::wglMakeCurrent(intermediate_dc, gl_context)) { + // GL context was successfully created and applied to the window's DC. + // Startup GLEW, the GL extensions wrangler. + GLenum glew_error = ::glewInit(); + if (glew_error == GLEW_OK) { + DLOG(INFO) << "Initialized GLEW " << ::glewGetString(GLEW_VERSION); + } else { + DLOG(ERROR) << "Unable to initialise GLEW : " + << ::glewGetErrorString(glew_error); + ::wglMakeCurrent(intermediate_dc, NULL); + ::wglDeleteContext(gl_context); + ::ReleaseDC(intermediate_window, intermediate_dc); + ::DestroyWindow(intermediate_window); + ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), + module_handle); + return false; + } + + // If the multi-sample extensions are present, query the api to determine + // the pixel format. + if (anti_aliased && WGLEW_ARB_pixel_format && WGLEW_ARB_multisample) { + int pixel_attributes[] = { + WGL_SAMPLES_ARB, 4, + WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, + WGL_SUPPORT_OPENGL_ARB, GL_TRUE, + WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, + WGL_COLOR_BITS_ARB, 24, + WGL_ALPHA_BITS_ARB, 8, + WGL_DEPTH_BITS_ARB, 24, + WGL_STENCIL_BITS_ARB, 8, + WGL_DOUBLE_BUFFER_ARB, GL_TRUE, + WGL_SAMPLE_BUFFERS_ARB, GL_TRUE, + 0, 0}; + + float pixel_attributes_f[] = {0, 0}; + int msaa_pixel_format; + unsigned int num_formats; + + // Query for the highest sampling rate supported, starting at 4x. + static const int kSampleCount[] = {4, 2}; + static const int kNumSamples = 2; + for (int sample = 0; sample < kNumSamples; ++sample) { + pixel_attributes[1] = kSampleCount[sample]; + if (GL_TRUE == ::wglChoosePixelFormatARB(intermediate_dc, + pixel_attributes, + pixel_attributes_f, + 1, + &msaa_pixel_format, + &num_formats)) { + *pixel_format = msaa_pixel_format; + break; + } + } + } + } + + ::wglMakeCurrent(intermediate_dc, NULL); + ::wglDeleteContext(gl_context); + ::ReleaseDC(intermediate_window, intermediate_dc); + ::DestroyWindow(intermediate_window); + ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), + module_handle); + return true; +} + +} // anonymous namespace +#endif + +bool GLES2DecoderImpl::InitPlatformSpecific() { +#if defined(OS_WIN) + device_context_ = ::GetDC(hwnd()); + + int pixel_format; + + if (!GetWindowsPixelFormat(hwnd(), + anti_aliased_, + &pixel_format)) { + DLOG(ERROR) << "Unable to determine optimal pixel format for GL context."; + return false; + } + + if (!::SetPixelFormat(device_context_, pixel_format, + &kPixelFormatDescriptor)) { + DLOG(ERROR) << "Unable to set the pixel format for GL context."; + return false; + } + + gl_context_ = ::wglCreateContext(device_context_); + if (!gl_context_) { + DLOG(ERROR) << "Failed to create GL context."; + return false; + } + + if (!::wglMakeCurrent(device_context_, gl_context_)) { + DLOG(ERROR) << "Unable to make gl context current."; + return false; + } +#elif defined(OS_LINUX) + DCHECK(window()); + if (!window()->Initialize()) + return false; + if (!window()->MakeCurrent()) + return false; +#endif + + return true; +} + +bool GLES2DecoderImpl::InitGlew() { + DLOG(INFO) << "Initializing GL and GLEW for GLES2Decoder."; + + GLenum glew_error = glewInit(); + if (glew_error != GLEW_OK) { + DLOG(ERROR) << "Unable to initialise GLEW : " + << ::glewGetErrorString(glew_error); + return false; + } + + // Check to see that we can use the OpenGL vertex attribute APIs + // TODO(petersont): Return false if this check fails, but because some + // Intel hardware does not support OpenGL 2.0, yet does support all of the + // extensions we require, we only log an error. A future CL should change + // this check to ensure that all of the extension strings we require are + // present. + if (!GLEW_VERSION_2_0) { + DLOG(ERROR) << "GL drivers do not have OpenGL 2.0 functionality."; + } + + bool extensions_found = true; + if (!GLEW_ARB_vertex_buffer_object) { + // NOTE: Linux NVidia drivers claim to support OpenGL 2.0 when using + // indirect rendering (e.g. remote X), but it is actually lying. The + // ARB_vertex_buffer_object functions silently no-op (!) when using + // indirect rendering, leading to crashes. Fortunately, in that case, the + // driver claims to not support ARB_vertex_buffer_object, so fail in that + // case. + DLOG(ERROR) << "GL drivers do not support vertex buffer objects."; + extensions_found = false; + } + if (!GLEW_EXT_framebuffer_object) { + DLOG(ERROR) << "GL drivers do not support framebuffer objects."; + extensions_found = false; + } + // Check for necessary extensions + if (!GLEW_VERSION_2_0 && !GLEW_EXT_stencil_two_side) { + DLOG(ERROR) << "Two sided stencil extension missing."; + extensions_found = false; + } + if (!GLEW_VERSION_1_4 && !GLEW_EXT_blend_func_separate) { + DLOG(ERROR) <<"Separate blend func extension missing."; + extensions_found = false; + } + if (!GLEW_VERSION_2_0 && !GLEW_EXT_blend_equation_separate) { + DLOG(ERROR) << "Separate blend function extension missing."; + extensions_found = false; + } + if (!extensions_found) + return false; + + return true; +} + +void GLES2DecoderImpl::Destroy() { +#ifdef OS_LINUX + DCHECK(window()); + window()->Destroy(); +#endif +} + +const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { + if (command_id > kStartPoint && command_id < kNumCommands) { + return gles2::GetCommandName(static_cast<CommandId>(command_id)); + } + return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); +} + +// Decode command with its arguments, and call the corresponding GL function. // Note: args is a pointer to the command buffer. As such, it could be changed // by a (malicious) client at any time, so if validation has to happen, it // should operate on a copy of them. -parse_error::ParseError GLES2Decoder::DoCommand( +parse_error::ParseError GLES2DecoderImpl::DoCommand( unsigned int command, unsigned int arg_count, const void* cmd_data) { @@ -185,7 +640,7 @@ parse_error::ParseError GLES2Decoder::DoCommand( namespace command_buffer { namespace gles2 { -void GLES2Decoder::CreateProgramHelper(GLuint client_id) { +void GLES2DecoderImpl::CreateProgramHelper(GLuint client_id) { // TODO(gman): verify client_id is unused. GLuint service_id = glCreateProgram(); if (service_id) { @@ -193,7 +648,7 @@ void GLES2Decoder::CreateProgramHelper(GLuint client_id) { } } -void GLES2Decoder::CreateShaderHelper(GLenum type, GLuint client_id) { +void GLES2DecoderImpl::CreateShaderHelper(GLenum type, GLuint client_id) { // TODO(gman): verify client_id is unused. GLuint service_id = glCreateShader(type); if (service_id) { @@ -201,7 +656,7 @@ void GLES2Decoder::CreateShaderHelper(GLenum type, GLuint client_id) { } } -void GLES2Decoder::DoBindBuffer(GLenum target, GLuint buffer) { +void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint buffer) { switch (target) { case GL_ARRAY_BUFFER: bound_array_buffer_ = buffer; @@ -215,7 +670,7 @@ void GLES2Decoder::DoBindBuffer(GLenum target, GLuint buffer) { glBindBuffer(target, buffer); } -void GLES2Decoder::DoDeleteProgram(GLuint program) { +void GLES2DecoderImpl::DoDeleteProgram(GLuint program) { GLuint service_id; if (id_map_.GetServiceId(program, &service_id)) { glDeleteProgram(service_id); @@ -223,7 +678,7 @@ void GLES2Decoder::DoDeleteProgram(GLuint program) { } } -void GLES2Decoder::DoDeleteShader(GLuint shader) { +void GLES2DecoderImpl::DoDeleteShader(GLuint shader) { GLuint service_id; if (id_map_.GetServiceId(shader, &service_id)) { glDeleteProgram(service_id); @@ -231,7 +686,7 @@ void GLES2Decoder::DoDeleteShader(GLuint shader) { } } -parse_error::ParseError GLES2Decoder::HandleDrawElements( +parse_error::ParseError GLES2DecoderImpl::HandleDrawElements( unsigned int arg_count, const gles2::DrawElements& c) { if (bound_element_array_buffer_ != 0) { GLenum mode = c.mode; @@ -277,7 +732,7 @@ parse_error::ParseError ShaderSourceHelper( } // anonymous namespace. -parse_error::ParseError GLES2Decoder::HandleShaderSource( +parse_error::ParseError GLES2DecoderImpl::HandleShaderSource( unsigned int arg_count, const gles2::ShaderSource& c) { GLuint shader = c.shader; GLsizei count = c.count; @@ -293,7 +748,7 @@ parse_error::ParseError GLES2Decoder::HandleShaderSource( shader, count, reinterpret_cast<const char*>(data), data_size); } -parse_error::ParseError GLES2Decoder::HandleShaderSourceImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleShaderSourceImmediate( unsigned int arg_count, const gles2::ShaderSourceImmediate& c) { GLuint shader = c.shader; GLsizei count = c.count; @@ -310,7 +765,7 @@ parse_error::ParseError GLES2Decoder::HandleShaderSourceImmediate( shader, count, reinterpret_cast<const char*>(data), data_size); } -parse_error::ParseError GLES2Decoder::HandleVertexAttribPointer( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( unsigned int arg_count, const gles2::VertexAttribPointer& c) { if (bound_array_buffer_ != 0) { GLuint indx = c.indx; @@ -334,6 +789,60 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttribPointer( return parse_error::kParseNoError; } +parse_error::ParseError GLES2DecoderImpl::HandleReadPixels( + unsigned int arg_count, 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. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribPointerv( + unsigned int arg_count, const gles2::GetVertexAttribPointerv& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetUniformiv( + unsigned int arg_count, const gles2::GetUniformiv& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetUniformfv( + unsigned int arg_count, const gles2::GetUniformfv& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetShaderPrecisionFormat( + unsigned int arg_count, const gles2::GetShaderPrecisionFormat& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetAttachedShaders( + unsigned int arg_count, const gles2::GetAttachedShaders& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetActiveUniform( + unsigned int arg_count, const gles2::GetActiveUniform& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + +parse_error::ParseError GLES2DecoderImpl::HandleGetActiveAttrib( + unsigned int arg_count, const gles2::GetActiveAttrib& c) { + // TODO(gman): Implement. + return parse_error::kParseNoError; +} + // Include the auto-generated part of this file. We split this because it means // we can easily edit the non-auto generated parts right here in this file // instead of having to edit some template or the code generator. diff --git a/o3d/gpu/command_buffer/service/gles2_cmd_decoder.h b/o3d/gpu/command_buffer/service/gles2_cmd_decoder.h index 72afe06..10387c6 100644 --- a/o3d/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/o3d/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -7,150 +7,62 @@ #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_GLES2_CMD_DECODER_H #define O3D_COMMAND_BUFFER_SERVICE_CROSS_GLES2_CMD_DECODER_H -#include <map> -#include "base/scoped_ptr.h" -#include "gpu/command_buffer/common/gles2_cmd_utils.h" -#include "gpu/command_buffer/common/gles2_cmd_format.h" +#include <build/build_config.h> +#ifdef OS_WIN +#include <windows.h> +#endif #include "gpu/command_buffer/service/common_decoder.h" namespace command_buffer { namespace gles2 { -// This class maps one set of ids to another. -class IdMap { - public: - // Maps a client_id to a service_id. Return false if the client_id or - // service_id are already mapped to something else. - bool AddMapping(GLuint client_id, GLuint service_id); - - // Unmaps a pair of ids. Returns false if the pair were not previously mapped. - bool RemoveMapping(GLuint client_id, GLuint service_id); - - // Gets the corresponding service_id for the given client_id. - // Returns false if there is no corresponding service_id. - bool GetServiceId(GLuint client_id, GLuint* service_id); - - // Gets the corresponding client_id for the given service_id. - // Returns false if there is no corresponding client_id. - bool GetClientId(GLuint service_id, GLuint* client_id); - - private: - // TODO(gman): Replace with faster implementation. - typedef std::map<GLuint, GLuint> MapType; - MapType id_map_; -}; - -// This class implements the AsyncAPIInterface interface, decoding GAPI -// commands and sending them to a GAPI interface. +// This class implements the AsyncAPIInterface interface, decoding GLES2 +// commands and calling GL. class GLES2Decoder : public CommonDecoder { public: typedef parse_error::ParseError ParseError; - GLES2Decoder(); + // Creates a decoder. + static GLES2Decoder* Create(); + virtual ~GLES2Decoder() { } - // Overridden from AsyncAPIInterface. - virtual ParseError DoCommand(unsigned int command, - unsigned int arg_count, - const void* args); - - // Overridden from AsyncAPIInterface. - virtual const char* GetCommandName(unsigned int command_id); - - private: - // Gets the address of shared memory. - // Parameters: - // shm_id: the id of the shared memory buffer. - // offset: the offset of the data in the shared memory buffer. - // size: size of area to get. - // Returns: - // NULL if shm_id isn't a valid shared memory buffer ID or if the offset is - // outside or if the offset + size are outside. - void* GetSharedMemory(unsigned int shm_id, unsigned int offset, - unsigned int size); - - // Typed version of GetSharedMemory - template <typename T> - T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, - unsigned int size) { - return static_cast<T>(GetSharedMemory(shm_id, offset, size)); +#if defined(OS_LINUX) + void set_window_wrapper(XWindowWrapper *window) { + window_ = window; } - - // Template to help call glGenXXX functions. - template <void gl_gen_function(GLsizei, GLuint*)> - bool GenGLObjects(GLsizei n, const GLuint* client_ids) { - // TODO(gman): Verify client ids are unused. - scoped_array<GLuint>temp(new GLuint[n]); - gl_gen_function(n, temp.get()); - // TODO(gman): check for success before copying results. - for (GLsizei ii = 0; ii < n; ++ii) { - if (!id_map_.AddMapping(client_ids[ii], temp[ii])) { - // TODO(gman): fail. - } - } - return true; + XWindowWrapper* window() const { + return window_; } - - // Template to help call glDeleteXXX functions. - template <void gl_delete_function(GLsizei, GLuint*)> - bool DeleteGLObjects(GLsizei n, const GLuint* client_ids) { - scoped_array<GLuint>temp(new GLuint[n]); - // TODO(gman): check for success before copying results. - for (GLsizei ii = 0; ii < n; ++ii) { - if (id_map_.GetServiceId(client_ids[ii], &temp[ii])) { - id_map_.RemoveMapping(client_ids[ii], temp[ii]); - } else { - temp[ii] = 0; - } - } - gl_delete_function(n, temp.get()); - return true; +#elif defined(OS_WIN) + void set_hwnd(HWND hwnd) { + hwnd_ = hwnd; } - // Wrapper for glCreateProgram - void CreateProgramHelper(GLuint client_id); - - // Wrapper for glCreateShader - void CreateShaderHelper(GLenum type, GLuint client_id); - - // Wrapper for glBindBuffer since we need to track the current targets. - void DoBindBuffer(GLenum target, GLuint buffer); - - // Wrapper for glDeleteProgram. - void DoDeleteProgram(GLuint program); - - // Wrapper for glDeleteShader. - void DoDeleteShader(GLuint shader); - - // Generate a member function prototype for each command in an automated and - // typesafe way. - #define GLES2_CMD_OP(name) \ - ParseError Handle ## name( \ - unsigned int arg_count, \ - const gles2::name& args); \ - - GLES2_COMMAND_LIST(GLES2_CMD_OP) - - #undef GLES2_CMD_OP - - // Map of client ids to GL ids. - IdMap id_map_; - GLES2Util util_; + HWND hwnd() const { + return hwnd_; + } +#endif - // pack alignment as last set by glPixelStorei - GLint pack_alignment_; + // Initializes the graphics context. + // Returns: + // true if successful. + virtual bool Initialize() = 0; - // unpack alignment as last set by glPixelStorei - GLint unpack_alignment_; + // Destroys the graphics context. + virtual void Destroy() = 0; - // The currently bound array buffer. If this is 0 it is illegal to call - // glVertexAttribPointer. - GLuint bound_array_buffer_; + protected: + GLES2Decoder(); - // The currently bound element array buffer. If this is 0 it is illegal - // to call glDrawElements. - GLuint bound_element_array_buffer_; + private: +#if defined(OS_LINUX) + XWindowWrapper *window_; +#elif defined(OS_WIN) + // Handle to the GL device. + HWND hwnd_; +#endif DISALLOW_COPY_AND_ASSIGN(GLES2Decoder); }; diff --git a/o3d/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/o3d/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index 399f6ce..581b280 100644 --- a/o3d/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/o3d/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h @@ -2,7 +2,7 @@ // It is included by gles2_cmd_decoder.cc -parse_error::ParseError GLES2Decoder::HandleActiveTexture( +parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( unsigned int arg_count, const gles2::ActiveTexture& c) { GLenum texture = static_cast<GLenum>(c.texture); parse_error::ParseError result = @@ -14,7 +14,7 @@ parse_error::ParseError GLES2Decoder::HandleActiveTexture( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleAttachShader( +parse_error::ParseError GLES2DecoderImpl::HandleAttachShader( unsigned int arg_count, const gles2::AttachShader& c) { GLuint program = static_cast<GLuint>(c.program); GLuint shader = static_cast<GLuint>(c.shader); @@ -27,7 +27,7 @@ parse_error::ParseError GLES2Decoder::HandleAttachShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBindAttribLocation( +parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation( unsigned int arg_count, const gles2::BindAttribLocation& c) { GLuint program = static_cast<GLuint>(c.program); GLuint index = static_cast<GLuint>(c.index); @@ -44,7 +44,7 @@ parse_error::ParseError GLES2Decoder::HandleBindAttribLocation( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBindAttribLocationImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( unsigned int arg_count, const gles2::BindAttribLocationImmediate& c) { GLuint program = static_cast<GLuint>(c.program); GLuint index = static_cast<GLuint>(c.index); @@ -63,7 +63,7 @@ parse_error::ParseError GLES2Decoder::HandleBindAttribLocationImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBindBuffer( +parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( unsigned int arg_count, const gles2::BindBuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLuint buffer = static_cast<GLuint>(c.buffer); @@ -76,7 +76,7 @@ parse_error::ParseError GLES2Decoder::HandleBindBuffer( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBindFramebuffer( +parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer( unsigned int arg_count, const gles2::BindFramebuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLuint framebuffer = static_cast<GLuint>(c.framebuffer); @@ -85,11 +85,11 @@ parse_error::ParseError GLES2Decoder::HandleBindFramebuffer( if (result != parse_error::kParseNoError) { return result; } - glBindFramebuffer(target, framebuffer); + glBindFramebufferEXT(target, framebuffer); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBindRenderbuffer( +parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer( unsigned int arg_count, const gles2::BindRenderbuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLuint renderbuffer = static_cast<GLuint>(c.renderbuffer); @@ -98,11 +98,11 @@ parse_error::ParseError GLES2Decoder::HandleBindRenderbuffer( if (result != parse_error::kParseNoError) { return result; } - glBindRenderbuffer(target, renderbuffer); + glBindRenderbufferEXT(target, renderbuffer); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBindTexture( +parse_error::ParseError GLES2DecoderImpl::HandleBindTexture( unsigned int arg_count, const gles2::BindTexture& c) { GLenum target = static_cast<GLenum>(c.target); GLuint texture = static_cast<GLuint>(c.texture); @@ -115,7 +115,7 @@ parse_error::ParseError GLES2Decoder::HandleBindTexture( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBlendColor( +parse_error::ParseError GLES2DecoderImpl::HandleBlendColor( unsigned int arg_count, const gles2::BlendColor& c) { GLclampf red = static_cast<GLclampf>(c.red); GLclampf green = static_cast<GLclampf>(c.green); @@ -130,7 +130,7 @@ parse_error::ParseError GLES2Decoder::HandleBlendColor( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBlendEquation( +parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation( unsigned int arg_count, const gles2::BlendEquation& c) { GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = @@ -142,7 +142,7 @@ parse_error::ParseError GLES2Decoder::HandleBlendEquation( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBlendEquationSeparate( +parse_error::ParseError GLES2DecoderImpl::HandleBlendEquationSeparate( unsigned int arg_count, const gles2::BlendEquationSeparate& c) { GLenum modeRGB = static_cast<GLenum>(c.modeRGB); GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); @@ -155,7 +155,7 @@ parse_error::ParseError GLES2Decoder::HandleBlendEquationSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBlendFunc( +parse_error::ParseError GLES2DecoderImpl::HandleBlendFunc( unsigned int arg_count, const gles2::BlendFunc& c) { GLenum sfactor = static_cast<GLenum>(c.sfactor); GLenum dfactor = static_cast<GLenum>(c.dfactor); @@ -168,7 +168,7 @@ parse_error::ParseError GLES2Decoder::HandleBlendFunc( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBlendFuncSeparate( +parse_error::ParseError GLES2DecoderImpl::HandleBlendFuncSeparate( unsigned int arg_count, const gles2::BlendFuncSeparate& c) { GLenum srcRGB = static_cast<GLenum>(c.srcRGB); GLenum dstRGB = static_cast<GLenum>(c.dstRGB); @@ -184,7 +184,7 @@ parse_error::ParseError GLES2Decoder::HandleBlendFuncSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBufferData( +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); @@ -203,7 +203,7 @@ parse_error::ParseError GLES2Decoder::HandleBufferData( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBufferDataImmediate( +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); @@ -219,7 +219,7 @@ parse_error::ParseError GLES2Decoder::HandleBufferDataImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBufferSubData( +parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( unsigned int arg_count, const gles2::BufferSubData& c) { GLenum target = static_cast<GLenum>(c.target); GLintptr offset = static_cast<GLintptr>(c.offset); @@ -238,7 +238,7 @@ parse_error::ParseError GLES2Decoder::HandleBufferSubData( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleBufferSubDataImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( unsigned int arg_count, const gles2::BufferSubDataImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLintptr offset = static_cast<GLintptr>(c.offset); @@ -255,7 +255,7 @@ parse_error::ParseError GLES2Decoder::HandleBufferSubDataImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCheckFramebufferStatus( +parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( unsigned int arg_count, const gles2::CheckFramebufferStatus& c) { GLenum target = static_cast<GLenum>(c.target); parse_error::ParseError result = @@ -263,11 +263,11 @@ parse_error::ParseError GLES2Decoder::HandleCheckFramebufferStatus( if (result != parse_error::kParseNoError) { return result; } - glCheckFramebufferStatus(target); + glCheckFramebufferStatusEXT(target); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleClear( +parse_error::ParseError GLES2DecoderImpl::HandleClear( unsigned int arg_count, const gles2::Clear& c) { GLbitfield mask = static_cast<GLbitfield>(c.mask); parse_error::ParseError result = @@ -279,7 +279,7 @@ parse_error::ParseError GLES2Decoder::HandleClear( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleClearColor( +parse_error::ParseError GLES2DecoderImpl::HandleClearColor( unsigned int arg_count, const gles2::ClearColor& c) { GLclampf red = static_cast<GLclampf>(c.red); GLclampf green = static_cast<GLclampf>(c.green); @@ -294,7 +294,7 @@ parse_error::ParseError GLES2Decoder::HandleClearColor( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleClearDepthf( +parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf( unsigned int arg_count, const gles2::ClearDepthf& c) { GLclampf depth = static_cast<GLclampf>(c.depth); parse_error::ParseError result = @@ -306,7 +306,7 @@ parse_error::ParseError GLES2Decoder::HandleClearDepthf( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleClearStencil( +parse_error::ParseError GLES2DecoderImpl::HandleClearStencil( unsigned int arg_count, const gles2::ClearStencil& c) { GLint s = static_cast<GLint>(c.s); parse_error::ParseError result = @@ -318,7 +318,7 @@ parse_error::ParseError GLES2Decoder::HandleClearStencil( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleColorMask( +parse_error::ParseError GLES2DecoderImpl::HandleColorMask( unsigned int arg_count, const gles2::ColorMask& c) { GLboolean red = static_cast<GLboolean>(c.red); GLboolean green = static_cast<GLboolean>(c.green); @@ -333,7 +333,7 @@ parse_error::ParseError GLES2Decoder::HandleColorMask( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCompileShader( +parse_error::ParseError GLES2DecoderImpl::HandleCompileShader( unsigned int arg_count, const gles2::CompileShader& c) { GLuint shader = static_cast<GLuint>(c.shader); parse_error::ParseError result = @@ -345,7 +345,7 @@ parse_error::ParseError GLES2Decoder::HandleCompileShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCompressedTexImage2D( +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); @@ -371,7 +371,7 @@ parse_error::ParseError GLES2Decoder::HandleCompressedTexImage2D( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCompressedTexImage2DImmediate( +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); @@ -394,7 +394,7 @@ parse_error::ParseError GLES2Decoder::HandleCompressedTexImage2DImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCompressedTexSubImage2D( +parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( unsigned int arg_count, const gles2::CompressedTexSubImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); @@ -421,7 +421,8 @@ parse_error::ParseError GLES2Decoder::HandleCompressedTexSubImage2D( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCompressedTexSubImage2DImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate( + unsigned int arg_count, const gles2::CompressedTexSubImage2DImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); @@ -445,7 +446,7 @@ parse_error::ParseError GLES2Decoder::HandleCompressedTexSubImage2DImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCopyTexImage2D( +parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( unsigned int arg_count, const gles2::CopyTexImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); @@ -466,7 +467,7 @@ parse_error::ParseError GLES2Decoder::HandleCopyTexImage2D( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCopyTexSubImage2D( +parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D( unsigned int arg_count, const gles2::CopyTexSubImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); @@ -487,7 +488,7 @@ parse_error::ParseError GLES2Decoder::HandleCopyTexSubImage2D( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCreateProgram( +parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram( unsigned int arg_count, const gles2::CreateProgram& c) { uint32 client_id = c.client_id; parse_error::ParseError result = @@ -499,7 +500,7 @@ parse_error::ParseError GLES2Decoder::HandleCreateProgram( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCreateShader( +parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( unsigned int arg_count, const gles2::CreateShader& c) { GLenum type = static_cast<GLenum>(c.type); uint32 client_id = c.client_id; @@ -512,7 +513,7 @@ parse_error::ParseError GLES2Decoder::HandleCreateShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleCullFace( +parse_error::ParseError GLES2DecoderImpl::HandleCullFace( unsigned int arg_count, const gles2::CullFace& c) { GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = @@ -524,7 +525,7 @@ parse_error::ParseError GLES2Decoder::HandleCullFace( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteBuffers( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers( unsigned int arg_count, const gles2::DeleteBuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( @@ -538,7 +539,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteBuffers( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteBuffersImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate( unsigned int arg_count, const gles2::DeleteBuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c); @@ -551,7 +552,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteBuffersImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteFramebuffers( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers( unsigned int arg_count, const gles2::DeleteFramebuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( @@ -566,7 +567,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteFramebuffers( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteFramebuffersImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( unsigned int arg_count, const gles2::DeleteFramebuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c); @@ -579,7 +580,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteFramebuffersImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteProgram( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram( unsigned int arg_count, const gles2::DeleteProgram& c) { GLuint program = static_cast<GLuint>(c.program); parse_error::ParseError result = @@ -591,7 +592,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteProgram( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteRenderbuffers( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( unsigned int arg_count, const gles2::DeleteRenderbuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( @@ -606,7 +607,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteRenderbuffers( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteRenderbuffersImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( unsigned int arg_count, const gles2::DeleteRenderbuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c); @@ -619,7 +620,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteRenderbuffersImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteShader( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( unsigned int arg_count, const gles2::DeleteShader& c) { GLuint shader = static_cast<GLuint>(c.shader); parse_error::ParseError result = @@ -631,7 +632,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteTextures( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( unsigned int arg_count, const gles2::DeleteTextures& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* textures = GetSharedMemoryAs<const GLuint*>( @@ -645,7 +646,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteTextures( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDeleteTexturesImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate( unsigned int arg_count, const gles2::DeleteTexturesImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); const GLuint* textures = GetImmediateDataAs<const GLuint*>(c); @@ -658,7 +659,7 @@ parse_error::ParseError GLES2Decoder::HandleDeleteTexturesImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDepthFunc( +parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( unsigned int arg_count, const gles2::DepthFunc& c) { GLenum func = static_cast<GLenum>(c.func); parse_error::ParseError result = @@ -670,7 +671,7 @@ parse_error::ParseError GLES2Decoder::HandleDepthFunc( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDepthMask( +parse_error::ParseError GLES2DecoderImpl::HandleDepthMask( unsigned int arg_count, const gles2::DepthMask& c) { GLboolean flag = static_cast<GLboolean>(c.flag); parse_error::ParseError result = @@ -682,7 +683,7 @@ parse_error::ParseError GLES2Decoder::HandleDepthMask( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDepthRangef( +parse_error::ParseError GLES2DecoderImpl::HandleDepthRangef( unsigned int arg_count, const gles2::DepthRangef& c) { GLclampf zNear = static_cast<GLclampf>(c.zNear); GLclampf zFar = static_cast<GLclampf>(c.zFar); @@ -695,7 +696,7 @@ parse_error::ParseError GLES2Decoder::HandleDepthRangef( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDetachShader( +parse_error::ParseError GLES2DecoderImpl::HandleDetachShader( unsigned int arg_count, const gles2::DetachShader& c) { GLuint program = static_cast<GLuint>(c.program); GLuint shader = static_cast<GLuint>(c.shader); @@ -708,7 +709,7 @@ parse_error::ParseError GLES2Decoder::HandleDetachShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDisable( +parse_error::ParseError GLES2DecoderImpl::HandleDisable( unsigned int arg_count, const gles2::Disable& c) { GLenum cap = static_cast<GLenum>(c.cap); parse_error::ParseError result = @@ -720,7 +721,7 @@ parse_error::ParseError GLES2Decoder::HandleDisable( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDisableVertexAttribArray( +parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( unsigned int arg_count, const gles2::DisableVertexAttribArray& c) { GLuint index = static_cast<GLuint>(c.index); parse_error::ParseError result = @@ -732,7 +733,7 @@ parse_error::ParseError GLES2Decoder::HandleDisableVertexAttribArray( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleDrawArrays( +parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays( unsigned int arg_count, const gles2::DrawArrays& c) { GLenum mode = static_cast<GLenum>(c.mode); GLint first = static_cast<GLint>(c.first); @@ -746,7 +747,7 @@ parse_error::ParseError GLES2Decoder::HandleDrawArrays( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleEnable( +parse_error::ParseError GLES2DecoderImpl::HandleEnable( unsigned int arg_count, const gles2::Enable& c) { GLenum cap = static_cast<GLenum>(c.cap); parse_error::ParseError result = @@ -758,7 +759,7 @@ parse_error::ParseError GLES2Decoder::HandleEnable( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleEnableVertexAttribArray( +parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( unsigned int arg_count, const gles2::EnableVertexAttribArray& c) { GLuint index = static_cast<GLuint>(c.index); parse_error::ParseError result = @@ -770,7 +771,7 @@ parse_error::ParseError GLES2Decoder::HandleEnableVertexAttribArray( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleFinish( +parse_error::ParseError GLES2DecoderImpl::HandleFinish( unsigned int arg_count, const gles2::Finish& c) { parse_error::ParseError result = ValidateFinish(this, arg_count); @@ -781,7 +782,7 @@ parse_error::ParseError GLES2Decoder::HandleFinish( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleFlush( +parse_error::ParseError GLES2DecoderImpl::HandleFlush( unsigned int arg_count, const gles2::Flush& c) { parse_error::ParseError result = ValidateFlush(this, arg_count); @@ -792,7 +793,7 @@ parse_error::ParseError GLES2Decoder::HandleFlush( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleFramebufferRenderbuffer( +parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer( unsigned int arg_count, const gles2::FramebufferRenderbuffer& c) { GLenum target = static_cast<GLenum>(c.target); GLenum attachment = static_cast<GLenum>(c.attachment); @@ -805,12 +806,12 @@ parse_error::ParseError GLES2Decoder::HandleFramebufferRenderbuffer( if (result != parse_error::kParseNoError) { return result; } - glFramebufferRenderbuffer( + glFramebufferRenderbufferEXT( target, attachment, renderbuffertarget, renderbuffer); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleFramebufferTexture2D( +parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D( unsigned int arg_count, const gles2::FramebufferTexture2D& c) { GLenum target = static_cast<GLenum>(c.target); GLenum attachment = static_cast<GLenum>(c.attachment); @@ -823,11 +824,11 @@ parse_error::ParseError GLES2Decoder::HandleFramebufferTexture2D( if (result != parse_error::kParseNoError) { return result; } - glFramebufferTexture2D(target, attachment, textarget, texture, level); + glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleFrontFace( +parse_error::ParseError GLES2DecoderImpl::HandleFrontFace( unsigned int arg_count, const gles2::FrontFace& c) { GLenum mode = static_cast<GLenum>(c.mode); parse_error::ParseError result = @@ -839,7 +840,7 @@ parse_error::ParseError GLES2Decoder::HandleFrontFace( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenBuffers( +parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers( unsigned int arg_count, const gles2::GenBuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* buffers = GetSharedMemoryAs<GLuint*>( @@ -853,7 +854,7 @@ parse_error::ParseError GLES2Decoder::HandleGenBuffers( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenBuffersImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate( unsigned int arg_count, const gles2::GenBuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* buffers = GetImmediateDataAs<GLuint*>(c); @@ -866,7 +867,7 @@ parse_error::ParseError GLES2Decoder::HandleGenBuffersImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenerateMipmap( +parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( unsigned int arg_count, const gles2::GenerateMipmap& c) { GLenum target = static_cast<GLenum>(c.target); parse_error::ParseError result = @@ -874,11 +875,11 @@ parse_error::ParseError GLES2Decoder::HandleGenerateMipmap( if (result != parse_error::kParseNoError) { return result; } - glGenerateMipmap(target); + glGenerateMipmapEXT(target); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenFramebuffers( +parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers( unsigned int arg_count, const gles2::GenFramebuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( @@ -893,7 +894,7 @@ parse_error::ParseError GLES2Decoder::HandleGenFramebuffers( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenFramebuffersImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate( unsigned int arg_count, const gles2::GenFramebuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c); @@ -906,7 +907,7 @@ parse_error::ParseError GLES2Decoder::HandleGenFramebuffersImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenRenderbuffers( +parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers( unsigned int arg_count, const gles2::GenRenderbuffers& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( @@ -921,7 +922,7 @@ parse_error::ParseError GLES2Decoder::HandleGenRenderbuffers( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenRenderbuffersImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate( unsigned int arg_count, const gles2::GenRenderbuffersImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c); @@ -934,7 +935,7 @@ parse_error::ParseError GLES2Decoder::HandleGenRenderbuffersImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenTextures( +parse_error::ParseError GLES2DecoderImpl::HandleGenTextures( unsigned int arg_count, const gles2::GenTextures& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* textures = GetSharedMemoryAs<GLuint*>( @@ -948,7 +949,7 @@ parse_error::ParseError GLES2Decoder::HandleGenTextures( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGenTexturesImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate( unsigned int arg_count, const gles2::GenTexturesImmediate& c) { GLsizei n = static_cast<GLsizei>(c.n); GLuint* textures = GetImmediateDataAs<GLuint*>(c); @@ -961,7 +962,7 @@ parse_error::ParseError GLES2Decoder::HandleGenTexturesImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetAttribLocation( +parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocation( unsigned int arg_count, const gles2::GetAttribLocation& c) { GLuint program = static_cast<GLuint>(c.program); uint32 name_size = c.data_size; @@ -977,7 +978,7 @@ parse_error::ParseError GLES2Decoder::HandleGetAttribLocation( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetAttribLocationImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocationImmediate( unsigned int arg_count, const gles2::GetAttribLocationImmediate& c) { GLuint program = static_cast<GLuint>(c.program); uint32 name_size = c.data_size; @@ -994,7 +995,7 @@ parse_error::ParseError GLES2Decoder::HandleGetAttribLocationImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetBooleanv( +parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( unsigned int arg_count, const gles2::GetBooleanv& c) { GLenum pname = static_cast<GLenum>(c.pname); GLboolean* params; @@ -1011,7 +1012,7 @@ parse_error::ParseError GLES2Decoder::HandleGetBooleanv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetBufferParameteriv( +parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv( unsigned int arg_count, const gles2::GetBufferParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1029,7 +1030,7 @@ parse_error::ParseError GLES2Decoder::HandleGetBufferParameteriv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetError( +parse_error::ParseError GLES2DecoderImpl::HandleGetError( unsigned int arg_count, const gles2::GetError& c) { GLenum* result_dst = GetSharedMemoryAs<GLenum*>( c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); @@ -1042,7 +1043,7 @@ parse_error::ParseError GLES2Decoder::HandleGetError( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetFloatv( +parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv( unsigned int arg_count, const gles2::GetFloatv& c) { GLenum pname = static_cast<GLenum>(c.pname); GLfloat* params; @@ -1059,7 +1060,7 @@ parse_error::ParseError GLES2Decoder::HandleGetFloatv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetFramebufferAttachmentParameteriv( +parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParameteriv( unsigned int arg_count, const gles2::GetFramebufferAttachmentParameteriv& c) { @@ -1077,11 +1078,11 @@ parse_error::ParseError GLES2Decoder::HandleGetFramebufferAttachmentParameteriv( if (result != parse_error::kParseNoError) { return result; } - glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); + glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetIntegerv( +parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv( unsigned int arg_count, const gles2::GetIntegerv& c) { GLenum pname = static_cast<GLenum>(c.pname); GLint* params; @@ -1098,7 +1099,7 @@ parse_error::ParseError GLES2Decoder::HandleGetIntegerv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetProgramiv( +parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv( unsigned int arg_count, const gles2::GetProgramiv& c) { GLuint program = static_cast<GLuint>(c.program); GLenum pname = static_cast<GLenum>(c.pname); @@ -1116,7 +1117,7 @@ parse_error::ParseError GLES2Decoder::HandleGetProgramiv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetProgramInfoLog( +parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( unsigned int arg_count, const gles2::GetProgramInfoLog& c) { GLuint program = static_cast<GLuint>(c.program); GLsizei bufsize = static_cast<GLsizei>(c.bufsize); @@ -1134,7 +1135,7 @@ parse_error::ParseError GLES2Decoder::HandleGetProgramInfoLog( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetRenderbufferParameteriv( +parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( unsigned int arg_count, const gles2::GetRenderbufferParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1149,11 +1150,11 @@ parse_error::ParseError GLES2Decoder::HandleGetRenderbufferParameteriv( if (result != parse_error::kParseNoError) { return result; } - glGetRenderbufferParameteriv(target, pname, params); + glGetRenderbufferParameterivEXT(target, pname, params); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetShaderiv( +parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv( unsigned int arg_count, const gles2::GetShaderiv& c) { GLuint shader = static_cast<GLuint>(c.shader); GLenum pname = static_cast<GLenum>(c.pname); @@ -1171,7 +1172,7 @@ parse_error::ParseError GLES2Decoder::HandleGetShaderiv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetShaderInfoLog( +parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( unsigned int arg_count, const gles2::GetShaderInfoLog& c) { GLuint shader = static_cast<GLuint>(c.shader); GLsizei bufsize = static_cast<GLsizei>(c.bufsize); @@ -1189,7 +1190,7 @@ parse_error::ParseError GLES2Decoder::HandleGetShaderInfoLog( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetShaderSource( +parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( unsigned int arg_count, const gles2::GetShaderSource& c) { GLuint shader = static_cast<GLuint>(c.shader); GLsizei bufsize = static_cast<GLsizei>(c.bufsize); @@ -1207,7 +1208,7 @@ parse_error::ParseError GLES2Decoder::HandleGetShaderSource( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetString( +parse_error::ParseError GLES2DecoderImpl::HandleGetString( unsigned int arg_count, const gles2::GetString& c) { GLenum name = static_cast<GLenum>(c.name); parse_error::ParseError result = @@ -1219,7 +1220,7 @@ parse_error::ParseError GLES2Decoder::HandleGetString( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetTexParameterfv( +parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv( unsigned int arg_count, const gles2::GetTexParameterfv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1237,7 +1238,7 @@ parse_error::ParseError GLES2Decoder::HandleGetTexParameterfv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetTexParameteriv( +parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv( unsigned int arg_count, const gles2::GetTexParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1255,7 +1256,7 @@ parse_error::ParseError GLES2Decoder::HandleGetTexParameteriv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetUniformLocation( +parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocation( unsigned int arg_count, const gles2::GetUniformLocation& c) { GLuint program = static_cast<GLuint>(c.program); uint32 name_size = c.data_size; @@ -1271,7 +1272,7 @@ parse_error::ParseError GLES2Decoder::HandleGetUniformLocation( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetUniformLocationImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocationImmediate( unsigned int arg_count, const gles2::GetUniformLocationImmediate& c) { GLuint program = static_cast<GLuint>(c.program); uint32 name_size = c.data_size; @@ -1288,7 +1289,7 @@ parse_error::ParseError GLES2Decoder::HandleGetUniformLocationImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetVertexAttribfv( +parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv( unsigned int arg_count, const gles2::GetVertexAttribfv& c) { GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); @@ -1306,7 +1307,7 @@ parse_error::ParseError GLES2Decoder::HandleGetVertexAttribfv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleGetVertexAttribiv( +parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv( unsigned int arg_count, const gles2::GetVertexAttribiv& c) { GLuint index = static_cast<GLuint>(c.index); GLenum pname = static_cast<GLenum>(c.pname); @@ -1324,7 +1325,7 @@ parse_error::ParseError GLES2Decoder::HandleGetVertexAttribiv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleHint( +parse_error::ParseError GLES2DecoderImpl::HandleHint( unsigned int arg_count, const gles2::Hint& c) { GLenum target = static_cast<GLenum>(c.target); GLenum mode = static_cast<GLenum>(c.mode); @@ -1337,7 +1338,7 @@ parse_error::ParseError GLES2Decoder::HandleHint( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsBuffer( +parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer( unsigned int arg_count, const gles2::IsBuffer& c) { GLuint buffer = static_cast<GLuint>(c.buffer); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1351,7 +1352,7 @@ parse_error::ParseError GLES2Decoder::HandleIsBuffer( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsEnabled( +parse_error::ParseError GLES2DecoderImpl::HandleIsEnabled( unsigned int arg_count, const gles2::IsEnabled& c) { GLenum cap = static_cast<GLenum>(c.cap); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1365,7 +1366,7 @@ parse_error::ParseError GLES2Decoder::HandleIsEnabled( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsFramebuffer( +parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer( unsigned int arg_count, const gles2::IsFramebuffer& c) { GLuint framebuffer = static_cast<GLuint>(c.framebuffer); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1375,11 +1376,11 @@ parse_error::ParseError GLES2Decoder::HandleIsFramebuffer( if (result != parse_error::kParseNoError) { return result; } - *result_dst = glIsFramebuffer(framebuffer); + *result_dst = glIsFramebufferEXT(framebuffer); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsProgram( +parse_error::ParseError GLES2DecoderImpl::HandleIsProgram( unsigned int arg_count, const gles2::IsProgram& c) { GLuint program = static_cast<GLuint>(c.program); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1393,7 +1394,7 @@ parse_error::ParseError GLES2Decoder::HandleIsProgram( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsRenderbuffer( +parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer( unsigned int arg_count, const gles2::IsRenderbuffer& c) { GLuint renderbuffer = static_cast<GLuint>(c.renderbuffer); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1403,11 +1404,11 @@ parse_error::ParseError GLES2Decoder::HandleIsRenderbuffer( if (result != parse_error::kParseNoError) { return result; } - *result_dst = glIsRenderbuffer(renderbuffer); + *result_dst = glIsRenderbufferEXT(renderbuffer); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsShader( +parse_error::ParseError GLES2DecoderImpl::HandleIsShader( unsigned int arg_count, const gles2::IsShader& c) { GLuint shader = static_cast<GLuint>(c.shader); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1421,7 +1422,7 @@ parse_error::ParseError GLES2Decoder::HandleIsShader( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleIsTexture( +parse_error::ParseError GLES2DecoderImpl::HandleIsTexture( unsigned int arg_count, const gles2::IsTexture& c) { GLuint texture = static_cast<GLuint>(c.texture); GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( @@ -1435,7 +1436,7 @@ parse_error::ParseError GLES2Decoder::HandleIsTexture( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleLineWidth( +parse_error::ParseError GLES2DecoderImpl::HandleLineWidth( unsigned int arg_count, const gles2::LineWidth& c) { GLfloat width = static_cast<GLfloat>(c.width); parse_error::ParseError result = @@ -1447,7 +1448,7 @@ parse_error::ParseError GLES2Decoder::HandleLineWidth( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleLinkProgram( +parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram( unsigned int arg_count, const gles2::LinkProgram& c) { GLuint program = static_cast<GLuint>(c.program); parse_error::ParseError result = @@ -1459,7 +1460,7 @@ parse_error::ParseError GLES2Decoder::HandleLinkProgram( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandlePolygonOffset( +parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset( unsigned int arg_count, const gles2::PolygonOffset& c) { GLfloat factor = static_cast<GLfloat>(c.factor); GLfloat units = static_cast<GLfloat>(c.units); @@ -1472,7 +1473,7 @@ parse_error::ParseError GLES2Decoder::HandlePolygonOffset( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleRenderbufferStorage( +parse_error::ParseError GLES2DecoderImpl::HandleRenderbufferStorage( unsigned int arg_count, const gles2::RenderbufferStorage& c) { GLenum target = static_cast<GLenum>(c.target); GLenum internalformat = static_cast<GLenum>(c.internalformat); @@ -1484,11 +1485,11 @@ parse_error::ParseError GLES2Decoder::HandleRenderbufferStorage( if (result != parse_error::kParseNoError) { return result; } - glRenderbufferStorage(target, internalformat, width, height); + glRenderbufferStorageEXT(target, internalformat, width, height); return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleSampleCoverage( +parse_error::ParseError GLES2DecoderImpl::HandleSampleCoverage( unsigned int arg_count, const gles2::SampleCoverage& c) { GLclampf value = static_cast<GLclampf>(c.value); GLboolean invert = static_cast<GLboolean>(c.invert); @@ -1501,7 +1502,7 @@ parse_error::ParseError GLES2Decoder::HandleSampleCoverage( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleScissor( +parse_error::ParseError GLES2DecoderImpl::HandleScissor( unsigned int arg_count, const gles2::Scissor& c) { GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); @@ -1516,7 +1517,7 @@ parse_error::ParseError GLES2Decoder::HandleScissor( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleStencilFunc( +parse_error::ParseError GLES2DecoderImpl::HandleStencilFunc( unsigned int arg_count, const gles2::StencilFunc& c) { GLenum func = static_cast<GLenum>(c.func); GLint ref = static_cast<GLint>(c.ref); @@ -1530,7 +1531,7 @@ parse_error::ParseError GLES2Decoder::HandleStencilFunc( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleStencilFuncSeparate( +parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate( unsigned int arg_count, const gles2::StencilFuncSeparate& c) { GLenum face = static_cast<GLenum>(c.face); GLenum func = static_cast<GLenum>(c.func); @@ -1545,7 +1546,7 @@ parse_error::ParseError GLES2Decoder::HandleStencilFuncSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleStencilMask( +parse_error::ParseError GLES2DecoderImpl::HandleStencilMask( unsigned int arg_count, const gles2::StencilMask& c) { GLuint mask = static_cast<GLuint>(c.mask); parse_error::ParseError result = @@ -1557,7 +1558,7 @@ parse_error::ParseError GLES2Decoder::HandleStencilMask( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleStencilMaskSeparate( +parse_error::ParseError GLES2DecoderImpl::HandleStencilMaskSeparate( unsigned int arg_count, const gles2::StencilMaskSeparate& c) { GLenum face = static_cast<GLenum>(c.face); GLuint mask = static_cast<GLuint>(c.mask); @@ -1570,7 +1571,7 @@ parse_error::ParseError GLES2Decoder::HandleStencilMaskSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleStencilOp( +parse_error::ParseError GLES2DecoderImpl::HandleStencilOp( unsigned int arg_count, const gles2::StencilOp& c) { GLenum fail = static_cast<GLenum>(c.fail); GLenum zfail = static_cast<GLenum>(c.zfail); @@ -1584,7 +1585,7 @@ parse_error::ParseError GLES2Decoder::HandleStencilOp( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleStencilOpSeparate( +parse_error::ParseError GLES2DecoderImpl::HandleStencilOpSeparate( unsigned int arg_count, const gles2::StencilOpSeparate& c) { GLenum face = static_cast<GLenum>(c.face); GLenum fail = static_cast<GLenum>(c.fail); @@ -1599,7 +1600,7 @@ parse_error::ParseError GLES2Decoder::HandleStencilOpSeparate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexImage2D( +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); @@ -1628,7 +1629,7 @@ parse_error::ParseError GLES2Decoder::HandleTexImage2D( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexImage2DImmediate( +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); @@ -1653,7 +1654,7 @@ parse_error::ParseError GLES2Decoder::HandleTexImage2DImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexParameterf( +parse_error::ParseError GLES2DecoderImpl::HandleTexParameterf( unsigned int arg_count, const gles2::TexParameterf& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1667,7 +1668,7 @@ parse_error::ParseError GLES2Decoder::HandleTexParameterf( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexParameterfv( +parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv( unsigned int arg_count, const gles2::TexParameterfv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1682,7 +1683,7 @@ parse_error::ParseError GLES2Decoder::HandleTexParameterfv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexParameterfvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate( unsigned int arg_count, const gles2::TexParameterfvImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1697,7 +1698,7 @@ parse_error::ParseError GLES2Decoder::HandleTexParameterfvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexParameteri( +parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri( unsigned int arg_count, const gles2::TexParameteri& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1711,7 +1712,7 @@ parse_error::ParseError GLES2Decoder::HandleTexParameteri( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexParameteriv( +parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv( unsigned int arg_count, const gles2::TexParameteriv& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1726,7 +1727,7 @@ parse_error::ParseError GLES2Decoder::HandleTexParameteriv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexParameterivImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate( unsigned int arg_count, const gles2::TexParameterivImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLenum pname = static_cast<GLenum>(c.pname); @@ -1741,7 +1742,7 @@ parse_error::ParseError GLES2Decoder::HandleTexParameterivImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexSubImage2D( +parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( unsigned int arg_count, const gles2::TexSubImage2D& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); @@ -1769,7 +1770,7 @@ parse_error::ParseError GLES2Decoder::HandleTexSubImage2D( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleTexSubImage2DImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( unsigned int arg_count, const gles2::TexSubImage2DImmediate& c) { GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); @@ -1793,7 +1794,7 @@ parse_error::ParseError GLES2Decoder::HandleTexSubImage2DImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform1f( +parse_error::ParseError GLES2DecoderImpl::HandleUniform1f( unsigned int arg_count, const gles2::Uniform1f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); @@ -1806,7 +1807,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform1f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform1fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv( unsigned int arg_count, const gles2::Uniform1fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1821,7 +1822,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform1fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform1fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate( unsigned int arg_count, const gles2::Uniform1fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1836,7 +1837,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform1fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform1i( +parse_error::ParseError GLES2DecoderImpl::HandleUniform1i( unsigned int arg_count, const gles2::Uniform1i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); @@ -1849,7 +1850,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform1i( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform1iv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv( unsigned int arg_count, const gles2::Uniform1iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1864,7 +1865,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform1iv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform1ivImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate( unsigned int arg_count, const gles2::Uniform1ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1879,7 +1880,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform1ivImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform2f( +parse_error::ParseError GLES2DecoderImpl::HandleUniform2f( unsigned int arg_count, const gles2::Uniform2f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); @@ -1893,7 +1894,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform2f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform2fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv( unsigned int arg_count, const gles2::Uniform2fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1908,7 +1909,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform2fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform2fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate( unsigned int arg_count, const gles2::Uniform2fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1923,7 +1924,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform2fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform2i( +parse_error::ParseError GLES2DecoderImpl::HandleUniform2i( unsigned int arg_count, const gles2::Uniform2i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); @@ -1937,7 +1938,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform2i( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform2iv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv( unsigned int arg_count, const gles2::Uniform2iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1952,7 +1953,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform2iv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform2ivImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate( unsigned int arg_count, const gles2::Uniform2ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1967,7 +1968,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform2ivImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform3f( +parse_error::ParseError GLES2DecoderImpl::HandleUniform3f( unsigned int arg_count, const gles2::Uniform3f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); @@ -1982,7 +1983,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform3f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform3fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv( unsigned int arg_count, const gles2::Uniform3fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -1997,7 +1998,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform3fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform3fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate( unsigned int arg_count, const gles2::Uniform3fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2012,7 +2013,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform3fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform3i( +parse_error::ParseError GLES2DecoderImpl::HandleUniform3i( unsigned int arg_count, const gles2::Uniform3i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); @@ -2027,7 +2028,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform3i( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform3iv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv( unsigned int arg_count, const gles2::Uniform3iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2042,7 +2043,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform3iv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform3ivImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate( unsigned int arg_count, const gles2::Uniform3ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2057,7 +2058,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform3ivImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform4f( +parse_error::ParseError GLES2DecoderImpl::HandleUniform4f( unsigned int arg_count, const gles2::Uniform4f& c) { GLint location = static_cast<GLint>(c.location); GLfloat x = static_cast<GLfloat>(c.x); @@ -2073,7 +2074,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform4f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform4fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv( unsigned int arg_count, const gles2::Uniform4fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2088,7 +2089,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform4fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform4fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate( unsigned int arg_count, const gles2::Uniform4fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2103,7 +2104,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform4fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform4i( +parse_error::ParseError GLES2DecoderImpl::HandleUniform4i( unsigned int arg_count, const gles2::Uniform4i& c) { GLint location = static_cast<GLint>(c.location); GLint x = static_cast<GLint>(c.x); @@ -2119,7 +2120,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform4i( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform4iv( +parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv( unsigned int arg_count, const gles2::Uniform4iv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2134,7 +2135,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform4iv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniform4ivImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate( unsigned int arg_count, const gles2::Uniform4ivImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2149,7 +2150,7 @@ parse_error::ParseError GLES2Decoder::HandleUniform4ivImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniformMatrix2fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( unsigned int arg_count, const gles2::UniformMatrix2fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2166,7 +2167,7 @@ parse_error::ParseError GLES2Decoder::HandleUniformMatrix2fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniformMatrix2fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( unsigned int arg_count, const gles2::UniformMatrix2fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2183,7 +2184,7 @@ parse_error::ParseError GLES2Decoder::HandleUniformMatrix2fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniformMatrix3fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( unsigned int arg_count, const gles2::UniformMatrix3fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2200,7 +2201,7 @@ parse_error::ParseError GLES2Decoder::HandleUniformMatrix3fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniformMatrix3fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( unsigned int arg_count, const gles2::UniformMatrix3fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2217,7 +2218,7 @@ parse_error::ParseError GLES2Decoder::HandleUniformMatrix3fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniformMatrix4fv( +parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( unsigned int arg_count, const gles2::UniformMatrix4fv& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2234,7 +2235,7 @@ parse_error::ParseError GLES2Decoder::HandleUniformMatrix4fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUniformMatrix4fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( unsigned int arg_count, const gles2::UniformMatrix4fvImmediate& c) { GLint location = static_cast<GLint>(c.location); GLsizei count = static_cast<GLsizei>(c.count); @@ -2251,7 +2252,7 @@ parse_error::ParseError GLES2Decoder::HandleUniformMatrix4fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleUseProgram( +parse_error::ParseError GLES2DecoderImpl::HandleUseProgram( unsigned int arg_count, const gles2::UseProgram& c) { GLuint program = static_cast<GLuint>(c.program); parse_error::ParseError result = @@ -2263,7 +2264,7 @@ parse_error::ParseError GLES2Decoder::HandleUseProgram( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleValidateProgram( +parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram( unsigned int arg_count, const gles2::ValidateProgram& c) { GLuint program = static_cast<GLuint>(c.program); parse_error::ParseError result = @@ -2275,7 +2276,7 @@ parse_error::ParseError GLES2Decoder::HandleValidateProgram( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib1f( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f( unsigned int arg_count, const gles2::VertexAttrib1f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); @@ -2288,7 +2289,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib1f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib1fv( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv( unsigned int arg_count, const gles2::VertexAttrib1fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( @@ -2302,7 +2303,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib1fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib1fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( unsigned int arg_count, const gles2::VertexAttrib1fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); @@ -2316,7 +2317,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib1fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib2f( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f( unsigned int arg_count, const gles2::VertexAttrib2f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); @@ -2330,7 +2331,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib2f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib2fv( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv( unsigned int arg_count, const gles2::VertexAttrib2fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( @@ -2344,7 +2345,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib2fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib2fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( unsigned int arg_count, const gles2::VertexAttrib2fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); @@ -2358,7 +2359,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib2fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib3f( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f( unsigned int arg_count, const gles2::VertexAttrib3f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); @@ -2373,7 +2374,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib3f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib3fv( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv( unsigned int arg_count, const gles2::VertexAttrib3fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( @@ -2387,7 +2388,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib3fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib3fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( unsigned int arg_count, const gles2::VertexAttrib3fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); @@ -2401,7 +2402,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib3fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib4f( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f( unsigned int arg_count, const gles2::VertexAttrib4f& c) { GLuint indx = static_cast<GLuint>(c.indx); GLfloat x = static_cast<GLfloat>(c.x); @@ -2417,7 +2418,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib4f( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib4fv( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv( unsigned int arg_count, const gles2::VertexAttrib4fv& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( @@ -2431,7 +2432,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib4fv( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleVertexAttrib4fvImmediate( +parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( unsigned int arg_count, const gles2::VertexAttrib4fvImmediate& c) { GLuint indx = static_cast<GLuint>(c.indx); const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); @@ -2445,7 +2446,7 @@ parse_error::ParseError GLES2Decoder::HandleVertexAttrib4fvImmediate( return parse_error::kParseNoError; } -parse_error::ParseError GLES2Decoder::HandleViewport( +parse_error::ParseError GLES2DecoderImpl::HandleViewport( unsigned int arg_count, const gles2::Viewport& c) { GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); diff --git a/o3d/gpu/command_buffer/service/gpu_processor.h b/o3d/gpu/command_buffer/service/gpu_processor.h index d61f3d2..786e504 100644 --- a/o3d/gpu/command_buffer/service/gpu_processor.h +++ b/o3d/gpu/command_buffer/service/gpu_processor.h @@ -11,17 +11,9 @@ #include "gpu/command_buffer/common/command_buffer.h" #include "gpu/command_buffer/service/cmd_buffer_engine.h" #include "gpu/command_buffer/service/cmd_parser.h" -#include "gpu/command_buffer/service/gapi_decoder.h" +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/np_utils/np_object_pointer.h" -#if defined(CB_SERVICE_D3D9) -#include "gpu/command_buffer/service/gapi_d3d9.h" -#elif defined(CB_SERVICE_GL) -#include "gpu/command_buffer/service/gapi_gl.h" -#else -#error command buffer service not defined -#endif - namespace command_buffer { // This class processes commands in a command buffer. It is event driven and @@ -29,21 +21,12 @@ namespace command_buffer { class GPUProcessor : public ::base::RefCounted<GPUProcessor>, public command_buffer::CommandBufferEngine { public: -#if defined(CB_SERVICE_D3D9) - typedef command_buffer::o3d::GAPID3D9 GPUGAPIInterface; -#elif defined(CB_SERVICE_GL) - typedef command_buffer::o3d::GAPIGL GPUGAPIInterface; -#else -#error command buffer service not defined -#endif - GPUProcessor(NPP npp, CommandBuffer* command_buffer); // This constructor is for unit tests. GPUProcessor(CommandBuffer* command_buffer, - GPUGAPIInterface* gapi, - command_buffer::o3d::GAPIDecoder* decoder, - command_buffer::CommandParser* parser, + gles2::GLES2Decoder* decoder, + CommandParser* parser, int commands_per_update); virtual bool Initialize(HWND hwnd); @@ -84,9 +67,8 @@ class GPUProcessor : public ::base::RefCounted<GPUProcessor>, scoped_ptr< ::base::SharedMemory> mapped_ring_buffer_; int commands_per_update_; - scoped_ptr<GPUGAPIInterface> gapi_; - scoped_ptr<command_buffer::o3d::GAPIDecoder> decoder_; - scoped_ptr<command_buffer::CommandParser> parser_; + scoped_ptr<gles2::GLES2Decoder> decoder_; + scoped_ptr<CommandParser> parser_; }; } // namespace command_buffer diff --git a/o3d/gpu/command_buffer/service/gpu_processor_unittest.cc b/o3d/gpu/command_buffer/service/gpu_processor_unittest.cc index faefcd2..89a9392 100644 --- a/o3d/gpu/command_buffer/service/gpu_processor_unittest.cc +++ b/o3d/gpu/command_buffer/service/gpu_processor_unittest.cc @@ -7,6 +7,7 @@ #include "gpu/command_buffer/common/command_buffer_mock.h" #include "gpu/command_buffer/service/mocks.h" #include "gpu/command_buffer/service/gpu_processor.h" +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/np_utils/np_browser_mock.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gmock/include/gmock/gmock.h" @@ -46,13 +47,9 @@ class GPUProcessorTest : public testing::Test { ON_CALL(*command_buffer_.get(), GetSize()) .WillByDefault(Return(kRingBufferEntries)); -#if defined(OS_WIN) - gapi_ = new GPUProcessor::GPUGAPIInterface; -#endif - async_api_.reset(new StrictMock<command_buffer::AsyncAPIMock>); - decoder_ = new command_buffer::o3d::GAPIDecoder(gapi_); + decoder_ = gles2::GLES2Decoder::Create(); parser_ = new command_buffer::CommandParser(buffer_, kRingBufferEntries, @@ -62,7 +59,6 @@ class GPUProcessorTest : public testing::Test { async_api_.get()); processor_ = new GPUProcessor(command_buffer_.get(), - gapi_, decoder_, parser_, 2); @@ -80,14 +76,10 @@ class GPUProcessorTest : public testing::Test { scoped_ptr<MockCommandBuffer> command_buffer_; scoped_ptr<::base::SharedMemory> shared_memory_; int32* buffer_; - command_buffer::o3d::GAPIDecoder* decoder_; + command_buffer::gles2::GLES2Decoder* decoder_; command_buffer::CommandParser* parser_; scoped_ptr<command_buffer::AsyncAPIMock> async_api_; scoped_refptr<GPUProcessor> processor_; - -#if defined(OS_WIN) - GPUProcessor::GPUGAPIInterface* gapi_; -#endif }; TEST_F(GPUProcessorTest, ProcessorDoesNothingIfRingBufferIsEmpty) { diff --git a/o3d/gpu/command_buffer/service/gpu_processor_win.cc b/o3d/gpu/command_buffer/service/gpu_processor_win.cc index 9d7d4de..d672c12 100644 --- a/o3d/gpu/command_buffer/service/gpu_processor_win.cc +++ b/o3d/gpu/command_buffer/service/gpu_processor_win.cc @@ -15,21 +15,18 @@ GPUProcessor::GPUProcessor(NPP npp, CommandBuffer* command_buffer) command_buffer_(command_buffer), commands_per_update_(100) { DCHECK(command_buffer); - gapi_.reset(new GPUGAPIInterface); - decoder_.reset(new command_buffer::o3d::GAPIDecoder(gapi_.get())); + decoder_.reset(gles2::GLES2Decoder::Create()); decoder_->set_engine(this); } GPUProcessor::GPUProcessor(CommandBuffer* command_buffer, - GPUGAPIInterface* gapi, - command_buffer::o3d::GAPIDecoder* decoder, - command_buffer::CommandParser* parser, + gles2::GLES2Decoder* decoder, + CommandParser* parser, int commands_per_update) : npp_(NULL), command_buffer_(command_buffer), commands_per_update_(commands_per_update) { DCHECK(command_buffer); - gapi_.reset(gapi); decoder_.reset(decoder); parser_.reset(parser); } @@ -38,7 +35,7 @@ bool GPUProcessor::Initialize(HWND handle) { DCHECK(handle); // Cannot reinitialize. - if (gapi_->hwnd() != NULL) + if (decoder_->hwnd() != NULL) return false; // Map the ring buffer and create the parser. @@ -58,15 +55,15 @@ bool GPUProcessor::Initialize(HWND handle) { } // Initialize GAPI immediately if the window handle is valid. - gapi_->set_hwnd(handle); - return gapi_->Initialize(); + decoder_->set_hwnd(handle); + return decoder_->Initialize(); } void GPUProcessor::Destroy() { // Destroy GAPI if window handle has not already become invalid. - if (gapi_->hwnd()) { - gapi_->Destroy(); - gapi_->set_hwnd(NULL); + if (decoder_->hwnd()) { + decoder_->Destroy(); + decoder_->set_hwnd(NULL); } } diff --git a/o3d/gpu/gpu.gyp b/o3d/gpu/gpu.gyp index e9e9881..a9bc9dfa 100644 --- a/o3d/gpu/gpu.gyp +++ b/o3d/gpu/gpu.gyp @@ -31,6 +31,9 @@ 'command_buffer/common/cmd_buffer_common.cc', 'command_buffer/common/command_buffer.h', 'command_buffer/common/command_buffer_mock.h', + 'command_buffer/common/gles2_cmd_ids_autogen.h', + 'command_buffer/common/gles2_cmd_ids.h', + 'command_buffer/common/gles2_cmd_format_autogen.h', 'command_buffer/common/gles2_cmd_format.cc', 'command_buffer/common/gles2_cmd_format.h', 'command_buffer/common/gles2_cmd_utils.cc', @@ -75,7 +78,7 @@ }, { # Stub to expose gles2_implementation as a namespace rather than a class - # so GLES2 programs can work with no changes. + # so GLES2 C++ programs can work with no changes. 'target_name': 'gles2_lib', 'type': 'static_library', 'dependencies': [ @@ -88,6 +91,20 @@ ], }, { + # Stub to expose gles2_implemenation in C instead of C++. + # so GLES2 programs can work with no changes. + 'target_name': 'gles2_c_lib', + 'type': 'static_library', + 'dependencies': [ + 'gles2_implementation', + ], + 'sources': [ + 'command_buffer/client/gles2_c_lib.h', + 'command_buffer/client/gles2_c_lib.cc', + 'command_buffer/client/gles2_c_lib_autogen.h', + ], + }, + { 'target_name': 'command_buffer_common_unittests', 'type': 'none', 'include_dirs': [ @@ -141,9 +158,6 @@ { 'target_name': 'command_buffer_service', 'type': 'static_library', - 'defines': [ - 'GPU_SERVICE=1', - ], 'include_dirs': [ '..', '../..', @@ -396,7 +410,7 @@ { 'target_name': 'gpu_all_unittests', 'type': 'executable', - 'dependencies': [ + 'dependencies': [ '../../testing/gmock.gyp:gmock', '../../testing/gmock.gyp:gmockmain', '../../testing/gtest.gyp:gtest', |