summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-15 20:23:17 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-15 20:23:17 +0000
commitd294ef3a7f91afdc1e5f9f570da7b8ef4b5bd8b7 (patch)
tree3f62b0248e483f16ab6543ebcd03028e7f93dd5a /gpu
parent3c3f4ac55dfce051c2530ba8e014db89b559f9e1 (diff)
downloadchromium_src-d294ef3a7f91afdc1e5f9f570da7b8ef4b5bd8b7.zip
chromium_src-d294ef3a7f91afdc1e5f9f570da7b8ef4b5bd8b7.tar.gz
chromium_src-d294ef3a7f91afdc1e5f9f570da7b8ef4b5bd8b7.tar.bz2
Another round of gcc fixes for GPU command buffers.
This actually gets command_buffer_common_unittests building and passing. BUG=n/a TEST=n/a Review URL: http://codereview.chromium.org/488011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py69
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper_test.cc2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h336
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h1475
4 files changed, 1216 insertions, 666 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 09e0249..4456db0 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -452,12 +452,12 @@ class TypeHandler(object):
def WriteCmdSizeTest(self, func, file):
"""Writes the size test for a command."""
- file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT\n")
+ file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n")
def WriteFormatTest(self, func, file):
"""Writes a format test for a command."""
file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name)
- file.Write(" %s cmd = { 0, };\n" % func.name)
+ file.Write(" %s cmd = {{0}};\n" % func.name)
file.Write(" void* next_cmd = cmd.Set(\n")
file.Write(" &cmd")
args = func.GetCmdArgs()
@@ -467,8 +467,11 @@ class TypeHandler(object):
value += 1
file.Write(");\n")
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
func.type_handler.WriteCmdSizeTest(func, file)
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n");
for arg in args:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -491,8 +494,11 @@ class TypeHandler(object):
value += 1
file.Write(");\n")
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
func.type_handler.WriteImmediateCmdSizeTest(func, file)
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n");
for arg in args:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -503,7 +509,7 @@ class TypeHandler(object):
def WriteImmediateCmdSizeTest(self, func, file):
"""Writes a size test for an immediate version of a command."""
file.Write(" // TODO(gman): Compute correct size.\n")
- file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4);\n")
+ file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);\n")
def WriteImmediateHandlerImplementation (self, func, file):
"""Writes the handler impl for the immediate version of a command."""
@@ -976,10 +982,14 @@ class GENnHandler(TypeHandler):
file.Write(",\n ids);\n")
args = func.GetCmdArgs()
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
- file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4),\n")
- file.Write(" cmd.header.size * 4); // NOLINT\n")
+ file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n")
+ file.Write(" cmd.header.size * 4u); // NOLINT\n")
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n");
+ file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n");
for arg in args:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -1152,10 +1162,14 @@ class DELnHandler(TypeHandler):
file.Write(",\n ids);\n")
args = func.GetCmdArgs()
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
- file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4),\n")
- file.Write(" cmd.header.size * 4); // NOLINT\n")
+ file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n")
+ file.Write(" cmd.header.size * 4u); // NOLINT\n")
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n");
+ file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n");
for arg in args:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -1337,10 +1351,14 @@ class PUTHandler(TypeHandler):
file.Write(",\n data);\n")
args = func.GetCmdArgs()
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n")
- file.Write(" cmd.header.size * 4); // NOLINT\n")
+ file.Write(" cmd.header.size * 4u); // NOLINT\n")
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n")
+ file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n")
for arg in args:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -1466,10 +1484,14 @@ class PUTnHandler(TypeHandler):
file.Write(",\n data);\n")
args = func.GetCmdArgs()
value = 1
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n")
- file.Write(" cmd.header.size * 4); // NOLINT\n")
+ file.Write(" cmd.header.size * 4u); // NOLINT\n")
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n")
+ file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n")
for arg in args:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -1642,10 +1664,14 @@ class GLcharHandler(TypeHandler):
value += 1
file.Write(",\n test_str);\n")
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
+ file.Write(" cmd.header.command);\n")
file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n")
file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n")
- file.Write(" cmd.header.size * 4);\n")
+ file.Write(" cmd.header.size * 4u);\n")
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n")
+ file.Write(" strlen(test_str) + 1);\n")
for arg in all_but_last_arg:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -1821,10 +1847,12 @@ class GetGLcharHandler(GLcharHandler):
value += 1
file.Write(",\n test_str);\n")
value = 11
- file.Write(" EXPECT_EQ(%s::kCmdId, cmd.header.command);\n" % func.name)
+ file.Write(" EXPECT_EQ(%s::kCmdId ^ cmd.header.command);\n" % func.name)
file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n")
file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n")
- file.Write(" cmd.header.size * 4);\n")
+ file.Write(" cmd.header.size * 4u);\n")
+ file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
+ file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n");
for arg in all_but_last_arg:
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value, arg.name))
@@ -1920,6 +1948,8 @@ class Argument(object):
"""A class that represents a function argument."""
cmd_type_map_ = {
+ 'GLint': 'int32',
+ 'GLsizei': 'int32',
'GLfloat': 'float',
'GLclampf': 'float',
}
@@ -2698,4 +2728,3 @@ def main(argv):
if __name__ == '__main__':
main(sys.argv[1:])
-
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
index 3cdc634..e7c0784 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -152,7 +152,7 @@ TEST_F(CommandBufferHelperTest, TestCommandProcessing) {
EXPECT_TRUE(parser_ != NULL);
EXPECT_FALSE(command_buffer_->GetErrorStatus());
EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
- EXPECT_EQ(0u, command_buffer_->GetGetOffset());
+ EXPECT_EQ(0, command_buffer_->GetGetOffset());
// Add 3 commands through the helper
AddCommandWithExpect(parse_error::kParseNoError, 1, 0, NULL);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index affe2c0..efa2538 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -914,7 +914,7 @@ struct ClearStencil {
}
gpu::CommandHeader header;
- uint32 s;
+ int32 s;
};
COMPILE_ASSERT(sizeof(ClearStencil) == 8,
@@ -1049,12 +1049,12 @@ struct CompressedTexImage2D {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
+ int32 level;
uint32 internalformat;
- uint32 width;
- uint32 height;
- uint32 border;
- uint32 imageSize;
+ int32 width;
+ int32 height;
+ int32 border;
+ int32 imageSize;
uint32 data_shm_id;
uint32 data_shm_offset;
};
@@ -1124,12 +1124,12 @@ struct CompressedTexImage2DImmediate {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
+ int32 level;
uint32 internalformat;
- uint32 width;
- uint32 height;
- uint32 border;
- uint32 imageSize;
+ int32 width;
+ int32 height;
+ int32 border;
+ int32 imageSize;
};
COMPILE_ASSERT(sizeof(CompressedTexImage2DImmediate) == 32,
@@ -1194,13 +1194,13 @@ struct CompressedTexSubImage2D {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 xoffset;
- uint32 yoffset;
- uint32 width;
- uint32 height;
+ int32 level;
+ int32 xoffset;
+ int32 yoffset;
+ int32 width;
+ int32 height;
uint32 format;
- uint32 imageSize;
+ int32 imageSize;
uint32 data_shm_id;
uint32 data_shm_offset;
};
@@ -1273,13 +1273,13 @@ struct CompressedTexSubImage2DImmediate {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 xoffset;
- uint32 yoffset;
- uint32 width;
- uint32 height;
+ int32 level;
+ int32 xoffset;
+ int32 yoffset;
+ int32 width;
+ int32 height;
uint32 format;
- uint32 imageSize;
+ int32 imageSize;
};
COMPILE_ASSERT(sizeof(CompressedTexSubImage2DImmediate) == 36,
@@ -1342,13 +1342,13 @@ struct CopyTexImage2D {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
+ int32 level;
uint32 internalformat;
- uint32 x;
- uint32 y;
- uint32 width;
- uint32 height;
- uint32 border;
+ int32 x;
+ int32 y;
+ int32 width;
+ int32 height;
+ int32 border;
};
COMPILE_ASSERT(sizeof(CopyTexImage2D) == 36,
@@ -1410,13 +1410,13 @@ struct CopyTexSubImage2D {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 xoffset;
- uint32 yoffset;
- uint32 x;
- uint32 y;
- uint32 width;
- uint32 height;
+ int32 level;
+ int32 xoffset;
+ int32 yoffset;
+ int32 x;
+ int32 y;
+ int32 width;
+ int32 height;
};
COMPILE_ASSERT(sizeof(CopyTexSubImage2D) == 36,
@@ -1575,7 +1575,7 @@ struct DeleteBuffers {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 buffers_shm_id;
uint32 buffers_shm_offset;
};
@@ -1623,7 +1623,7 @@ struct DeleteBuffersImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(DeleteBuffersImmediate) == 8,
@@ -1664,7 +1664,7 @@ struct DeleteFramebuffers {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 framebuffers_shm_id;
uint32 framebuffers_shm_offset;
};
@@ -1712,7 +1712,7 @@ struct DeleteFramebuffersImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(DeleteFramebuffersImmediate) == 8,
@@ -1787,7 +1787,7 @@ struct DeleteRenderbuffers {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 renderbuffers_shm_id;
uint32 renderbuffers_shm_offset;
};
@@ -1835,7 +1835,7 @@ struct DeleteRenderbuffersImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(DeleteRenderbuffersImmediate) == 8,
@@ -1908,7 +1908,7 @@ struct DeleteTextures {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 textures_shm_id;
uint32 textures_shm_offset;
};
@@ -1956,7 +1956,7 @@ struct DeleteTexturesImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(DeleteTexturesImmediate) == 8,
@@ -2205,8 +2205,8 @@ struct DrawArrays {
gpu::CommandHeader header;
uint32 mode;
- uint32 first;
- uint32 count;
+ int32 first;
+ int32 count;
};
COMPILE_ASSERT(sizeof(DrawArrays) == 16,
@@ -2250,7 +2250,7 @@ struct DrawElements {
gpu::CommandHeader header;
uint32 mode;
- uint32 count;
+ int32 count;
uint32 type;
uint32 index_offset;
};
@@ -2484,7 +2484,7 @@ struct FramebufferTexture2D {
uint32 attachment;
uint32 textarget;
uint32 texture;
- uint32 level;
+ int32 level;
};
COMPILE_ASSERT(sizeof(FramebufferTexture2D) == 24,
@@ -2565,7 +2565,7 @@ struct GenBuffers {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 buffers_shm_id;
uint32 buffers_shm_offset;
};
@@ -2613,7 +2613,7 @@ struct GenBuffersImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(GenBuffersImmediate) == 8,
@@ -2688,7 +2688,7 @@ struct GenFramebuffers {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 framebuffers_shm_id;
uint32 framebuffers_shm_offset;
};
@@ -2736,7 +2736,7 @@ struct GenFramebuffersImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(GenFramebuffersImmediate) == 8,
@@ -2777,7 +2777,7 @@ struct GenRenderbuffers {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 renderbuffers_shm_id;
uint32 renderbuffers_shm_offset;
};
@@ -2825,7 +2825,7 @@ struct GenRenderbuffersImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(GenRenderbuffersImmediate) == 8,
@@ -2864,7 +2864,7 @@ struct GenTextures {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
uint32 textures_shm_id;
uint32 textures_shm_offset;
};
@@ -2912,7 +2912,7 @@ struct GenTexturesImmediate {
}
gpu::CommandHeader header;
- uint32 n;
+ int32 n;
};
COMPILE_ASSERT(sizeof(GenTexturesImmediate) == 8,
@@ -2970,7 +2970,7 @@ struct GetActiveAttrib {
gpu::CommandHeader header;
uint32 program;
uint32 index;
- uint32 bufsize;
+ int32 bufsize;
uint32 length_shm_id;
uint32 length_shm_offset;
uint32 size_shm_id;
@@ -3056,7 +3056,7 @@ struct GetActiveUniform {
gpu::CommandHeader header;
uint32 program;
uint32 index;
- uint32 bufsize;
+ int32 bufsize;
uint32 length_shm_id;
uint32 length_shm_offset;
uint32 size_shm_id;
@@ -3133,7 +3133,7 @@ struct GetAttachedShaders {
gpu::CommandHeader header;
uint32 program;
- uint32 maxcount;
+ int32 maxcount;
uint32 count_shm_id;
uint32 count_shm_offset;
uint32 shaders_shm_id;
@@ -3529,7 +3529,7 @@ struct GetProgramInfoLog {
gpu::CommandHeader header;
uint32 program;
- uint32 bufsize;
+ int32 bufsize;
uint32 length_shm_id;
uint32 length_shm_offset;
uint32 infolog_shm_id;
@@ -3694,7 +3694,7 @@ struct GetShaderInfoLog {
gpu::CommandHeader header;
uint32 shader;
- uint32 bufsize;
+ int32 bufsize;
uint32 length_shm_id;
uint32 length_shm_offset;
uint32 infolog_shm_id;
@@ -3820,7 +3820,7 @@ struct GetShaderSource {
gpu::CommandHeader header;
uint32 shader;
- uint32 bufsize;
+ int32 bufsize;
uint32 length_shm_id;
uint32 length_shm_offset;
uint32 source_shm_id;
@@ -4013,7 +4013,7 @@ struct GetUniformfv {
gpu::CommandHeader header;
uint32 program;
- uint32 location;
+ int32 location;
uint32 params_shm_id;
uint32 params_shm_offset;
};
@@ -4064,7 +4064,7 @@ struct GetUniformiv {
gpu::CommandHeader header;
uint32 program;
- uint32 location;
+ int32 location;
uint32 params_shm_id;
uint32 params_shm_offset;
};
@@ -4686,7 +4686,7 @@ struct PixelStorei {
gpu::CommandHeader header;
uint32 pname;
- uint32 param;
+ int32 param;
};
COMPILE_ASSERT(sizeof(PixelStorei) == 12,
@@ -4775,10 +4775,10 @@ struct ReadPixels {
}
gpu::CommandHeader header;
- uint32 x;
- uint32 y;
- uint32 width;
- uint32 height;
+ int32 x;
+ int32 y;
+ int32 width;
+ int32 height;
uint32 format;
uint32 type;
uint32 pixels_shm_id;
@@ -4840,8 +4840,8 @@ struct RenderbufferStorage {
gpu::CommandHeader header;
uint32 target;
uint32 internalformat;
- uint32 width;
- uint32 height;
+ int32 width;
+ int32 height;
};
COMPILE_ASSERT(sizeof(RenderbufferStorage) == 20,
@@ -4922,10 +4922,10 @@ struct Scissor {
}
gpu::CommandHeader header;
- uint32 x;
- uint32 y;
- uint32 width;
- uint32 height;
+ int32 x;
+ int32 y;
+ int32 width;
+ int32 height;
};
COMPILE_ASSERT(sizeof(Scissor) == 20,
@@ -4976,7 +4976,7 @@ struct ShaderSource {
gpu::CommandHeader header;
uint32 shader;
- uint32 count;
+ int32 count;
uint32 data_shm_id;
uint32 data_shm_offset;
uint32 data_size;
@@ -5028,7 +5028,7 @@ struct ShaderSourceImmediate {
gpu::CommandHeader header;
uint32 shader;
- uint32 count;
+ int32 count;
uint32 data_size;
};
@@ -5070,7 +5070,7 @@ struct StencilFunc {
gpu::CommandHeader header;
uint32 func;
- uint32 ref;
+ int32 ref;
uint32 mask;
};
@@ -5114,7 +5114,7 @@ struct StencilFuncSeparate {
gpu::CommandHeader header;
uint32 face;
uint32 func;
- uint32 ref;
+ int32 ref;
uint32 mask;
};
@@ -5335,11 +5335,11 @@ struct TexImage2D {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 internalformat;
- uint32 width;
- uint32 height;
- uint32 border;
+ int32 level;
+ int32 internalformat;
+ int32 width;
+ int32 height;
+ int32 border;
uint32 format;
uint32 type;
uint32 pixels_shm_id;
@@ -5415,11 +5415,11 @@ struct TexImage2DImmediate {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 internalformat;
- uint32 width;
- uint32 height;
- uint32 border;
+ int32 level;
+ int32 internalformat;
+ int32 width;
+ int32 height;
+ int32 border;
uint32 format;
uint32 type;
};
@@ -5613,7 +5613,7 @@ struct TexParameteri {
gpu::CommandHeader header;
uint32 target;
uint32 pname;
- uint32 param;
+ int32 param;
};
COMPILE_ASSERT(sizeof(TexParameteri) == 16,
@@ -5768,11 +5768,11 @@ struct TexSubImage2D {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 xoffset;
- uint32 yoffset;
- uint32 width;
- uint32 height;
+ int32 level;
+ int32 xoffset;
+ int32 yoffset;
+ int32 width;
+ int32 height;
uint32 format;
uint32 type;
uint32 pixels_shm_id;
@@ -5847,11 +5847,11 @@ struct TexSubImage2DImmediate {
gpu::CommandHeader header;
uint32 target;
- uint32 level;
- uint32 xoffset;
- uint32 yoffset;
- uint32 width;
- uint32 height;
+ int32 level;
+ int32 xoffset;
+ int32 yoffset;
+ int32 width;
+ int32 height;
uint32 format;
uint32 type;
};
@@ -5902,7 +5902,7 @@ struct Uniform1f {
}
gpu::CommandHeader header;
- uint32 location;
+ int32 location;
float x;
};
@@ -5947,8 +5947,8 @@ struct Uniform1fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6000,8 +6000,8 @@ struct Uniform1fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform1fvImmediate) == 12,
@@ -6038,8 +6038,8 @@ struct Uniform1i {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 x;
+ int32 location;
+ int32 x;
};
COMPILE_ASSERT(sizeof(Uniform1i) == 12,
@@ -6083,8 +6083,8 @@ struct Uniform1iv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6136,8 +6136,8 @@ struct Uniform1ivImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform1ivImmediate) == 12,
@@ -6175,7 +6175,7 @@ struct Uniform2f {
}
gpu::CommandHeader header;
- uint32 location;
+ int32 location;
float x;
float y;
};
@@ -6223,8 +6223,8 @@ struct Uniform2fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6276,8 +6276,8 @@ struct Uniform2fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform2fvImmediate) == 12,
@@ -6315,9 +6315,9 @@ struct Uniform2i {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 x;
- uint32 y;
+ int32 location;
+ int32 x;
+ int32 y;
};
COMPILE_ASSERT(sizeof(Uniform2i) == 16,
@@ -6363,8 +6363,8 @@ struct Uniform2iv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6416,8 +6416,8 @@ struct Uniform2ivImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform2ivImmediate) == 12,
@@ -6456,7 +6456,7 @@ struct Uniform3f {
}
gpu::CommandHeader header;
- uint32 location;
+ int32 location;
float x;
float y;
float z;
@@ -6507,8 +6507,8 @@ struct Uniform3fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6560,8 +6560,8 @@ struct Uniform3fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform3fvImmediate) == 12,
@@ -6600,10 +6600,10 @@ struct Uniform3i {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 x;
- uint32 y;
- uint32 z;
+ int32 location;
+ int32 x;
+ int32 y;
+ int32 z;
};
COMPILE_ASSERT(sizeof(Uniform3i) == 20,
@@ -6651,8 +6651,8 @@ struct Uniform3iv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6704,8 +6704,8 @@ struct Uniform3ivImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform3ivImmediate) == 12,
@@ -6747,7 +6747,7 @@ struct Uniform4f {
}
gpu::CommandHeader header;
- uint32 location;
+ int32 location;
float x;
float y;
float z;
@@ -6801,8 +6801,8 @@ struct Uniform4fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -6854,8 +6854,8 @@ struct Uniform4fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform4fvImmediate) == 12,
@@ -6896,11 +6896,11 @@ struct Uniform4i {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 x;
- uint32 y;
- uint32 z;
- uint32 w;
+ int32 location;
+ int32 x;
+ int32 y;
+ int32 z;
+ int32 w;
};
COMPILE_ASSERT(sizeof(Uniform4i) == 24,
@@ -6950,8 +6950,8 @@ struct Uniform4iv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 v_shm_id;
uint32 v_shm_offset;
};
@@ -7003,8 +7003,8 @@ struct Uniform4ivImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
};
COMPILE_ASSERT(sizeof(Uniform4ivImmediate) == 12,
@@ -7050,8 +7050,8 @@ struct UniformMatrix2fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 transpose;
uint32 value_shm_id;
uint32 value_shm_offset;
@@ -7111,8 +7111,8 @@ struct UniformMatrix2fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 transpose;
};
@@ -7161,8 +7161,8 @@ struct UniformMatrix3fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 transpose;
uint32 value_shm_id;
uint32 value_shm_offset;
@@ -7222,8 +7222,8 @@ struct UniformMatrix3fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 transpose;
};
@@ -7272,8 +7272,8 @@ struct UniformMatrix4fv {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 transpose;
uint32 value_shm_id;
uint32 value_shm_offset;
@@ -7333,8 +7333,8 @@ struct UniformMatrix4fvImmediate {
}
gpu::CommandHeader header;
- uint32 location;
- uint32 count;
+ int32 location;
+ int32 count;
uint32 transpose;
};
@@ -7982,10 +7982,10 @@ struct VertexAttribPointer {
gpu::CommandHeader header;
uint32 indx;
- uint32 size;
+ int32 size;
uint32 type;
uint32 normalized;
- uint32 stride;
+ int32 stride;
uint32 offset;
};
@@ -8033,10 +8033,10 @@ struct Viewport {
}
gpu::CommandHeader header;
- uint32 x;
- uint32 y;
- uint32 width;
- uint32 height;
+ int32 x;
+ int32 y;
+ int32 width;
+ int32 height;
};
COMPILE_ASSERT(sizeof(Viewport) == 20,
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
index ed5455f..e00e834 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -4,29 +4,35 @@
// It is included by gles2_cmd_format_test.cc
TEST(GLES2FormatTest, ActiveTexture) {
- ActiveTexture cmd = { 0, };
+ ActiveTexture cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(ActiveTexture::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ActiveTexture::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.texture);
}
TEST(GLES2FormatTest, AttachShader) {
- AttachShader cmd = { 0, };
+ AttachShader cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(AttachShader::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(AttachShader::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
}
TEST(GLES2FormatTest, BindAttribLocation) {
- BindAttribLocation cmd = { 0, };
+ BindAttribLocation cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -34,8 +40,11 @@ TEST(GLES2FormatTest, BindAttribLocation) {
static_cast<uint32>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(BindAttribLocation::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BindAttribLocation::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32>(13), cmd.name_shm_id);
@@ -53,73 +62,92 @@ TEST(GLES2FormatTest, BindAttribLocationImmediate) {
static_cast<GLuint>(11),
static_cast<GLuint>(12),
test_str);
- EXPECT_EQ(BindAttribLocationImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(BindAttribLocationImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) + // NOLINT
RoundSizeToMultipleOfEntries(strlen(test_str)),
- cmd.header.size * 4);
+ cmd.header.size * 4u);
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ strlen(test_str) + 1);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
// TODO(gman): check that string got copied.
}
TEST(GLES2FormatTest, BindBuffer) {
- BindBuffer cmd = { 0, };
+ BindBuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(BindBuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BindBuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.buffer);
}
TEST(GLES2FormatTest, BindFramebuffer) {
- BindFramebuffer cmd = { 0, };
+ BindFramebuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(BindFramebuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BindFramebuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.framebuffer);
}
TEST(GLES2FormatTest, BindRenderbuffer) {
- BindRenderbuffer cmd = { 0, };
+ BindRenderbuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(BindRenderbuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BindRenderbuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.renderbuffer);
}
TEST(GLES2FormatTest, BindTexture) {
- BindTexture cmd = { 0, };
+ BindTexture cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(BindTexture::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BindTexture::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.texture);
}
TEST(GLES2FormatTest, BlendColor) {
- BlendColor cmd = { 0, };
+ BlendColor cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLclampf>(11),
static_cast<GLclampf>(12),
static_cast<GLclampf>(13),
static_cast<GLclampf>(14));
- EXPECT_EQ(BlendColor::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BlendColor::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
@@ -127,49 +155,61 @@ TEST(GLES2FormatTest, BlendColor) {
}
TEST(GLES2FormatTest, BlendEquation) {
- BlendEquation cmd = { 0, };
+ BlendEquation cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(BlendEquation::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BlendEquation::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
}
TEST(GLES2FormatTest, BlendEquationSeparate) {
- BlendEquationSeparate cmd = { 0, };
+ BlendEquationSeparate cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12));
- EXPECT_EQ(BlendEquationSeparate::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BlendEquationSeparate::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.modeRGB);
EXPECT_EQ(static_cast<GLenum>(12), cmd.modeAlpha);
}
TEST(GLES2FormatTest, BlendFunc) {
- BlendFunc cmd = { 0, };
+ BlendFunc cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12));
- EXPECT_EQ(BlendFunc::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BlendFunc::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.sfactor);
EXPECT_EQ(static_cast<GLenum>(12), cmd.dfactor);
}
TEST(GLES2FormatTest, BlendFuncSeparate) {
- BlendFuncSeparate cmd = { 0, };
+ BlendFuncSeparate cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLenum>(13),
static_cast<GLenum>(14));
- EXPECT_EQ(BlendFuncSeparate::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BlendFuncSeparate::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.srcRGB);
EXPECT_EQ(static_cast<GLenum>(12), cmd.dstRGB);
EXPECT_EQ(static_cast<GLenum>(13), cmd.srcAlpha);
@@ -177,7 +217,7 @@ TEST(GLES2FormatTest, BlendFuncSeparate) {
}
TEST(GLES2FormatTest, BufferData) {
- BufferData cmd = { 0, };
+ BufferData cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -185,8 +225,11 @@ TEST(GLES2FormatTest, BufferData) {
static_cast<uint32>(13),
static_cast<uint32>(14),
static_cast<GLenum>(15));
- EXPECT_EQ(BufferData::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BufferData::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLsizeiptr>(12), cmd.size);
EXPECT_EQ(static_cast<uint32>(13), cmd.data_shm_id);
@@ -196,7 +239,7 @@ TEST(GLES2FormatTest, BufferData) {
// TODO(gman): Implement test for BufferDataImmediate
TEST(GLES2FormatTest, BufferSubData) {
- BufferSubData cmd = { 0, };
+ BufferSubData cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -204,8 +247,11 @@ TEST(GLES2FormatTest, BufferSubData) {
static_cast<GLsizeiptr>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(BufferSubData::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(BufferSubData::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLintptr>(12), cmd.offset);
EXPECT_EQ(static_cast<GLsizeiptr>(13), cmd.size);
@@ -215,35 +261,44 @@ TEST(GLES2FormatTest, BufferSubData) {
// TODO(gman): Implement test for BufferSubDataImmediate
TEST(GLES2FormatTest, CheckFramebufferStatus) {
- CheckFramebufferStatus cmd = { 0, };
+ CheckFramebufferStatus cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(CheckFramebufferStatus::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CheckFramebufferStatus::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
}
TEST(GLES2FormatTest, Clear) {
- Clear cmd = { 0, };
+ Clear cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLbitfield>(11));
- EXPECT_EQ(Clear::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Clear::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLbitfield>(11), cmd.mask);
}
TEST(GLES2FormatTest, ClearColor) {
- ClearColor cmd = { 0, };
+ ClearColor cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLclampf>(11),
static_cast<GLclampf>(12),
static_cast<GLclampf>(13),
static_cast<GLclampf>(14));
- EXPECT_EQ(ClearColor::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ClearColor::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
@@ -251,35 +306,44 @@ TEST(GLES2FormatTest, ClearColor) {
}
TEST(GLES2FormatTest, ClearDepthf) {
- ClearDepthf cmd = { 0, };
+ ClearDepthf cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLclampf>(11));
- EXPECT_EQ(ClearDepthf::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ClearDepthf::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLclampf>(11), cmd.depth);
}
TEST(GLES2FormatTest, ClearStencil) {
- ClearStencil cmd = { 0, };
+ ClearStencil cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11));
- EXPECT_EQ(ClearStencil::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ClearStencil::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.s);
}
TEST(GLES2FormatTest, ColorMask) {
- ColorMask cmd = { 0, };
+ ColorMask cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLboolean>(11),
static_cast<GLboolean>(12),
static_cast<GLboolean>(13),
static_cast<GLboolean>(14));
- EXPECT_EQ(ColorMask::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ColorMask::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLboolean>(11), cmd.red);
EXPECT_EQ(static_cast<GLboolean>(12), cmd.green);
EXPECT_EQ(static_cast<GLboolean>(13), cmd.blue);
@@ -287,17 +351,20 @@ TEST(GLES2FormatTest, ColorMask) {
}
TEST(GLES2FormatTest, CompileShader) {
- CompileShader cmd = { 0, };
+ CompileShader cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(CompileShader::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CompileShader::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
}
TEST(GLES2FormatTest, CompressedTexImage2D) {
- CompressedTexImage2D cmd = { 0, };
+ CompressedTexImage2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -309,8 +376,11 @@ TEST(GLES2FormatTest, CompressedTexImage2D) {
static_cast<GLsizei>(17),
static_cast<uint32>(18),
static_cast<uint32>(19));
- EXPECT_EQ(CompressedTexImage2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CompressedTexImage2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
@@ -324,7 +394,7 @@ TEST(GLES2FormatTest, CompressedTexImage2D) {
// TODO(gman): Implement test for CompressedTexImage2DImmediate
TEST(GLES2FormatTest, CompressedTexSubImage2D) {
- CompressedTexSubImage2D cmd = { 0, };
+ CompressedTexSubImage2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -337,8 +407,11 @@ TEST(GLES2FormatTest, CompressedTexSubImage2D) {
static_cast<GLsizei>(18),
static_cast<uint32>(19),
static_cast<uint32>(20));
- EXPECT_EQ(CompressedTexSubImage2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CompressedTexSubImage2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
@@ -353,7 +426,7 @@ TEST(GLES2FormatTest, CompressedTexSubImage2D) {
// TODO(gman): Implement test for CompressedTexSubImage2DImmediate
TEST(GLES2FormatTest, CopyTexImage2D) {
- CopyTexImage2D cmd = { 0, };
+ CopyTexImage2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -364,8 +437,11 @@ TEST(GLES2FormatTest, CopyTexImage2D) {
static_cast<GLsizei>(16),
static_cast<GLsizei>(17),
static_cast<GLint>(18));
- EXPECT_EQ(CopyTexImage2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CopyTexImage2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
@@ -377,7 +453,7 @@ TEST(GLES2FormatTest, CopyTexImage2D) {
}
TEST(GLES2FormatTest, CopyTexSubImage2D) {
- CopyTexSubImage2D cmd = { 0, };
+ CopyTexSubImage2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -388,8 +464,11 @@ TEST(GLES2FormatTest, CopyTexSubImage2D) {
static_cast<GLint>(16),
static_cast<GLsizei>(17),
static_cast<GLsizei>(18));
- EXPECT_EQ(CopyTexSubImage2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CopyTexSubImage2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
@@ -401,46 +480,58 @@ TEST(GLES2FormatTest, CopyTexSubImage2D) {
}
TEST(GLES2FormatTest, CreateProgram) {
- CreateProgram cmd = { 0, };
+ CreateProgram cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<uint32>(11));
- EXPECT_EQ(CreateProgram::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CreateProgram::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<uint32>(11), cmd.client_id);
}
TEST(GLES2FormatTest, CreateShader) {
- CreateShader cmd = { 0, };
+ CreateShader cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<uint32>(12));
- EXPECT_EQ(CreateShader::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CreateShader::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.type);
EXPECT_EQ(static_cast<uint32>(12), cmd.client_id);
}
TEST(GLES2FormatTest, CullFace) {
- CullFace cmd = { 0, };
+ CullFace cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(CullFace::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(CullFace::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
}
TEST(GLES2FormatTest, DeleteBuffers) {
- DeleteBuffers cmd = { 0, };
+ DeleteBuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(DeleteBuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DeleteBuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.buffers_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.buffers_shm_offset);
@@ -455,23 +546,30 @@ TEST(GLES2FormatTest, DeleteBuffersImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(DeleteBuffersImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(DeleteBuffersImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, DeleteFramebuffers) {
- DeleteFramebuffers cmd = { 0, };
+ DeleteFramebuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(DeleteFramebuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DeleteFramebuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.framebuffers_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.framebuffers_shm_offset);
@@ -486,33 +584,43 @@ TEST(GLES2FormatTest, DeleteFramebuffersImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(DeleteFramebuffersImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(DeleteFramebuffersImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, DeleteProgram) {
- DeleteProgram cmd = { 0, };
+ DeleteProgram cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(DeleteProgram::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DeleteProgram::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
}
TEST(GLES2FormatTest, DeleteRenderbuffers) {
- DeleteRenderbuffers cmd = { 0, };
+ DeleteRenderbuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(DeleteRenderbuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DeleteRenderbuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.renderbuffers_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.renderbuffers_shm_offset);
@@ -527,33 +635,43 @@ TEST(GLES2FormatTest, DeleteRenderbuffersImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(DeleteRenderbuffersImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(DeleteRenderbuffersImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, DeleteShader) {
- DeleteShader cmd = { 0, };
+ DeleteShader cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(DeleteShader::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DeleteShader::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
}
TEST(GLES2FormatTest, DeleteTextures) {
- DeleteTextures cmd = { 0, };
+ DeleteTextures cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(DeleteTextures::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DeleteTextures::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.textures_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.textures_shm_offset);
@@ -568,102 +686,130 @@ TEST(GLES2FormatTest, DeleteTexturesImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(DeleteTexturesImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(DeleteTexturesImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, DepthFunc) {
- DepthFunc cmd = { 0, };
+ DepthFunc cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(DepthFunc::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DepthFunc::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
}
TEST(GLES2FormatTest, DepthMask) {
- DepthMask cmd = { 0, };
+ DepthMask cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLboolean>(11));
- EXPECT_EQ(DepthMask::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DepthMask::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLboolean>(11), cmd.flag);
}
TEST(GLES2FormatTest, DepthRangef) {
- DepthRangef cmd = { 0, };
+ DepthRangef cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLclampf>(11),
static_cast<GLclampf>(12));
- EXPECT_EQ(DepthRangef::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DepthRangef::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLclampf>(11), cmd.zNear);
EXPECT_EQ(static_cast<GLclampf>(12), cmd.zFar);
}
TEST(GLES2FormatTest, DetachShader) {
- DetachShader cmd = { 0, };
+ DetachShader cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(DetachShader::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DetachShader::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
}
TEST(GLES2FormatTest, Disable) {
- Disable cmd = { 0, };
+ Disable cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(Disable::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Disable::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
}
TEST(GLES2FormatTest, DisableVertexAttribArray) {
- DisableVertexAttribArray cmd = { 0, };
+ DisableVertexAttribArray cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(DisableVertexAttribArray::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DisableVertexAttribArray::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
}
TEST(GLES2FormatTest, DrawArrays) {
- DrawArrays cmd = { 0, };
+ DrawArrays cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLint>(12),
static_cast<GLsizei>(13));
- EXPECT_EQ(DrawArrays::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DrawArrays::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
EXPECT_EQ(static_cast<GLint>(12), cmd.first);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.count);
}
TEST(GLES2FormatTest, DrawElements) {
- DrawElements cmd = { 0, };
+ DrawElements cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLsizei>(12),
static_cast<GLenum>(13),
static_cast<GLuint>(14));
- EXPECT_EQ(DrawElements::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(DrawElements::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
@@ -671,51 +817,66 @@ TEST(GLES2FormatTest, DrawElements) {
}
TEST(GLES2FormatTest, Enable) {
- Enable cmd = { 0, };
+ Enable cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(Enable::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Enable::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
}
TEST(GLES2FormatTest, EnableVertexAttribArray) {
- EnableVertexAttribArray cmd = { 0, };
+ EnableVertexAttribArray cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(EnableVertexAttribArray::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(EnableVertexAttribArray::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
}
TEST(GLES2FormatTest, Finish) {
- Finish cmd = { 0, };
+ Finish cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd);
- EXPECT_EQ(Finish::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Finish::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
}
TEST(GLES2FormatTest, Flush) {
- Flush cmd = { 0, };
+ Flush cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd);
- EXPECT_EQ(Flush::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Flush::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
}
TEST(GLES2FormatTest, FramebufferRenderbuffer) {
- FramebufferRenderbuffer cmd = { 0, };
+ FramebufferRenderbuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLenum>(13),
static_cast<GLuint>(14));
- EXPECT_EQ(FramebufferRenderbuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(FramebufferRenderbuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLenum>(13), cmd.renderbuffertarget);
@@ -723,7 +884,7 @@ TEST(GLES2FormatTest, FramebufferRenderbuffer) {
}
TEST(GLES2FormatTest, FramebufferTexture2D) {
- FramebufferTexture2D cmd = { 0, };
+ FramebufferTexture2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -731,8 +892,11 @@ TEST(GLES2FormatTest, FramebufferTexture2D) {
static_cast<GLenum>(13),
static_cast<GLuint>(14),
static_cast<GLint>(15));
- EXPECT_EQ(FramebufferTexture2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(FramebufferTexture2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLenum>(13), cmd.textarget);
@@ -741,24 +905,30 @@ TEST(GLES2FormatTest, FramebufferTexture2D) {
}
TEST(GLES2FormatTest, FrontFace) {
- FrontFace cmd = { 0, };
+ FrontFace cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(FrontFace::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(FrontFace::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
}
TEST(GLES2FormatTest, GenBuffers) {
- GenBuffers cmd = { 0, };
+ GenBuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GenBuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GenBuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.buffers_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.buffers_shm_offset);
@@ -773,33 +943,43 @@ TEST(GLES2FormatTest, GenBuffersImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(GenBuffersImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(GenBuffersImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, GenerateMipmap) {
- GenerateMipmap cmd = { 0, };
+ GenerateMipmap cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(GenerateMipmap::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GenerateMipmap::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
}
TEST(GLES2FormatTest, GenFramebuffers) {
- GenFramebuffers cmd = { 0, };
+ GenFramebuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GenFramebuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GenFramebuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.framebuffers_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.framebuffers_shm_offset);
@@ -814,23 +994,30 @@ TEST(GLES2FormatTest, GenFramebuffersImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(GenFramebuffersImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(GenFramebuffersImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, GenRenderbuffers) {
- GenRenderbuffers cmd = { 0, };
+ GenRenderbuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GenRenderbuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GenRenderbuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.renderbuffers_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.renderbuffers_shm_offset);
@@ -845,23 +1032,30 @@ TEST(GLES2FormatTest, GenRenderbuffersImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(GenRenderbuffersImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(GenRenderbuffersImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, GenTextures) {
- GenTextures cmd = { 0, };
+ GenTextures cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLsizei>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GenTextures::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GenTextures::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32>(12), cmd.textures_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.textures_shm_offset);
@@ -876,16 +1070,20 @@ TEST(GLES2FormatTest, GenTexturesImmediate) {
&cmd,
static_cast<GLsizei>(11),
ids);
- EXPECT_EQ(GenTexturesImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(GenTexturesImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
- RoundSizeToMultipleOfEntries(cmd.n * 4),
- cmd.header.size * 4); // NOLINT
+ RoundSizeToMultipleOfEntries(cmd.n * 4u),
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(cmd.n * 4u));
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
// TODO(gman): Check that ids were inserted;
}
TEST(GLES2FormatTest, GetActiveAttrib) {
- GetActiveAttrib cmd = { 0, };
+ GetActiveAttrib cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -899,8 +1097,11 @@ TEST(GLES2FormatTest, GetActiveAttrib) {
static_cast<uint32>(19),
static_cast<uint32>(20),
static_cast<uint32>(21));
- EXPECT_EQ(GetActiveAttrib::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetActiveAttrib::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.bufsize);
@@ -915,7 +1116,7 @@ TEST(GLES2FormatTest, GetActiveAttrib) {
}
TEST(GLES2FormatTest, GetActiveUniform) {
- GetActiveUniform cmd = { 0, };
+ GetActiveUniform cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -929,8 +1130,11 @@ TEST(GLES2FormatTest, GetActiveUniform) {
static_cast<uint32>(19),
static_cast<uint32>(20),
static_cast<uint32>(21));
- EXPECT_EQ(GetActiveUniform::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetActiveUniform::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.bufsize);
@@ -945,7 +1149,7 @@ TEST(GLES2FormatTest, GetActiveUniform) {
}
TEST(GLES2FormatTest, GetAttachedShaders) {
- GetAttachedShaders cmd = { 0, };
+ GetAttachedShaders cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -954,8 +1158,11 @@ TEST(GLES2FormatTest, GetAttachedShaders) {
static_cast<uint32>(14),
static_cast<uint32>(15),
static_cast<uint32>(16));
- EXPECT_EQ(GetAttachedShaders::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetAttachedShaders::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.maxcount);
EXPECT_EQ(static_cast<uint32>(13), cmd.count_shm_id);
@@ -967,29 +1174,35 @@ TEST(GLES2FormatTest, GetAttachedShaders) {
// TODO(gman): Write test for GetAttribLocation
// TODO(gman): Write test for GetAttribLocationImmediate
TEST(GLES2FormatTest, GetBooleanv) {
- GetBooleanv cmd = { 0, };
+ GetBooleanv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GetBooleanv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetBooleanv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_offset);
}
TEST(GLES2FormatTest, GetBufferParameteriv) {
- GetBufferParameteriv cmd = { 0, };
+ GetBufferParameteriv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetBufferParameteriv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetBufferParameteriv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -997,33 +1210,39 @@ TEST(GLES2FormatTest, GetBufferParameteriv) {
}
TEST(GLES2FormatTest, GetError) {
- GetError cmd = { 0, };
+ GetError cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<uint32>(11),
static_cast<uint32>(12));
- EXPECT_EQ(GetError::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetError::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<uint32>(11), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, GetFloatv) {
- GetFloatv cmd = { 0, };
+ GetFloatv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GetFloatv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetFloatv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_offset);
}
TEST(GLES2FormatTest, GetFramebufferAttachmentParameteriv) {
- GetFramebufferAttachmentParameteriv cmd = { 0, };
+ GetFramebufferAttachmentParameteriv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -1031,8 +1250,11 @@ TEST(GLES2FormatTest, GetFramebufferAttachmentParameteriv) {
static_cast<GLenum>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(GetFramebufferAttachmentParameteriv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetFramebufferAttachmentParameteriv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
@@ -1041,29 +1263,35 @@ TEST(GLES2FormatTest, GetFramebufferAttachmentParameteriv) {
}
TEST(GLES2FormatTest, GetIntegerv) {
- GetIntegerv cmd = { 0, };
+ GetIntegerv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(GetIntegerv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetIntegerv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_offset);
}
TEST(GLES2FormatTest, GetProgramiv) {
- GetProgramiv cmd = { 0, };
+ GetProgramiv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetProgramiv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetProgramiv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1071,7 +1299,7 @@ TEST(GLES2FormatTest, GetProgramiv) {
}
TEST(GLES2FormatTest, GetProgramInfoLog) {
- GetProgramInfoLog cmd = { 0, };
+ GetProgramInfoLog cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -1080,8 +1308,11 @@ TEST(GLES2FormatTest, GetProgramInfoLog) {
static_cast<uint32>(14),
static_cast<uint32>(15),
static_cast<uint32>(16));
- EXPECT_EQ(GetProgramInfoLog::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetProgramInfoLog::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.bufsize);
EXPECT_EQ(static_cast<uint32>(13), cmd.length_shm_id);
@@ -1091,15 +1322,18 @@ TEST(GLES2FormatTest, GetProgramInfoLog) {
}
TEST(GLES2FormatTest, GetRenderbufferParameteriv) {
- GetRenderbufferParameteriv cmd = { 0, };
+ GetRenderbufferParameteriv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetRenderbufferParameteriv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetRenderbufferParameteriv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1107,15 +1341,18 @@ TEST(GLES2FormatTest, GetRenderbufferParameteriv) {
}
TEST(GLES2FormatTest, GetShaderiv) {
- GetShaderiv cmd = { 0, };
+ GetShaderiv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetShaderiv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetShaderiv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1123,7 +1360,7 @@ TEST(GLES2FormatTest, GetShaderiv) {
}
TEST(GLES2FormatTest, GetShaderInfoLog) {
- GetShaderInfoLog cmd = { 0, };
+ GetShaderInfoLog cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -1132,8 +1369,11 @@ TEST(GLES2FormatTest, GetShaderInfoLog) {
static_cast<uint32>(14),
static_cast<uint32>(15),
static_cast<uint32>(16));
- EXPECT_EQ(GetShaderInfoLog::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetShaderInfoLog::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.bufsize);
EXPECT_EQ(static_cast<uint32>(13), cmd.length_shm_id);
@@ -1143,7 +1383,7 @@ TEST(GLES2FormatTest, GetShaderInfoLog) {
}
TEST(GLES2FormatTest, GetShaderPrecisionFormat) {
- GetShaderPrecisionFormat cmd = { 0, };
+ GetShaderPrecisionFormat cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -1152,8 +1392,11 @@ TEST(GLES2FormatTest, GetShaderPrecisionFormat) {
static_cast<uint32>(14),
static_cast<uint32>(15),
static_cast<uint32>(16));
- EXPECT_EQ(GetShaderPrecisionFormat::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetShaderPrecisionFormat::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.shadertype);
EXPECT_EQ(static_cast<GLenum>(12), cmd.precisiontype);
EXPECT_EQ(static_cast<uint32>(13), cmd.range_shm_id);
@@ -1163,7 +1406,7 @@ TEST(GLES2FormatTest, GetShaderPrecisionFormat) {
}
TEST(GLES2FormatTest, GetShaderSource) {
- GetShaderSource cmd = { 0, };
+ GetShaderSource cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -1172,8 +1415,11 @@ TEST(GLES2FormatTest, GetShaderSource) {
static_cast<uint32>(14),
static_cast<uint32>(15),
static_cast<uint32>(16));
- EXPECT_EQ(GetShaderSource::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetShaderSource::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.bufsize);
EXPECT_EQ(static_cast<uint32>(13), cmd.length_shm_id);
@@ -1183,25 +1429,31 @@ TEST(GLES2FormatTest, GetShaderSource) {
}
TEST(GLES2FormatTest, GetString) {
- GetString cmd = { 0, };
+ GetString cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11));
- EXPECT_EQ(GetString::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetString::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.name);
}
TEST(GLES2FormatTest, GetTexParameterfv) {
- GetTexParameterfv cmd = { 0, };
+ GetTexParameterfv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetTexParameterfv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetTexParameterfv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1209,15 +1461,18 @@ TEST(GLES2FormatTest, GetTexParameterfv) {
}
TEST(GLES2FormatTest, GetTexParameteriv) {
- GetTexParameteriv cmd = { 0, };
+ GetTexParameteriv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetTexParameteriv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetTexParameteriv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1225,15 +1480,18 @@ TEST(GLES2FormatTest, GetTexParameteriv) {
}
TEST(GLES2FormatTest, GetUniformfv) {
- GetUniformfv cmd = { 0, };
+ GetUniformfv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLint>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetUniformfv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetUniformfv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLint>(12), cmd.location);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1241,15 +1499,18 @@ TEST(GLES2FormatTest, GetUniformfv) {
}
TEST(GLES2FormatTest, GetUniformiv) {
- GetUniformiv cmd = { 0, };
+ GetUniformiv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLint>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetUniformiv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetUniformiv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLint>(12), cmd.location);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1259,15 +1520,18 @@ TEST(GLES2FormatTest, GetUniformiv) {
// TODO(gman): Write test for GetUniformLocation
// TODO(gman): Write test for GetUniformLocationImmediate
TEST(GLES2FormatTest, GetVertexAttribfv) {
- GetVertexAttribfv cmd = { 0, };
+ GetVertexAttribfv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetVertexAttribfv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetVertexAttribfv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1275,15 +1539,18 @@ TEST(GLES2FormatTest, GetVertexAttribfv) {
}
TEST(GLES2FormatTest, GetVertexAttribiv) {
- GetVertexAttribiv cmd = { 0, };
+ GetVertexAttribiv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetVertexAttribiv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetVertexAttribiv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1291,15 +1558,18 @@ TEST(GLES2FormatTest, GetVertexAttribiv) {
}
TEST(GLES2FormatTest, GetVertexAttribPointerv) {
- GetVertexAttribPointerv cmd = { 0, };
+ GetVertexAttribPointerv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(GetVertexAttribPointerv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(GetVertexAttribPointerv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.pointer_shm_id);
@@ -1307,161 +1577,197 @@ TEST(GLES2FormatTest, GetVertexAttribPointerv) {
}
TEST(GLES2FormatTest, Hint) {
- Hint cmd = { 0, };
+ Hint cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12));
- EXPECT_EQ(Hint::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Hint::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.mode);
}
TEST(GLES2FormatTest, IsBuffer) {
- IsBuffer cmd = { 0, };
+ IsBuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsBuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsBuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.buffer);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, IsEnabled) {
- IsEnabled cmd = { 0, };
+ IsEnabled cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsEnabled::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsEnabled::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, IsFramebuffer) {
- IsFramebuffer cmd = { 0, };
+ IsFramebuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsFramebuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsFramebuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.framebuffer);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, IsProgram) {
- IsProgram cmd = { 0, };
+ IsProgram cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsProgram::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsProgram::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, IsRenderbuffer) {
- IsRenderbuffer cmd = { 0, };
+ IsRenderbuffer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsRenderbuffer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsRenderbuffer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.renderbuffer);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, IsShader) {
- IsShader cmd = { 0, };
+ IsShader cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsShader::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsShader::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, IsTexture) {
- IsTexture cmd = { 0, };
+ IsTexture cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(IsTexture::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(IsTexture::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.texture);
EXPECT_EQ(static_cast<uint32>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.result_shm_offset);
}
TEST(GLES2FormatTest, LineWidth) {
- LineWidth cmd = { 0, };
+ LineWidth cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLfloat>(11));
- EXPECT_EQ(LineWidth::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(LineWidth::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLfloat>(11), cmd.width);
}
TEST(GLES2FormatTest, LinkProgram) {
- LinkProgram cmd = { 0, };
+ LinkProgram cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(LinkProgram::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(LinkProgram::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
}
TEST(GLES2FormatTest, PixelStorei) {
- PixelStorei cmd = { 0, };
+ PixelStorei cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLint>(12));
- EXPECT_EQ(PixelStorei::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(PixelStorei::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<GLint>(12), cmd.param);
}
TEST(GLES2FormatTest, PolygonOffset) {
- PolygonOffset cmd = { 0, };
+ PolygonOffset cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLfloat>(11),
static_cast<GLfloat>(12));
- EXPECT_EQ(PolygonOffset::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(PolygonOffset::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLfloat>(11), cmd.factor);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.units);
}
TEST(GLES2FormatTest, ReadPixels) {
- ReadPixels cmd = { 0, };
+ ReadPixels cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
@@ -1472,8 +1778,11 @@ TEST(GLES2FormatTest, ReadPixels) {
static_cast<GLenum>(16),
static_cast<uint32>(17),
static_cast<uint32>(18));
- EXPECT_EQ(ReadPixels::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ReadPixels::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.x);
EXPECT_EQ(static_cast<GLint>(12), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
@@ -1485,15 +1794,18 @@ TEST(GLES2FormatTest, ReadPixels) {
}
TEST(GLES2FormatTest, RenderbufferStorage) {
- RenderbufferStorage cmd = { 0, };
+ RenderbufferStorage cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLsizei>(13),
static_cast<GLsizei>(14));
- EXPECT_EQ(RenderbufferStorage::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(RenderbufferStorage::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.internalformat);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
@@ -1501,27 +1813,33 @@ TEST(GLES2FormatTest, RenderbufferStorage) {
}
TEST(GLES2FormatTest, SampleCoverage) {
- SampleCoverage cmd = { 0, };
+ SampleCoverage cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLclampf>(11),
static_cast<GLboolean>(12));
- EXPECT_EQ(SampleCoverage::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(SampleCoverage::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLclampf>(11), cmd.value);
EXPECT_EQ(static_cast<GLboolean>(12), cmd.invert);
}
TEST(GLES2FormatTest, Scissor) {
- Scissor cmd = { 0, };
+ Scissor cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLint>(12),
static_cast<GLsizei>(13),
static_cast<GLsizei>(14));
- EXPECT_EQ(Scissor::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Scissor::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.x);
EXPECT_EQ(static_cast<GLint>(12), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
@@ -1529,7 +1847,7 @@ TEST(GLES2FormatTest, Scissor) {
}
TEST(GLES2FormatTest, ShaderSource) {
- ShaderSource cmd = { 0, };
+ ShaderSource cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -1537,8 +1855,11 @@ TEST(GLES2FormatTest, ShaderSource) {
static_cast<uint32>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(ShaderSource::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ShaderSource::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.data_shm_id);
@@ -1548,29 +1869,35 @@ TEST(GLES2FormatTest, ShaderSource) {
// TODO(gman): Implement test for ShaderSourceImmediate
TEST(GLES2FormatTest, StencilFunc) {
- StencilFunc cmd = { 0, };
+ StencilFunc cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLint>(12),
static_cast<GLuint>(13));
- EXPECT_EQ(StencilFunc::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(StencilFunc::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
EXPECT_EQ(static_cast<GLint>(12), cmd.ref);
EXPECT_EQ(static_cast<GLuint>(13), cmd.mask);
}
TEST(GLES2FormatTest, StencilFuncSeparate) {
- StencilFuncSeparate cmd = { 0, };
+ StencilFuncSeparate cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLint>(13),
static_cast<GLuint>(14));
- EXPECT_EQ(StencilFuncSeparate::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(StencilFuncSeparate::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
EXPECT_EQ(static_cast<GLenum>(12), cmd.func);
EXPECT_EQ(static_cast<GLint>(13), cmd.ref);
@@ -1578,51 +1905,63 @@ TEST(GLES2FormatTest, StencilFuncSeparate) {
}
TEST(GLES2FormatTest, StencilMask) {
- StencilMask cmd = { 0, };
+ StencilMask cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(StencilMask::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(StencilMask::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.mask);
}
TEST(GLES2FormatTest, StencilMaskSeparate) {
- StencilMaskSeparate cmd = { 0, };
+ StencilMaskSeparate cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLuint>(12));
- EXPECT_EQ(StencilMaskSeparate::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(StencilMaskSeparate::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
EXPECT_EQ(static_cast<GLuint>(12), cmd.mask);
}
TEST(GLES2FormatTest, StencilOp) {
- StencilOp cmd = { 0, };
+ StencilOp cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLenum>(13));
- EXPECT_EQ(StencilOp::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(StencilOp::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.fail);
EXPECT_EQ(static_cast<GLenum>(12), cmd.zfail);
EXPECT_EQ(static_cast<GLenum>(13), cmd.zpass);
}
TEST(GLES2FormatTest, StencilOpSeparate) {
- StencilOpSeparate cmd = { 0, };
+ StencilOpSeparate cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLenum>(13),
static_cast<GLenum>(14));
- EXPECT_EQ(StencilOpSeparate::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(StencilOpSeparate::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
EXPECT_EQ(static_cast<GLenum>(12), cmd.fail);
EXPECT_EQ(static_cast<GLenum>(13), cmd.zfail);
@@ -1630,7 +1969,7 @@ TEST(GLES2FormatTest, StencilOpSeparate) {
}
TEST(GLES2FormatTest, TexImage2D) {
- TexImage2D cmd = { 0, };
+ TexImage2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -1643,8 +1982,11 @@ TEST(GLES2FormatTest, TexImage2D) {
static_cast<GLenum>(18),
static_cast<uint32>(19),
static_cast<uint32>(20));
- EXPECT_EQ(TexImage2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(TexImage2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.internalformat);
@@ -1659,29 +2001,35 @@ TEST(GLES2FormatTest, TexImage2D) {
// TODO(gman): Implement test for TexImage2DImmediate
TEST(GLES2FormatTest, TexParameterf) {
- TexParameterf cmd = { 0, };
+ TexParameterf cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLfloat>(13));
- EXPECT_EQ(TexParameterf::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(TexParameterf::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.param);
}
TEST(GLES2FormatTest, TexParameterfv) {
- TexParameterfv cmd = { 0, };
+ TexParameterfv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(TexParameterfv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(TexParameterfv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1701,39 +2049,49 @@ TEST(GLES2FormatTest, TexParameterfvImmediate) {
static_cast<GLenum>(11),
static_cast<GLenum>(12),
data);
- EXPECT_EQ(TexParameterfvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(TexParameterfvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, TexParameteri) {
- TexParameteri cmd = { 0, };
+ TexParameteri cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<GLint>(13));
- EXPECT_EQ(TexParameteri::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(TexParameteri::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<GLint>(13), cmd.param);
}
TEST(GLES2FormatTest, TexParameteriv) {
- TexParameteriv cmd = { 0, };
+ TexParameteriv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
static_cast<GLenum>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(TexParameteriv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(TexParameteriv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32>(13), cmd.params_shm_id);
@@ -1753,17 +2111,21 @@ TEST(GLES2FormatTest, TexParameterivImmediate) {
static_cast<GLenum>(11),
static_cast<GLenum>(12),
data);
- EXPECT_EQ(TexParameterivImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(TexParameterivImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, TexSubImage2D) {
- TexSubImage2D cmd = { 0, };
+ TexSubImage2D cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLenum>(11),
@@ -1776,8 +2138,11 @@ TEST(GLES2FormatTest, TexSubImage2D) {
static_cast<GLenum>(18),
static_cast<uint32>(19),
static_cast<uint32>(20));
- EXPECT_EQ(TexSubImage2D::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(TexSubImage2D::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
@@ -1792,27 +2157,33 @@ TEST(GLES2FormatTest, TexSubImage2D) {
// TODO(gman): Implement test for TexSubImage2DImmediate
TEST(GLES2FormatTest, Uniform1f) {
- Uniform1f cmd = { 0, };
+ Uniform1f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLfloat>(12));
- EXPECT_EQ(Uniform1f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform1f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
}
TEST(GLES2FormatTest, Uniform1fv) {
- Uniform1fv cmd = { 0, };
+ Uniform1fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform1fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform1fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -1833,37 +2204,47 @@ TEST(GLES2FormatTest, Uniform1fvImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform1fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform1fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform1i) {
- Uniform1i cmd = { 0, };
+ Uniform1i cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLint>(12));
- EXPECT_EQ(Uniform1i::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform1i::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLint>(12), cmd.x);
}
TEST(GLES2FormatTest, Uniform1iv) {
- Uniform1iv cmd = { 0, };
+ Uniform1iv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform1iv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform1iv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -1884,39 +2265,49 @@ TEST(GLES2FormatTest, Uniform1ivImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform1ivImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform1ivImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform2f) {
- Uniform2f cmd = { 0, };
+ Uniform2f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLfloat>(12),
static_cast<GLfloat>(13));
- EXPECT_EQ(Uniform2f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform2f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
}
TEST(GLES2FormatTest, Uniform2fv) {
- Uniform2fv cmd = { 0, };
+ Uniform2fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform2fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform2fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -1939,39 +2330,49 @@ TEST(GLES2FormatTest, Uniform2fvImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform2fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform2fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform2i) {
- Uniform2i cmd = { 0, };
+ Uniform2i cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLint>(12),
static_cast<GLint>(13));
- EXPECT_EQ(Uniform2i::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform2i::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLint>(12), cmd.x);
EXPECT_EQ(static_cast<GLint>(13), cmd.y);
}
TEST(GLES2FormatTest, Uniform2iv) {
- Uniform2iv cmd = { 0, };
+ Uniform2iv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform2iv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform2iv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -1994,25 +2395,32 @@ TEST(GLES2FormatTest, Uniform2ivImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform2ivImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform2ivImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform3f) {
- Uniform3f cmd = { 0, };
+ Uniform3f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLfloat>(12),
static_cast<GLfloat>(13),
static_cast<GLfloat>(14));
- EXPECT_EQ(Uniform3f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform3f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
@@ -2020,15 +2428,18 @@ TEST(GLES2FormatTest, Uniform3f) {
}
TEST(GLES2FormatTest, Uniform3fv) {
- Uniform3fv cmd = { 0, };
+ Uniform3fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform3fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform3fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -2053,25 +2464,32 @@ TEST(GLES2FormatTest, Uniform3fvImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform3fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform3fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform3i) {
- Uniform3i cmd = { 0, };
+ Uniform3i cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLint>(12),
static_cast<GLint>(13),
static_cast<GLint>(14));
- EXPECT_EQ(Uniform3i::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform3i::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLint>(12), cmd.x);
EXPECT_EQ(static_cast<GLint>(13), cmd.y);
@@ -2079,15 +2497,18 @@ TEST(GLES2FormatTest, Uniform3i) {
}
TEST(GLES2FormatTest, Uniform3iv) {
- Uniform3iv cmd = { 0, };
+ Uniform3iv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform3iv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform3iv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -2112,17 +2533,21 @@ TEST(GLES2FormatTest, Uniform3ivImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform3ivImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform3ivImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform4f) {
- Uniform4f cmd = { 0, };
+ Uniform4f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
@@ -2130,8 +2555,11 @@ TEST(GLES2FormatTest, Uniform4f) {
static_cast<GLfloat>(13),
static_cast<GLfloat>(14),
static_cast<GLfloat>(15));
- EXPECT_EQ(Uniform4f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform4f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
@@ -2140,15 +2568,18 @@ TEST(GLES2FormatTest, Uniform4f) {
}
TEST(GLES2FormatTest, Uniform4fv) {
- Uniform4fv cmd = { 0, };
+ Uniform4fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform4fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform4fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -2175,17 +2606,21 @@ TEST(GLES2FormatTest, Uniform4fvImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform4fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform4fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, Uniform4i) {
- Uniform4i cmd = { 0, };
+ Uniform4i cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
@@ -2193,8 +2628,11 @@ TEST(GLES2FormatTest, Uniform4i) {
static_cast<GLint>(13),
static_cast<GLint>(14),
static_cast<GLint>(15));
- EXPECT_EQ(Uniform4i::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform4i::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLint>(12), cmd.x);
EXPECT_EQ(static_cast<GLint>(13), cmd.y);
@@ -2203,15 +2641,18 @@ TEST(GLES2FormatTest, Uniform4i) {
}
TEST(GLES2FormatTest, Uniform4iv) {
- Uniform4iv cmd = { 0, };
+ Uniform4iv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLsizei>(12),
static_cast<uint32>(13),
static_cast<uint32>(14));
- EXPECT_EQ(Uniform4iv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Uniform4iv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<uint32>(13), cmd.v_shm_id);
@@ -2238,17 +2679,21 @@ TEST(GLES2FormatTest, Uniform4ivImmediate) {
static_cast<GLint>(1),
static_cast<GLsizei>(2),
data);
- EXPECT_EQ(Uniform4ivImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(Uniform4ivImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, UniformMatrix2fv) {
- UniformMatrix2fv cmd = { 0, };
+ UniformMatrix2fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
@@ -2256,8 +2701,11 @@ TEST(GLES2FormatTest, UniformMatrix2fv) {
static_cast<GLboolean>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(UniformMatrix2fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(UniformMatrix2fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<GLboolean>(13), cmd.transpose);
@@ -2286,10 +2734,14 @@ TEST(GLES2FormatTest, UniformMatrix2fvImmediate) {
static_cast<GLsizei>(2),
static_cast<GLboolean>(3),
data);
- EXPECT_EQ(UniformMatrix2fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(UniformMatrix2fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose);
@@ -2297,7 +2749,7 @@ TEST(GLES2FormatTest, UniformMatrix2fvImmediate) {
}
TEST(GLES2FormatTest, UniformMatrix3fv) {
- UniformMatrix3fv cmd = { 0, };
+ UniformMatrix3fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
@@ -2305,8 +2757,11 @@ TEST(GLES2FormatTest, UniformMatrix3fv) {
static_cast<GLboolean>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(UniformMatrix3fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(UniformMatrix3fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<GLboolean>(13), cmd.transpose);
@@ -2345,10 +2800,14 @@ TEST(GLES2FormatTest, UniformMatrix3fvImmediate) {
static_cast<GLsizei>(2),
static_cast<GLboolean>(3),
data);
- EXPECT_EQ(UniformMatrix3fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(UniformMatrix3fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose);
@@ -2356,7 +2815,7 @@ TEST(GLES2FormatTest, UniformMatrix3fvImmediate) {
}
TEST(GLES2FormatTest, UniformMatrix4fv) {
- UniformMatrix4fv cmd = { 0, };
+ UniformMatrix4fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
@@ -2364,8 +2823,11 @@ TEST(GLES2FormatTest, UniformMatrix4fv) {
static_cast<GLboolean>(13),
static_cast<uint32>(14),
static_cast<uint32>(15));
- EXPECT_EQ(UniformMatrix4fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(UniformMatrix4fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<GLboolean>(13), cmd.transpose);
@@ -2418,10 +2880,14 @@ TEST(GLES2FormatTest, UniformMatrix4fvImmediate) {
static_cast<GLsizei>(2),
static_cast<GLboolean>(3),
data);
- EXPECT_EQ(UniformMatrix4fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(UniformMatrix4fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLint>(1), cmd.location);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose);
@@ -2429,46 +2895,58 @@ TEST(GLES2FormatTest, UniformMatrix4fvImmediate) {
}
TEST(GLES2FormatTest, UseProgram) {
- UseProgram cmd = { 0, };
+ UseProgram cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(UseProgram::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(UseProgram::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
}
TEST(GLES2FormatTest, ValidateProgram) {
- ValidateProgram cmd = { 0, };
+ ValidateProgram cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11));
- EXPECT_EQ(ValidateProgram::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(ValidateProgram::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
}
TEST(GLES2FormatTest, VertexAttrib1f) {
- VertexAttrib1f cmd = { 0, };
+ VertexAttrib1f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLfloat>(12));
- EXPECT_EQ(VertexAttrib1f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib1f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
}
TEST(GLES2FormatTest, VertexAttrib1fv) {
- VertexAttrib1fv cmd = { 0, };
+ VertexAttrib1fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(VertexAttrib1fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib1fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<uint32>(12), cmd.values_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.values_shm_offset);
@@ -2486,37 +2964,47 @@ TEST(GLES2FormatTest, VertexAttrib1fvImmediate) {
&cmd,
static_cast<GLuint>(11),
data);
- EXPECT_EQ(VertexAttrib1fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib1fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, VertexAttrib2f) {
- VertexAttrib2f cmd = { 0, };
+ VertexAttrib2f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLfloat>(12),
static_cast<GLfloat>(13));
- EXPECT_EQ(VertexAttrib2f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib2f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
}
TEST(GLES2FormatTest, VertexAttrib2fv) {
- VertexAttrib2fv cmd = { 0, };
+ VertexAttrib2fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(VertexAttrib2fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib2fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<uint32>(12), cmd.values_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.values_shm_offset);
@@ -2535,24 +3023,31 @@ TEST(GLES2FormatTest, VertexAttrib2fvImmediate) {
&cmd,
static_cast<GLuint>(11),
data);
- EXPECT_EQ(VertexAttrib2fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib2fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, VertexAttrib3f) {
- VertexAttrib3f cmd = { 0, };
+ VertexAttrib3f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<GLfloat>(12),
static_cast<GLfloat>(13),
static_cast<GLfloat>(14));
- EXPECT_EQ(VertexAttrib3f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib3f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
@@ -2560,14 +3055,17 @@ TEST(GLES2FormatTest, VertexAttrib3f) {
}
TEST(GLES2FormatTest, VertexAttrib3fv) {
- VertexAttrib3fv cmd = { 0, };
+ VertexAttrib3fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(VertexAttrib3fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib3fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<uint32>(12), cmd.values_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.values_shm_offset);
@@ -2587,16 +3085,20 @@ TEST(GLES2FormatTest, VertexAttrib3fvImmediate) {
&cmd,
static_cast<GLuint>(11),
data);
- EXPECT_EQ(VertexAttrib3fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib3fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, VertexAttrib4f) {
- VertexAttrib4f cmd = { 0, };
+ VertexAttrib4f cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -2604,8 +3106,11 @@ TEST(GLES2FormatTest, VertexAttrib4f) {
static_cast<GLfloat>(13),
static_cast<GLfloat>(14),
static_cast<GLfloat>(15));
- EXPECT_EQ(VertexAttrib4f::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib4f::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
@@ -2614,14 +3119,17 @@ TEST(GLES2FormatTest, VertexAttrib4f) {
}
TEST(GLES2FormatTest, VertexAttrib4fv) {
- VertexAttrib4fv cmd = { 0, };
+ VertexAttrib4fv cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
static_cast<uint32>(12),
static_cast<uint32>(13));
- EXPECT_EQ(VertexAttrib4fv::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib4fv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<uint32>(12), cmd.values_shm_id);
EXPECT_EQ(static_cast<uint32>(13), cmd.values_shm_offset);
@@ -2642,16 +3150,20 @@ TEST(GLES2FormatTest, VertexAttrib4fvImmediate) {
&cmd,
static_cast<GLuint>(11),
data);
- EXPECT_EQ(VertexAttrib4fvImmediate::kCmdId, cmd.header.command);
+ EXPECT_EQ(static_cast<uint32>(VertexAttrib4fvImmediate::kCmdId),
+ cmd.header.command);
EXPECT_EQ(sizeof(cmd) +
RoundSizeToMultipleOfEntries(sizeof(data)),
- cmd.header.size * 4); // NOLINT
+ cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
+ RoundSizeToMultipleOfEntries(sizeof(data)));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
// TODO(gman): Check that data was inserted;
}
TEST(GLES2FormatTest, VertexAttribPointer) {
- VertexAttribPointer cmd = { 0, };
+ VertexAttribPointer cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLuint>(11),
@@ -2660,8 +3172,11 @@ TEST(GLES2FormatTest, VertexAttribPointer) {
static_cast<GLboolean>(14),
static_cast<GLsizei>(15),
static_cast<GLuint>(16));
- EXPECT_EQ(VertexAttribPointer::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(VertexAttribPointer::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
EXPECT_EQ(static_cast<GLint>(12), cmd.size);
EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
@@ -2671,15 +3186,18 @@ TEST(GLES2FormatTest, VertexAttribPointer) {
}
TEST(GLES2FormatTest, Viewport) {
- Viewport cmd = { 0, };
+ Viewport cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd,
static_cast<GLint>(11),
static_cast<GLint>(12),
static_cast<GLsizei>(13),
static_cast<GLsizei>(14));
- EXPECT_EQ(Viewport::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(Viewport::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
EXPECT_EQ(static_cast<GLint>(11), cmd.x);
EXPECT_EQ(static_cast<GLint>(12), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
@@ -2687,10 +3205,13 @@ TEST(GLES2FormatTest, Viewport) {
}
TEST(GLES2FormatTest, SwapBuffers) {
- SwapBuffers cmd = { 0, };
+ SwapBuffers cmd = {{0}};
void* next_cmd = cmd.Set(
&cmd);
- EXPECT_EQ(SwapBuffers::kCmdId, cmd.header.command);
- EXPECT_EQ(sizeof(cmd), cmd.header.size * 4); // NOLINT
+ EXPECT_EQ(static_cast<uint32>(SwapBuffers::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
}