Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / gpu / command_buffer / common / gles2_cmd_format_test_autogen.h
blobd1470d45eade4d71560b7dc833187048c9d1c587
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // This file contains unit tests for gles2 commmands
12 // It is included by gles2_cmd_format_test.cc
14 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
15 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
17 TEST_F(GLES2FormatTest, ActiveTexture) {
18 cmds::ActiveTexture& cmd = *GetBufferAs<cmds::ActiveTexture>();
19 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
20 EXPECT_EQ(static_cast<uint32_t>(cmds::ActiveTexture::kCmdId),
21 cmd.header.command);
22 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
23 EXPECT_EQ(static_cast<GLenum>(11), cmd.texture);
24 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
27 TEST_F(GLES2FormatTest, AttachShader) {
28 cmds::AttachShader& cmd = *GetBufferAs<cmds::AttachShader>();
29 void* next_cmd =
30 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
31 EXPECT_EQ(static_cast<uint32_t>(cmds::AttachShader::kCmdId),
32 cmd.header.command);
33 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
34 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
35 EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
36 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
39 TEST_F(GLES2FormatTest, BindAttribLocationBucket) {
40 cmds::BindAttribLocationBucket& cmd =
41 *GetBufferAs<cmds::BindAttribLocationBucket>();
42 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
43 static_cast<GLuint>(12), static_cast<uint32_t>(13));
44 EXPECT_EQ(static_cast<uint32_t>(cmds::BindAttribLocationBucket::kCmdId),
45 cmd.header.command);
46 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
47 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
48 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
49 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
50 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
53 TEST_F(GLES2FormatTest, BindBuffer) {
54 cmds::BindBuffer& cmd = *GetBufferAs<cmds::BindBuffer>();
55 void* next_cmd =
56 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
57 EXPECT_EQ(static_cast<uint32_t>(cmds::BindBuffer::kCmdId),
58 cmd.header.command);
59 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
60 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
61 EXPECT_EQ(static_cast<GLuint>(12), cmd.buffer);
62 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
65 TEST_F(GLES2FormatTest, BindFramebuffer) {
66 cmds::BindFramebuffer& cmd = *GetBufferAs<cmds::BindFramebuffer>();
67 void* next_cmd =
68 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
69 EXPECT_EQ(static_cast<uint32_t>(cmds::BindFramebuffer::kCmdId),
70 cmd.header.command);
71 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
72 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
73 EXPECT_EQ(static_cast<GLuint>(12), cmd.framebuffer);
74 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
77 TEST_F(GLES2FormatTest, BindRenderbuffer) {
78 cmds::BindRenderbuffer& cmd = *GetBufferAs<cmds::BindRenderbuffer>();
79 void* next_cmd =
80 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
81 EXPECT_EQ(static_cast<uint32_t>(cmds::BindRenderbuffer::kCmdId),
82 cmd.header.command);
83 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
84 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
85 EXPECT_EQ(static_cast<GLuint>(12), cmd.renderbuffer);
86 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
89 TEST_F(GLES2FormatTest, BindTexture) {
90 cmds::BindTexture& cmd = *GetBufferAs<cmds::BindTexture>();
91 void* next_cmd =
92 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
93 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexture::kCmdId),
94 cmd.header.command);
95 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
96 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
97 EXPECT_EQ(static_cast<GLuint>(12), cmd.texture);
98 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
101 TEST_F(GLES2FormatTest, BlendColor) {
102 cmds::BlendColor& cmd = *GetBufferAs<cmds::BlendColor>();
103 void* next_cmd =
104 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12),
105 static_cast<GLclampf>(13), static_cast<GLclampf>(14));
106 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendColor::kCmdId),
107 cmd.header.command);
108 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
109 EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
110 EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
111 EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
112 EXPECT_EQ(static_cast<GLclampf>(14), cmd.alpha);
113 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
116 TEST_F(GLES2FormatTest, BlendEquation) {
117 cmds::BlendEquation& cmd = *GetBufferAs<cmds::BlendEquation>();
118 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
119 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquation::kCmdId),
120 cmd.header.command);
121 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
122 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
123 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
126 TEST_F(GLES2FormatTest, BlendEquationSeparate) {
127 cmds::BlendEquationSeparate& cmd =
128 *GetBufferAs<cmds::BlendEquationSeparate>();
129 void* next_cmd =
130 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
131 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquationSeparate::kCmdId),
132 cmd.header.command);
133 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
134 EXPECT_EQ(static_cast<GLenum>(11), cmd.modeRGB);
135 EXPECT_EQ(static_cast<GLenum>(12), cmd.modeAlpha);
136 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
139 TEST_F(GLES2FormatTest, BlendFunc) {
140 cmds::BlendFunc& cmd = *GetBufferAs<cmds::BlendFunc>();
141 void* next_cmd =
142 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
143 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFunc::kCmdId), cmd.header.command);
144 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
145 EXPECT_EQ(static_cast<GLenum>(11), cmd.sfactor);
146 EXPECT_EQ(static_cast<GLenum>(12), cmd.dfactor);
147 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
150 TEST_F(GLES2FormatTest, BlendFuncSeparate) {
151 cmds::BlendFuncSeparate& cmd = *GetBufferAs<cmds::BlendFuncSeparate>();
152 void* next_cmd =
153 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
154 static_cast<GLenum>(13), static_cast<GLenum>(14));
155 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFuncSeparate::kCmdId),
156 cmd.header.command);
157 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
158 EXPECT_EQ(static_cast<GLenum>(11), cmd.srcRGB);
159 EXPECT_EQ(static_cast<GLenum>(12), cmd.dstRGB);
160 EXPECT_EQ(static_cast<GLenum>(13), cmd.srcAlpha);
161 EXPECT_EQ(static_cast<GLenum>(14), cmd.dstAlpha);
162 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
165 TEST_F(GLES2FormatTest, BufferData) {
166 cmds::BufferData& cmd = *GetBufferAs<cmds::BufferData>();
167 void* next_cmd =
168 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizeiptr>(12),
169 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
170 static_cast<GLenum>(15));
171 EXPECT_EQ(static_cast<uint32_t>(cmds::BufferData::kCmdId),
172 cmd.header.command);
173 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
174 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
175 EXPECT_EQ(static_cast<GLsizeiptr>(12), cmd.size);
176 EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
177 EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
178 EXPECT_EQ(static_cast<GLenum>(15), cmd.usage);
179 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
182 TEST_F(GLES2FormatTest, BufferSubData) {
183 cmds::BufferSubData& cmd = *GetBufferAs<cmds::BufferSubData>();
184 void* next_cmd =
185 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLintptr>(12),
186 static_cast<GLsizeiptr>(13), static_cast<uint32_t>(14),
187 static_cast<uint32_t>(15));
188 EXPECT_EQ(static_cast<uint32_t>(cmds::BufferSubData::kCmdId),
189 cmd.header.command);
190 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
191 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
192 EXPECT_EQ(static_cast<GLintptr>(12), cmd.offset);
193 EXPECT_EQ(static_cast<GLsizeiptr>(13), cmd.size);
194 EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_id);
195 EXPECT_EQ(static_cast<uint32_t>(15), cmd.data_shm_offset);
196 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
199 TEST_F(GLES2FormatTest, CheckFramebufferStatus) {
200 cmds::CheckFramebufferStatus& cmd =
201 *GetBufferAs<cmds::CheckFramebufferStatus>();
202 void* next_cmd =
203 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
204 static_cast<uint32_t>(13));
205 EXPECT_EQ(static_cast<uint32_t>(cmds::CheckFramebufferStatus::kCmdId),
206 cmd.header.command);
207 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
208 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
209 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
210 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
211 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
214 TEST_F(GLES2FormatTest, Clear) {
215 cmds::Clear& cmd = *GetBufferAs<cmds::Clear>();
216 void* next_cmd = cmd.Set(&cmd, static_cast<GLbitfield>(11));
217 EXPECT_EQ(static_cast<uint32_t>(cmds::Clear::kCmdId), cmd.header.command);
218 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
219 EXPECT_EQ(static_cast<GLbitfield>(11), cmd.mask);
220 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
223 TEST_F(GLES2FormatTest, ClearColor) {
224 cmds::ClearColor& cmd = *GetBufferAs<cmds::ClearColor>();
225 void* next_cmd =
226 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12),
227 static_cast<GLclampf>(13), static_cast<GLclampf>(14));
228 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearColor::kCmdId),
229 cmd.header.command);
230 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
231 EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
232 EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
233 EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
234 EXPECT_EQ(static_cast<GLclampf>(14), cmd.alpha);
235 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
238 TEST_F(GLES2FormatTest, ClearDepthf) {
239 cmds::ClearDepthf& cmd = *GetBufferAs<cmds::ClearDepthf>();
240 void* next_cmd = cmd.Set(&cmd, static_cast<GLclampf>(11));
241 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearDepthf::kCmdId),
242 cmd.header.command);
243 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
244 EXPECT_EQ(static_cast<GLclampf>(11), cmd.depth);
245 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
248 TEST_F(GLES2FormatTest, ClearStencil) {
249 cmds::ClearStencil& cmd = *GetBufferAs<cmds::ClearStencil>();
250 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11));
251 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearStencil::kCmdId),
252 cmd.header.command);
253 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
254 EXPECT_EQ(static_cast<GLint>(11), cmd.s);
255 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
258 TEST_F(GLES2FormatTest, ColorMask) {
259 cmds::ColorMask& cmd = *GetBufferAs<cmds::ColorMask>();
260 void* next_cmd =
261 cmd.Set(&cmd, static_cast<GLboolean>(11), static_cast<GLboolean>(12),
262 static_cast<GLboolean>(13), static_cast<GLboolean>(14));
263 EXPECT_EQ(static_cast<uint32_t>(cmds::ColorMask::kCmdId), cmd.header.command);
264 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
265 EXPECT_EQ(static_cast<GLboolean>(11), cmd.red);
266 EXPECT_EQ(static_cast<GLboolean>(12), cmd.green);
267 EXPECT_EQ(static_cast<GLboolean>(13), cmd.blue);
268 EXPECT_EQ(static_cast<GLboolean>(14), cmd.alpha);
269 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
272 TEST_F(GLES2FormatTest, CompileShader) {
273 cmds::CompileShader& cmd = *GetBufferAs<cmds::CompileShader>();
274 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
275 EXPECT_EQ(static_cast<uint32_t>(cmds::CompileShader::kCmdId),
276 cmd.header.command);
277 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
278 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
279 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
282 TEST_F(GLES2FormatTest, CompressedTexImage2DBucket) {
283 cmds::CompressedTexImage2DBucket& cmd =
284 *GetBufferAs<cmds::CompressedTexImage2DBucket>();
285 void* next_cmd =
286 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
287 static_cast<GLenum>(13), static_cast<GLsizei>(14),
288 static_cast<GLsizei>(15), static_cast<GLuint>(16));
289 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2DBucket::kCmdId),
290 cmd.header.command);
291 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
292 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
293 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
294 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
295 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
296 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
297 EXPECT_EQ(static_cast<GLuint>(16), cmd.bucket_id);
298 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
301 TEST_F(GLES2FormatTest, CompressedTexImage2D) {
302 cmds::CompressedTexImage2D& cmd = *GetBufferAs<cmds::CompressedTexImage2D>();
303 void* next_cmd =
304 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
305 static_cast<GLenum>(13), static_cast<GLsizei>(14),
306 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
307 static_cast<uint32_t>(17), static_cast<uint32_t>(18));
308 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2D::kCmdId),
309 cmd.header.command);
310 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
311 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
312 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
313 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
314 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
315 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
316 EXPECT_EQ(static_cast<GLsizei>(16), cmd.imageSize);
317 EXPECT_EQ(static_cast<uint32_t>(17), cmd.data_shm_id);
318 EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_offset);
319 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
322 TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) {
323 cmds::CompressedTexSubImage2DBucket& cmd =
324 *GetBufferAs<cmds::CompressedTexSubImage2DBucket>();
325 void* next_cmd =
326 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
327 static_cast<GLint>(13), static_cast<GLint>(14),
328 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
329 static_cast<GLenum>(17), static_cast<GLuint>(18));
330 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2DBucket::kCmdId),
331 cmd.header.command);
332 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
333 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
334 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
335 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
336 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
337 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
338 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
339 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
340 EXPECT_EQ(static_cast<GLuint>(18), cmd.bucket_id);
341 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
344 TEST_F(GLES2FormatTest, CompressedTexSubImage2D) {
345 cmds::CompressedTexSubImage2D& cmd =
346 *GetBufferAs<cmds::CompressedTexSubImage2D>();
347 void* next_cmd =
348 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
349 static_cast<GLint>(13), static_cast<GLint>(14),
350 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
351 static_cast<GLenum>(17), static_cast<GLsizei>(18),
352 static_cast<uint32_t>(19), static_cast<uint32_t>(20));
353 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2D::kCmdId),
354 cmd.header.command);
355 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
356 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
357 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
358 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
359 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
360 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
361 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
362 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
363 EXPECT_EQ(static_cast<GLsizei>(18), cmd.imageSize);
364 EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id);
365 EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset);
366 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
369 TEST_F(GLES2FormatTest, CopyTexImage2D) {
370 cmds::CopyTexImage2D& cmd = *GetBufferAs<cmds::CopyTexImage2D>();
371 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
372 static_cast<GLint>(12), static_cast<GLenum>(13),
373 static_cast<GLint>(14), static_cast<GLint>(15),
374 static_cast<GLsizei>(16), static_cast<GLsizei>(17));
375 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexImage2D::kCmdId),
376 cmd.header.command);
377 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
378 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
379 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
380 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
381 EXPECT_EQ(static_cast<GLint>(14), cmd.x);
382 EXPECT_EQ(static_cast<GLint>(15), cmd.y);
383 EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
384 EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
385 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
388 TEST_F(GLES2FormatTest, CopyTexSubImage2D) {
389 cmds::CopyTexSubImage2D& cmd = *GetBufferAs<cmds::CopyTexSubImage2D>();
390 void* next_cmd =
391 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
392 static_cast<GLint>(13), static_cast<GLint>(14),
393 static_cast<GLint>(15), static_cast<GLint>(16),
394 static_cast<GLsizei>(17), static_cast<GLsizei>(18));
395 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage2D::kCmdId),
396 cmd.header.command);
397 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
398 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
399 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
400 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
401 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
402 EXPECT_EQ(static_cast<GLint>(15), cmd.x);
403 EXPECT_EQ(static_cast<GLint>(16), cmd.y);
404 EXPECT_EQ(static_cast<GLsizei>(17), cmd.width);
405 EXPECT_EQ(static_cast<GLsizei>(18), cmd.height);
406 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
409 TEST_F(GLES2FormatTest, CreateProgram) {
410 cmds::CreateProgram& cmd = *GetBufferAs<cmds::CreateProgram>();
411 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
412 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateProgram::kCmdId),
413 cmd.header.command);
414 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
415 EXPECT_EQ(static_cast<uint32_t>(11), cmd.client_id);
416 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
419 TEST_F(GLES2FormatTest, CreateShader) {
420 cmds::CreateShader& cmd = *GetBufferAs<cmds::CreateShader>();
421 void* next_cmd =
422 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12));
423 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateShader::kCmdId),
424 cmd.header.command);
425 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
426 EXPECT_EQ(static_cast<GLenum>(11), cmd.type);
427 EXPECT_EQ(static_cast<uint32_t>(12), cmd.client_id);
428 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
431 TEST_F(GLES2FormatTest, CullFace) {
432 cmds::CullFace& cmd = *GetBufferAs<cmds::CullFace>();
433 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
434 EXPECT_EQ(static_cast<uint32_t>(cmds::CullFace::kCmdId), cmd.header.command);
435 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
436 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
437 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
440 TEST_F(GLES2FormatTest, DeleteBuffersImmediate) {
441 static GLuint ids[] = {
442 12, 23, 34,
444 cmds::DeleteBuffersImmediate& cmd =
445 *GetBufferAs<cmds::DeleteBuffersImmediate>();
446 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
447 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteBuffersImmediate::kCmdId),
448 cmd.header.command);
449 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
450 cmd.header.size * 4u);
451 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
452 CheckBytesWrittenMatchesExpectedSize(
453 next_cmd,
454 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
455 // TODO(gman): Check that ids were inserted;
458 TEST_F(GLES2FormatTest, DeleteFramebuffersImmediate) {
459 static GLuint ids[] = {
460 12, 23, 34,
462 cmds::DeleteFramebuffersImmediate& cmd =
463 *GetBufferAs<cmds::DeleteFramebuffersImmediate>();
464 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
465 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteFramebuffersImmediate::kCmdId),
466 cmd.header.command);
467 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
468 cmd.header.size * 4u);
469 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
470 CheckBytesWrittenMatchesExpectedSize(
471 next_cmd,
472 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
473 // TODO(gman): Check that ids were inserted;
476 TEST_F(GLES2FormatTest, DeleteProgram) {
477 cmds::DeleteProgram& cmd = *GetBufferAs<cmds::DeleteProgram>();
478 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
479 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteProgram::kCmdId),
480 cmd.header.command);
481 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
482 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
483 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
486 TEST_F(GLES2FormatTest, DeleteRenderbuffersImmediate) {
487 static GLuint ids[] = {
488 12, 23, 34,
490 cmds::DeleteRenderbuffersImmediate& cmd =
491 *GetBufferAs<cmds::DeleteRenderbuffersImmediate>();
492 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
493 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteRenderbuffersImmediate::kCmdId),
494 cmd.header.command);
495 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
496 cmd.header.size * 4u);
497 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
498 CheckBytesWrittenMatchesExpectedSize(
499 next_cmd,
500 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
501 // TODO(gman): Check that ids were inserted;
504 TEST_F(GLES2FormatTest, DeleteShader) {
505 cmds::DeleteShader& cmd = *GetBufferAs<cmds::DeleteShader>();
506 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
507 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteShader::kCmdId),
508 cmd.header.command);
509 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
510 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
511 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
514 TEST_F(GLES2FormatTest, DeleteTexturesImmediate) {
515 static GLuint ids[] = {
516 12, 23, 34,
518 cmds::DeleteTexturesImmediate& cmd =
519 *GetBufferAs<cmds::DeleteTexturesImmediate>();
520 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
521 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteTexturesImmediate::kCmdId),
522 cmd.header.command);
523 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
524 cmd.header.size * 4u);
525 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
526 CheckBytesWrittenMatchesExpectedSize(
527 next_cmd,
528 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
529 // TODO(gman): Check that ids were inserted;
532 TEST_F(GLES2FormatTest, DepthFunc) {
533 cmds::DepthFunc& cmd = *GetBufferAs<cmds::DepthFunc>();
534 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
535 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthFunc::kCmdId), cmd.header.command);
536 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
537 EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
538 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
541 TEST_F(GLES2FormatTest, DepthMask) {
542 cmds::DepthMask& cmd = *GetBufferAs<cmds::DepthMask>();
543 void* next_cmd = cmd.Set(&cmd, static_cast<GLboolean>(11));
544 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthMask::kCmdId), cmd.header.command);
545 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
546 EXPECT_EQ(static_cast<GLboolean>(11), cmd.flag);
547 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
550 TEST_F(GLES2FormatTest, DepthRangef) {
551 cmds::DepthRangef& cmd = *GetBufferAs<cmds::DepthRangef>();
552 void* next_cmd =
553 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12));
554 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthRangef::kCmdId),
555 cmd.header.command);
556 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
557 EXPECT_EQ(static_cast<GLclampf>(11), cmd.zNear);
558 EXPECT_EQ(static_cast<GLclampf>(12), cmd.zFar);
559 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
562 TEST_F(GLES2FormatTest, DetachShader) {
563 cmds::DetachShader& cmd = *GetBufferAs<cmds::DetachShader>();
564 void* next_cmd =
565 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
566 EXPECT_EQ(static_cast<uint32_t>(cmds::DetachShader::kCmdId),
567 cmd.header.command);
568 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
569 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
570 EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
571 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
574 TEST_F(GLES2FormatTest, Disable) {
575 cmds::Disable& cmd = *GetBufferAs<cmds::Disable>();
576 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
577 EXPECT_EQ(static_cast<uint32_t>(cmds::Disable::kCmdId), cmd.header.command);
578 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
579 EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
580 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
583 TEST_F(GLES2FormatTest, DisableVertexAttribArray) {
584 cmds::DisableVertexAttribArray& cmd =
585 *GetBufferAs<cmds::DisableVertexAttribArray>();
586 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
587 EXPECT_EQ(static_cast<uint32_t>(cmds::DisableVertexAttribArray::kCmdId),
588 cmd.header.command);
589 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
590 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
591 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
594 TEST_F(GLES2FormatTest, DrawArrays) {
595 cmds::DrawArrays& cmd = *GetBufferAs<cmds::DrawArrays>();
596 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
597 static_cast<GLint>(12), static_cast<GLsizei>(13));
598 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArrays::kCmdId),
599 cmd.header.command);
600 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
601 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
602 EXPECT_EQ(static_cast<GLint>(12), cmd.first);
603 EXPECT_EQ(static_cast<GLsizei>(13), cmd.count);
604 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
607 TEST_F(GLES2FormatTest, DrawElements) {
608 cmds::DrawElements& cmd = *GetBufferAs<cmds::DrawElements>();
609 void* next_cmd =
610 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizei>(12),
611 static_cast<GLenum>(13), static_cast<GLuint>(14));
612 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElements::kCmdId),
613 cmd.header.command);
614 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
615 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
616 EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
617 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
618 EXPECT_EQ(static_cast<GLuint>(14), cmd.index_offset);
619 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
622 TEST_F(GLES2FormatTest, Enable) {
623 cmds::Enable& cmd = *GetBufferAs<cmds::Enable>();
624 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
625 EXPECT_EQ(static_cast<uint32_t>(cmds::Enable::kCmdId), cmd.header.command);
626 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
627 EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
628 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
631 TEST_F(GLES2FormatTest, EnableVertexAttribArray) {
632 cmds::EnableVertexAttribArray& cmd =
633 *GetBufferAs<cmds::EnableVertexAttribArray>();
634 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
635 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableVertexAttribArray::kCmdId),
636 cmd.header.command);
637 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
638 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
639 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
642 TEST_F(GLES2FormatTest, Finish) {
643 cmds::Finish& cmd = *GetBufferAs<cmds::Finish>();
644 void* next_cmd = cmd.Set(&cmd);
645 EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId), cmd.header.command);
646 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
647 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
650 TEST_F(GLES2FormatTest, Flush) {
651 cmds::Flush& cmd = *GetBufferAs<cmds::Flush>();
652 void* next_cmd = cmd.Set(&cmd);
653 EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId), cmd.header.command);
654 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
655 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
658 TEST_F(GLES2FormatTest, FramebufferRenderbuffer) {
659 cmds::FramebufferRenderbuffer& cmd =
660 *GetBufferAs<cmds::FramebufferRenderbuffer>();
661 void* next_cmd =
662 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
663 static_cast<GLenum>(13), static_cast<GLuint>(14));
664 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferRenderbuffer::kCmdId),
665 cmd.header.command);
666 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
667 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
668 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
669 EXPECT_EQ(static_cast<GLenum>(13), cmd.renderbuffertarget);
670 EXPECT_EQ(static_cast<GLuint>(14), cmd.renderbuffer);
671 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
674 TEST_F(GLES2FormatTest, FramebufferTexture2D) {
675 cmds::FramebufferTexture2D& cmd = *GetBufferAs<cmds::FramebufferTexture2D>();
676 void* next_cmd =
677 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
678 static_cast<GLenum>(13), static_cast<GLuint>(14));
679 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTexture2D::kCmdId),
680 cmd.header.command);
681 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
682 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
683 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
684 EXPECT_EQ(static_cast<GLenum>(13), cmd.textarget);
685 EXPECT_EQ(static_cast<GLuint>(14), cmd.texture);
686 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
689 TEST_F(GLES2FormatTest, FrontFace) {
690 cmds::FrontFace& cmd = *GetBufferAs<cmds::FrontFace>();
691 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
692 EXPECT_EQ(static_cast<uint32_t>(cmds::FrontFace::kCmdId), cmd.header.command);
693 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
694 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
695 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
698 TEST_F(GLES2FormatTest, GenBuffersImmediate) {
699 static GLuint ids[] = {
700 12, 23, 34,
702 cmds::GenBuffersImmediate& cmd = *GetBufferAs<cmds::GenBuffersImmediate>();
703 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
704 EXPECT_EQ(static_cast<uint32_t>(cmds::GenBuffersImmediate::kCmdId),
705 cmd.header.command);
706 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
707 cmd.header.size * 4u);
708 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
709 CheckBytesWrittenMatchesExpectedSize(
710 next_cmd,
711 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
712 // TODO(gman): Check that ids were inserted;
715 TEST_F(GLES2FormatTest, GenerateMipmap) {
716 cmds::GenerateMipmap& cmd = *GetBufferAs<cmds::GenerateMipmap>();
717 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
718 EXPECT_EQ(static_cast<uint32_t>(cmds::GenerateMipmap::kCmdId),
719 cmd.header.command);
720 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
721 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
722 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
725 TEST_F(GLES2FormatTest, GenFramebuffersImmediate) {
726 static GLuint ids[] = {
727 12, 23, 34,
729 cmds::GenFramebuffersImmediate& cmd =
730 *GetBufferAs<cmds::GenFramebuffersImmediate>();
731 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
732 EXPECT_EQ(static_cast<uint32_t>(cmds::GenFramebuffersImmediate::kCmdId),
733 cmd.header.command);
734 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
735 cmd.header.size * 4u);
736 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
737 CheckBytesWrittenMatchesExpectedSize(
738 next_cmd,
739 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
740 // TODO(gman): Check that ids were inserted;
743 TEST_F(GLES2FormatTest, GenRenderbuffersImmediate) {
744 static GLuint ids[] = {
745 12, 23, 34,
747 cmds::GenRenderbuffersImmediate& cmd =
748 *GetBufferAs<cmds::GenRenderbuffersImmediate>();
749 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
750 EXPECT_EQ(static_cast<uint32_t>(cmds::GenRenderbuffersImmediate::kCmdId),
751 cmd.header.command);
752 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
753 cmd.header.size * 4u);
754 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
755 CheckBytesWrittenMatchesExpectedSize(
756 next_cmd,
757 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
758 // TODO(gman): Check that ids were inserted;
761 TEST_F(GLES2FormatTest, GenTexturesImmediate) {
762 static GLuint ids[] = {
763 12, 23, 34,
765 cmds::GenTexturesImmediate& cmd = *GetBufferAs<cmds::GenTexturesImmediate>();
766 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
767 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTexturesImmediate::kCmdId),
768 cmd.header.command);
769 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
770 cmd.header.size * 4u);
771 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
772 CheckBytesWrittenMatchesExpectedSize(
773 next_cmd,
774 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
775 // TODO(gman): Check that ids were inserted;
778 TEST_F(GLES2FormatTest, GetActiveAttrib) {
779 cmds::GetActiveAttrib& cmd = *GetBufferAs<cmds::GetActiveAttrib>();
780 void* next_cmd =
781 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
782 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
783 static_cast<uint32_t>(15));
784 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveAttrib::kCmdId),
785 cmd.header.command);
786 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
787 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
788 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
789 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
790 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
791 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
792 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
795 TEST_F(GLES2FormatTest, GetActiveUniform) {
796 cmds::GetActiveUniform& cmd = *GetBufferAs<cmds::GetActiveUniform>();
797 void* next_cmd =
798 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
799 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
800 static_cast<uint32_t>(15));
801 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniform::kCmdId),
802 cmd.header.command);
803 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
804 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
805 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
806 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
807 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
808 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
809 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
812 TEST_F(GLES2FormatTest, GetAttachedShaders) {
813 cmds::GetAttachedShaders& cmd = *GetBufferAs<cmds::GetAttachedShaders>();
814 void* next_cmd =
815 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
816 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
817 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttachedShaders::kCmdId),
818 cmd.header.command);
819 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
820 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
821 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
822 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
823 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_size);
824 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
827 TEST_F(GLES2FormatTest, GetAttribLocation) {
828 cmds::GetAttribLocation& cmd = *GetBufferAs<cmds::GetAttribLocation>();
829 void* next_cmd =
830 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
831 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
832 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttribLocation::kCmdId),
833 cmd.header.command);
834 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
835 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
836 EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
837 EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
838 EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
839 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
842 TEST_F(GLES2FormatTest, GetBooleanv) {
843 cmds::GetBooleanv& cmd = *GetBufferAs<cmds::GetBooleanv>();
844 void* next_cmd =
845 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
846 static_cast<uint32_t>(13));
847 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBooleanv::kCmdId),
848 cmd.header.command);
849 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
850 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
851 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
852 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
853 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
856 TEST_F(GLES2FormatTest, GetBufferParameteriv) {
857 cmds::GetBufferParameteriv& cmd = *GetBufferAs<cmds::GetBufferParameteriv>();
858 void* next_cmd =
859 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
860 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
861 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteriv::kCmdId),
862 cmd.header.command);
863 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
864 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
865 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
866 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
867 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
868 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
871 TEST_F(GLES2FormatTest, GetError) {
872 cmds::GetError& cmd = *GetBufferAs<cmds::GetError>();
873 void* next_cmd =
874 cmd.Set(&cmd, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
875 EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId), cmd.header.command);
876 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
877 EXPECT_EQ(static_cast<uint32_t>(11), cmd.result_shm_id);
878 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_offset);
879 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
882 TEST_F(GLES2FormatTest, GetFloatv) {
883 cmds::GetFloatv& cmd = *GetBufferAs<cmds::GetFloatv>();
884 void* next_cmd =
885 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
886 static_cast<uint32_t>(13));
887 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFloatv::kCmdId), cmd.header.command);
888 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
889 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
890 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
891 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
892 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
895 TEST_F(GLES2FormatTest, GetFramebufferAttachmentParameteriv) {
896 cmds::GetFramebufferAttachmentParameteriv& cmd =
897 *GetBufferAs<cmds::GetFramebufferAttachmentParameteriv>();
898 void* next_cmd =
899 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
900 static_cast<GLenum>(13), static_cast<uint32_t>(14),
901 static_cast<uint32_t>(15));
902 EXPECT_EQ(
903 static_cast<uint32_t>(cmds::GetFramebufferAttachmentParameteriv::kCmdId),
904 cmd.header.command);
905 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
906 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
907 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
908 EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
909 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
910 EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
911 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
914 TEST_F(GLES2FormatTest, GetIntegerv) {
915 cmds::GetIntegerv& cmd = *GetBufferAs<cmds::GetIntegerv>();
916 void* next_cmd =
917 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
918 static_cast<uint32_t>(13));
919 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegerv::kCmdId),
920 cmd.header.command);
921 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
922 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
923 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
924 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
925 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
928 TEST_F(GLES2FormatTest, GetProgramiv) {
929 cmds::GetProgramiv& cmd = *GetBufferAs<cmds::GetProgramiv>();
930 void* next_cmd =
931 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
932 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
933 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramiv::kCmdId),
934 cmd.header.command);
935 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
936 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
937 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
938 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
939 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
940 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
943 TEST_F(GLES2FormatTest, GetProgramInfoLog) {
944 cmds::GetProgramInfoLog& cmd = *GetBufferAs<cmds::GetProgramInfoLog>();
945 void* next_cmd =
946 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
947 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoLog::kCmdId),
948 cmd.header.command);
949 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
950 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
951 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
952 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
955 TEST_F(GLES2FormatTest, GetRenderbufferParameteriv) {
956 cmds::GetRenderbufferParameteriv& cmd =
957 *GetBufferAs<cmds::GetRenderbufferParameteriv>();
958 void* next_cmd =
959 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
960 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
961 EXPECT_EQ(static_cast<uint32_t>(cmds::GetRenderbufferParameteriv::kCmdId),
962 cmd.header.command);
963 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
964 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
965 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
966 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
967 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
968 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
971 TEST_F(GLES2FormatTest, GetShaderiv) {
972 cmds::GetShaderiv& cmd = *GetBufferAs<cmds::GetShaderiv>();
973 void* next_cmd =
974 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
975 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
976 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderiv::kCmdId),
977 cmd.header.command);
978 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
979 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
980 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
981 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
982 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
983 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
986 TEST_F(GLES2FormatTest, GetShaderInfoLog) {
987 cmds::GetShaderInfoLog& cmd = *GetBufferAs<cmds::GetShaderInfoLog>();
988 void* next_cmd =
989 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
990 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderInfoLog::kCmdId),
991 cmd.header.command);
992 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
993 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
994 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
995 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
998 TEST_F(GLES2FormatTest, GetShaderPrecisionFormat) {
999 cmds::GetShaderPrecisionFormat& cmd =
1000 *GetBufferAs<cmds::GetShaderPrecisionFormat>();
1001 void* next_cmd =
1002 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1003 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1004 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderPrecisionFormat::kCmdId),
1005 cmd.header.command);
1006 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1007 EXPECT_EQ(static_cast<GLenum>(11), cmd.shadertype);
1008 EXPECT_EQ(static_cast<GLenum>(12), cmd.precisiontype);
1009 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_id);
1010 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_offset);
1011 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1014 TEST_F(GLES2FormatTest, GetShaderSource) {
1015 cmds::GetShaderSource& cmd = *GetBufferAs<cmds::GetShaderSource>();
1016 void* next_cmd =
1017 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
1018 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderSource::kCmdId),
1019 cmd.header.command);
1020 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1021 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1022 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
1023 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1026 TEST_F(GLES2FormatTest, GetString) {
1027 cmds::GetString& cmd = *GetBufferAs<cmds::GetString>();
1028 void* next_cmd =
1029 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12));
1030 EXPECT_EQ(static_cast<uint32_t>(cmds::GetString::kCmdId), cmd.header.command);
1031 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1032 EXPECT_EQ(static_cast<GLenum>(11), cmd.name);
1033 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
1034 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1037 TEST_F(GLES2FormatTest, GetTexParameterfv) {
1038 cmds::GetTexParameterfv& cmd = *GetBufferAs<cmds::GetTexParameterfv>();
1039 void* next_cmd =
1040 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1041 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1042 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameterfv::kCmdId),
1043 cmd.header.command);
1044 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1045 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1046 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1047 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1048 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1049 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1052 TEST_F(GLES2FormatTest, GetTexParameteriv) {
1053 cmds::GetTexParameteriv& cmd = *GetBufferAs<cmds::GetTexParameteriv>();
1054 void* next_cmd =
1055 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1056 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1057 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameteriv::kCmdId),
1058 cmd.header.command);
1059 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1060 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1061 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1062 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1063 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1064 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1067 TEST_F(GLES2FormatTest, GetUniformfv) {
1068 cmds::GetUniformfv& cmd = *GetBufferAs<cmds::GetUniformfv>();
1069 void* next_cmd =
1070 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
1071 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1072 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformfv::kCmdId),
1073 cmd.header.command);
1074 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1075 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1076 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
1077 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1078 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1079 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1082 TEST_F(GLES2FormatTest, GetUniformiv) {
1083 cmds::GetUniformiv& cmd = *GetBufferAs<cmds::GetUniformiv>();
1084 void* next_cmd =
1085 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
1086 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1087 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformiv::kCmdId),
1088 cmd.header.command);
1089 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1090 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1091 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
1092 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1093 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1094 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1097 TEST_F(GLES2FormatTest, GetUniformLocation) {
1098 cmds::GetUniformLocation& cmd = *GetBufferAs<cmds::GetUniformLocation>();
1099 void* next_cmd =
1100 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1101 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1102 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformLocation::kCmdId),
1103 cmd.header.command);
1104 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1105 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1106 EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
1107 EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
1108 EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
1109 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1112 TEST_F(GLES2FormatTest, GetVertexAttribfv) {
1113 cmds::GetVertexAttribfv& cmd = *GetBufferAs<cmds::GetVertexAttribfv>();
1114 void* next_cmd =
1115 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1116 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1117 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribfv::kCmdId),
1118 cmd.header.command);
1119 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1120 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1121 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1122 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1123 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1124 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1127 TEST_F(GLES2FormatTest, GetVertexAttribiv) {
1128 cmds::GetVertexAttribiv& cmd = *GetBufferAs<cmds::GetVertexAttribiv>();
1129 void* next_cmd =
1130 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1131 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1132 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribiv::kCmdId),
1133 cmd.header.command);
1134 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1135 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1136 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1137 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1138 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1139 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1142 TEST_F(GLES2FormatTest, GetVertexAttribPointerv) {
1143 cmds::GetVertexAttribPointerv& cmd =
1144 *GetBufferAs<cmds::GetVertexAttribPointerv>();
1145 void* next_cmd =
1146 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1147 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1148 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribPointerv::kCmdId),
1149 cmd.header.command);
1150 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1151 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1152 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1153 EXPECT_EQ(static_cast<uint32_t>(13), cmd.pointer_shm_id);
1154 EXPECT_EQ(static_cast<uint32_t>(14), cmd.pointer_shm_offset);
1155 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1158 TEST_F(GLES2FormatTest, Hint) {
1159 cmds::Hint& cmd = *GetBufferAs<cmds::Hint>();
1160 void* next_cmd =
1161 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
1162 EXPECT_EQ(static_cast<uint32_t>(cmds::Hint::kCmdId), cmd.header.command);
1163 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1164 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1165 EXPECT_EQ(static_cast<GLenum>(12), cmd.mode);
1166 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1169 TEST_F(GLES2FormatTest, IsBuffer) {
1170 cmds::IsBuffer& cmd = *GetBufferAs<cmds::IsBuffer>();
1171 void* next_cmd =
1172 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1173 static_cast<uint32_t>(13));
1174 EXPECT_EQ(static_cast<uint32_t>(cmds::IsBuffer::kCmdId), cmd.header.command);
1175 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1176 EXPECT_EQ(static_cast<GLuint>(11), cmd.buffer);
1177 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1178 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1179 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1182 TEST_F(GLES2FormatTest, IsEnabled) {
1183 cmds::IsEnabled& cmd = *GetBufferAs<cmds::IsEnabled>();
1184 void* next_cmd =
1185 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
1186 static_cast<uint32_t>(13));
1187 EXPECT_EQ(static_cast<uint32_t>(cmds::IsEnabled::kCmdId), cmd.header.command);
1188 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1189 EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
1190 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1191 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1192 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1195 TEST_F(GLES2FormatTest, IsFramebuffer) {
1196 cmds::IsFramebuffer& cmd = *GetBufferAs<cmds::IsFramebuffer>();
1197 void* next_cmd =
1198 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1199 static_cast<uint32_t>(13));
1200 EXPECT_EQ(static_cast<uint32_t>(cmds::IsFramebuffer::kCmdId),
1201 cmd.header.command);
1202 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1203 EXPECT_EQ(static_cast<GLuint>(11), cmd.framebuffer);
1204 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1205 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1206 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1209 TEST_F(GLES2FormatTest, IsProgram) {
1210 cmds::IsProgram& cmd = *GetBufferAs<cmds::IsProgram>();
1211 void* next_cmd =
1212 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1213 static_cast<uint32_t>(13));
1214 EXPECT_EQ(static_cast<uint32_t>(cmds::IsProgram::kCmdId), cmd.header.command);
1215 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1216 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1217 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1218 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1219 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1222 TEST_F(GLES2FormatTest, IsRenderbuffer) {
1223 cmds::IsRenderbuffer& cmd = *GetBufferAs<cmds::IsRenderbuffer>();
1224 void* next_cmd =
1225 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1226 static_cast<uint32_t>(13));
1227 EXPECT_EQ(static_cast<uint32_t>(cmds::IsRenderbuffer::kCmdId),
1228 cmd.header.command);
1229 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1230 EXPECT_EQ(static_cast<GLuint>(11), cmd.renderbuffer);
1231 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1232 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1233 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1236 TEST_F(GLES2FormatTest, IsShader) {
1237 cmds::IsShader& cmd = *GetBufferAs<cmds::IsShader>();
1238 void* next_cmd =
1239 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1240 static_cast<uint32_t>(13));
1241 EXPECT_EQ(static_cast<uint32_t>(cmds::IsShader::kCmdId), cmd.header.command);
1242 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1243 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1244 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1245 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1246 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1249 TEST_F(GLES2FormatTest, IsTexture) {
1250 cmds::IsTexture& cmd = *GetBufferAs<cmds::IsTexture>();
1251 void* next_cmd =
1252 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1253 static_cast<uint32_t>(13));
1254 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTexture::kCmdId), cmd.header.command);
1255 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1256 EXPECT_EQ(static_cast<GLuint>(11), cmd.texture);
1257 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1258 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1259 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1262 TEST_F(GLES2FormatTest, LineWidth) {
1263 cmds::LineWidth& cmd = *GetBufferAs<cmds::LineWidth>();
1264 void* next_cmd = cmd.Set(&cmd, static_cast<GLfloat>(11));
1265 EXPECT_EQ(static_cast<uint32_t>(cmds::LineWidth::kCmdId), cmd.header.command);
1266 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1267 EXPECT_EQ(static_cast<GLfloat>(11), cmd.width);
1268 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1271 TEST_F(GLES2FormatTest, LinkProgram) {
1272 cmds::LinkProgram& cmd = *GetBufferAs<cmds::LinkProgram>();
1273 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
1274 EXPECT_EQ(static_cast<uint32_t>(cmds::LinkProgram::kCmdId),
1275 cmd.header.command);
1276 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1277 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1278 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1281 TEST_F(GLES2FormatTest, PixelStorei) {
1282 cmds::PixelStorei& cmd = *GetBufferAs<cmds::PixelStorei>();
1283 void* next_cmd =
1284 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12));
1285 EXPECT_EQ(static_cast<uint32_t>(cmds::PixelStorei::kCmdId),
1286 cmd.header.command);
1287 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1288 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1289 EXPECT_EQ(static_cast<GLint>(12), cmd.param);
1290 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1293 TEST_F(GLES2FormatTest, PolygonOffset) {
1294 cmds::PolygonOffset& cmd = *GetBufferAs<cmds::PolygonOffset>();
1295 void* next_cmd =
1296 cmd.Set(&cmd, static_cast<GLfloat>(11), static_cast<GLfloat>(12));
1297 EXPECT_EQ(static_cast<uint32_t>(cmds::PolygonOffset::kCmdId),
1298 cmd.header.command);
1299 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1300 EXPECT_EQ(static_cast<GLfloat>(11), cmd.factor);
1301 EXPECT_EQ(static_cast<GLfloat>(12), cmd.units);
1302 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1305 TEST_F(GLES2FormatTest, ReadPixels) {
1306 cmds::ReadPixels& cmd = *GetBufferAs<cmds::ReadPixels>();
1307 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
1308 static_cast<GLsizei>(13), static_cast<GLsizei>(14),
1309 static_cast<GLenum>(15), static_cast<GLenum>(16),
1310 static_cast<uint32_t>(17), static_cast<uint32_t>(18),
1311 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
1312 static_cast<GLboolean>(21));
1313 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadPixels::kCmdId),
1314 cmd.header.command);
1315 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1316 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
1317 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
1318 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
1319 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
1320 EXPECT_EQ(static_cast<GLenum>(15), cmd.format);
1321 EXPECT_EQ(static_cast<GLenum>(16), cmd.type);
1322 EXPECT_EQ(static_cast<uint32_t>(17), cmd.pixels_shm_id);
1323 EXPECT_EQ(static_cast<uint32_t>(18), cmd.pixels_shm_offset);
1324 EXPECT_EQ(static_cast<uint32_t>(19), cmd.result_shm_id);
1325 EXPECT_EQ(static_cast<uint32_t>(20), cmd.result_shm_offset);
1326 EXPECT_EQ(static_cast<GLboolean>(21), cmd.async);
1327 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1330 TEST_F(GLES2FormatTest, ReleaseShaderCompiler) {
1331 cmds::ReleaseShaderCompiler& cmd =
1332 *GetBufferAs<cmds::ReleaseShaderCompiler>();
1333 void* next_cmd = cmd.Set(&cmd);
1334 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseShaderCompiler::kCmdId),
1335 cmd.header.command);
1336 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1337 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1340 TEST_F(GLES2FormatTest, RenderbufferStorage) {
1341 cmds::RenderbufferStorage& cmd = *GetBufferAs<cmds::RenderbufferStorage>();
1342 void* next_cmd =
1343 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1344 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
1345 EXPECT_EQ(static_cast<uint32_t>(cmds::RenderbufferStorage::kCmdId),
1346 cmd.header.command);
1347 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1348 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1349 EXPECT_EQ(static_cast<GLenum>(12), cmd.internalformat);
1350 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
1351 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
1352 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1355 TEST_F(GLES2FormatTest, SampleCoverage) {
1356 cmds::SampleCoverage& cmd = *GetBufferAs<cmds::SampleCoverage>();
1357 void* next_cmd =
1358 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLboolean>(12));
1359 EXPECT_EQ(static_cast<uint32_t>(cmds::SampleCoverage::kCmdId),
1360 cmd.header.command);
1361 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1362 EXPECT_EQ(static_cast<GLclampf>(11), cmd.value);
1363 EXPECT_EQ(static_cast<GLboolean>(12), cmd.invert);
1364 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1367 TEST_F(GLES2FormatTest, Scissor) {
1368 cmds::Scissor& cmd = *GetBufferAs<cmds::Scissor>();
1369 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
1370 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
1371 EXPECT_EQ(static_cast<uint32_t>(cmds::Scissor::kCmdId), cmd.header.command);
1372 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1373 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
1374 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
1375 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
1376 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
1377 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1380 TEST_F(GLES2FormatTest, ShaderBinary) {
1381 cmds::ShaderBinary& cmd = *GetBufferAs<cmds::ShaderBinary>();
1382 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(11),
1383 static_cast<uint32_t>(12), static_cast<uint32_t>(13),
1384 static_cast<GLenum>(14), static_cast<uint32_t>(15),
1385 static_cast<uint32_t>(16), static_cast<GLsizei>(17));
1386 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderBinary::kCmdId),
1387 cmd.header.command);
1388 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1389 EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
1390 EXPECT_EQ(static_cast<uint32_t>(12), cmd.shaders_shm_id);
1391 EXPECT_EQ(static_cast<uint32_t>(13), cmd.shaders_shm_offset);
1392 EXPECT_EQ(static_cast<GLenum>(14), cmd.binaryformat);
1393 EXPECT_EQ(static_cast<uint32_t>(15), cmd.binary_shm_id);
1394 EXPECT_EQ(static_cast<uint32_t>(16), cmd.binary_shm_offset);
1395 EXPECT_EQ(static_cast<GLsizei>(17), cmd.length);
1396 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1399 TEST_F(GLES2FormatTest, ShaderSourceBucket) {
1400 cmds::ShaderSourceBucket& cmd = *GetBufferAs<cmds::ShaderSourceBucket>();
1401 void* next_cmd =
1402 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
1403 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderSourceBucket::kCmdId),
1404 cmd.header.command);
1405 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1406 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1407 EXPECT_EQ(static_cast<uint32_t>(12), cmd.data_bucket_id);
1408 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1411 TEST_F(GLES2FormatTest, StencilFunc) {
1412 cmds::StencilFunc& cmd = *GetBufferAs<cmds::StencilFunc>();
1413 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
1414 static_cast<GLint>(12), static_cast<GLuint>(13));
1415 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFunc::kCmdId),
1416 cmd.header.command);
1417 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1418 EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
1419 EXPECT_EQ(static_cast<GLint>(12), cmd.ref);
1420 EXPECT_EQ(static_cast<GLuint>(13), cmd.mask);
1421 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1424 TEST_F(GLES2FormatTest, StencilFuncSeparate) {
1425 cmds::StencilFuncSeparate& cmd = *GetBufferAs<cmds::StencilFuncSeparate>();
1426 void* next_cmd =
1427 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1428 static_cast<GLint>(13), static_cast<GLuint>(14));
1429 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFuncSeparate::kCmdId),
1430 cmd.header.command);
1431 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1432 EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
1433 EXPECT_EQ(static_cast<GLenum>(12), cmd.func);
1434 EXPECT_EQ(static_cast<GLint>(13), cmd.ref);
1435 EXPECT_EQ(static_cast<GLuint>(14), cmd.mask);
1436 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1439 TEST_F(GLES2FormatTest, StencilMask) {
1440 cmds::StencilMask& cmd = *GetBufferAs<cmds::StencilMask>();
1441 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
1442 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMask::kCmdId),
1443 cmd.header.command);
1444 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1445 EXPECT_EQ(static_cast<GLuint>(11), cmd.mask);
1446 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1449 TEST_F(GLES2FormatTest, StencilMaskSeparate) {
1450 cmds::StencilMaskSeparate& cmd = *GetBufferAs<cmds::StencilMaskSeparate>();
1451 void* next_cmd =
1452 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
1453 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMaskSeparate::kCmdId),
1454 cmd.header.command);
1455 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1456 EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
1457 EXPECT_EQ(static_cast<GLuint>(12), cmd.mask);
1458 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1461 TEST_F(GLES2FormatTest, StencilOp) {
1462 cmds::StencilOp& cmd = *GetBufferAs<cmds::StencilOp>();
1463 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
1464 static_cast<GLenum>(12), static_cast<GLenum>(13));
1465 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOp::kCmdId), cmd.header.command);
1466 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1467 EXPECT_EQ(static_cast<GLenum>(11), cmd.fail);
1468 EXPECT_EQ(static_cast<GLenum>(12), cmd.zfail);
1469 EXPECT_EQ(static_cast<GLenum>(13), cmd.zpass);
1470 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1473 TEST_F(GLES2FormatTest, StencilOpSeparate) {
1474 cmds::StencilOpSeparate& cmd = *GetBufferAs<cmds::StencilOpSeparate>();
1475 void* next_cmd =
1476 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1477 static_cast<GLenum>(13), static_cast<GLenum>(14));
1478 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOpSeparate::kCmdId),
1479 cmd.header.command);
1480 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1481 EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
1482 EXPECT_EQ(static_cast<GLenum>(12), cmd.fail);
1483 EXPECT_EQ(static_cast<GLenum>(13), cmd.zfail);
1484 EXPECT_EQ(static_cast<GLenum>(14), cmd.zpass);
1485 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1488 TEST_F(GLES2FormatTest, TexImage2D) {
1489 cmds::TexImage2D& cmd = *GetBufferAs<cmds::TexImage2D>();
1490 void* next_cmd =
1491 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
1492 static_cast<GLint>(13), static_cast<GLsizei>(14),
1493 static_cast<GLsizei>(15), static_cast<GLenum>(16),
1494 static_cast<GLenum>(17), static_cast<uint32_t>(18),
1495 static_cast<uint32_t>(19));
1496 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage2D::kCmdId),
1497 cmd.header.command);
1498 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1499 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1500 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
1501 EXPECT_EQ(static_cast<GLint>(13), cmd.internalformat);
1502 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
1503 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
1504 EXPECT_EQ(static_cast<GLenum>(16), cmd.format);
1505 EXPECT_EQ(static_cast<GLenum>(17), cmd.type);
1506 EXPECT_EQ(static_cast<uint32_t>(18), cmd.pixels_shm_id);
1507 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_offset);
1508 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1511 TEST_F(GLES2FormatTest, TexParameterf) {
1512 cmds::TexParameterf& cmd = *GetBufferAs<cmds::TexParameterf>();
1513 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
1514 static_cast<GLenum>(12), static_cast<GLfloat>(13));
1515 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterf::kCmdId),
1516 cmd.header.command);
1517 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1518 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1519 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1520 EXPECT_EQ(static_cast<GLfloat>(13), cmd.param);
1521 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1524 TEST_F(GLES2FormatTest, TexParameterfvImmediate) {
1525 const int kSomeBaseValueToTestWith = 51;
1526 static GLfloat data[] = {
1527 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1529 cmds::TexParameterfvImmediate& cmd =
1530 *GetBufferAs<cmds::TexParameterfvImmediate>();
1531 void* next_cmd =
1532 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12), data);
1533 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterfvImmediate::kCmdId),
1534 cmd.header.command);
1535 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
1536 cmd.header.size * 4u);
1537 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1538 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1539 CheckBytesWrittenMatchesExpectedSize(
1540 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1541 // TODO(gman): Check that data was inserted;
1544 TEST_F(GLES2FormatTest, TexParameteri) {
1545 cmds::TexParameteri& cmd = *GetBufferAs<cmds::TexParameteri>();
1546 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
1547 static_cast<GLenum>(12), static_cast<GLint>(13));
1548 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameteri::kCmdId),
1549 cmd.header.command);
1550 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1551 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1552 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1553 EXPECT_EQ(static_cast<GLint>(13), cmd.param);
1554 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1557 TEST_F(GLES2FormatTest, TexParameterivImmediate) {
1558 const int kSomeBaseValueToTestWith = 51;
1559 static GLint data[] = {
1560 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
1562 cmds::TexParameterivImmediate& cmd =
1563 *GetBufferAs<cmds::TexParameterivImmediate>();
1564 void* next_cmd =
1565 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12), data);
1566 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterivImmediate::kCmdId),
1567 cmd.header.command);
1568 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
1569 cmd.header.size * 4u);
1570 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1571 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1572 CheckBytesWrittenMatchesExpectedSize(
1573 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1574 // TODO(gman): Check that data was inserted;
1577 TEST_F(GLES2FormatTest, TexSubImage2D) {
1578 cmds::TexSubImage2D& cmd = *GetBufferAs<cmds::TexSubImage2D>();
1579 void* next_cmd = cmd.Set(
1580 &cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
1581 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLsizei>(15),
1582 static_cast<GLsizei>(16), static_cast<GLenum>(17),
1583 static_cast<GLenum>(18), static_cast<uint32_t>(19),
1584 static_cast<uint32_t>(20), static_cast<GLboolean>(21));
1585 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage2D::kCmdId),
1586 cmd.header.command);
1587 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1588 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1589 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
1590 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
1591 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
1592 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
1593 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
1594 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
1595 EXPECT_EQ(static_cast<GLenum>(18), cmd.type);
1596 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_id);
1597 EXPECT_EQ(static_cast<uint32_t>(20), cmd.pixels_shm_offset);
1598 EXPECT_EQ(static_cast<GLboolean>(21), cmd.internal);
1599 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1602 TEST_F(GLES2FormatTest, Uniform1f) {
1603 cmds::Uniform1f& cmd = *GetBufferAs<cmds::Uniform1f>();
1604 void* next_cmd =
1605 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLfloat>(12));
1606 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1f::kCmdId), cmd.header.command);
1607 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1608 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1609 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
1610 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1613 TEST_F(GLES2FormatTest, Uniform1fvImmediate) {
1614 const int kSomeBaseValueToTestWith = 51;
1615 static GLfloat data[] = {
1616 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1617 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1619 cmds::Uniform1fvImmediate& cmd = *GetBufferAs<cmds::Uniform1fvImmediate>();
1620 const GLsizei kNumElements = 2;
1621 const size_t kExpectedCmdSize =
1622 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 1;
1623 void* next_cmd =
1624 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1625 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1fvImmediate::kCmdId),
1626 cmd.header.command);
1627 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1628 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1629 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1630 CheckBytesWrittenMatchesExpectedSize(
1631 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1632 // TODO(gman): Check that data was inserted;
1635 TEST_F(GLES2FormatTest, Uniform1i) {
1636 cmds::Uniform1i& cmd = *GetBufferAs<cmds::Uniform1i>();
1637 void* next_cmd =
1638 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12));
1639 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1i::kCmdId), cmd.header.command);
1640 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1641 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1642 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
1643 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1646 TEST_F(GLES2FormatTest, Uniform1ivImmediate) {
1647 const int kSomeBaseValueToTestWith = 51;
1648 static GLint data[] = {
1649 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
1650 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
1652 cmds::Uniform1ivImmediate& cmd = *GetBufferAs<cmds::Uniform1ivImmediate>();
1653 const GLsizei kNumElements = 2;
1654 const size_t kExpectedCmdSize =
1655 sizeof(cmd) + kNumElements * sizeof(GLint) * 1;
1656 void* next_cmd =
1657 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1658 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ivImmediate::kCmdId),
1659 cmd.header.command);
1660 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1661 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1662 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1663 CheckBytesWrittenMatchesExpectedSize(
1664 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1665 // TODO(gman): Check that data was inserted;
1668 TEST_F(GLES2FormatTest, Uniform2f) {
1669 cmds::Uniform2f& cmd = *GetBufferAs<cmds::Uniform2f>();
1670 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
1671 static_cast<GLfloat>(12), static_cast<GLfloat>(13));
1672 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2f::kCmdId), cmd.header.command);
1673 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1674 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1675 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
1676 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
1677 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1680 TEST_F(GLES2FormatTest, Uniform2fvImmediate) {
1681 const int kSomeBaseValueToTestWith = 51;
1682 static GLfloat data[] = {
1683 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1684 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1685 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
1686 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
1688 cmds::Uniform2fvImmediate& cmd = *GetBufferAs<cmds::Uniform2fvImmediate>();
1689 const GLsizei kNumElements = 2;
1690 const size_t kExpectedCmdSize =
1691 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 2;
1692 void* next_cmd =
1693 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1694 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2fvImmediate::kCmdId),
1695 cmd.header.command);
1696 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1697 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1698 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1699 CheckBytesWrittenMatchesExpectedSize(
1700 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1701 // TODO(gman): Check that data was inserted;
1704 TEST_F(GLES2FormatTest, Uniform2i) {
1705 cmds::Uniform2i& cmd = *GetBufferAs<cmds::Uniform2i>();
1706 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
1707 static_cast<GLint>(13));
1708 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2i::kCmdId), cmd.header.command);
1709 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1710 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1711 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
1712 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
1713 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1716 TEST_F(GLES2FormatTest, Uniform2ivImmediate) {
1717 const int kSomeBaseValueToTestWith = 51;
1718 static GLint data[] = {
1719 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
1720 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
1721 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
1722 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
1724 cmds::Uniform2ivImmediate& cmd = *GetBufferAs<cmds::Uniform2ivImmediate>();
1725 const GLsizei kNumElements = 2;
1726 const size_t kExpectedCmdSize =
1727 sizeof(cmd) + kNumElements * sizeof(GLint) * 2;
1728 void* next_cmd =
1729 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1730 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ivImmediate::kCmdId),
1731 cmd.header.command);
1732 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1733 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1734 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1735 CheckBytesWrittenMatchesExpectedSize(
1736 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1737 // TODO(gman): Check that data was inserted;
1740 TEST_F(GLES2FormatTest, Uniform3f) {
1741 cmds::Uniform3f& cmd = *GetBufferAs<cmds::Uniform3f>();
1742 void* next_cmd =
1743 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLfloat>(12),
1744 static_cast<GLfloat>(13), static_cast<GLfloat>(14));
1745 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3f::kCmdId), cmd.header.command);
1746 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1747 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1748 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
1749 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
1750 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
1751 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1754 TEST_F(GLES2FormatTest, Uniform3fvImmediate) {
1755 const int kSomeBaseValueToTestWith = 51;
1756 static GLfloat data[] = {
1757 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1758 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1759 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
1760 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
1761 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
1762 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
1764 cmds::Uniform3fvImmediate& cmd = *GetBufferAs<cmds::Uniform3fvImmediate>();
1765 const GLsizei kNumElements = 2;
1766 const size_t kExpectedCmdSize =
1767 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 3;
1768 void* next_cmd =
1769 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1770 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3fvImmediate::kCmdId),
1771 cmd.header.command);
1772 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1773 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1774 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1775 CheckBytesWrittenMatchesExpectedSize(
1776 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1777 // TODO(gman): Check that data was inserted;
1780 TEST_F(GLES2FormatTest, Uniform3i) {
1781 cmds::Uniform3i& cmd = *GetBufferAs<cmds::Uniform3i>();
1782 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
1783 static_cast<GLint>(13), static_cast<GLint>(14));
1784 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3i::kCmdId), cmd.header.command);
1785 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1786 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1787 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
1788 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
1789 EXPECT_EQ(static_cast<GLint>(14), cmd.z);
1790 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1793 TEST_F(GLES2FormatTest, Uniform3ivImmediate) {
1794 const int kSomeBaseValueToTestWith = 51;
1795 static GLint data[] = {
1796 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
1797 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
1798 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
1799 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
1800 static_cast<GLint>(kSomeBaseValueToTestWith + 4),
1801 static_cast<GLint>(kSomeBaseValueToTestWith + 5),
1803 cmds::Uniform3ivImmediate& cmd = *GetBufferAs<cmds::Uniform3ivImmediate>();
1804 const GLsizei kNumElements = 2;
1805 const size_t kExpectedCmdSize =
1806 sizeof(cmd) + kNumElements * sizeof(GLint) * 3;
1807 void* next_cmd =
1808 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1809 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ivImmediate::kCmdId),
1810 cmd.header.command);
1811 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1812 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1813 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1814 CheckBytesWrittenMatchesExpectedSize(
1815 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1816 // TODO(gman): Check that data was inserted;
1819 TEST_F(GLES2FormatTest, Uniform4f) {
1820 cmds::Uniform4f& cmd = *GetBufferAs<cmds::Uniform4f>();
1821 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
1822 static_cast<GLfloat>(12), static_cast<GLfloat>(13),
1823 static_cast<GLfloat>(14), static_cast<GLfloat>(15));
1824 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4f::kCmdId), cmd.header.command);
1825 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1826 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1827 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
1828 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
1829 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
1830 EXPECT_EQ(static_cast<GLfloat>(15), cmd.w);
1831 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1834 TEST_F(GLES2FormatTest, Uniform4fvImmediate) {
1835 const int kSomeBaseValueToTestWith = 51;
1836 static GLfloat data[] = {
1837 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1838 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1839 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
1840 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
1841 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
1842 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
1843 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
1844 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
1846 cmds::Uniform4fvImmediate& cmd = *GetBufferAs<cmds::Uniform4fvImmediate>();
1847 const GLsizei kNumElements = 2;
1848 const size_t kExpectedCmdSize =
1849 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 4;
1850 void* next_cmd =
1851 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1852 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4fvImmediate::kCmdId),
1853 cmd.header.command);
1854 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1855 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1856 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1857 CheckBytesWrittenMatchesExpectedSize(
1858 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1859 // TODO(gman): Check that data was inserted;
1862 TEST_F(GLES2FormatTest, Uniform4i) {
1863 cmds::Uniform4i& cmd = *GetBufferAs<cmds::Uniform4i>();
1864 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
1865 static_cast<GLint>(13), static_cast<GLint>(14),
1866 static_cast<GLint>(15));
1867 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4i::kCmdId), cmd.header.command);
1868 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1869 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
1870 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
1871 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
1872 EXPECT_EQ(static_cast<GLint>(14), cmd.z);
1873 EXPECT_EQ(static_cast<GLint>(15), cmd.w);
1874 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1877 TEST_F(GLES2FormatTest, Uniform4ivImmediate) {
1878 const int kSomeBaseValueToTestWith = 51;
1879 static GLint data[] = {
1880 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
1881 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
1882 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
1883 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
1884 static_cast<GLint>(kSomeBaseValueToTestWith + 4),
1885 static_cast<GLint>(kSomeBaseValueToTestWith + 5),
1886 static_cast<GLint>(kSomeBaseValueToTestWith + 6),
1887 static_cast<GLint>(kSomeBaseValueToTestWith + 7),
1889 cmds::Uniform4ivImmediate& cmd = *GetBufferAs<cmds::Uniform4ivImmediate>();
1890 const GLsizei kNumElements = 2;
1891 const size_t kExpectedCmdSize =
1892 sizeof(cmd) + kNumElements * sizeof(GLint) * 4;
1893 void* next_cmd =
1894 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1895 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ivImmediate::kCmdId),
1896 cmd.header.command);
1897 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1898 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1899 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1900 CheckBytesWrittenMatchesExpectedSize(
1901 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1902 // TODO(gman): Check that data was inserted;
1905 TEST_F(GLES2FormatTest, UniformMatrix2fvImmediate) {
1906 const int kSomeBaseValueToTestWith = 51;
1907 static GLfloat data[] = {
1908 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1909 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1910 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
1911 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
1912 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
1913 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
1914 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
1915 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
1917 cmds::UniformMatrix2fvImmediate& cmd =
1918 *GetBufferAs<cmds::UniformMatrix2fvImmediate>();
1919 const GLsizei kNumElements = 2;
1920 const size_t kExpectedCmdSize =
1921 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 4;
1922 void* next_cmd =
1923 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1924 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2fvImmediate::kCmdId),
1925 cmd.header.command);
1926 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1927 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1928 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1929 CheckBytesWrittenMatchesExpectedSize(
1930 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1931 // TODO(gman): Check that data was inserted;
1934 TEST_F(GLES2FormatTest, UniformMatrix3fvImmediate) {
1935 const int kSomeBaseValueToTestWith = 51;
1936 static GLfloat data[] = {
1937 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1938 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1939 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
1940 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
1941 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
1942 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
1943 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
1944 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
1945 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
1946 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
1947 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
1948 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
1949 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
1950 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
1951 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
1952 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
1953 static_cast<GLfloat>(kSomeBaseValueToTestWith + 16),
1954 static_cast<GLfloat>(kSomeBaseValueToTestWith + 17),
1956 cmds::UniformMatrix3fvImmediate& cmd =
1957 *GetBufferAs<cmds::UniformMatrix3fvImmediate>();
1958 const GLsizei kNumElements = 2;
1959 const size_t kExpectedCmdSize =
1960 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 9;
1961 void* next_cmd =
1962 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
1963 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3fvImmediate::kCmdId),
1964 cmd.header.command);
1965 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1966 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
1967 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1968 CheckBytesWrittenMatchesExpectedSize(
1969 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1970 // TODO(gman): Check that data was inserted;
1973 TEST_F(GLES2FormatTest, UniformMatrix4fvImmediate) {
1974 const int kSomeBaseValueToTestWith = 51;
1975 static GLfloat data[] = {
1976 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
1977 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
1978 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
1979 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
1980 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
1981 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
1982 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
1983 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
1984 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
1985 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
1986 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
1987 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
1988 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
1989 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
1990 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
1991 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
1992 static_cast<GLfloat>(kSomeBaseValueToTestWith + 16),
1993 static_cast<GLfloat>(kSomeBaseValueToTestWith + 17),
1994 static_cast<GLfloat>(kSomeBaseValueToTestWith + 18),
1995 static_cast<GLfloat>(kSomeBaseValueToTestWith + 19),
1996 static_cast<GLfloat>(kSomeBaseValueToTestWith + 20),
1997 static_cast<GLfloat>(kSomeBaseValueToTestWith + 21),
1998 static_cast<GLfloat>(kSomeBaseValueToTestWith + 22),
1999 static_cast<GLfloat>(kSomeBaseValueToTestWith + 23),
2000 static_cast<GLfloat>(kSomeBaseValueToTestWith + 24),
2001 static_cast<GLfloat>(kSomeBaseValueToTestWith + 25),
2002 static_cast<GLfloat>(kSomeBaseValueToTestWith + 26),
2003 static_cast<GLfloat>(kSomeBaseValueToTestWith + 27),
2004 static_cast<GLfloat>(kSomeBaseValueToTestWith + 28),
2005 static_cast<GLfloat>(kSomeBaseValueToTestWith + 29),
2006 static_cast<GLfloat>(kSomeBaseValueToTestWith + 30),
2007 static_cast<GLfloat>(kSomeBaseValueToTestWith + 31),
2009 cmds::UniformMatrix4fvImmediate& cmd =
2010 *GetBufferAs<cmds::UniformMatrix4fvImmediate>();
2011 const GLsizei kNumElements = 2;
2012 const size_t kExpectedCmdSize =
2013 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 16;
2014 void* next_cmd =
2015 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2016 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4fvImmediate::kCmdId),
2017 cmd.header.command);
2018 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2019 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2020 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2021 CheckBytesWrittenMatchesExpectedSize(
2022 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2023 // TODO(gman): Check that data was inserted;
2026 TEST_F(GLES2FormatTest, UseProgram) {
2027 cmds::UseProgram& cmd = *GetBufferAs<cmds::UseProgram>();
2028 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2029 EXPECT_EQ(static_cast<uint32_t>(cmds::UseProgram::kCmdId),
2030 cmd.header.command);
2031 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2032 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
2033 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2036 TEST_F(GLES2FormatTest, ValidateProgram) {
2037 cmds::ValidateProgram& cmd = *GetBufferAs<cmds::ValidateProgram>();
2038 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2039 EXPECT_EQ(static_cast<uint32_t>(cmds::ValidateProgram::kCmdId),
2040 cmd.header.command);
2041 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2042 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
2043 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2046 TEST_F(GLES2FormatTest, VertexAttrib1f) {
2047 cmds::VertexAttrib1f& cmd = *GetBufferAs<cmds::VertexAttrib1f>();
2048 void* next_cmd =
2049 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLfloat>(12));
2050 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1f::kCmdId),
2051 cmd.header.command);
2052 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2053 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2054 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2055 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2058 TEST_F(GLES2FormatTest, VertexAttrib1fvImmediate) {
2059 const int kSomeBaseValueToTestWith = 51;
2060 static GLfloat data[] = {
2061 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2063 cmds::VertexAttrib1fvImmediate& cmd =
2064 *GetBufferAs<cmds::VertexAttrib1fvImmediate>();
2065 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
2066 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1fvImmediate::kCmdId),
2067 cmd.header.command);
2068 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2069 cmd.header.size * 4u);
2070 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2071 CheckBytesWrittenMatchesExpectedSize(
2072 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2073 // TODO(gman): Check that data was inserted;
2076 TEST_F(GLES2FormatTest, VertexAttrib2f) {
2077 cmds::VertexAttrib2f& cmd = *GetBufferAs<cmds::VertexAttrib2f>();
2078 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2079 static_cast<GLfloat>(12), static_cast<GLfloat>(13));
2080 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2f::kCmdId),
2081 cmd.header.command);
2082 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2083 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2084 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2085 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
2086 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2089 TEST_F(GLES2FormatTest, VertexAttrib2fvImmediate) {
2090 const int kSomeBaseValueToTestWith = 51;
2091 static GLfloat data[] = {
2092 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2093 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2095 cmds::VertexAttrib2fvImmediate& cmd =
2096 *GetBufferAs<cmds::VertexAttrib2fvImmediate>();
2097 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
2098 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2fvImmediate::kCmdId),
2099 cmd.header.command);
2100 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2101 cmd.header.size * 4u);
2102 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2103 CheckBytesWrittenMatchesExpectedSize(
2104 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2105 // TODO(gman): Check that data was inserted;
2108 TEST_F(GLES2FormatTest, VertexAttrib3f) {
2109 cmds::VertexAttrib3f& cmd = *GetBufferAs<cmds::VertexAttrib3f>();
2110 void* next_cmd =
2111 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLfloat>(12),
2112 static_cast<GLfloat>(13), static_cast<GLfloat>(14));
2113 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3f::kCmdId),
2114 cmd.header.command);
2115 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2116 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2117 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2118 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
2119 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
2120 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2123 TEST_F(GLES2FormatTest, VertexAttrib3fvImmediate) {
2124 const int kSomeBaseValueToTestWith = 51;
2125 static GLfloat data[] = {
2126 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2127 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2128 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
2130 cmds::VertexAttrib3fvImmediate& cmd =
2131 *GetBufferAs<cmds::VertexAttrib3fvImmediate>();
2132 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
2133 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3fvImmediate::kCmdId),
2134 cmd.header.command);
2135 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2136 cmd.header.size * 4u);
2137 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2138 CheckBytesWrittenMatchesExpectedSize(
2139 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2140 // TODO(gman): Check that data was inserted;
2143 TEST_F(GLES2FormatTest, VertexAttrib4f) {
2144 cmds::VertexAttrib4f& cmd = *GetBufferAs<cmds::VertexAttrib4f>();
2145 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2146 static_cast<GLfloat>(12), static_cast<GLfloat>(13),
2147 static_cast<GLfloat>(14), static_cast<GLfloat>(15));
2148 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4f::kCmdId),
2149 cmd.header.command);
2150 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2151 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2152 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2153 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
2154 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
2155 EXPECT_EQ(static_cast<GLfloat>(15), cmd.w);
2156 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2159 TEST_F(GLES2FormatTest, VertexAttrib4fvImmediate) {
2160 const int kSomeBaseValueToTestWith = 51;
2161 static GLfloat data[] = {
2162 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2163 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2164 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
2165 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
2167 cmds::VertexAttrib4fvImmediate& cmd =
2168 *GetBufferAs<cmds::VertexAttrib4fvImmediate>();
2169 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
2170 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4fvImmediate::kCmdId),
2171 cmd.header.command);
2172 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2173 cmd.header.size * 4u);
2174 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2175 CheckBytesWrittenMatchesExpectedSize(
2176 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2177 // TODO(gman): Check that data was inserted;
2180 TEST_F(GLES2FormatTest, VertexAttribPointer) {
2181 cmds::VertexAttribPointer& cmd = *GetBufferAs<cmds::VertexAttribPointer>();
2182 void* next_cmd =
2183 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
2184 static_cast<GLenum>(13), static_cast<GLboolean>(14),
2185 static_cast<GLsizei>(15), static_cast<GLuint>(16));
2186 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribPointer::kCmdId),
2187 cmd.header.command);
2188 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2189 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
2190 EXPECT_EQ(static_cast<GLint>(12), cmd.size);
2191 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
2192 EXPECT_EQ(static_cast<GLboolean>(14), cmd.normalized);
2193 EXPECT_EQ(static_cast<GLsizei>(15), cmd.stride);
2194 EXPECT_EQ(static_cast<GLuint>(16), cmd.offset);
2195 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2198 TEST_F(GLES2FormatTest, Viewport) {
2199 cmds::Viewport& cmd = *GetBufferAs<cmds::Viewport>();
2200 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2201 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
2202 EXPECT_EQ(static_cast<uint32_t>(cmds::Viewport::kCmdId), cmd.header.command);
2203 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2204 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
2205 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
2206 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
2207 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
2208 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2211 TEST_F(GLES2FormatTest, BlitFramebufferCHROMIUM) {
2212 cmds::BlitFramebufferCHROMIUM& cmd =
2213 *GetBufferAs<cmds::BlitFramebufferCHROMIUM>();
2214 void* next_cmd = cmd.Set(
2215 &cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2216 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLint>(15),
2217 static_cast<GLint>(16), static_cast<GLint>(17), static_cast<GLint>(18),
2218 static_cast<GLbitfield>(19), static_cast<GLenum>(20));
2219 EXPECT_EQ(static_cast<uint32_t>(cmds::BlitFramebufferCHROMIUM::kCmdId),
2220 cmd.header.command);
2221 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2222 EXPECT_EQ(static_cast<GLint>(11), cmd.srcX0);
2223 EXPECT_EQ(static_cast<GLint>(12), cmd.srcY0);
2224 EXPECT_EQ(static_cast<GLint>(13), cmd.srcX1);
2225 EXPECT_EQ(static_cast<GLint>(14), cmd.srcY1);
2226 EXPECT_EQ(static_cast<GLint>(15), cmd.dstX0);
2227 EXPECT_EQ(static_cast<GLint>(16), cmd.dstY0);
2228 EXPECT_EQ(static_cast<GLint>(17), cmd.dstX1);
2229 EXPECT_EQ(static_cast<GLint>(18), cmd.dstY1);
2230 EXPECT_EQ(static_cast<GLbitfield>(19), cmd.mask);
2231 EXPECT_EQ(static_cast<GLenum>(20), cmd.filter);
2232 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2235 TEST_F(GLES2FormatTest, RenderbufferStorageMultisampleCHROMIUM) {
2236 cmds::RenderbufferStorageMultisampleCHROMIUM& cmd =
2237 *GetBufferAs<cmds::RenderbufferStorageMultisampleCHROMIUM>();
2238 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2239 static_cast<GLsizei>(12), static_cast<GLenum>(13),
2240 static_cast<GLsizei>(14), static_cast<GLsizei>(15));
2241 EXPECT_EQ(static_cast<uint32_t>(
2242 cmds::RenderbufferStorageMultisampleCHROMIUM::kCmdId),
2243 cmd.header.command);
2244 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2245 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2246 EXPECT_EQ(static_cast<GLsizei>(12), cmd.samples);
2247 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
2248 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
2249 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
2250 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2253 TEST_F(GLES2FormatTest, RenderbufferStorageMultisampleEXT) {
2254 cmds::RenderbufferStorageMultisampleEXT& cmd =
2255 *GetBufferAs<cmds::RenderbufferStorageMultisampleEXT>();
2256 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2257 static_cast<GLsizei>(12), static_cast<GLenum>(13),
2258 static_cast<GLsizei>(14), static_cast<GLsizei>(15));
2259 EXPECT_EQ(
2260 static_cast<uint32_t>(cmds::RenderbufferStorageMultisampleEXT::kCmdId),
2261 cmd.header.command);
2262 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2263 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2264 EXPECT_EQ(static_cast<GLsizei>(12), cmd.samples);
2265 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
2266 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
2267 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
2268 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2271 TEST_F(GLES2FormatTest, FramebufferTexture2DMultisampleEXT) {
2272 cmds::FramebufferTexture2DMultisampleEXT& cmd =
2273 *GetBufferAs<cmds::FramebufferTexture2DMultisampleEXT>();
2274 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2275 static_cast<GLenum>(12), static_cast<GLenum>(13),
2276 static_cast<GLuint>(14), static_cast<GLsizei>(15));
2277 EXPECT_EQ(
2278 static_cast<uint32_t>(cmds::FramebufferTexture2DMultisampleEXT::kCmdId),
2279 cmd.header.command);
2280 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2281 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2282 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
2283 EXPECT_EQ(static_cast<GLenum>(13), cmd.textarget);
2284 EXPECT_EQ(static_cast<GLuint>(14), cmd.texture);
2285 EXPECT_EQ(static_cast<GLsizei>(15), cmd.samples);
2286 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2289 TEST_F(GLES2FormatTest, TexStorage2DEXT) {
2290 cmds::TexStorage2DEXT& cmd = *GetBufferAs<cmds::TexStorage2DEXT>();
2291 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2292 static_cast<GLsizei>(12), static_cast<GLenum>(13),
2293 static_cast<GLsizei>(14), static_cast<GLsizei>(15));
2294 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage2DEXT::kCmdId),
2295 cmd.header.command);
2296 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2297 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2298 EXPECT_EQ(static_cast<GLsizei>(12), cmd.levels);
2299 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalFormat);
2300 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
2301 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
2302 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2305 TEST_F(GLES2FormatTest, GenQueriesEXTImmediate) {
2306 static GLuint ids[] = {
2307 12, 23, 34,
2309 cmds::GenQueriesEXTImmediate& cmd =
2310 *GetBufferAs<cmds::GenQueriesEXTImmediate>();
2311 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
2312 EXPECT_EQ(static_cast<uint32_t>(cmds::GenQueriesEXTImmediate::kCmdId),
2313 cmd.header.command);
2314 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
2315 cmd.header.size * 4u);
2316 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
2317 CheckBytesWrittenMatchesExpectedSize(
2318 next_cmd,
2319 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
2320 // TODO(gman): Check that ids were inserted;
2323 TEST_F(GLES2FormatTest, DeleteQueriesEXTImmediate) {
2324 static GLuint ids[] = {
2325 12, 23, 34,
2327 cmds::DeleteQueriesEXTImmediate& cmd =
2328 *GetBufferAs<cmds::DeleteQueriesEXTImmediate>();
2329 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
2330 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteQueriesEXTImmediate::kCmdId),
2331 cmd.header.command);
2332 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
2333 cmd.header.size * 4u);
2334 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
2335 CheckBytesWrittenMatchesExpectedSize(
2336 next_cmd,
2337 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
2338 // TODO(gman): Check that ids were inserted;
2341 TEST_F(GLES2FormatTest, BeginQueryEXT) {
2342 cmds::BeginQueryEXT& cmd = *GetBufferAs<cmds::BeginQueryEXT>();
2343 void* next_cmd =
2344 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
2345 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
2346 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginQueryEXT::kCmdId),
2347 cmd.header.command);
2348 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2349 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2350 EXPECT_EQ(static_cast<GLuint>(12), cmd.id);
2351 EXPECT_EQ(static_cast<uint32_t>(13), cmd.sync_data_shm_id);
2352 EXPECT_EQ(static_cast<uint32_t>(14), cmd.sync_data_shm_offset);
2353 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2356 TEST_F(GLES2FormatTest, EndQueryEXT) {
2357 cmds::EndQueryEXT& cmd = *GetBufferAs<cmds::EndQueryEXT>();
2358 void* next_cmd =
2359 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
2360 EXPECT_EQ(static_cast<uint32_t>(cmds::EndQueryEXT::kCmdId),
2361 cmd.header.command);
2362 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2363 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2364 EXPECT_EQ(static_cast<GLuint>(12), cmd.submit_count);
2365 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2368 TEST_F(GLES2FormatTest, InsertEventMarkerEXT) {
2369 cmds::InsertEventMarkerEXT& cmd = *GetBufferAs<cmds::InsertEventMarkerEXT>();
2370 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2371 EXPECT_EQ(static_cast<uint32_t>(cmds::InsertEventMarkerEXT::kCmdId),
2372 cmd.header.command);
2373 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2374 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
2375 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2378 TEST_F(GLES2FormatTest, PushGroupMarkerEXT) {
2379 cmds::PushGroupMarkerEXT& cmd = *GetBufferAs<cmds::PushGroupMarkerEXT>();
2380 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2381 EXPECT_EQ(static_cast<uint32_t>(cmds::PushGroupMarkerEXT::kCmdId),
2382 cmd.header.command);
2383 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2384 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
2385 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2388 TEST_F(GLES2FormatTest, PopGroupMarkerEXT) {
2389 cmds::PopGroupMarkerEXT& cmd = *GetBufferAs<cmds::PopGroupMarkerEXT>();
2390 void* next_cmd = cmd.Set(&cmd);
2391 EXPECT_EQ(static_cast<uint32_t>(cmds::PopGroupMarkerEXT::kCmdId),
2392 cmd.header.command);
2393 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2394 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2397 TEST_F(GLES2FormatTest, GenVertexArraysOESImmediate) {
2398 static GLuint ids[] = {
2399 12, 23, 34,
2401 cmds::GenVertexArraysOESImmediate& cmd =
2402 *GetBufferAs<cmds::GenVertexArraysOESImmediate>();
2403 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
2404 EXPECT_EQ(static_cast<uint32_t>(cmds::GenVertexArraysOESImmediate::kCmdId),
2405 cmd.header.command);
2406 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
2407 cmd.header.size * 4u);
2408 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
2409 CheckBytesWrittenMatchesExpectedSize(
2410 next_cmd,
2411 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
2412 // TODO(gman): Check that ids were inserted;
2415 TEST_F(GLES2FormatTest, DeleteVertexArraysOESImmediate) {
2416 static GLuint ids[] = {
2417 12, 23, 34,
2419 cmds::DeleteVertexArraysOESImmediate& cmd =
2420 *GetBufferAs<cmds::DeleteVertexArraysOESImmediate>();
2421 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
2422 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteVertexArraysOESImmediate::kCmdId),
2423 cmd.header.command);
2424 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
2425 cmd.header.size * 4u);
2426 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
2427 CheckBytesWrittenMatchesExpectedSize(
2428 next_cmd,
2429 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
2430 // TODO(gman): Check that ids were inserted;
2433 TEST_F(GLES2FormatTest, IsVertexArrayOES) {
2434 cmds::IsVertexArrayOES& cmd = *GetBufferAs<cmds::IsVertexArrayOES>();
2435 void* next_cmd =
2436 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
2437 static_cast<uint32_t>(13));
2438 EXPECT_EQ(static_cast<uint32_t>(cmds::IsVertexArrayOES::kCmdId),
2439 cmd.header.command);
2440 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2441 EXPECT_EQ(static_cast<GLuint>(11), cmd.array);
2442 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
2443 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
2444 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2447 TEST_F(GLES2FormatTest, BindVertexArrayOES) {
2448 cmds::BindVertexArrayOES& cmd = *GetBufferAs<cmds::BindVertexArrayOES>();
2449 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2450 EXPECT_EQ(static_cast<uint32_t>(cmds::BindVertexArrayOES::kCmdId),
2451 cmd.header.command);
2452 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2453 EXPECT_EQ(static_cast<GLuint>(11), cmd.array);
2454 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2457 TEST_F(GLES2FormatTest, SwapBuffers) {
2458 cmds::SwapBuffers& cmd = *GetBufferAs<cmds::SwapBuffers>();
2459 void* next_cmd = cmd.Set(&cmd);
2460 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapBuffers::kCmdId),
2461 cmd.header.command);
2462 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2463 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2466 TEST_F(GLES2FormatTest, GetMaxValueInBufferCHROMIUM) {
2467 cmds::GetMaxValueInBufferCHROMIUM& cmd =
2468 *GetBufferAs<cmds::GetMaxValueInBufferCHROMIUM>();
2469 void* next_cmd =
2470 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLsizei>(12),
2471 static_cast<GLenum>(13), static_cast<GLuint>(14),
2472 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
2473 EXPECT_EQ(static_cast<uint32_t>(cmds::GetMaxValueInBufferCHROMIUM::kCmdId),
2474 cmd.header.command);
2475 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2476 EXPECT_EQ(static_cast<GLuint>(11), cmd.buffer_id);
2477 EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
2478 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
2479 EXPECT_EQ(static_cast<GLuint>(14), cmd.offset);
2480 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_id);
2481 EXPECT_EQ(static_cast<uint32_t>(16), cmd.result_shm_offset);
2482 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2485 TEST_F(GLES2FormatTest, EnableFeatureCHROMIUM) {
2486 cmds::EnableFeatureCHROMIUM& cmd =
2487 *GetBufferAs<cmds::EnableFeatureCHROMIUM>();
2488 void* next_cmd =
2489 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
2490 static_cast<uint32_t>(13));
2491 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableFeatureCHROMIUM::kCmdId),
2492 cmd.header.command);
2493 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2494 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
2495 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
2496 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
2497 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2500 TEST_F(GLES2FormatTest, ResizeCHROMIUM) {
2501 cmds::ResizeCHROMIUM& cmd = *GetBufferAs<cmds::ResizeCHROMIUM>();
2502 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2503 static_cast<GLuint>(12), static_cast<GLfloat>(13));
2504 EXPECT_EQ(static_cast<uint32_t>(cmds::ResizeCHROMIUM::kCmdId),
2505 cmd.header.command);
2506 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2507 EXPECT_EQ(static_cast<GLuint>(11), cmd.width);
2508 EXPECT_EQ(static_cast<GLuint>(12), cmd.height);
2509 EXPECT_EQ(static_cast<GLfloat>(13), cmd.scale_factor);
2510 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2513 TEST_F(GLES2FormatTest, GetRequestableExtensionsCHROMIUM) {
2514 cmds::GetRequestableExtensionsCHROMIUM& cmd =
2515 *GetBufferAs<cmds::GetRequestableExtensionsCHROMIUM>();
2516 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
2517 EXPECT_EQ(
2518 static_cast<uint32_t>(cmds::GetRequestableExtensionsCHROMIUM::kCmdId),
2519 cmd.header.command);
2520 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2521 EXPECT_EQ(static_cast<uint32_t>(11), cmd.bucket_id);
2522 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2525 TEST_F(GLES2FormatTest, RequestExtensionCHROMIUM) {
2526 cmds::RequestExtensionCHROMIUM& cmd =
2527 *GetBufferAs<cmds::RequestExtensionCHROMIUM>();
2528 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
2529 EXPECT_EQ(static_cast<uint32_t>(cmds::RequestExtensionCHROMIUM::kCmdId),
2530 cmd.header.command);
2531 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2532 EXPECT_EQ(static_cast<uint32_t>(11), cmd.bucket_id);
2533 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2536 TEST_F(GLES2FormatTest, GetProgramInfoCHROMIUM) {
2537 cmds::GetProgramInfoCHROMIUM& cmd =
2538 *GetBufferAs<cmds::GetProgramInfoCHROMIUM>();
2539 void* next_cmd =
2540 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
2541 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoCHROMIUM::kCmdId),
2542 cmd.header.command);
2543 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2544 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
2545 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
2546 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2549 TEST_F(GLES2FormatTest, GetTranslatedShaderSourceANGLE) {
2550 cmds::GetTranslatedShaderSourceANGLE& cmd =
2551 *GetBufferAs<cmds::GetTranslatedShaderSourceANGLE>();
2552 void* next_cmd =
2553 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
2554 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTranslatedShaderSourceANGLE::kCmdId),
2555 cmd.header.command);
2556 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2557 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
2558 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
2559 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2562 TEST_F(GLES2FormatTest, PostSubBufferCHROMIUM) {
2563 cmds::PostSubBufferCHROMIUM& cmd =
2564 *GetBufferAs<cmds::PostSubBufferCHROMIUM>();
2565 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2566 static_cast<GLint>(13), static_cast<GLint>(14));
2567 EXPECT_EQ(static_cast<uint32_t>(cmds::PostSubBufferCHROMIUM::kCmdId),
2568 cmd.header.command);
2569 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2570 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
2571 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
2572 EXPECT_EQ(static_cast<GLint>(13), cmd.width);
2573 EXPECT_EQ(static_cast<GLint>(14), cmd.height);
2574 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2577 TEST_F(GLES2FormatTest, TexImageIOSurface2DCHROMIUM) {
2578 cmds::TexImageIOSurface2DCHROMIUM& cmd =
2579 *GetBufferAs<cmds::TexImageIOSurface2DCHROMIUM>();
2580 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2581 static_cast<GLsizei>(12), static_cast<GLsizei>(13),
2582 static_cast<GLuint>(14), static_cast<GLuint>(15));
2583 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImageIOSurface2DCHROMIUM::kCmdId),
2584 cmd.header.command);
2585 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2586 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2587 EXPECT_EQ(static_cast<GLsizei>(12), cmd.width);
2588 EXPECT_EQ(static_cast<GLsizei>(13), cmd.height);
2589 EXPECT_EQ(static_cast<GLuint>(14), cmd.ioSurfaceId);
2590 EXPECT_EQ(static_cast<GLuint>(15), cmd.plane);
2591 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2594 TEST_F(GLES2FormatTest, CopyTextureCHROMIUM) {
2595 cmds::CopyTextureCHROMIUM& cmd = *GetBufferAs<cmds::CopyTextureCHROMIUM>();
2596 void* next_cmd =
2597 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
2598 static_cast<GLenum>(13), static_cast<GLint>(14),
2599 static_cast<GLint>(15), static_cast<GLenum>(16));
2600 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTextureCHROMIUM::kCmdId),
2601 cmd.header.command);
2602 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2603 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2604 EXPECT_EQ(static_cast<GLenum>(12), cmd.source_id);
2605 EXPECT_EQ(static_cast<GLenum>(13), cmd.dest_id);
2606 EXPECT_EQ(static_cast<GLint>(14), cmd.level);
2607 EXPECT_EQ(static_cast<GLint>(15), cmd.internalformat);
2608 EXPECT_EQ(static_cast<GLenum>(16), cmd.dest_type);
2609 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2612 TEST_F(GLES2FormatTest, DrawArraysInstancedANGLE) {
2613 cmds::DrawArraysInstancedANGLE& cmd =
2614 *GetBufferAs<cmds::DrawArraysInstancedANGLE>();
2615 void* next_cmd =
2616 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
2617 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
2618 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArraysInstancedANGLE::kCmdId),
2619 cmd.header.command);
2620 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2621 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
2622 EXPECT_EQ(static_cast<GLint>(12), cmd.first);
2623 EXPECT_EQ(static_cast<GLsizei>(13), cmd.count);
2624 EXPECT_EQ(static_cast<GLsizei>(14), cmd.primcount);
2625 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2628 TEST_F(GLES2FormatTest, DrawElementsInstancedANGLE) {
2629 cmds::DrawElementsInstancedANGLE& cmd =
2630 *GetBufferAs<cmds::DrawElementsInstancedANGLE>();
2631 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2632 static_cast<GLsizei>(12), static_cast<GLenum>(13),
2633 static_cast<GLuint>(14), static_cast<GLsizei>(15));
2634 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElementsInstancedANGLE::kCmdId),
2635 cmd.header.command);
2636 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2637 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
2638 EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
2639 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
2640 EXPECT_EQ(static_cast<GLuint>(14), cmd.index_offset);
2641 EXPECT_EQ(static_cast<GLsizei>(15), cmd.primcount);
2642 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2645 TEST_F(GLES2FormatTest, VertexAttribDivisorANGLE) {
2646 cmds::VertexAttribDivisorANGLE& cmd =
2647 *GetBufferAs<cmds::VertexAttribDivisorANGLE>();
2648 void* next_cmd =
2649 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
2650 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribDivisorANGLE::kCmdId),
2651 cmd.header.command);
2652 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2653 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
2654 EXPECT_EQ(static_cast<GLuint>(12), cmd.divisor);
2655 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2658 // TODO(gman): Write test for GenMailboxCHROMIUM
2659 TEST_F(GLES2FormatTest, ProduceTextureCHROMIUMImmediate) {
2660 const int kSomeBaseValueToTestWith = 51;
2661 static GLbyte data[] = {
2662 static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
2663 static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
2664 static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
2665 static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
2666 static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
2667 static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
2668 static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
2669 static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
2670 static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
2671 static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
2672 static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
2673 static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
2674 static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
2675 static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
2676 static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
2677 static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
2678 static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
2679 static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
2680 static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
2681 static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
2682 static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
2683 static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
2684 static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
2685 static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
2686 static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
2687 static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
2688 static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
2689 static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
2690 static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
2691 static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
2692 static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
2693 static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
2694 static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
2695 static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
2696 static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
2697 static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
2698 static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
2699 static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
2700 static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
2701 static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
2702 static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
2703 static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
2704 static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
2705 static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
2706 static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
2707 static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
2708 static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
2709 static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
2710 static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
2711 static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
2712 static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
2713 static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
2714 static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
2715 static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
2716 static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
2717 static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
2718 static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
2719 static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
2720 static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
2721 static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
2722 static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
2723 static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
2724 static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
2725 static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
2727 cmds::ProduceTextureCHROMIUMImmediate& cmd =
2728 *GetBufferAs<cmds::ProduceTextureCHROMIUMImmediate>();
2729 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), data);
2730 EXPECT_EQ(
2731 static_cast<uint32_t>(cmds::ProduceTextureCHROMIUMImmediate::kCmdId),
2732 cmd.header.command);
2733 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2734 cmd.header.size * 4u);
2735 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2736 CheckBytesWrittenMatchesExpectedSize(
2737 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2738 // TODO(gman): Check that data was inserted;
2741 TEST_F(GLES2FormatTest, ProduceTextureDirectCHROMIUMImmediate) {
2742 const int kSomeBaseValueToTestWith = 51;
2743 static GLbyte data[] = {
2744 static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
2745 static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
2746 static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
2747 static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
2748 static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
2749 static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
2750 static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
2751 static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
2752 static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
2753 static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
2754 static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
2755 static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
2756 static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
2757 static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
2758 static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
2759 static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
2760 static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
2761 static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
2762 static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
2763 static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
2764 static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
2765 static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
2766 static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
2767 static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
2768 static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
2769 static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
2770 static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
2771 static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
2772 static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
2773 static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
2774 static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
2775 static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
2776 static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
2777 static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
2778 static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
2779 static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
2780 static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
2781 static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
2782 static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
2783 static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
2784 static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
2785 static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
2786 static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
2787 static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
2788 static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
2789 static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
2790 static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
2791 static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
2792 static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
2793 static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
2794 static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
2795 static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
2796 static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
2797 static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
2798 static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
2799 static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
2800 static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
2801 static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
2802 static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
2803 static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
2804 static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
2805 static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
2806 static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
2807 static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
2809 cmds::ProduceTextureDirectCHROMIUMImmediate& cmd =
2810 *GetBufferAs<cmds::ProduceTextureDirectCHROMIUMImmediate>();
2811 void* next_cmd =
2812 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), data);
2813 EXPECT_EQ(static_cast<uint32_t>(
2814 cmds::ProduceTextureDirectCHROMIUMImmediate::kCmdId),
2815 cmd.header.command);
2816 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2817 cmd.header.size * 4u);
2818 EXPECT_EQ(static_cast<GLuint>(11), cmd.texture);
2819 EXPECT_EQ(static_cast<GLenum>(12), cmd.target);
2820 CheckBytesWrittenMatchesExpectedSize(
2821 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2822 // TODO(gman): Check that data was inserted;
2825 TEST_F(GLES2FormatTest, ConsumeTextureCHROMIUMImmediate) {
2826 const int kSomeBaseValueToTestWith = 51;
2827 static GLbyte data[] = {
2828 static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
2829 static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
2830 static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
2831 static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
2832 static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
2833 static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
2834 static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
2835 static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
2836 static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
2837 static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
2838 static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
2839 static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
2840 static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
2841 static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
2842 static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
2843 static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
2844 static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
2845 static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
2846 static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
2847 static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
2848 static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
2849 static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
2850 static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
2851 static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
2852 static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
2853 static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
2854 static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
2855 static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
2856 static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
2857 static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
2858 static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
2859 static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
2860 static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
2861 static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
2862 static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
2863 static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
2864 static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
2865 static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
2866 static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
2867 static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
2868 static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
2869 static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
2870 static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
2871 static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
2872 static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
2873 static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
2874 static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
2875 static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
2876 static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
2877 static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
2878 static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
2879 static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
2880 static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
2881 static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
2882 static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
2883 static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
2884 static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
2885 static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
2886 static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
2887 static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
2888 static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
2889 static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
2890 static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
2891 static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
2893 cmds::ConsumeTextureCHROMIUMImmediate& cmd =
2894 *GetBufferAs<cmds::ConsumeTextureCHROMIUMImmediate>();
2895 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), data);
2896 EXPECT_EQ(
2897 static_cast<uint32_t>(cmds::ConsumeTextureCHROMIUMImmediate::kCmdId),
2898 cmd.header.command);
2899 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2900 cmd.header.size * 4u);
2901 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2902 CheckBytesWrittenMatchesExpectedSize(
2903 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2904 // TODO(gman): Check that data was inserted;
2907 // TODO(gman): Write test for CreateAndConsumeTextureCHROMIUMImmediate
2908 TEST_F(GLES2FormatTest, BindUniformLocationCHROMIUMBucket) {
2909 cmds::BindUniformLocationCHROMIUMBucket& cmd =
2910 *GetBufferAs<cmds::BindUniformLocationCHROMIUMBucket>();
2911 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2912 static_cast<GLint>(12), static_cast<uint32_t>(13));
2913 EXPECT_EQ(
2914 static_cast<uint32_t>(cmds::BindUniformLocationCHROMIUMBucket::kCmdId),
2915 cmd.header.command);
2916 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2917 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
2918 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
2919 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
2920 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2923 TEST_F(GLES2FormatTest, GenValuebuffersCHROMIUMImmediate) {
2924 static GLuint ids[] = {
2925 12, 23, 34,
2927 cmds::GenValuebuffersCHROMIUMImmediate& cmd =
2928 *GetBufferAs<cmds::GenValuebuffersCHROMIUMImmediate>();
2929 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
2930 EXPECT_EQ(
2931 static_cast<uint32_t>(cmds::GenValuebuffersCHROMIUMImmediate::kCmdId),
2932 cmd.header.command);
2933 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
2934 cmd.header.size * 4u);
2935 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
2936 CheckBytesWrittenMatchesExpectedSize(
2937 next_cmd,
2938 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
2939 // TODO(gman): Check that ids were inserted;
2942 TEST_F(GLES2FormatTest, DeleteValuebuffersCHROMIUMImmediate) {
2943 static GLuint ids[] = {
2944 12, 23, 34,
2946 cmds::DeleteValuebuffersCHROMIUMImmediate& cmd =
2947 *GetBufferAs<cmds::DeleteValuebuffersCHROMIUMImmediate>();
2948 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
2949 EXPECT_EQ(
2950 static_cast<uint32_t>(cmds::DeleteValuebuffersCHROMIUMImmediate::kCmdId),
2951 cmd.header.command);
2952 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
2953 cmd.header.size * 4u);
2954 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
2955 CheckBytesWrittenMatchesExpectedSize(
2956 next_cmd,
2957 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
2958 // TODO(gman): Check that ids were inserted;
2961 TEST_F(GLES2FormatTest, IsValuebufferCHROMIUM) {
2962 cmds::IsValuebufferCHROMIUM& cmd =
2963 *GetBufferAs<cmds::IsValuebufferCHROMIUM>();
2964 void* next_cmd =
2965 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
2966 static_cast<uint32_t>(13));
2967 EXPECT_EQ(static_cast<uint32_t>(cmds::IsValuebufferCHROMIUM::kCmdId),
2968 cmd.header.command);
2969 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2970 EXPECT_EQ(static_cast<GLuint>(11), cmd.valuebuffer);
2971 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
2972 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
2973 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2976 TEST_F(GLES2FormatTest, BindValuebufferCHROMIUM) {
2977 cmds::BindValuebufferCHROMIUM& cmd =
2978 *GetBufferAs<cmds::BindValuebufferCHROMIUM>();
2979 void* next_cmd =
2980 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
2981 EXPECT_EQ(static_cast<uint32_t>(cmds::BindValuebufferCHROMIUM::kCmdId),
2982 cmd.header.command);
2983 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2984 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2985 EXPECT_EQ(static_cast<GLuint>(12), cmd.valuebuffer);
2986 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2989 TEST_F(GLES2FormatTest, SubscribeValueCHROMIUM) {
2990 cmds::SubscribeValueCHROMIUM& cmd =
2991 *GetBufferAs<cmds::SubscribeValueCHROMIUM>();
2992 void* next_cmd =
2993 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
2994 EXPECT_EQ(static_cast<uint32_t>(cmds::SubscribeValueCHROMIUM::kCmdId),
2995 cmd.header.command);
2996 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2997 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2998 EXPECT_EQ(static_cast<GLenum>(12), cmd.subscription);
2999 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3002 TEST_F(GLES2FormatTest, PopulateSubscribedValuesCHROMIUM) {
3003 cmds::PopulateSubscribedValuesCHROMIUM& cmd =
3004 *GetBufferAs<cmds::PopulateSubscribedValuesCHROMIUM>();
3005 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
3006 EXPECT_EQ(
3007 static_cast<uint32_t>(cmds::PopulateSubscribedValuesCHROMIUM::kCmdId),
3008 cmd.header.command);
3009 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3010 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3011 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3014 TEST_F(GLES2FormatTest, UniformValuebufferCHROMIUM) {
3015 cmds::UniformValuebufferCHROMIUM& cmd =
3016 *GetBufferAs<cmds::UniformValuebufferCHROMIUM>();
3017 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
3018 static_cast<GLenum>(12), static_cast<GLenum>(13));
3019 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformValuebufferCHROMIUM::kCmdId),
3020 cmd.header.command);
3021 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3022 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
3023 EXPECT_EQ(static_cast<GLenum>(12), cmd.target);
3024 EXPECT_EQ(static_cast<GLenum>(13), cmd.subscription);
3025 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3028 TEST_F(GLES2FormatTest, BindTexImage2DCHROMIUM) {
3029 cmds::BindTexImage2DCHROMIUM& cmd =
3030 *GetBufferAs<cmds::BindTexImage2DCHROMIUM>();
3031 void* next_cmd =
3032 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12));
3033 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexImage2DCHROMIUM::kCmdId),
3034 cmd.header.command);
3035 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3036 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3037 EXPECT_EQ(static_cast<GLint>(12), cmd.imageId);
3038 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3041 TEST_F(GLES2FormatTest, ReleaseTexImage2DCHROMIUM) {
3042 cmds::ReleaseTexImage2DCHROMIUM& cmd =
3043 *GetBufferAs<cmds::ReleaseTexImage2DCHROMIUM>();
3044 void* next_cmd =
3045 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12));
3046 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseTexImage2DCHROMIUM::kCmdId),
3047 cmd.header.command);
3048 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3049 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3050 EXPECT_EQ(static_cast<GLint>(12), cmd.imageId);
3051 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3054 TEST_F(GLES2FormatTest, TraceBeginCHROMIUM) {
3055 cmds::TraceBeginCHROMIUM& cmd = *GetBufferAs<cmds::TraceBeginCHROMIUM>();
3056 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3057 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceBeginCHROMIUM::kCmdId),
3058 cmd.header.command);
3059 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3060 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
3061 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3064 TEST_F(GLES2FormatTest, TraceEndCHROMIUM) {
3065 cmds::TraceEndCHROMIUM& cmd = *GetBufferAs<cmds::TraceEndCHROMIUM>();
3066 void* next_cmd = cmd.Set(&cmd);
3067 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceEndCHROMIUM::kCmdId),
3068 cmd.header.command);
3069 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3070 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3073 TEST_F(GLES2FormatTest, AsyncTexSubImage2DCHROMIUM) {
3074 cmds::AsyncTexSubImage2DCHROMIUM& cmd =
3075 *GetBufferAs<cmds::AsyncTexSubImage2DCHROMIUM>();
3076 void* next_cmd = cmd.Set(
3077 &cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
3078 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLsizei>(15),
3079 static_cast<GLsizei>(16), static_cast<GLenum>(17),
3080 static_cast<GLenum>(18), static_cast<uint32_t>(19),
3081 static_cast<uint32_t>(20), static_cast<uint32_t>(21),
3082 static_cast<uint32_t>(22), static_cast<uint32_t>(23));
3083 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexSubImage2DCHROMIUM::kCmdId),
3084 cmd.header.command);
3085 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3086 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3087 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
3088 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
3089 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
3090 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
3091 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
3092 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
3093 EXPECT_EQ(static_cast<GLenum>(18), cmd.type);
3094 EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id);
3095 EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset);
3096 EXPECT_EQ(static_cast<uint32_t>(21), cmd.async_upload_token);
3097 EXPECT_EQ(static_cast<uint32_t>(22), cmd.sync_data_shm_id);
3098 EXPECT_EQ(static_cast<uint32_t>(23), cmd.sync_data_shm_offset);
3099 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3102 TEST_F(GLES2FormatTest, AsyncTexImage2DCHROMIUM) {
3103 cmds::AsyncTexImage2DCHROMIUM& cmd =
3104 *GetBufferAs<cmds::AsyncTexImage2DCHROMIUM>();
3105 void* next_cmd =
3106 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
3107 static_cast<GLint>(13), static_cast<GLsizei>(14),
3108 static_cast<GLsizei>(15), static_cast<GLenum>(16),
3109 static_cast<GLenum>(17), static_cast<uint32_t>(18),
3110 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
3111 static_cast<uint32_t>(21), static_cast<uint32_t>(22));
3112 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexImage2DCHROMIUM::kCmdId),
3113 cmd.header.command);
3114 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3115 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3116 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
3117 EXPECT_EQ(static_cast<GLint>(13), cmd.internalformat);
3118 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
3119 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
3120 EXPECT_EQ(static_cast<GLenum>(16), cmd.format);
3121 EXPECT_EQ(static_cast<GLenum>(17), cmd.type);
3122 EXPECT_EQ(static_cast<uint32_t>(18), cmd.pixels_shm_id);
3123 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_offset);
3124 EXPECT_EQ(static_cast<uint32_t>(20), cmd.async_upload_token);
3125 EXPECT_EQ(static_cast<uint32_t>(21), cmd.sync_data_shm_id);
3126 EXPECT_EQ(static_cast<uint32_t>(22), cmd.sync_data_shm_offset);
3127 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3130 TEST_F(GLES2FormatTest, WaitAsyncTexImage2DCHROMIUM) {
3131 cmds::WaitAsyncTexImage2DCHROMIUM& cmd =
3132 *GetBufferAs<cmds::WaitAsyncTexImage2DCHROMIUM>();
3133 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
3134 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAsyncTexImage2DCHROMIUM::kCmdId),
3135 cmd.header.command);
3136 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3137 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3138 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3141 TEST_F(GLES2FormatTest, WaitAllAsyncTexImage2DCHROMIUM) {
3142 cmds::WaitAllAsyncTexImage2DCHROMIUM& cmd =
3143 *GetBufferAs<cmds::WaitAllAsyncTexImage2DCHROMIUM>();
3144 void* next_cmd = cmd.Set(&cmd);
3145 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAllAsyncTexImage2DCHROMIUM::kCmdId),
3146 cmd.header.command);
3147 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3148 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3151 TEST_F(GLES2FormatTest, DiscardFramebufferEXTImmediate) {
3152 const int kSomeBaseValueToTestWith = 51;
3153 static GLenum data[] = {
3154 static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
3155 static_cast<GLenum>(kSomeBaseValueToTestWith + 1),
3157 cmds::DiscardFramebufferEXTImmediate& cmd =
3158 *GetBufferAs<cmds::DiscardFramebufferEXTImmediate>();
3159 const GLsizei kNumElements = 2;
3160 const size_t kExpectedCmdSize =
3161 sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
3162 void* next_cmd =
3163 cmd.Set(&cmd, static_cast<GLenum>(1), static_cast<GLsizei>(2), data);
3164 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardFramebufferEXTImmediate::kCmdId),
3165 cmd.header.command);
3166 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3167 EXPECT_EQ(static_cast<GLenum>(1), cmd.target);
3168 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3169 CheckBytesWrittenMatchesExpectedSize(
3170 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3171 // TODO(gman): Check that data was inserted;
3174 TEST_F(GLES2FormatTest, LoseContextCHROMIUM) {
3175 cmds::LoseContextCHROMIUM& cmd = *GetBufferAs<cmds::LoseContextCHROMIUM>();
3176 void* next_cmd =
3177 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
3178 EXPECT_EQ(static_cast<uint32_t>(cmds::LoseContextCHROMIUM::kCmdId),
3179 cmd.header.command);
3180 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3181 EXPECT_EQ(static_cast<GLenum>(11), cmd.current);
3182 EXPECT_EQ(static_cast<GLenum>(12), cmd.other);
3183 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3186 // TODO(gman): Write test for InsertSyncPointCHROMIUM
3187 TEST_F(GLES2FormatTest, WaitSyncPointCHROMIUM) {
3188 cmds::WaitSyncPointCHROMIUM& cmd =
3189 *GetBufferAs<cmds::WaitSyncPointCHROMIUM>();
3190 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3191 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSyncPointCHROMIUM::kCmdId),
3192 cmd.header.command);
3193 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3194 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync_point);
3195 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3198 TEST_F(GLES2FormatTest, DrawBuffersEXTImmediate) {
3199 const int kSomeBaseValueToTestWith = 51;
3200 static GLenum data[] = {
3201 static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
3203 cmds::DrawBuffersEXTImmediate& cmd =
3204 *GetBufferAs<cmds::DrawBuffersEXTImmediate>();
3205 const GLsizei kNumElements = 1;
3206 const size_t kExpectedCmdSize =
3207 sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
3208 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(1), data);
3209 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawBuffersEXTImmediate::kCmdId),
3210 cmd.header.command);
3211 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3212 EXPECT_EQ(static_cast<GLsizei>(1), cmd.count);
3213 CheckBytesWrittenMatchesExpectedSize(
3214 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3215 // TODO(gman): Check that data was inserted;
3218 TEST_F(GLES2FormatTest, DiscardBackbufferCHROMIUM) {
3219 cmds::DiscardBackbufferCHROMIUM& cmd =
3220 *GetBufferAs<cmds::DiscardBackbufferCHROMIUM>();
3221 void* next_cmd = cmd.Set(&cmd);
3222 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardBackbufferCHROMIUM::kCmdId),
3223 cmd.header.command);
3224 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3225 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3228 TEST_F(GLES2FormatTest, ScheduleOverlayPlaneCHROMIUM) {
3229 cmds::ScheduleOverlayPlaneCHROMIUM& cmd =
3230 *GetBufferAs<cmds::ScheduleOverlayPlaneCHROMIUM>();
3231 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
3232 static_cast<GLenum>(12), static_cast<GLuint>(13),
3233 static_cast<GLint>(14), static_cast<GLint>(15),
3234 static_cast<GLint>(16), static_cast<GLint>(17),
3235 static_cast<GLfloat>(18), static_cast<GLfloat>(19),
3236 static_cast<GLfloat>(20), static_cast<GLfloat>(21));
3237 EXPECT_EQ(static_cast<uint32_t>(cmds::ScheduleOverlayPlaneCHROMIUM::kCmdId),
3238 cmd.header.command);
3239 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3240 EXPECT_EQ(static_cast<GLint>(11), cmd.plane_z_order);
3241 EXPECT_EQ(static_cast<GLenum>(12), cmd.plane_transform);
3242 EXPECT_EQ(static_cast<GLuint>(13), cmd.overlay_texture_id);
3243 EXPECT_EQ(static_cast<GLint>(14), cmd.bounds_x);
3244 EXPECT_EQ(static_cast<GLint>(15), cmd.bounds_y);
3245 EXPECT_EQ(static_cast<GLint>(16), cmd.bounds_width);
3246 EXPECT_EQ(static_cast<GLint>(17), cmd.bounds_height);
3247 EXPECT_EQ(static_cast<GLfloat>(18), cmd.uv_x);
3248 EXPECT_EQ(static_cast<GLfloat>(19), cmd.uv_y);
3249 EXPECT_EQ(static_cast<GLfloat>(20), cmd.uv_width);
3250 EXPECT_EQ(static_cast<GLfloat>(21), cmd.uv_height);
3251 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3254 TEST_F(GLES2FormatTest, MatrixLoadfCHROMIUMImmediate) {
3255 const int kSomeBaseValueToTestWith = 51;
3256 static GLfloat data[] = {
3257 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3258 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3259 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3260 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3261 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3262 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3263 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3264 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3265 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3266 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3267 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3268 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3269 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3270 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3271 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3272 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3274 cmds::MatrixLoadfCHROMIUMImmediate& cmd =
3275 *GetBufferAs<cmds::MatrixLoadfCHROMIUMImmediate>();
3276 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), data);
3277 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadfCHROMIUMImmediate::kCmdId),
3278 cmd.header.command);
3279 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3280 cmd.header.size * 4u);
3281 EXPECT_EQ(static_cast<GLenum>(11), cmd.matrixMode);
3282 CheckBytesWrittenMatchesExpectedSize(
3283 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3284 // TODO(gman): Check that data was inserted;
3287 TEST_F(GLES2FormatTest, MatrixLoadIdentityCHROMIUM) {
3288 cmds::MatrixLoadIdentityCHROMIUM& cmd =
3289 *GetBufferAs<cmds::MatrixLoadIdentityCHROMIUM>();
3290 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
3291 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadIdentityCHROMIUM::kCmdId),
3292 cmd.header.command);
3293 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3294 EXPECT_EQ(static_cast<GLenum>(11), cmd.matrixMode);
3295 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3298 TEST_F(GLES2FormatTest, BlendBarrierKHR) {
3299 cmds::BlendBarrierKHR& cmd = *GetBufferAs<cmds::BlendBarrierKHR>();
3300 void* next_cmd = cmd.Set(&cmd);
3301 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendBarrierKHR::kCmdId),
3302 cmd.header.command);
3303 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3304 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3307 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_