1 // Copyright (c) 2012 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
9 // This file contains unit tests for gles2 commmands
10 // It is included by gles2_cmd_format_test.cc
12 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
13 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
15 TEST_F(GLES2FormatTest
, ActiveTexture
) {
16 cmds::ActiveTexture
& cmd
= *GetBufferAs
<cmds::ActiveTexture
>();
17 void* next_cmd
= cmd
.Set(
19 static_cast<GLenum
>(11));
20 EXPECT_EQ(static_cast<uint32
>(cmds::ActiveTexture::kCmdId
),
22 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
23 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.texture
);
24 CheckBytesWrittenMatchesExpectedSize(
25 next_cmd
, sizeof(cmd
));
28 TEST_F(GLES2FormatTest
, AttachShader
) {
29 cmds::AttachShader
& cmd
= *GetBufferAs
<cmds::AttachShader
>();
30 void* next_cmd
= cmd
.Set(
32 static_cast<GLuint
>(11),
33 static_cast<GLuint
>(12));
34 EXPECT_EQ(static_cast<uint32
>(cmds::AttachShader::kCmdId
),
36 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
37 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
38 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
39 CheckBytesWrittenMatchesExpectedSize(
40 next_cmd
, sizeof(cmd
));
43 TEST_F(GLES2FormatTest
, BindAttribLocation
) {
44 cmds::BindAttribLocation
& cmd
= *GetBufferAs
<cmds::BindAttribLocation
>();
45 void* next_cmd
= cmd
.Set(
47 static_cast<GLuint
>(11),
48 static_cast<GLuint
>(12),
49 static_cast<uint32
>(13),
50 static_cast<uint32
>(14),
51 static_cast<uint32
>(15));
52 EXPECT_EQ(static_cast<uint32
>(cmds::BindAttribLocation::kCmdId
),
54 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
55 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
56 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
57 EXPECT_EQ(static_cast<uint32
>(13), cmd
.name_shm_id
);
58 EXPECT_EQ(static_cast<uint32
>(14), cmd
.name_shm_offset
);
59 EXPECT_EQ(static_cast<uint32
>(15), cmd
.data_size
);
60 CheckBytesWrittenMatchesExpectedSize(
61 next_cmd
, sizeof(cmd
));
65 TEST_F(GLES2FormatTest
, BindAttribLocationImmediate
) {
66 cmds::BindAttribLocationImmediate
& cmd
=
67 *GetBufferAs
<cmds::BindAttribLocationImmediate
>();
68 static const char* const test_str
= "test string";
69 void* next_cmd
= cmd
.Set(
71 static_cast<GLuint
>(11),
72 static_cast<GLuint
>(12),
75 EXPECT_EQ(static_cast<uint32
>(cmds::BindAttribLocationImmediate::kCmdId
),
77 EXPECT_EQ(sizeof(cmd
) +
78 RoundSizeToMultipleOfEntries(strlen(test_str
)),
79 cmd
.header
.size
* 4u);
80 EXPECT_EQ(static_cast<char*>(next_cmd
),
81 reinterpret_cast<char*>(&cmd
) + sizeof(cmd
) +
82 RoundSizeToMultipleOfEntries(strlen(test_str
)));
83 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
84 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
85 EXPECT_EQ(static_cast<uint32
>(strlen(test_str
)), cmd
.data_size
);
86 EXPECT_EQ(0, memcmp(test_str
, ImmediateDataAddress(&cmd
), strlen(test_str
)));
89 sizeof(cmd
) + RoundSizeToMultipleOfEntries(strlen(test_str
)),
90 sizeof(cmd
) + strlen(test_str
));
93 TEST_F(GLES2FormatTest
, BindAttribLocationBucket
) {
94 cmds::BindAttribLocationBucket
& cmd
=
95 *GetBufferAs
<cmds::BindAttribLocationBucket
>();
96 void* next_cmd
= cmd
.Set(
98 static_cast<GLuint
>(11),
99 static_cast<GLuint
>(12),
100 static_cast<uint32
>(13));
101 EXPECT_EQ(static_cast<uint32
>(cmds::BindAttribLocationBucket::kCmdId
),
103 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
104 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
105 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
106 EXPECT_EQ(static_cast<uint32
>(13), cmd
.name_bucket_id
);
107 CheckBytesWrittenMatchesExpectedSize(
108 next_cmd
, sizeof(cmd
));
111 TEST_F(GLES2FormatTest
, BindBuffer
) {
112 cmds::BindBuffer
& cmd
= *GetBufferAs
<cmds::BindBuffer
>();
113 void* next_cmd
= cmd
.Set(
115 static_cast<GLenum
>(11),
116 static_cast<GLuint
>(12));
117 EXPECT_EQ(static_cast<uint32
>(cmds::BindBuffer::kCmdId
),
119 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
120 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
121 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.buffer
);
122 CheckBytesWrittenMatchesExpectedSize(
123 next_cmd
, sizeof(cmd
));
126 TEST_F(GLES2FormatTest
, BindFramebuffer
) {
127 cmds::BindFramebuffer
& cmd
= *GetBufferAs
<cmds::BindFramebuffer
>();
128 void* next_cmd
= cmd
.Set(
130 static_cast<GLenum
>(11),
131 static_cast<GLuint
>(12));
132 EXPECT_EQ(static_cast<uint32
>(cmds::BindFramebuffer::kCmdId
),
134 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
135 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
136 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.framebuffer
);
137 CheckBytesWrittenMatchesExpectedSize(
138 next_cmd
, sizeof(cmd
));
141 TEST_F(GLES2FormatTest
, BindRenderbuffer
) {
142 cmds::BindRenderbuffer
& cmd
= *GetBufferAs
<cmds::BindRenderbuffer
>();
143 void* next_cmd
= cmd
.Set(
145 static_cast<GLenum
>(11),
146 static_cast<GLuint
>(12));
147 EXPECT_EQ(static_cast<uint32
>(cmds::BindRenderbuffer::kCmdId
),
149 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
150 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
151 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.renderbuffer
);
152 CheckBytesWrittenMatchesExpectedSize(
153 next_cmd
, sizeof(cmd
));
156 TEST_F(GLES2FormatTest
, BindTexture
) {
157 cmds::BindTexture
& cmd
= *GetBufferAs
<cmds::BindTexture
>();
158 void* next_cmd
= cmd
.Set(
160 static_cast<GLenum
>(11),
161 static_cast<GLuint
>(12));
162 EXPECT_EQ(static_cast<uint32
>(cmds::BindTexture::kCmdId
),
164 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
165 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
166 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.texture
);
167 CheckBytesWrittenMatchesExpectedSize(
168 next_cmd
, sizeof(cmd
));
171 TEST_F(GLES2FormatTest
, BlendColor
) {
172 cmds::BlendColor
& cmd
= *GetBufferAs
<cmds::BlendColor
>();
173 void* next_cmd
= cmd
.Set(
175 static_cast<GLclampf
>(11),
176 static_cast<GLclampf
>(12),
177 static_cast<GLclampf
>(13),
178 static_cast<GLclampf
>(14));
179 EXPECT_EQ(static_cast<uint32
>(cmds::BlendColor::kCmdId
),
181 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
182 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.red
);
183 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.green
);
184 EXPECT_EQ(static_cast<GLclampf
>(13), cmd
.blue
);
185 EXPECT_EQ(static_cast<GLclampf
>(14), cmd
.alpha
);
186 CheckBytesWrittenMatchesExpectedSize(
187 next_cmd
, sizeof(cmd
));
190 TEST_F(GLES2FormatTest
, BlendEquation
) {
191 cmds::BlendEquation
& cmd
= *GetBufferAs
<cmds::BlendEquation
>();
192 void* next_cmd
= cmd
.Set(
194 static_cast<GLenum
>(11));
195 EXPECT_EQ(static_cast<uint32
>(cmds::BlendEquation::kCmdId
),
197 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
198 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
199 CheckBytesWrittenMatchesExpectedSize(
200 next_cmd
, sizeof(cmd
));
203 TEST_F(GLES2FormatTest
, BlendEquationSeparate
) {
204 cmds::BlendEquationSeparate
& cmd
=
205 *GetBufferAs
<cmds::BlendEquationSeparate
>();
206 void* next_cmd
= cmd
.Set(
208 static_cast<GLenum
>(11),
209 static_cast<GLenum
>(12));
210 EXPECT_EQ(static_cast<uint32
>(cmds::BlendEquationSeparate::kCmdId
),
212 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
213 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.modeRGB
);
214 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.modeAlpha
);
215 CheckBytesWrittenMatchesExpectedSize(
216 next_cmd
, sizeof(cmd
));
219 TEST_F(GLES2FormatTest
, BlendFunc
) {
220 cmds::BlendFunc
& cmd
= *GetBufferAs
<cmds::BlendFunc
>();
221 void* next_cmd
= cmd
.Set(
223 static_cast<GLenum
>(11),
224 static_cast<GLenum
>(12));
225 EXPECT_EQ(static_cast<uint32
>(cmds::BlendFunc::kCmdId
),
227 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
228 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.sfactor
);
229 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.dfactor
);
230 CheckBytesWrittenMatchesExpectedSize(
231 next_cmd
, sizeof(cmd
));
234 TEST_F(GLES2FormatTest
, BlendFuncSeparate
) {
235 cmds::BlendFuncSeparate
& cmd
= *GetBufferAs
<cmds::BlendFuncSeparate
>();
236 void* next_cmd
= cmd
.Set(
238 static_cast<GLenum
>(11),
239 static_cast<GLenum
>(12),
240 static_cast<GLenum
>(13),
241 static_cast<GLenum
>(14));
242 EXPECT_EQ(static_cast<uint32
>(cmds::BlendFuncSeparate::kCmdId
),
244 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
245 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.srcRGB
);
246 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.dstRGB
);
247 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.srcAlpha
);
248 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.dstAlpha
);
249 CheckBytesWrittenMatchesExpectedSize(
250 next_cmd
, sizeof(cmd
));
253 TEST_F(GLES2FormatTest
, BufferData
) {
254 cmds::BufferData
& cmd
= *GetBufferAs
<cmds::BufferData
>();
255 void* next_cmd
= cmd
.Set(
257 static_cast<GLenum
>(11),
258 static_cast<GLsizeiptr
>(12),
259 static_cast<uint32
>(13),
260 static_cast<uint32
>(14),
261 static_cast<GLenum
>(15));
262 EXPECT_EQ(static_cast<uint32
>(cmds::BufferData::kCmdId
),
264 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
265 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
266 EXPECT_EQ(static_cast<GLsizeiptr
>(12), cmd
.size
);
267 EXPECT_EQ(static_cast<uint32
>(13), cmd
.data_shm_id
);
268 EXPECT_EQ(static_cast<uint32
>(14), cmd
.data_shm_offset
);
269 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.usage
);
270 CheckBytesWrittenMatchesExpectedSize(
271 next_cmd
, sizeof(cmd
));
274 // TODO(gman): Implement test for BufferDataImmediate
275 TEST_F(GLES2FormatTest
, BufferSubData
) {
276 cmds::BufferSubData
& cmd
= *GetBufferAs
<cmds::BufferSubData
>();
277 void* next_cmd
= cmd
.Set(
279 static_cast<GLenum
>(11),
280 static_cast<GLintptr
>(12),
281 static_cast<GLsizeiptr
>(13),
282 static_cast<uint32
>(14),
283 static_cast<uint32
>(15));
284 EXPECT_EQ(static_cast<uint32
>(cmds::BufferSubData::kCmdId
),
286 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
287 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
288 EXPECT_EQ(static_cast<GLintptr
>(12), cmd
.offset
);
289 EXPECT_EQ(static_cast<GLsizeiptr
>(13), cmd
.size
);
290 EXPECT_EQ(static_cast<uint32
>(14), cmd
.data_shm_id
);
291 EXPECT_EQ(static_cast<uint32
>(15), cmd
.data_shm_offset
);
292 CheckBytesWrittenMatchesExpectedSize(
293 next_cmd
, sizeof(cmd
));
296 // TODO(gman): Implement test for BufferSubDataImmediate
297 TEST_F(GLES2FormatTest
, CheckFramebufferStatus
) {
298 cmds::CheckFramebufferStatus
& cmd
=
299 *GetBufferAs
<cmds::CheckFramebufferStatus
>();
300 void* next_cmd
= cmd
.Set(
302 static_cast<GLenum
>(11),
303 static_cast<uint32
>(12),
304 static_cast<uint32
>(13));
305 EXPECT_EQ(static_cast<uint32
>(cmds::CheckFramebufferStatus::kCmdId
),
307 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
308 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
309 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
310 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
311 CheckBytesWrittenMatchesExpectedSize(
312 next_cmd
, sizeof(cmd
));
315 TEST_F(GLES2FormatTest
, Clear
) {
316 cmds::Clear
& cmd
= *GetBufferAs
<cmds::Clear
>();
317 void* next_cmd
= cmd
.Set(
319 static_cast<GLbitfield
>(11));
320 EXPECT_EQ(static_cast<uint32
>(cmds::Clear::kCmdId
),
322 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
323 EXPECT_EQ(static_cast<GLbitfield
>(11), cmd
.mask
);
324 CheckBytesWrittenMatchesExpectedSize(
325 next_cmd
, sizeof(cmd
));
328 TEST_F(GLES2FormatTest
, ClearColor
) {
329 cmds::ClearColor
& cmd
= *GetBufferAs
<cmds::ClearColor
>();
330 void* next_cmd
= cmd
.Set(
332 static_cast<GLclampf
>(11),
333 static_cast<GLclampf
>(12),
334 static_cast<GLclampf
>(13),
335 static_cast<GLclampf
>(14));
336 EXPECT_EQ(static_cast<uint32
>(cmds::ClearColor::kCmdId
),
338 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
339 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.red
);
340 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.green
);
341 EXPECT_EQ(static_cast<GLclampf
>(13), cmd
.blue
);
342 EXPECT_EQ(static_cast<GLclampf
>(14), cmd
.alpha
);
343 CheckBytesWrittenMatchesExpectedSize(
344 next_cmd
, sizeof(cmd
));
347 TEST_F(GLES2FormatTest
, ClearDepthf
) {
348 cmds::ClearDepthf
& cmd
= *GetBufferAs
<cmds::ClearDepthf
>();
349 void* next_cmd
= cmd
.Set(
351 static_cast<GLclampf
>(11));
352 EXPECT_EQ(static_cast<uint32
>(cmds::ClearDepthf::kCmdId
),
354 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
355 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.depth
);
356 CheckBytesWrittenMatchesExpectedSize(
357 next_cmd
, sizeof(cmd
));
360 TEST_F(GLES2FormatTest
, ClearStencil
) {
361 cmds::ClearStencil
& cmd
= *GetBufferAs
<cmds::ClearStencil
>();
362 void* next_cmd
= cmd
.Set(
364 static_cast<GLint
>(11));
365 EXPECT_EQ(static_cast<uint32
>(cmds::ClearStencil::kCmdId
),
367 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
368 EXPECT_EQ(static_cast<GLint
>(11), cmd
.s
);
369 CheckBytesWrittenMatchesExpectedSize(
370 next_cmd
, sizeof(cmd
));
373 TEST_F(GLES2FormatTest
, ColorMask
) {
374 cmds::ColorMask
& cmd
= *GetBufferAs
<cmds::ColorMask
>();
375 void* next_cmd
= cmd
.Set(
377 static_cast<GLboolean
>(11),
378 static_cast<GLboolean
>(12),
379 static_cast<GLboolean
>(13),
380 static_cast<GLboolean
>(14));
381 EXPECT_EQ(static_cast<uint32
>(cmds::ColorMask::kCmdId
),
383 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
384 EXPECT_EQ(static_cast<GLboolean
>(11), cmd
.red
);
385 EXPECT_EQ(static_cast<GLboolean
>(12), cmd
.green
);
386 EXPECT_EQ(static_cast<GLboolean
>(13), cmd
.blue
);
387 EXPECT_EQ(static_cast<GLboolean
>(14), cmd
.alpha
);
388 CheckBytesWrittenMatchesExpectedSize(
389 next_cmd
, sizeof(cmd
));
392 TEST_F(GLES2FormatTest
, CompileShader
) {
393 cmds::CompileShader
& cmd
= *GetBufferAs
<cmds::CompileShader
>();
394 void* next_cmd
= cmd
.Set(
396 static_cast<GLuint
>(11));
397 EXPECT_EQ(static_cast<uint32
>(cmds::CompileShader::kCmdId
),
399 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
400 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
401 CheckBytesWrittenMatchesExpectedSize(
402 next_cmd
, sizeof(cmd
));
405 TEST_F(GLES2FormatTest
, CompressedTexImage2D
) {
406 cmds::CompressedTexImage2D
& cmd
= *GetBufferAs
<cmds::CompressedTexImage2D
>();
407 void* next_cmd
= cmd
.Set(
409 static_cast<GLenum
>(11),
410 static_cast<GLint
>(12),
411 static_cast<GLenum
>(13),
412 static_cast<GLsizei
>(14),
413 static_cast<GLsizei
>(15),
414 static_cast<GLint
>(16),
415 static_cast<GLsizei
>(17),
416 static_cast<uint32
>(18),
417 static_cast<uint32
>(19));
418 EXPECT_EQ(static_cast<uint32
>(cmds::CompressedTexImage2D::kCmdId
),
420 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
421 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
422 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
423 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
424 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
425 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
426 EXPECT_EQ(static_cast<GLint
>(16), cmd
.border
);
427 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.imageSize
);
428 EXPECT_EQ(static_cast<uint32
>(18), cmd
.data_shm_id
);
429 EXPECT_EQ(static_cast<uint32
>(19), cmd
.data_shm_offset
);
430 CheckBytesWrittenMatchesExpectedSize(
431 next_cmd
, sizeof(cmd
));
434 // TODO(gman): Implement test for CompressedTexImage2DImmediate
435 TEST_F(GLES2FormatTest
, CompressedTexImage2DBucket
) {
436 cmds::CompressedTexImage2DBucket
& cmd
=
437 *GetBufferAs
<cmds::CompressedTexImage2DBucket
>();
438 void* next_cmd
= cmd
.Set(
440 static_cast<GLenum
>(11),
441 static_cast<GLint
>(12),
442 static_cast<GLenum
>(13),
443 static_cast<GLsizei
>(14),
444 static_cast<GLsizei
>(15),
445 static_cast<GLint
>(16),
446 static_cast<GLuint
>(17));
447 EXPECT_EQ(static_cast<uint32
>(cmds::CompressedTexImage2DBucket::kCmdId
),
449 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
450 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
451 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
452 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
453 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
454 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
455 EXPECT_EQ(static_cast<GLint
>(16), cmd
.border
);
456 EXPECT_EQ(static_cast<GLuint
>(17), cmd
.bucket_id
);
457 CheckBytesWrittenMatchesExpectedSize(
458 next_cmd
, sizeof(cmd
));
461 TEST_F(GLES2FormatTest
, CompressedTexSubImage2D
) {
462 cmds::CompressedTexSubImage2D
& cmd
=
463 *GetBufferAs
<cmds::CompressedTexSubImage2D
>();
464 void* next_cmd
= cmd
.Set(
466 static_cast<GLenum
>(11),
467 static_cast<GLint
>(12),
468 static_cast<GLint
>(13),
469 static_cast<GLint
>(14),
470 static_cast<GLsizei
>(15),
471 static_cast<GLsizei
>(16),
472 static_cast<GLenum
>(17),
473 static_cast<GLsizei
>(18),
474 static_cast<uint32
>(19),
475 static_cast<uint32
>(20));
476 EXPECT_EQ(static_cast<uint32
>(cmds::CompressedTexSubImage2D::kCmdId
),
478 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
479 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
480 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
481 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
482 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
483 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
484 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
485 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
486 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.imageSize
);
487 EXPECT_EQ(static_cast<uint32
>(19), cmd
.data_shm_id
);
488 EXPECT_EQ(static_cast<uint32
>(20), cmd
.data_shm_offset
);
489 CheckBytesWrittenMatchesExpectedSize(
490 next_cmd
, sizeof(cmd
));
493 // TODO(gman): Implement test for CompressedTexSubImage2DImmediate
494 TEST_F(GLES2FormatTest
, CompressedTexSubImage2DBucket
) {
495 cmds::CompressedTexSubImage2DBucket
& cmd
=
496 *GetBufferAs
<cmds::CompressedTexSubImage2DBucket
>();
497 void* next_cmd
= cmd
.Set(
499 static_cast<GLenum
>(11),
500 static_cast<GLint
>(12),
501 static_cast<GLint
>(13),
502 static_cast<GLint
>(14),
503 static_cast<GLsizei
>(15),
504 static_cast<GLsizei
>(16),
505 static_cast<GLenum
>(17),
506 static_cast<GLuint
>(18));
507 EXPECT_EQ(static_cast<uint32
>(cmds::CompressedTexSubImage2DBucket::kCmdId
),
509 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
510 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
511 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
512 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
513 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
514 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
515 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
516 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
517 EXPECT_EQ(static_cast<GLuint
>(18), cmd
.bucket_id
);
518 CheckBytesWrittenMatchesExpectedSize(
519 next_cmd
, sizeof(cmd
));
522 TEST_F(GLES2FormatTest
, CopyTexImage2D
) {
523 cmds::CopyTexImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexImage2D
>();
524 void* next_cmd
= cmd
.Set(
526 static_cast<GLenum
>(11),
527 static_cast<GLint
>(12),
528 static_cast<GLenum
>(13),
529 static_cast<GLint
>(14),
530 static_cast<GLint
>(15),
531 static_cast<GLsizei
>(16),
532 static_cast<GLsizei
>(17),
533 static_cast<GLint
>(18));
534 EXPECT_EQ(static_cast<uint32
>(cmds::CopyTexImage2D::kCmdId
),
536 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
537 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
538 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
539 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
540 EXPECT_EQ(static_cast<GLint
>(14), cmd
.x
);
541 EXPECT_EQ(static_cast<GLint
>(15), cmd
.y
);
542 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
543 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
544 EXPECT_EQ(static_cast<GLint
>(18), cmd
.border
);
545 CheckBytesWrittenMatchesExpectedSize(
546 next_cmd
, sizeof(cmd
));
549 TEST_F(GLES2FormatTest
, CopyTexSubImage2D
) {
550 cmds::CopyTexSubImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexSubImage2D
>();
551 void* next_cmd
= cmd
.Set(
553 static_cast<GLenum
>(11),
554 static_cast<GLint
>(12),
555 static_cast<GLint
>(13),
556 static_cast<GLint
>(14),
557 static_cast<GLint
>(15),
558 static_cast<GLint
>(16),
559 static_cast<GLsizei
>(17),
560 static_cast<GLsizei
>(18));
561 EXPECT_EQ(static_cast<uint32
>(cmds::CopyTexSubImage2D::kCmdId
),
563 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
564 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
565 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
566 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
567 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
568 EXPECT_EQ(static_cast<GLint
>(15), cmd
.x
);
569 EXPECT_EQ(static_cast<GLint
>(16), cmd
.y
);
570 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.width
);
571 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.height
);
572 CheckBytesWrittenMatchesExpectedSize(
573 next_cmd
, sizeof(cmd
));
576 TEST_F(GLES2FormatTest
, CreateProgram
) {
577 cmds::CreateProgram
& cmd
= *GetBufferAs
<cmds::CreateProgram
>();
578 void* next_cmd
= cmd
.Set(
580 static_cast<uint32
>(11));
581 EXPECT_EQ(static_cast<uint32
>(cmds::CreateProgram::kCmdId
),
583 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
584 EXPECT_EQ(static_cast<uint32
>(11), cmd
.client_id
);
585 CheckBytesWrittenMatchesExpectedSize(
586 next_cmd
, sizeof(cmd
));
589 TEST_F(GLES2FormatTest
, CreateShader
) {
590 cmds::CreateShader
& cmd
= *GetBufferAs
<cmds::CreateShader
>();
591 void* next_cmd
= cmd
.Set(
593 static_cast<GLenum
>(11),
594 static_cast<uint32
>(12));
595 EXPECT_EQ(static_cast<uint32
>(cmds::CreateShader::kCmdId
),
597 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
598 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.type
);
599 EXPECT_EQ(static_cast<uint32
>(12), cmd
.client_id
);
600 CheckBytesWrittenMatchesExpectedSize(
601 next_cmd
, sizeof(cmd
));
604 TEST_F(GLES2FormatTest
, CullFace
) {
605 cmds::CullFace
& cmd
= *GetBufferAs
<cmds::CullFace
>();
606 void* next_cmd
= cmd
.Set(
608 static_cast<GLenum
>(11));
609 EXPECT_EQ(static_cast<uint32
>(cmds::CullFace::kCmdId
),
611 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
612 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
613 CheckBytesWrittenMatchesExpectedSize(
614 next_cmd
, sizeof(cmd
));
617 TEST_F(GLES2FormatTest
, DeleteBuffers
) {
618 cmds::DeleteBuffers
& cmd
= *GetBufferAs
<cmds::DeleteBuffers
>();
619 void* next_cmd
= cmd
.Set(
621 static_cast<GLsizei
>(11),
622 static_cast<uint32
>(12),
623 static_cast<uint32
>(13));
624 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteBuffers::kCmdId
),
626 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
627 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
628 EXPECT_EQ(static_cast<uint32
>(12), cmd
.buffers_shm_id
);
629 EXPECT_EQ(static_cast<uint32
>(13), cmd
.buffers_shm_offset
);
630 CheckBytesWrittenMatchesExpectedSize(
631 next_cmd
, sizeof(cmd
));
634 TEST_F(GLES2FormatTest
, DeleteBuffersImmediate
) {
635 static GLuint ids
[] = { 12, 23, 34, };
636 cmds::DeleteBuffersImmediate
& cmd
=
637 *GetBufferAs
<cmds::DeleteBuffersImmediate
>();
638 void* next_cmd
= cmd
.Set(
639 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
640 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteBuffersImmediate::kCmdId
),
642 EXPECT_EQ(sizeof(cmd
) +
643 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
644 cmd
.header
.size
* 4u);
645 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
646 CheckBytesWrittenMatchesExpectedSize(
647 next_cmd
, sizeof(cmd
) +
648 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
649 // TODO(gman): Check that ids were inserted;
652 TEST_F(GLES2FormatTest
, DeleteFramebuffers
) {
653 cmds::DeleteFramebuffers
& cmd
= *GetBufferAs
<cmds::DeleteFramebuffers
>();
654 void* next_cmd
= cmd
.Set(
656 static_cast<GLsizei
>(11),
657 static_cast<uint32
>(12),
658 static_cast<uint32
>(13));
659 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteFramebuffers::kCmdId
),
661 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
662 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
663 EXPECT_EQ(static_cast<uint32
>(12), cmd
.framebuffers_shm_id
);
664 EXPECT_EQ(static_cast<uint32
>(13), cmd
.framebuffers_shm_offset
);
665 CheckBytesWrittenMatchesExpectedSize(
666 next_cmd
, sizeof(cmd
));
669 TEST_F(GLES2FormatTest
, DeleteFramebuffersImmediate
) {
670 static GLuint ids
[] = { 12, 23, 34, };
671 cmds::DeleteFramebuffersImmediate
& cmd
=
672 *GetBufferAs
<cmds::DeleteFramebuffersImmediate
>();
673 void* next_cmd
= cmd
.Set(
674 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
675 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteFramebuffersImmediate::kCmdId
),
677 EXPECT_EQ(sizeof(cmd
) +
678 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
679 cmd
.header
.size
* 4u);
680 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
681 CheckBytesWrittenMatchesExpectedSize(
682 next_cmd
, sizeof(cmd
) +
683 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
684 // TODO(gman): Check that ids were inserted;
687 TEST_F(GLES2FormatTest
, DeleteProgram
) {
688 cmds::DeleteProgram
& cmd
= *GetBufferAs
<cmds::DeleteProgram
>();
689 void* next_cmd
= cmd
.Set(
691 static_cast<GLuint
>(11));
692 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteProgram::kCmdId
),
694 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
695 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
696 CheckBytesWrittenMatchesExpectedSize(
697 next_cmd
, sizeof(cmd
));
700 TEST_F(GLES2FormatTest
, DeleteRenderbuffers
) {
701 cmds::DeleteRenderbuffers
& cmd
= *GetBufferAs
<cmds::DeleteRenderbuffers
>();
702 void* next_cmd
= cmd
.Set(
704 static_cast<GLsizei
>(11),
705 static_cast<uint32
>(12),
706 static_cast<uint32
>(13));
707 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteRenderbuffers::kCmdId
),
709 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
710 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
711 EXPECT_EQ(static_cast<uint32
>(12), cmd
.renderbuffers_shm_id
);
712 EXPECT_EQ(static_cast<uint32
>(13), cmd
.renderbuffers_shm_offset
);
713 CheckBytesWrittenMatchesExpectedSize(
714 next_cmd
, sizeof(cmd
));
717 TEST_F(GLES2FormatTest
, DeleteRenderbuffersImmediate
) {
718 static GLuint ids
[] = { 12, 23, 34, };
719 cmds::DeleteRenderbuffersImmediate
& cmd
=
720 *GetBufferAs
<cmds::DeleteRenderbuffersImmediate
>();
721 void* next_cmd
= cmd
.Set(
722 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
723 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteRenderbuffersImmediate::kCmdId
),
725 EXPECT_EQ(sizeof(cmd
) +
726 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
727 cmd
.header
.size
* 4u);
728 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
729 CheckBytesWrittenMatchesExpectedSize(
730 next_cmd
, sizeof(cmd
) +
731 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
732 // TODO(gman): Check that ids were inserted;
735 TEST_F(GLES2FormatTest
, DeleteShader
) {
736 cmds::DeleteShader
& cmd
= *GetBufferAs
<cmds::DeleteShader
>();
737 void* next_cmd
= cmd
.Set(
739 static_cast<GLuint
>(11));
740 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteShader::kCmdId
),
742 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
743 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
744 CheckBytesWrittenMatchesExpectedSize(
745 next_cmd
, sizeof(cmd
));
748 TEST_F(GLES2FormatTest
, DeleteTextures
) {
749 cmds::DeleteTextures
& cmd
= *GetBufferAs
<cmds::DeleteTextures
>();
750 void* next_cmd
= cmd
.Set(
752 static_cast<GLsizei
>(11),
753 static_cast<uint32
>(12),
754 static_cast<uint32
>(13));
755 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteTextures::kCmdId
),
757 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
758 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
759 EXPECT_EQ(static_cast<uint32
>(12), cmd
.textures_shm_id
);
760 EXPECT_EQ(static_cast<uint32
>(13), cmd
.textures_shm_offset
);
761 CheckBytesWrittenMatchesExpectedSize(
762 next_cmd
, sizeof(cmd
));
765 TEST_F(GLES2FormatTest
, DeleteTexturesImmediate
) {
766 static GLuint ids
[] = { 12, 23, 34, };
767 cmds::DeleteTexturesImmediate
& cmd
=
768 *GetBufferAs
<cmds::DeleteTexturesImmediate
>();
769 void* next_cmd
= cmd
.Set(
770 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
771 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteTexturesImmediate::kCmdId
),
773 EXPECT_EQ(sizeof(cmd
) +
774 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
775 cmd
.header
.size
* 4u);
776 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
777 CheckBytesWrittenMatchesExpectedSize(
778 next_cmd
, sizeof(cmd
) +
779 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
780 // TODO(gman): Check that ids were inserted;
783 TEST_F(GLES2FormatTest
, DepthFunc
) {
784 cmds::DepthFunc
& cmd
= *GetBufferAs
<cmds::DepthFunc
>();
785 void* next_cmd
= cmd
.Set(
787 static_cast<GLenum
>(11));
788 EXPECT_EQ(static_cast<uint32
>(cmds::DepthFunc::kCmdId
),
790 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
791 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
792 CheckBytesWrittenMatchesExpectedSize(
793 next_cmd
, sizeof(cmd
));
796 TEST_F(GLES2FormatTest
, DepthMask
) {
797 cmds::DepthMask
& cmd
= *GetBufferAs
<cmds::DepthMask
>();
798 void* next_cmd
= cmd
.Set(
800 static_cast<GLboolean
>(11));
801 EXPECT_EQ(static_cast<uint32
>(cmds::DepthMask::kCmdId
),
803 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
804 EXPECT_EQ(static_cast<GLboolean
>(11), cmd
.flag
);
805 CheckBytesWrittenMatchesExpectedSize(
806 next_cmd
, sizeof(cmd
));
809 TEST_F(GLES2FormatTest
, DepthRangef
) {
810 cmds::DepthRangef
& cmd
= *GetBufferAs
<cmds::DepthRangef
>();
811 void* next_cmd
= cmd
.Set(
813 static_cast<GLclampf
>(11),
814 static_cast<GLclampf
>(12));
815 EXPECT_EQ(static_cast<uint32
>(cmds::DepthRangef::kCmdId
),
817 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
818 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.zNear
);
819 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.zFar
);
820 CheckBytesWrittenMatchesExpectedSize(
821 next_cmd
, sizeof(cmd
));
824 TEST_F(GLES2FormatTest
, DetachShader
) {
825 cmds::DetachShader
& cmd
= *GetBufferAs
<cmds::DetachShader
>();
826 void* next_cmd
= cmd
.Set(
828 static_cast<GLuint
>(11),
829 static_cast<GLuint
>(12));
830 EXPECT_EQ(static_cast<uint32
>(cmds::DetachShader::kCmdId
),
832 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
833 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
834 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
835 CheckBytesWrittenMatchesExpectedSize(
836 next_cmd
, sizeof(cmd
));
839 TEST_F(GLES2FormatTest
, Disable
) {
840 cmds::Disable
& cmd
= *GetBufferAs
<cmds::Disable
>();
841 void* next_cmd
= cmd
.Set(
843 static_cast<GLenum
>(11));
844 EXPECT_EQ(static_cast<uint32
>(cmds::Disable::kCmdId
),
846 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
847 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
848 CheckBytesWrittenMatchesExpectedSize(
849 next_cmd
, sizeof(cmd
));
852 TEST_F(GLES2FormatTest
, DisableVertexAttribArray
) {
853 cmds::DisableVertexAttribArray
& cmd
=
854 *GetBufferAs
<cmds::DisableVertexAttribArray
>();
855 void* next_cmd
= cmd
.Set(
857 static_cast<GLuint
>(11));
858 EXPECT_EQ(static_cast<uint32
>(cmds::DisableVertexAttribArray::kCmdId
),
860 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
861 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
862 CheckBytesWrittenMatchesExpectedSize(
863 next_cmd
, sizeof(cmd
));
866 TEST_F(GLES2FormatTest
, DrawArrays
) {
867 cmds::DrawArrays
& cmd
= *GetBufferAs
<cmds::DrawArrays
>();
868 void* next_cmd
= cmd
.Set(
870 static_cast<GLenum
>(11),
871 static_cast<GLint
>(12),
872 static_cast<GLsizei
>(13));
873 EXPECT_EQ(static_cast<uint32
>(cmds::DrawArrays::kCmdId
),
875 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
876 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
877 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
878 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
879 CheckBytesWrittenMatchesExpectedSize(
880 next_cmd
, sizeof(cmd
));
883 TEST_F(GLES2FormatTest
, DrawElements
) {
884 cmds::DrawElements
& cmd
= *GetBufferAs
<cmds::DrawElements
>();
885 void* next_cmd
= cmd
.Set(
887 static_cast<GLenum
>(11),
888 static_cast<GLsizei
>(12),
889 static_cast<GLenum
>(13),
890 static_cast<GLuint
>(14));
891 EXPECT_EQ(static_cast<uint32
>(cmds::DrawElements::kCmdId
),
893 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
894 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
895 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
896 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
897 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
898 CheckBytesWrittenMatchesExpectedSize(
899 next_cmd
, sizeof(cmd
));
902 TEST_F(GLES2FormatTest
, Enable
) {
903 cmds::Enable
& cmd
= *GetBufferAs
<cmds::Enable
>();
904 void* next_cmd
= cmd
.Set(
906 static_cast<GLenum
>(11));
907 EXPECT_EQ(static_cast<uint32
>(cmds::Enable::kCmdId
),
909 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
910 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
911 CheckBytesWrittenMatchesExpectedSize(
912 next_cmd
, sizeof(cmd
));
915 TEST_F(GLES2FormatTest
, EnableVertexAttribArray
) {
916 cmds::EnableVertexAttribArray
& cmd
=
917 *GetBufferAs
<cmds::EnableVertexAttribArray
>();
918 void* next_cmd
= cmd
.Set(
920 static_cast<GLuint
>(11));
921 EXPECT_EQ(static_cast<uint32
>(cmds::EnableVertexAttribArray::kCmdId
),
923 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
924 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
925 CheckBytesWrittenMatchesExpectedSize(
926 next_cmd
, sizeof(cmd
));
929 TEST_F(GLES2FormatTest
, Finish
) {
930 cmds::Finish
& cmd
= *GetBufferAs
<cmds::Finish
>();
931 void* next_cmd
= cmd
.Set(
933 EXPECT_EQ(static_cast<uint32
>(cmds::Finish::kCmdId
),
935 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
936 CheckBytesWrittenMatchesExpectedSize(
937 next_cmd
, sizeof(cmd
));
940 TEST_F(GLES2FormatTest
, Flush
) {
941 cmds::Flush
& cmd
= *GetBufferAs
<cmds::Flush
>();
942 void* next_cmd
= cmd
.Set(
944 EXPECT_EQ(static_cast<uint32
>(cmds::Flush::kCmdId
),
946 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
947 CheckBytesWrittenMatchesExpectedSize(
948 next_cmd
, sizeof(cmd
));
951 TEST_F(GLES2FormatTest
, FramebufferRenderbuffer
) {
952 cmds::FramebufferRenderbuffer
& cmd
=
953 *GetBufferAs
<cmds::FramebufferRenderbuffer
>();
954 void* next_cmd
= cmd
.Set(
956 static_cast<GLenum
>(11),
957 static_cast<GLenum
>(12),
958 static_cast<GLenum
>(13),
959 static_cast<GLuint
>(14));
960 EXPECT_EQ(static_cast<uint32
>(cmds::FramebufferRenderbuffer::kCmdId
),
962 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
963 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
964 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
965 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.renderbuffertarget
);
966 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.renderbuffer
);
967 CheckBytesWrittenMatchesExpectedSize(
968 next_cmd
, sizeof(cmd
));
971 TEST_F(GLES2FormatTest
, FramebufferTexture2D
) {
972 cmds::FramebufferTexture2D
& cmd
= *GetBufferAs
<cmds::FramebufferTexture2D
>();
973 void* next_cmd
= cmd
.Set(
975 static_cast<GLenum
>(11),
976 static_cast<GLenum
>(12),
977 static_cast<GLenum
>(13),
978 static_cast<GLuint
>(14),
979 static_cast<GLint
>(15));
980 EXPECT_EQ(static_cast<uint32
>(cmds::FramebufferTexture2D::kCmdId
),
982 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
983 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
984 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
985 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
986 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
987 EXPECT_EQ(static_cast<GLint
>(15), cmd
.level
);
988 CheckBytesWrittenMatchesExpectedSize(
989 next_cmd
, sizeof(cmd
));
992 TEST_F(GLES2FormatTest
, FrontFace
) {
993 cmds::FrontFace
& cmd
= *GetBufferAs
<cmds::FrontFace
>();
994 void* next_cmd
= cmd
.Set(
996 static_cast<GLenum
>(11));
997 EXPECT_EQ(static_cast<uint32
>(cmds::FrontFace::kCmdId
),
999 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1000 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
1001 CheckBytesWrittenMatchesExpectedSize(
1002 next_cmd
, sizeof(cmd
));
1005 TEST_F(GLES2FormatTest
, GenBuffers
) {
1006 cmds::GenBuffers
& cmd
= *GetBufferAs
<cmds::GenBuffers
>();
1007 void* next_cmd
= cmd
.Set(
1009 static_cast<GLsizei
>(11),
1010 static_cast<uint32
>(12),
1011 static_cast<uint32
>(13));
1012 EXPECT_EQ(static_cast<uint32
>(cmds::GenBuffers::kCmdId
),
1013 cmd
.header
.command
);
1014 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1015 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
1016 EXPECT_EQ(static_cast<uint32
>(12), cmd
.buffers_shm_id
);
1017 EXPECT_EQ(static_cast<uint32
>(13), cmd
.buffers_shm_offset
);
1018 CheckBytesWrittenMatchesExpectedSize(
1019 next_cmd
, sizeof(cmd
));
1022 TEST_F(GLES2FormatTest
, GenBuffersImmediate
) {
1023 static GLuint ids
[] = { 12, 23, 34, };
1024 cmds::GenBuffersImmediate
& cmd
= *GetBufferAs
<cmds::GenBuffersImmediate
>();
1025 void* next_cmd
= cmd
.Set(
1026 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1027 EXPECT_EQ(static_cast<uint32
>(cmds::GenBuffersImmediate::kCmdId
),
1028 cmd
.header
.command
);
1029 EXPECT_EQ(sizeof(cmd
) +
1030 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1031 cmd
.header
.size
* 4u);
1032 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1033 CheckBytesWrittenMatchesExpectedSize(
1034 next_cmd
, sizeof(cmd
) +
1035 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1036 // TODO(gman): Check that ids were inserted;
1039 TEST_F(GLES2FormatTest
, GenerateMipmap
) {
1040 cmds::GenerateMipmap
& cmd
= *GetBufferAs
<cmds::GenerateMipmap
>();
1041 void* next_cmd
= cmd
.Set(
1043 static_cast<GLenum
>(11));
1044 EXPECT_EQ(static_cast<uint32
>(cmds::GenerateMipmap::kCmdId
),
1045 cmd
.header
.command
);
1046 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1047 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1048 CheckBytesWrittenMatchesExpectedSize(
1049 next_cmd
, sizeof(cmd
));
1052 TEST_F(GLES2FormatTest
, GenFramebuffers
) {
1053 cmds::GenFramebuffers
& cmd
= *GetBufferAs
<cmds::GenFramebuffers
>();
1054 void* next_cmd
= cmd
.Set(
1056 static_cast<GLsizei
>(11),
1057 static_cast<uint32
>(12),
1058 static_cast<uint32
>(13));
1059 EXPECT_EQ(static_cast<uint32
>(cmds::GenFramebuffers::kCmdId
),
1060 cmd
.header
.command
);
1061 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1062 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
1063 EXPECT_EQ(static_cast<uint32
>(12), cmd
.framebuffers_shm_id
);
1064 EXPECT_EQ(static_cast<uint32
>(13), cmd
.framebuffers_shm_offset
);
1065 CheckBytesWrittenMatchesExpectedSize(
1066 next_cmd
, sizeof(cmd
));
1069 TEST_F(GLES2FormatTest
, GenFramebuffersImmediate
) {
1070 static GLuint ids
[] = { 12, 23, 34, };
1071 cmds::GenFramebuffersImmediate
& cmd
=
1072 *GetBufferAs
<cmds::GenFramebuffersImmediate
>();
1073 void* next_cmd
= cmd
.Set(
1074 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1075 EXPECT_EQ(static_cast<uint32
>(cmds::GenFramebuffersImmediate::kCmdId
),
1076 cmd
.header
.command
);
1077 EXPECT_EQ(sizeof(cmd
) +
1078 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1079 cmd
.header
.size
* 4u);
1080 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1081 CheckBytesWrittenMatchesExpectedSize(
1082 next_cmd
, sizeof(cmd
) +
1083 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1084 // TODO(gman): Check that ids were inserted;
1087 TEST_F(GLES2FormatTest
, GenRenderbuffers
) {
1088 cmds::GenRenderbuffers
& cmd
= *GetBufferAs
<cmds::GenRenderbuffers
>();
1089 void* next_cmd
= cmd
.Set(
1091 static_cast<GLsizei
>(11),
1092 static_cast<uint32
>(12),
1093 static_cast<uint32
>(13));
1094 EXPECT_EQ(static_cast<uint32
>(cmds::GenRenderbuffers::kCmdId
),
1095 cmd
.header
.command
);
1096 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1097 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
1098 EXPECT_EQ(static_cast<uint32
>(12), cmd
.renderbuffers_shm_id
);
1099 EXPECT_EQ(static_cast<uint32
>(13), cmd
.renderbuffers_shm_offset
);
1100 CheckBytesWrittenMatchesExpectedSize(
1101 next_cmd
, sizeof(cmd
));
1104 TEST_F(GLES2FormatTest
, GenRenderbuffersImmediate
) {
1105 static GLuint ids
[] = { 12, 23, 34, };
1106 cmds::GenRenderbuffersImmediate
& cmd
=
1107 *GetBufferAs
<cmds::GenRenderbuffersImmediate
>();
1108 void* next_cmd
= cmd
.Set(
1109 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1110 EXPECT_EQ(static_cast<uint32
>(cmds::GenRenderbuffersImmediate::kCmdId
),
1111 cmd
.header
.command
);
1112 EXPECT_EQ(sizeof(cmd
) +
1113 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1114 cmd
.header
.size
* 4u);
1115 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1116 CheckBytesWrittenMatchesExpectedSize(
1117 next_cmd
, sizeof(cmd
) +
1118 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1119 // TODO(gman): Check that ids were inserted;
1122 TEST_F(GLES2FormatTest
, GenTextures
) {
1123 cmds::GenTextures
& cmd
= *GetBufferAs
<cmds::GenTextures
>();
1124 void* next_cmd
= cmd
.Set(
1126 static_cast<GLsizei
>(11),
1127 static_cast<uint32
>(12),
1128 static_cast<uint32
>(13));
1129 EXPECT_EQ(static_cast<uint32
>(cmds::GenTextures::kCmdId
),
1130 cmd
.header
.command
);
1131 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1132 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
1133 EXPECT_EQ(static_cast<uint32
>(12), cmd
.textures_shm_id
);
1134 EXPECT_EQ(static_cast<uint32
>(13), cmd
.textures_shm_offset
);
1135 CheckBytesWrittenMatchesExpectedSize(
1136 next_cmd
, sizeof(cmd
));
1139 TEST_F(GLES2FormatTest
, GenTexturesImmediate
) {
1140 static GLuint ids
[] = { 12, 23, 34, };
1141 cmds::GenTexturesImmediate
& cmd
= *GetBufferAs
<cmds::GenTexturesImmediate
>();
1142 void* next_cmd
= cmd
.Set(
1143 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1144 EXPECT_EQ(static_cast<uint32
>(cmds::GenTexturesImmediate::kCmdId
),
1145 cmd
.header
.command
);
1146 EXPECT_EQ(sizeof(cmd
) +
1147 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1148 cmd
.header
.size
* 4u);
1149 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1150 CheckBytesWrittenMatchesExpectedSize(
1151 next_cmd
, sizeof(cmd
) +
1152 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1153 // TODO(gman): Check that ids were inserted;
1156 TEST_F(GLES2FormatTest
, GetActiveAttrib
) {
1157 cmds::GetActiveAttrib
& cmd
= *GetBufferAs
<cmds::GetActiveAttrib
>();
1158 void* next_cmd
= cmd
.Set(
1160 static_cast<GLuint
>(11),
1161 static_cast<GLuint
>(12),
1162 static_cast<uint32
>(13),
1163 static_cast<uint32
>(14),
1164 static_cast<uint32
>(15));
1165 EXPECT_EQ(static_cast<uint32
>(cmds::GetActiveAttrib::kCmdId
),
1166 cmd
.header
.command
);
1167 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1168 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1169 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1170 EXPECT_EQ(static_cast<uint32
>(13), cmd
.name_bucket_id
);
1171 EXPECT_EQ(static_cast<uint32
>(14), cmd
.result_shm_id
);
1172 EXPECT_EQ(static_cast<uint32
>(15), cmd
.result_shm_offset
);
1173 CheckBytesWrittenMatchesExpectedSize(
1174 next_cmd
, sizeof(cmd
));
1177 TEST_F(GLES2FormatTest
, GetActiveUniform
) {
1178 cmds::GetActiveUniform
& cmd
= *GetBufferAs
<cmds::GetActiveUniform
>();
1179 void* next_cmd
= cmd
.Set(
1181 static_cast<GLuint
>(11),
1182 static_cast<GLuint
>(12),
1183 static_cast<uint32
>(13),
1184 static_cast<uint32
>(14),
1185 static_cast<uint32
>(15));
1186 EXPECT_EQ(static_cast<uint32
>(cmds::GetActiveUniform::kCmdId
),
1187 cmd
.header
.command
);
1188 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1189 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1190 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1191 EXPECT_EQ(static_cast<uint32
>(13), cmd
.name_bucket_id
);
1192 EXPECT_EQ(static_cast<uint32
>(14), cmd
.result_shm_id
);
1193 EXPECT_EQ(static_cast<uint32
>(15), cmd
.result_shm_offset
);
1194 CheckBytesWrittenMatchesExpectedSize(
1195 next_cmd
, sizeof(cmd
));
1198 TEST_F(GLES2FormatTest
, GetAttachedShaders
) {
1199 cmds::GetAttachedShaders
& cmd
= *GetBufferAs
<cmds::GetAttachedShaders
>();
1200 void* next_cmd
= cmd
.Set(
1202 static_cast<GLuint
>(11),
1203 static_cast<uint32
>(12),
1204 static_cast<uint32
>(13),
1205 static_cast<uint32
>(14));
1206 EXPECT_EQ(static_cast<uint32
>(cmds::GetAttachedShaders::kCmdId
),
1207 cmd
.header
.command
);
1208 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1209 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1210 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1211 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1212 EXPECT_EQ(static_cast<uint32
>(14), cmd
.result_size
);
1213 CheckBytesWrittenMatchesExpectedSize(
1214 next_cmd
, sizeof(cmd
));
1217 // TODO(gman): Write test for GetAttribLocation
1218 // TODO(gman): Write test for GetAttribLocationImmediate
1219 // TODO(gman): Write test for GetAttribLocationBucket
1220 TEST_F(GLES2FormatTest
, GetBooleanv
) {
1221 cmds::GetBooleanv
& cmd
= *GetBufferAs
<cmds::GetBooleanv
>();
1222 void* next_cmd
= cmd
.Set(
1224 static_cast<GLenum
>(11),
1225 static_cast<uint32
>(12),
1226 static_cast<uint32
>(13));
1227 EXPECT_EQ(static_cast<uint32
>(cmds::GetBooleanv::kCmdId
),
1228 cmd
.header
.command
);
1229 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1230 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1231 EXPECT_EQ(static_cast<uint32
>(12), cmd
.params_shm_id
);
1232 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_offset
);
1233 CheckBytesWrittenMatchesExpectedSize(
1234 next_cmd
, sizeof(cmd
));
1237 TEST_F(GLES2FormatTest
, GetBufferParameteriv
) {
1238 cmds::GetBufferParameteriv
& cmd
= *GetBufferAs
<cmds::GetBufferParameteriv
>();
1239 void* next_cmd
= cmd
.Set(
1241 static_cast<GLenum
>(11),
1242 static_cast<GLenum
>(12),
1243 static_cast<uint32
>(13),
1244 static_cast<uint32
>(14));
1245 EXPECT_EQ(static_cast<uint32
>(cmds::GetBufferParameteriv::kCmdId
),
1246 cmd
.header
.command
);
1247 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1248 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1249 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1250 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1251 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1252 CheckBytesWrittenMatchesExpectedSize(
1253 next_cmd
, sizeof(cmd
));
1256 TEST_F(GLES2FormatTest
, GetError
) {
1257 cmds::GetError
& cmd
= *GetBufferAs
<cmds::GetError
>();
1258 void* next_cmd
= cmd
.Set(
1260 static_cast<uint32
>(11),
1261 static_cast<uint32
>(12));
1262 EXPECT_EQ(static_cast<uint32
>(cmds::GetError::kCmdId
),
1263 cmd
.header
.command
);
1264 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1265 EXPECT_EQ(static_cast<uint32
>(11), cmd
.result_shm_id
);
1266 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_offset
);
1267 CheckBytesWrittenMatchesExpectedSize(
1268 next_cmd
, sizeof(cmd
));
1271 TEST_F(GLES2FormatTest
, GetFloatv
) {
1272 cmds::GetFloatv
& cmd
= *GetBufferAs
<cmds::GetFloatv
>();
1273 void* next_cmd
= cmd
.Set(
1275 static_cast<GLenum
>(11),
1276 static_cast<uint32
>(12),
1277 static_cast<uint32
>(13));
1278 EXPECT_EQ(static_cast<uint32
>(cmds::GetFloatv::kCmdId
),
1279 cmd
.header
.command
);
1280 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1281 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1282 EXPECT_EQ(static_cast<uint32
>(12), cmd
.params_shm_id
);
1283 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_offset
);
1284 CheckBytesWrittenMatchesExpectedSize(
1285 next_cmd
, sizeof(cmd
));
1288 TEST_F(GLES2FormatTest
, GetFramebufferAttachmentParameteriv
) {
1289 cmds::GetFramebufferAttachmentParameteriv
& cmd
=
1290 *GetBufferAs
<cmds::GetFramebufferAttachmentParameteriv
>();
1291 void* next_cmd
= cmd
.Set(
1293 static_cast<GLenum
>(11),
1294 static_cast<GLenum
>(12),
1295 static_cast<GLenum
>(13),
1296 static_cast<uint32
>(14),
1297 static_cast<uint32
>(15));
1299 static_cast<uint32
>(cmds::GetFramebufferAttachmentParameteriv::kCmdId
),
1300 cmd
.header
.command
);
1301 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1302 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1303 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
1304 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1305 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_id
);
1306 EXPECT_EQ(static_cast<uint32
>(15), cmd
.params_shm_offset
);
1307 CheckBytesWrittenMatchesExpectedSize(
1308 next_cmd
, sizeof(cmd
));
1311 TEST_F(GLES2FormatTest
, GetIntegerv
) {
1312 cmds::GetIntegerv
& cmd
= *GetBufferAs
<cmds::GetIntegerv
>();
1313 void* next_cmd
= cmd
.Set(
1315 static_cast<GLenum
>(11),
1316 static_cast<uint32
>(12),
1317 static_cast<uint32
>(13));
1318 EXPECT_EQ(static_cast<uint32
>(cmds::GetIntegerv::kCmdId
),
1319 cmd
.header
.command
);
1320 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1321 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1322 EXPECT_EQ(static_cast<uint32
>(12), cmd
.params_shm_id
);
1323 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_offset
);
1324 CheckBytesWrittenMatchesExpectedSize(
1325 next_cmd
, sizeof(cmd
));
1328 TEST_F(GLES2FormatTest
, GetProgramiv
) {
1329 cmds::GetProgramiv
& cmd
= *GetBufferAs
<cmds::GetProgramiv
>();
1330 void* next_cmd
= cmd
.Set(
1332 static_cast<GLuint
>(11),
1333 static_cast<GLenum
>(12),
1334 static_cast<uint32
>(13),
1335 static_cast<uint32
>(14));
1336 EXPECT_EQ(static_cast<uint32
>(cmds::GetProgramiv::kCmdId
),
1337 cmd
.header
.command
);
1338 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1339 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1340 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1341 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1342 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1343 CheckBytesWrittenMatchesExpectedSize(
1344 next_cmd
, sizeof(cmd
));
1347 TEST_F(GLES2FormatTest
, GetProgramInfoLog
) {
1348 cmds::GetProgramInfoLog
& cmd
= *GetBufferAs
<cmds::GetProgramInfoLog
>();
1349 void* next_cmd
= cmd
.Set(
1351 static_cast<GLuint
>(11),
1352 static_cast<uint32
>(12));
1353 EXPECT_EQ(static_cast<uint32
>(cmds::GetProgramInfoLog::kCmdId
),
1354 cmd
.header
.command
);
1355 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1356 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1357 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bucket_id
);
1358 CheckBytesWrittenMatchesExpectedSize(
1359 next_cmd
, sizeof(cmd
));
1362 TEST_F(GLES2FormatTest
, GetRenderbufferParameteriv
) {
1363 cmds::GetRenderbufferParameteriv
& cmd
=
1364 *GetBufferAs
<cmds::GetRenderbufferParameteriv
>();
1365 void* next_cmd
= cmd
.Set(
1367 static_cast<GLenum
>(11),
1368 static_cast<GLenum
>(12),
1369 static_cast<uint32
>(13),
1370 static_cast<uint32
>(14));
1371 EXPECT_EQ(static_cast<uint32
>(cmds::GetRenderbufferParameteriv::kCmdId
),
1372 cmd
.header
.command
);
1373 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1374 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1375 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1376 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1377 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1378 CheckBytesWrittenMatchesExpectedSize(
1379 next_cmd
, sizeof(cmd
));
1382 TEST_F(GLES2FormatTest
, GetShaderiv
) {
1383 cmds::GetShaderiv
& cmd
= *GetBufferAs
<cmds::GetShaderiv
>();
1384 void* next_cmd
= cmd
.Set(
1386 static_cast<GLuint
>(11),
1387 static_cast<GLenum
>(12),
1388 static_cast<uint32
>(13),
1389 static_cast<uint32
>(14));
1390 EXPECT_EQ(static_cast<uint32
>(cmds::GetShaderiv::kCmdId
),
1391 cmd
.header
.command
);
1392 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1393 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1394 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1395 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1396 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1397 CheckBytesWrittenMatchesExpectedSize(
1398 next_cmd
, sizeof(cmd
));
1401 TEST_F(GLES2FormatTest
, GetShaderInfoLog
) {
1402 cmds::GetShaderInfoLog
& cmd
= *GetBufferAs
<cmds::GetShaderInfoLog
>();
1403 void* next_cmd
= cmd
.Set(
1405 static_cast<GLuint
>(11),
1406 static_cast<uint32
>(12));
1407 EXPECT_EQ(static_cast<uint32
>(cmds::GetShaderInfoLog::kCmdId
),
1408 cmd
.header
.command
);
1409 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1410 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1411 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bucket_id
);
1412 CheckBytesWrittenMatchesExpectedSize(
1413 next_cmd
, sizeof(cmd
));
1416 TEST_F(GLES2FormatTest
, GetShaderPrecisionFormat
) {
1417 cmds::GetShaderPrecisionFormat
& cmd
=
1418 *GetBufferAs
<cmds::GetShaderPrecisionFormat
>();
1419 void* next_cmd
= cmd
.Set(
1421 static_cast<GLenum
>(11),
1422 static_cast<GLenum
>(12),
1423 static_cast<uint32
>(13),
1424 static_cast<uint32
>(14));
1425 EXPECT_EQ(static_cast<uint32
>(cmds::GetShaderPrecisionFormat::kCmdId
),
1426 cmd
.header
.command
);
1427 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1428 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.shadertype
);
1429 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.precisiontype
);
1430 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_id
);
1431 EXPECT_EQ(static_cast<uint32
>(14), cmd
.result_shm_offset
);
1432 CheckBytesWrittenMatchesExpectedSize(
1433 next_cmd
, sizeof(cmd
));
1436 TEST_F(GLES2FormatTest
, GetShaderSource
) {
1437 cmds::GetShaderSource
& cmd
= *GetBufferAs
<cmds::GetShaderSource
>();
1438 void* next_cmd
= cmd
.Set(
1440 static_cast<GLuint
>(11),
1441 static_cast<uint32
>(12));
1442 EXPECT_EQ(static_cast<uint32
>(cmds::GetShaderSource::kCmdId
),
1443 cmd
.header
.command
);
1444 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1445 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1446 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bucket_id
);
1447 CheckBytesWrittenMatchesExpectedSize(
1448 next_cmd
, sizeof(cmd
));
1451 TEST_F(GLES2FormatTest
, GetString
) {
1452 cmds::GetString
& cmd
= *GetBufferAs
<cmds::GetString
>();
1453 void* next_cmd
= cmd
.Set(
1455 static_cast<GLenum
>(11),
1456 static_cast<uint32
>(12));
1457 EXPECT_EQ(static_cast<uint32
>(cmds::GetString::kCmdId
),
1458 cmd
.header
.command
);
1459 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1460 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.name
);
1461 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bucket_id
);
1462 CheckBytesWrittenMatchesExpectedSize(
1463 next_cmd
, sizeof(cmd
));
1466 TEST_F(GLES2FormatTest
, GetTexParameterfv
) {
1467 cmds::GetTexParameterfv
& cmd
= *GetBufferAs
<cmds::GetTexParameterfv
>();
1468 void* next_cmd
= cmd
.Set(
1470 static_cast<GLenum
>(11),
1471 static_cast<GLenum
>(12),
1472 static_cast<uint32
>(13),
1473 static_cast<uint32
>(14));
1474 EXPECT_EQ(static_cast<uint32
>(cmds::GetTexParameterfv::kCmdId
),
1475 cmd
.header
.command
);
1476 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1477 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1478 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1479 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1480 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1481 CheckBytesWrittenMatchesExpectedSize(
1482 next_cmd
, sizeof(cmd
));
1485 TEST_F(GLES2FormatTest
, GetTexParameteriv
) {
1486 cmds::GetTexParameteriv
& cmd
= *GetBufferAs
<cmds::GetTexParameteriv
>();
1487 void* next_cmd
= cmd
.Set(
1489 static_cast<GLenum
>(11),
1490 static_cast<GLenum
>(12),
1491 static_cast<uint32
>(13),
1492 static_cast<uint32
>(14));
1493 EXPECT_EQ(static_cast<uint32
>(cmds::GetTexParameteriv::kCmdId
),
1494 cmd
.header
.command
);
1495 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1496 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1497 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1498 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1499 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1500 CheckBytesWrittenMatchesExpectedSize(
1501 next_cmd
, sizeof(cmd
));
1504 TEST_F(GLES2FormatTest
, GetUniformfv
) {
1505 cmds::GetUniformfv
& cmd
= *GetBufferAs
<cmds::GetUniformfv
>();
1506 void* next_cmd
= cmd
.Set(
1508 static_cast<GLuint
>(11),
1509 static_cast<GLint
>(12),
1510 static_cast<uint32
>(13),
1511 static_cast<uint32
>(14));
1512 EXPECT_EQ(static_cast<uint32
>(cmds::GetUniformfv::kCmdId
),
1513 cmd
.header
.command
);
1514 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1515 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1516 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1517 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1518 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1519 CheckBytesWrittenMatchesExpectedSize(
1520 next_cmd
, sizeof(cmd
));
1523 TEST_F(GLES2FormatTest
, GetUniformiv
) {
1524 cmds::GetUniformiv
& cmd
= *GetBufferAs
<cmds::GetUniformiv
>();
1525 void* next_cmd
= cmd
.Set(
1527 static_cast<GLuint
>(11),
1528 static_cast<GLint
>(12),
1529 static_cast<uint32
>(13),
1530 static_cast<uint32
>(14));
1531 EXPECT_EQ(static_cast<uint32
>(cmds::GetUniformiv::kCmdId
),
1532 cmd
.header
.command
);
1533 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1534 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1535 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1536 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1537 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1538 CheckBytesWrittenMatchesExpectedSize(
1539 next_cmd
, sizeof(cmd
));
1542 // TODO(gman): Write test for GetUniformLocation
1543 // TODO(gman): Write test for GetUniformLocationImmediate
1544 // TODO(gman): Write test for GetUniformLocationBucket
1545 TEST_F(GLES2FormatTest
, GetVertexAttribfv
) {
1546 cmds::GetVertexAttribfv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribfv
>();
1547 void* next_cmd
= cmd
.Set(
1549 static_cast<GLuint
>(11),
1550 static_cast<GLenum
>(12),
1551 static_cast<uint32
>(13),
1552 static_cast<uint32
>(14));
1553 EXPECT_EQ(static_cast<uint32
>(cmds::GetVertexAttribfv::kCmdId
),
1554 cmd
.header
.command
);
1555 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1556 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1557 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1558 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1559 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1560 CheckBytesWrittenMatchesExpectedSize(
1561 next_cmd
, sizeof(cmd
));
1564 TEST_F(GLES2FormatTest
, GetVertexAttribiv
) {
1565 cmds::GetVertexAttribiv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribiv
>();
1566 void* next_cmd
= cmd
.Set(
1568 static_cast<GLuint
>(11),
1569 static_cast<GLenum
>(12),
1570 static_cast<uint32
>(13),
1571 static_cast<uint32
>(14));
1572 EXPECT_EQ(static_cast<uint32
>(cmds::GetVertexAttribiv::kCmdId
),
1573 cmd
.header
.command
);
1574 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1575 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1576 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1577 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
1578 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
1579 CheckBytesWrittenMatchesExpectedSize(
1580 next_cmd
, sizeof(cmd
));
1583 TEST_F(GLES2FormatTest
, GetVertexAttribPointerv
) {
1584 cmds::GetVertexAttribPointerv
& cmd
=
1585 *GetBufferAs
<cmds::GetVertexAttribPointerv
>();
1586 void* next_cmd
= cmd
.Set(
1588 static_cast<GLuint
>(11),
1589 static_cast<GLenum
>(12),
1590 static_cast<uint32
>(13),
1591 static_cast<uint32
>(14));
1592 EXPECT_EQ(static_cast<uint32
>(cmds::GetVertexAttribPointerv::kCmdId
),
1593 cmd
.header
.command
);
1594 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1595 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1596 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1597 EXPECT_EQ(static_cast<uint32
>(13), cmd
.pointer_shm_id
);
1598 EXPECT_EQ(static_cast<uint32
>(14), cmd
.pointer_shm_offset
);
1599 CheckBytesWrittenMatchesExpectedSize(
1600 next_cmd
, sizeof(cmd
));
1603 TEST_F(GLES2FormatTest
, Hint
) {
1604 cmds::Hint
& cmd
= *GetBufferAs
<cmds::Hint
>();
1605 void* next_cmd
= cmd
.Set(
1607 static_cast<GLenum
>(11),
1608 static_cast<GLenum
>(12));
1609 EXPECT_EQ(static_cast<uint32
>(cmds::Hint::kCmdId
),
1610 cmd
.header
.command
);
1611 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1612 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1613 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.mode
);
1614 CheckBytesWrittenMatchesExpectedSize(
1615 next_cmd
, sizeof(cmd
));
1618 TEST_F(GLES2FormatTest
, IsBuffer
) {
1619 cmds::IsBuffer
& cmd
= *GetBufferAs
<cmds::IsBuffer
>();
1620 void* next_cmd
= cmd
.Set(
1622 static_cast<GLuint
>(11),
1623 static_cast<uint32
>(12),
1624 static_cast<uint32
>(13));
1625 EXPECT_EQ(static_cast<uint32
>(cmds::IsBuffer::kCmdId
),
1626 cmd
.header
.command
);
1627 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1628 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer
);
1629 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1630 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1631 CheckBytesWrittenMatchesExpectedSize(
1632 next_cmd
, sizeof(cmd
));
1635 TEST_F(GLES2FormatTest
, IsEnabled
) {
1636 cmds::IsEnabled
& cmd
= *GetBufferAs
<cmds::IsEnabled
>();
1637 void* next_cmd
= cmd
.Set(
1639 static_cast<GLenum
>(11),
1640 static_cast<uint32
>(12),
1641 static_cast<uint32
>(13));
1642 EXPECT_EQ(static_cast<uint32
>(cmds::IsEnabled::kCmdId
),
1643 cmd
.header
.command
);
1644 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1645 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
1646 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1647 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1648 CheckBytesWrittenMatchesExpectedSize(
1649 next_cmd
, sizeof(cmd
));
1652 TEST_F(GLES2FormatTest
, IsFramebuffer
) {
1653 cmds::IsFramebuffer
& cmd
= *GetBufferAs
<cmds::IsFramebuffer
>();
1654 void* next_cmd
= cmd
.Set(
1656 static_cast<GLuint
>(11),
1657 static_cast<uint32
>(12),
1658 static_cast<uint32
>(13));
1659 EXPECT_EQ(static_cast<uint32
>(cmds::IsFramebuffer::kCmdId
),
1660 cmd
.header
.command
);
1661 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1662 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.framebuffer
);
1663 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1664 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1665 CheckBytesWrittenMatchesExpectedSize(
1666 next_cmd
, sizeof(cmd
));
1669 TEST_F(GLES2FormatTest
, IsProgram
) {
1670 cmds::IsProgram
& cmd
= *GetBufferAs
<cmds::IsProgram
>();
1671 void* next_cmd
= cmd
.Set(
1673 static_cast<GLuint
>(11),
1674 static_cast<uint32
>(12),
1675 static_cast<uint32
>(13));
1676 EXPECT_EQ(static_cast<uint32
>(cmds::IsProgram::kCmdId
),
1677 cmd
.header
.command
);
1678 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1679 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1680 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1681 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1682 CheckBytesWrittenMatchesExpectedSize(
1683 next_cmd
, sizeof(cmd
));
1686 TEST_F(GLES2FormatTest
, IsRenderbuffer
) {
1687 cmds::IsRenderbuffer
& cmd
= *GetBufferAs
<cmds::IsRenderbuffer
>();
1688 void* next_cmd
= cmd
.Set(
1690 static_cast<GLuint
>(11),
1691 static_cast<uint32
>(12),
1692 static_cast<uint32
>(13));
1693 EXPECT_EQ(static_cast<uint32
>(cmds::IsRenderbuffer::kCmdId
),
1694 cmd
.header
.command
);
1695 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1696 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.renderbuffer
);
1697 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1698 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1699 CheckBytesWrittenMatchesExpectedSize(
1700 next_cmd
, sizeof(cmd
));
1703 TEST_F(GLES2FormatTest
, IsShader
) {
1704 cmds::IsShader
& cmd
= *GetBufferAs
<cmds::IsShader
>();
1705 void* next_cmd
= cmd
.Set(
1707 static_cast<GLuint
>(11),
1708 static_cast<uint32
>(12),
1709 static_cast<uint32
>(13));
1710 EXPECT_EQ(static_cast<uint32
>(cmds::IsShader::kCmdId
),
1711 cmd
.header
.command
);
1712 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1713 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1714 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1715 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1716 CheckBytesWrittenMatchesExpectedSize(
1717 next_cmd
, sizeof(cmd
));
1720 TEST_F(GLES2FormatTest
, IsTexture
) {
1721 cmds::IsTexture
& cmd
= *GetBufferAs
<cmds::IsTexture
>();
1722 void* next_cmd
= cmd
.Set(
1724 static_cast<GLuint
>(11),
1725 static_cast<uint32
>(12),
1726 static_cast<uint32
>(13));
1727 EXPECT_EQ(static_cast<uint32
>(cmds::IsTexture::kCmdId
),
1728 cmd
.header
.command
);
1729 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1730 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
1731 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
1732 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
1733 CheckBytesWrittenMatchesExpectedSize(
1734 next_cmd
, sizeof(cmd
));
1737 TEST_F(GLES2FormatTest
, LineWidth
) {
1738 cmds::LineWidth
& cmd
= *GetBufferAs
<cmds::LineWidth
>();
1739 void* next_cmd
= cmd
.Set(
1741 static_cast<GLfloat
>(11));
1742 EXPECT_EQ(static_cast<uint32
>(cmds::LineWidth::kCmdId
),
1743 cmd
.header
.command
);
1744 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1745 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.width
);
1746 CheckBytesWrittenMatchesExpectedSize(
1747 next_cmd
, sizeof(cmd
));
1750 TEST_F(GLES2FormatTest
, LinkProgram
) {
1751 cmds::LinkProgram
& cmd
= *GetBufferAs
<cmds::LinkProgram
>();
1752 void* next_cmd
= cmd
.Set(
1754 static_cast<GLuint
>(11));
1755 EXPECT_EQ(static_cast<uint32
>(cmds::LinkProgram::kCmdId
),
1756 cmd
.header
.command
);
1757 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1758 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1759 CheckBytesWrittenMatchesExpectedSize(
1760 next_cmd
, sizeof(cmd
));
1763 TEST_F(GLES2FormatTest
, PixelStorei
) {
1764 cmds::PixelStorei
& cmd
= *GetBufferAs
<cmds::PixelStorei
>();
1765 void* next_cmd
= cmd
.Set(
1767 static_cast<GLenum
>(11),
1768 static_cast<GLint
>(12));
1769 EXPECT_EQ(static_cast<uint32
>(cmds::PixelStorei::kCmdId
),
1770 cmd
.header
.command
);
1771 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1772 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1773 EXPECT_EQ(static_cast<GLint
>(12), cmd
.param
);
1774 CheckBytesWrittenMatchesExpectedSize(
1775 next_cmd
, sizeof(cmd
));
1778 TEST_F(GLES2FormatTest
, PolygonOffset
) {
1779 cmds::PolygonOffset
& cmd
= *GetBufferAs
<cmds::PolygonOffset
>();
1780 void* next_cmd
= cmd
.Set(
1782 static_cast<GLfloat
>(11),
1783 static_cast<GLfloat
>(12));
1784 EXPECT_EQ(static_cast<uint32
>(cmds::PolygonOffset::kCmdId
),
1785 cmd
.header
.command
);
1786 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1787 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.factor
);
1788 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.units
);
1789 CheckBytesWrittenMatchesExpectedSize(
1790 next_cmd
, sizeof(cmd
));
1793 TEST_F(GLES2FormatTest
, ReadPixels
) {
1794 cmds::ReadPixels
& cmd
= *GetBufferAs
<cmds::ReadPixels
>();
1795 void* next_cmd
= cmd
.Set(
1797 static_cast<GLint
>(11),
1798 static_cast<GLint
>(12),
1799 static_cast<GLsizei
>(13),
1800 static_cast<GLsizei
>(14),
1801 static_cast<GLenum
>(15),
1802 static_cast<GLenum
>(16),
1803 static_cast<uint32
>(17),
1804 static_cast<uint32
>(18),
1805 static_cast<uint32
>(19),
1806 static_cast<uint32
>(20),
1807 static_cast<GLboolean
>(21));
1808 EXPECT_EQ(static_cast<uint32
>(cmds::ReadPixels::kCmdId
),
1809 cmd
.header
.command
);
1810 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1811 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
1812 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
1813 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1814 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1815 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.format
);
1816 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.type
);
1817 EXPECT_EQ(static_cast<uint32
>(17), cmd
.pixels_shm_id
);
1818 EXPECT_EQ(static_cast<uint32
>(18), cmd
.pixels_shm_offset
);
1819 EXPECT_EQ(static_cast<uint32
>(19), cmd
.result_shm_id
);
1820 EXPECT_EQ(static_cast<uint32
>(20), cmd
.result_shm_offset
);
1821 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.async
);
1822 CheckBytesWrittenMatchesExpectedSize(
1823 next_cmd
, sizeof(cmd
));
1826 TEST_F(GLES2FormatTest
, ReleaseShaderCompiler
) {
1827 cmds::ReleaseShaderCompiler
& cmd
=
1828 *GetBufferAs
<cmds::ReleaseShaderCompiler
>();
1829 void* next_cmd
= cmd
.Set(
1831 EXPECT_EQ(static_cast<uint32
>(cmds::ReleaseShaderCompiler::kCmdId
),
1832 cmd
.header
.command
);
1833 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1834 CheckBytesWrittenMatchesExpectedSize(
1835 next_cmd
, sizeof(cmd
));
1838 TEST_F(GLES2FormatTest
, RenderbufferStorage
) {
1839 cmds::RenderbufferStorage
& cmd
= *GetBufferAs
<cmds::RenderbufferStorage
>();
1840 void* next_cmd
= cmd
.Set(
1842 static_cast<GLenum
>(11),
1843 static_cast<GLenum
>(12),
1844 static_cast<GLsizei
>(13),
1845 static_cast<GLsizei
>(14));
1846 EXPECT_EQ(static_cast<uint32
>(cmds::RenderbufferStorage::kCmdId
),
1847 cmd
.header
.command
);
1848 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1849 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1850 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.internalformat
);
1851 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1852 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1853 CheckBytesWrittenMatchesExpectedSize(
1854 next_cmd
, sizeof(cmd
));
1857 TEST_F(GLES2FormatTest
, SampleCoverage
) {
1858 cmds::SampleCoverage
& cmd
= *GetBufferAs
<cmds::SampleCoverage
>();
1859 void* next_cmd
= cmd
.Set(
1861 static_cast<GLclampf
>(11),
1862 static_cast<GLboolean
>(12));
1863 EXPECT_EQ(static_cast<uint32
>(cmds::SampleCoverage::kCmdId
),
1864 cmd
.header
.command
);
1865 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1866 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.value
);
1867 EXPECT_EQ(static_cast<GLboolean
>(12), cmd
.invert
);
1868 CheckBytesWrittenMatchesExpectedSize(
1869 next_cmd
, sizeof(cmd
));
1872 TEST_F(GLES2FormatTest
, Scissor
) {
1873 cmds::Scissor
& cmd
= *GetBufferAs
<cmds::Scissor
>();
1874 void* next_cmd
= cmd
.Set(
1876 static_cast<GLint
>(11),
1877 static_cast<GLint
>(12),
1878 static_cast<GLsizei
>(13),
1879 static_cast<GLsizei
>(14));
1880 EXPECT_EQ(static_cast<uint32
>(cmds::Scissor::kCmdId
),
1881 cmd
.header
.command
);
1882 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1883 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
1884 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
1885 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1886 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1887 CheckBytesWrittenMatchesExpectedSize(
1888 next_cmd
, sizeof(cmd
));
1891 TEST_F(GLES2FormatTest
, ShaderBinary
) {
1892 cmds::ShaderBinary
& cmd
= *GetBufferAs
<cmds::ShaderBinary
>();
1893 void* next_cmd
= cmd
.Set(
1895 static_cast<GLsizei
>(11),
1896 static_cast<uint32
>(12),
1897 static_cast<uint32
>(13),
1898 static_cast<GLenum
>(14),
1899 static_cast<uint32
>(15),
1900 static_cast<uint32
>(16),
1901 static_cast<GLsizei
>(17));
1902 EXPECT_EQ(static_cast<uint32
>(cmds::ShaderBinary::kCmdId
),
1903 cmd
.header
.command
);
1904 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1905 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
1906 EXPECT_EQ(static_cast<uint32
>(12), cmd
.shaders_shm_id
);
1907 EXPECT_EQ(static_cast<uint32
>(13), cmd
.shaders_shm_offset
);
1908 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.binaryformat
);
1909 EXPECT_EQ(static_cast<uint32
>(15), cmd
.binary_shm_id
);
1910 EXPECT_EQ(static_cast<uint32
>(16), cmd
.binary_shm_offset
);
1911 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.length
);
1912 CheckBytesWrittenMatchesExpectedSize(
1913 next_cmd
, sizeof(cmd
));
1916 TEST_F(GLES2FormatTest
, ShaderSource
) {
1917 cmds::ShaderSource
& cmd
= *GetBufferAs
<cmds::ShaderSource
>();
1918 void* next_cmd
= cmd
.Set(
1920 static_cast<GLuint
>(11),
1921 static_cast<uint32
>(12),
1922 static_cast<uint32
>(13),
1923 static_cast<uint32
>(14));
1924 EXPECT_EQ(static_cast<uint32
>(cmds::ShaderSource::kCmdId
),
1925 cmd
.header
.command
);
1926 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1927 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1928 EXPECT_EQ(static_cast<uint32
>(12), cmd
.data_shm_id
);
1929 EXPECT_EQ(static_cast<uint32
>(13), cmd
.data_shm_offset
);
1930 EXPECT_EQ(static_cast<uint32
>(14), cmd
.data_size
);
1931 CheckBytesWrittenMatchesExpectedSize(
1932 next_cmd
, sizeof(cmd
));
1935 // TODO(gman): Implement test for ShaderSourceImmediate
1936 TEST_F(GLES2FormatTest
, ShaderSourceBucket
) {
1937 cmds::ShaderSourceBucket
& cmd
= *GetBufferAs
<cmds::ShaderSourceBucket
>();
1938 void* next_cmd
= cmd
.Set(
1940 static_cast<GLuint
>(11),
1941 static_cast<uint32
>(12));
1942 EXPECT_EQ(static_cast<uint32
>(cmds::ShaderSourceBucket::kCmdId
),
1943 cmd
.header
.command
);
1944 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1945 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1946 EXPECT_EQ(static_cast<uint32
>(12), cmd
.data_bucket_id
);
1947 CheckBytesWrittenMatchesExpectedSize(
1948 next_cmd
, sizeof(cmd
));
1951 TEST_F(GLES2FormatTest
, StencilFunc
) {
1952 cmds::StencilFunc
& cmd
= *GetBufferAs
<cmds::StencilFunc
>();
1953 void* next_cmd
= cmd
.Set(
1955 static_cast<GLenum
>(11),
1956 static_cast<GLint
>(12),
1957 static_cast<GLuint
>(13));
1958 EXPECT_EQ(static_cast<uint32
>(cmds::StencilFunc::kCmdId
),
1959 cmd
.header
.command
);
1960 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1961 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
1962 EXPECT_EQ(static_cast<GLint
>(12), cmd
.ref
);
1963 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
1964 CheckBytesWrittenMatchesExpectedSize(
1965 next_cmd
, sizeof(cmd
));
1968 TEST_F(GLES2FormatTest
, StencilFuncSeparate
) {
1969 cmds::StencilFuncSeparate
& cmd
= *GetBufferAs
<cmds::StencilFuncSeparate
>();
1970 void* next_cmd
= cmd
.Set(
1972 static_cast<GLenum
>(11),
1973 static_cast<GLenum
>(12),
1974 static_cast<GLint
>(13),
1975 static_cast<GLuint
>(14));
1976 EXPECT_EQ(static_cast<uint32
>(cmds::StencilFuncSeparate::kCmdId
),
1977 cmd
.header
.command
);
1978 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1979 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
1980 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.func
);
1981 EXPECT_EQ(static_cast<GLint
>(13), cmd
.ref
);
1982 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.mask
);
1983 CheckBytesWrittenMatchesExpectedSize(
1984 next_cmd
, sizeof(cmd
));
1987 TEST_F(GLES2FormatTest
, StencilMask
) {
1988 cmds::StencilMask
& cmd
= *GetBufferAs
<cmds::StencilMask
>();
1989 void* next_cmd
= cmd
.Set(
1991 static_cast<GLuint
>(11));
1992 EXPECT_EQ(static_cast<uint32
>(cmds::StencilMask::kCmdId
),
1993 cmd
.header
.command
);
1994 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1995 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.mask
);
1996 CheckBytesWrittenMatchesExpectedSize(
1997 next_cmd
, sizeof(cmd
));
2000 TEST_F(GLES2FormatTest
, StencilMaskSeparate
) {
2001 cmds::StencilMaskSeparate
& cmd
= *GetBufferAs
<cmds::StencilMaskSeparate
>();
2002 void* next_cmd
= cmd
.Set(
2004 static_cast<GLenum
>(11),
2005 static_cast<GLuint
>(12));
2006 EXPECT_EQ(static_cast<uint32
>(cmds::StencilMaskSeparate::kCmdId
),
2007 cmd
.header
.command
);
2008 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2009 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2010 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.mask
);
2011 CheckBytesWrittenMatchesExpectedSize(
2012 next_cmd
, sizeof(cmd
));
2015 TEST_F(GLES2FormatTest
, StencilOp
) {
2016 cmds::StencilOp
& cmd
= *GetBufferAs
<cmds::StencilOp
>();
2017 void* next_cmd
= cmd
.Set(
2019 static_cast<GLenum
>(11),
2020 static_cast<GLenum
>(12),
2021 static_cast<GLenum
>(13));
2022 EXPECT_EQ(static_cast<uint32
>(cmds::StencilOp::kCmdId
),
2023 cmd
.header
.command
);
2024 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2025 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.fail
);
2026 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.zfail
);
2027 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zpass
);
2028 CheckBytesWrittenMatchesExpectedSize(
2029 next_cmd
, sizeof(cmd
));
2032 TEST_F(GLES2FormatTest
, StencilOpSeparate
) {
2033 cmds::StencilOpSeparate
& cmd
= *GetBufferAs
<cmds::StencilOpSeparate
>();
2034 void* next_cmd
= cmd
.Set(
2036 static_cast<GLenum
>(11),
2037 static_cast<GLenum
>(12),
2038 static_cast<GLenum
>(13),
2039 static_cast<GLenum
>(14));
2040 EXPECT_EQ(static_cast<uint32
>(cmds::StencilOpSeparate::kCmdId
),
2041 cmd
.header
.command
);
2042 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2043 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2044 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.fail
);
2045 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zfail
);
2046 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.zpass
);
2047 CheckBytesWrittenMatchesExpectedSize(
2048 next_cmd
, sizeof(cmd
));
2051 TEST_F(GLES2FormatTest
, TexImage2D
) {
2052 cmds::TexImage2D
& cmd
= *GetBufferAs
<cmds::TexImage2D
>();
2053 void* next_cmd
= cmd
.Set(
2055 static_cast<GLenum
>(11),
2056 static_cast<GLint
>(12),
2057 static_cast<GLint
>(13),
2058 static_cast<GLsizei
>(14),
2059 static_cast<GLsizei
>(15),
2060 static_cast<GLint
>(16),
2061 static_cast<GLenum
>(17),
2062 static_cast<GLenum
>(18),
2063 static_cast<uint32
>(19),
2064 static_cast<uint32
>(20));
2065 EXPECT_EQ(static_cast<uint32
>(cmds::TexImage2D::kCmdId
),
2066 cmd
.header
.command
);
2067 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2068 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2069 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2070 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
2071 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2072 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2073 EXPECT_EQ(static_cast<GLint
>(16), cmd
.border
);
2074 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
2075 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
2076 EXPECT_EQ(static_cast<uint32
>(19), cmd
.pixels_shm_id
);
2077 EXPECT_EQ(static_cast<uint32
>(20), cmd
.pixels_shm_offset
);
2078 CheckBytesWrittenMatchesExpectedSize(
2079 next_cmd
, sizeof(cmd
));
2082 // TODO(gman): Implement test for TexImage2DImmediate
2083 TEST_F(GLES2FormatTest
, TexParameterf
) {
2084 cmds::TexParameterf
& cmd
= *GetBufferAs
<cmds::TexParameterf
>();
2085 void* next_cmd
= cmd
.Set(
2087 static_cast<GLenum
>(11),
2088 static_cast<GLenum
>(12),
2089 static_cast<GLfloat
>(13));
2090 EXPECT_EQ(static_cast<uint32
>(cmds::TexParameterf::kCmdId
),
2091 cmd
.header
.command
);
2092 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2093 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2094 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2095 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.param
);
2096 CheckBytesWrittenMatchesExpectedSize(
2097 next_cmd
, sizeof(cmd
));
2100 TEST_F(GLES2FormatTest
, TexParameterfv
) {
2101 cmds::TexParameterfv
& cmd
= *GetBufferAs
<cmds::TexParameterfv
>();
2102 void* next_cmd
= cmd
.Set(
2104 static_cast<GLenum
>(11),
2105 static_cast<GLenum
>(12),
2106 static_cast<uint32
>(13),
2107 static_cast<uint32
>(14));
2108 EXPECT_EQ(static_cast<uint32
>(cmds::TexParameterfv::kCmdId
),
2109 cmd
.header
.command
);
2110 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2111 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2112 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2113 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
2114 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
2115 CheckBytesWrittenMatchesExpectedSize(
2116 next_cmd
, sizeof(cmd
));
2119 TEST_F(GLES2FormatTest
, TexParameterfvImmediate
) {
2120 const int kSomeBaseValueToTestWith
= 51;
2121 static GLfloat data
[] = {
2122 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2124 cmds::TexParameterfvImmediate
& cmd
=
2125 *GetBufferAs
<cmds::TexParameterfvImmediate
>();
2126 void* next_cmd
= cmd
.Set(
2128 static_cast<GLenum
>(11),
2129 static_cast<GLenum
>(12),
2131 EXPECT_EQ(static_cast<uint32
>(cmds::TexParameterfvImmediate::kCmdId
),
2132 cmd
.header
.command
);
2133 EXPECT_EQ(sizeof(cmd
) +
2134 RoundSizeToMultipleOfEntries(sizeof(data
)),
2135 cmd
.header
.size
* 4u);
2136 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2137 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2138 CheckBytesWrittenMatchesExpectedSize(
2139 next_cmd
, sizeof(cmd
) +
2140 RoundSizeToMultipleOfEntries(sizeof(data
)));
2141 // TODO(gman): Check that data was inserted;
2144 TEST_F(GLES2FormatTest
, TexParameteri
) {
2145 cmds::TexParameteri
& cmd
= *GetBufferAs
<cmds::TexParameteri
>();
2146 void* next_cmd
= cmd
.Set(
2148 static_cast<GLenum
>(11),
2149 static_cast<GLenum
>(12),
2150 static_cast<GLint
>(13));
2151 EXPECT_EQ(static_cast<uint32
>(cmds::TexParameteri::kCmdId
),
2152 cmd
.header
.command
);
2153 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2154 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2155 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2156 EXPECT_EQ(static_cast<GLint
>(13), cmd
.param
);
2157 CheckBytesWrittenMatchesExpectedSize(
2158 next_cmd
, sizeof(cmd
));
2161 TEST_F(GLES2FormatTest
, TexParameteriv
) {
2162 cmds::TexParameteriv
& cmd
= *GetBufferAs
<cmds::TexParameteriv
>();
2163 void* next_cmd
= cmd
.Set(
2165 static_cast<GLenum
>(11),
2166 static_cast<GLenum
>(12),
2167 static_cast<uint32
>(13),
2168 static_cast<uint32
>(14));
2169 EXPECT_EQ(static_cast<uint32
>(cmds::TexParameteriv::kCmdId
),
2170 cmd
.header
.command
);
2171 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2172 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2173 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2174 EXPECT_EQ(static_cast<uint32
>(13), cmd
.params_shm_id
);
2175 EXPECT_EQ(static_cast<uint32
>(14), cmd
.params_shm_offset
);
2176 CheckBytesWrittenMatchesExpectedSize(
2177 next_cmd
, sizeof(cmd
));
2180 TEST_F(GLES2FormatTest
, TexParameterivImmediate
) {
2181 const int kSomeBaseValueToTestWith
= 51;
2182 static GLint data
[] = {
2183 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2185 cmds::TexParameterivImmediate
& cmd
=
2186 *GetBufferAs
<cmds::TexParameterivImmediate
>();
2187 void* next_cmd
= cmd
.Set(
2189 static_cast<GLenum
>(11),
2190 static_cast<GLenum
>(12),
2192 EXPECT_EQ(static_cast<uint32
>(cmds::TexParameterivImmediate::kCmdId
),
2193 cmd
.header
.command
);
2194 EXPECT_EQ(sizeof(cmd
) +
2195 RoundSizeToMultipleOfEntries(sizeof(data
)),
2196 cmd
.header
.size
* 4u);
2197 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2198 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2199 CheckBytesWrittenMatchesExpectedSize(
2200 next_cmd
, sizeof(cmd
) +
2201 RoundSizeToMultipleOfEntries(sizeof(data
)));
2202 // TODO(gman): Check that data was inserted;
2205 TEST_F(GLES2FormatTest
, TexSubImage2D
) {
2206 cmds::TexSubImage2D
& cmd
= *GetBufferAs
<cmds::TexSubImage2D
>();
2207 void* next_cmd
= cmd
.Set(
2209 static_cast<GLenum
>(11),
2210 static_cast<GLint
>(12),
2211 static_cast<GLint
>(13),
2212 static_cast<GLint
>(14),
2213 static_cast<GLsizei
>(15),
2214 static_cast<GLsizei
>(16),
2215 static_cast<GLenum
>(17),
2216 static_cast<GLenum
>(18),
2217 static_cast<uint32
>(19),
2218 static_cast<uint32
>(20),
2219 static_cast<GLboolean
>(21));
2220 EXPECT_EQ(static_cast<uint32
>(cmds::TexSubImage2D::kCmdId
),
2221 cmd
.header
.command
);
2222 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2223 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2224 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2225 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
2226 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
2227 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
2228 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
2229 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
2230 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
2231 EXPECT_EQ(static_cast<uint32
>(19), cmd
.pixels_shm_id
);
2232 EXPECT_EQ(static_cast<uint32
>(20), cmd
.pixels_shm_offset
);
2233 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.internal
);
2234 CheckBytesWrittenMatchesExpectedSize(
2235 next_cmd
, sizeof(cmd
));
2238 // TODO(gman): Implement test for TexSubImage2DImmediate
2239 TEST_F(GLES2FormatTest
, Uniform1f
) {
2240 cmds::Uniform1f
& cmd
= *GetBufferAs
<cmds::Uniform1f
>();
2241 void* next_cmd
= cmd
.Set(
2243 static_cast<GLint
>(11),
2244 static_cast<GLfloat
>(12));
2245 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform1f::kCmdId
),
2246 cmd
.header
.command
);
2247 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2248 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2249 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2250 CheckBytesWrittenMatchesExpectedSize(
2251 next_cmd
, sizeof(cmd
));
2254 TEST_F(GLES2FormatTest
, Uniform1fv
) {
2255 cmds::Uniform1fv
& cmd
= *GetBufferAs
<cmds::Uniform1fv
>();
2256 void* next_cmd
= cmd
.Set(
2258 static_cast<GLint
>(11),
2259 static_cast<GLsizei
>(12),
2260 static_cast<uint32
>(13),
2261 static_cast<uint32
>(14));
2262 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform1fv::kCmdId
),
2263 cmd
.header
.command
);
2264 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2265 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2266 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2267 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2268 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2269 CheckBytesWrittenMatchesExpectedSize(
2270 next_cmd
, sizeof(cmd
));
2273 TEST_F(GLES2FormatTest
, Uniform1fvImmediate
) {
2274 const int kSomeBaseValueToTestWith
= 51;
2275 static GLfloat data
[] = {
2276 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2277 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2279 cmds::Uniform1fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1fvImmediate
>();
2280 const GLsizei kNumElements
= 2;
2281 const size_t kExpectedCmdSize
=
2282 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 1;
2283 void* next_cmd
= cmd
.Set(
2285 static_cast<GLint
>(1),
2286 static_cast<GLsizei
>(2),
2288 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform1fvImmediate::kCmdId
),
2289 cmd
.header
.command
);
2290 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2291 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2292 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2293 CheckBytesWrittenMatchesExpectedSize(
2294 next_cmd
, sizeof(cmd
) +
2295 RoundSizeToMultipleOfEntries(sizeof(data
)));
2296 // TODO(gman): Check that data was inserted;
2299 TEST_F(GLES2FormatTest
, Uniform1i
) {
2300 cmds::Uniform1i
& cmd
= *GetBufferAs
<cmds::Uniform1i
>();
2301 void* next_cmd
= cmd
.Set(
2303 static_cast<GLint
>(11),
2304 static_cast<GLint
>(12));
2305 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform1i::kCmdId
),
2306 cmd
.header
.command
);
2307 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2308 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2309 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2310 CheckBytesWrittenMatchesExpectedSize(
2311 next_cmd
, sizeof(cmd
));
2314 TEST_F(GLES2FormatTest
, Uniform1iv
) {
2315 cmds::Uniform1iv
& cmd
= *GetBufferAs
<cmds::Uniform1iv
>();
2316 void* next_cmd
= cmd
.Set(
2318 static_cast<GLint
>(11),
2319 static_cast<GLsizei
>(12),
2320 static_cast<uint32
>(13),
2321 static_cast<uint32
>(14));
2322 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform1iv::kCmdId
),
2323 cmd
.header
.command
);
2324 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2325 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2326 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2327 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2328 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2329 CheckBytesWrittenMatchesExpectedSize(
2330 next_cmd
, sizeof(cmd
));
2333 TEST_F(GLES2FormatTest
, Uniform1ivImmediate
) {
2334 const int kSomeBaseValueToTestWith
= 51;
2335 static GLint data
[] = {
2336 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2337 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2339 cmds::Uniform1ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1ivImmediate
>();
2340 const GLsizei kNumElements
= 2;
2341 const size_t kExpectedCmdSize
=
2342 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 1;
2343 void* next_cmd
= cmd
.Set(
2345 static_cast<GLint
>(1),
2346 static_cast<GLsizei
>(2),
2348 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform1ivImmediate::kCmdId
),
2349 cmd
.header
.command
);
2350 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2351 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2352 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2353 CheckBytesWrittenMatchesExpectedSize(
2354 next_cmd
, sizeof(cmd
) +
2355 RoundSizeToMultipleOfEntries(sizeof(data
)));
2356 // TODO(gman): Check that data was inserted;
2359 TEST_F(GLES2FormatTest
, Uniform2f
) {
2360 cmds::Uniform2f
& cmd
= *GetBufferAs
<cmds::Uniform2f
>();
2361 void* next_cmd
= cmd
.Set(
2363 static_cast<GLint
>(11),
2364 static_cast<GLfloat
>(12),
2365 static_cast<GLfloat
>(13));
2366 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform2f::kCmdId
),
2367 cmd
.header
.command
);
2368 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2369 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2370 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2371 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2372 CheckBytesWrittenMatchesExpectedSize(
2373 next_cmd
, sizeof(cmd
));
2376 TEST_F(GLES2FormatTest
, Uniform2fv
) {
2377 cmds::Uniform2fv
& cmd
= *GetBufferAs
<cmds::Uniform2fv
>();
2378 void* next_cmd
= cmd
.Set(
2380 static_cast<GLint
>(11),
2381 static_cast<GLsizei
>(12),
2382 static_cast<uint32
>(13),
2383 static_cast<uint32
>(14));
2384 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform2fv::kCmdId
),
2385 cmd
.header
.command
);
2386 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2387 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2388 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2389 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2390 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2391 CheckBytesWrittenMatchesExpectedSize(
2392 next_cmd
, sizeof(cmd
));
2395 TEST_F(GLES2FormatTest
, Uniform2fvImmediate
) {
2396 const int kSomeBaseValueToTestWith
= 51;
2397 static GLfloat data
[] = {
2398 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2399 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2400 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2401 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2403 cmds::Uniform2fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2fvImmediate
>();
2404 const GLsizei kNumElements
= 2;
2405 const size_t kExpectedCmdSize
=
2406 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 2;
2407 void* next_cmd
= cmd
.Set(
2409 static_cast<GLint
>(1),
2410 static_cast<GLsizei
>(2),
2412 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform2fvImmediate::kCmdId
),
2413 cmd
.header
.command
);
2414 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2415 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2416 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2417 CheckBytesWrittenMatchesExpectedSize(
2418 next_cmd
, sizeof(cmd
) +
2419 RoundSizeToMultipleOfEntries(sizeof(data
)));
2420 // TODO(gman): Check that data was inserted;
2423 TEST_F(GLES2FormatTest
, Uniform2i
) {
2424 cmds::Uniform2i
& cmd
= *GetBufferAs
<cmds::Uniform2i
>();
2425 void* next_cmd
= cmd
.Set(
2427 static_cast<GLint
>(11),
2428 static_cast<GLint
>(12),
2429 static_cast<GLint
>(13));
2430 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform2i::kCmdId
),
2431 cmd
.header
.command
);
2432 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2433 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2434 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2435 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2436 CheckBytesWrittenMatchesExpectedSize(
2437 next_cmd
, sizeof(cmd
));
2440 TEST_F(GLES2FormatTest
, Uniform2iv
) {
2441 cmds::Uniform2iv
& cmd
= *GetBufferAs
<cmds::Uniform2iv
>();
2442 void* next_cmd
= cmd
.Set(
2444 static_cast<GLint
>(11),
2445 static_cast<GLsizei
>(12),
2446 static_cast<uint32
>(13),
2447 static_cast<uint32
>(14));
2448 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform2iv::kCmdId
),
2449 cmd
.header
.command
);
2450 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2451 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2452 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2453 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2454 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2455 CheckBytesWrittenMatchesExpectedSize(
2456 next_cmd
, sizeof(cmd
));
2459 TEST_F(GLES2FormatTest
, Uniform2ivImmediate
) {
2460 const int kSomeBaseValueToTestWith
= 51;
2461 static GLint data
[] = {
2462 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2463 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2464 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2465 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2467 cmds::Uniform2ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2ivImmediate
>();
2468 const GLsizei kNumElements
= 2;
2469 const size_t kExpectedCmdSize
=
2470 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 2;
2471 void* next_cmd
= cmd
.Set(
2473 static_cast<GLint
>(1),
2474 static_cast<GLsizei
>(2),
2476 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform2ivImmediate::kCmdId
),
2477 cmd
.header
.command
);
2478 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2479 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2480 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2481 CheckBytesWrittenMatchesExpectedSize(
2482 next_cmd
, sizeof(cmd
) +
2483 RoundSizeToMultipleOfEntries(sizeof(data
)));
2484 // TODO(gman): Check that data was inserted;
2487 TEST_F(GLES2FormatTest
, Uniform3f
) {
2488 cmds::Uniform3f
& cmd
= *GetBufferAs
<cmds::Uniform3f
>();
2489 void* next_cmd
= cmd
.Set(
2491 static_cast<GLint
>(11),
2492 static_cast<GLfloat
>(12),
2493 static_cast<GLfloat
>(13),
2494 static_cast<GLfloat
>(14));
2495 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform3f::kCmdId
),
2496 cmd
.header
.command
);
2497 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2498 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2499 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2500 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2501 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2502 CheckBytesWrittenMatchesExpectedSize(
2503 next_cmd
, sizeof(cmd
));
2506 TEST_F(GLES2FormatTest
, Uniform3fv
) {
2507 cmds::Uniform3fv
& cmd
= *GetBufferAs
<cmds::Uniform3fv
>();
2508 void* next_cmd
= cmd
.Set(
2510 static_cast<GLint
>(11),
2511 static_cast<GLsizei
>(12),
2512 static_cast<uint32
>(13),
2513 static_cast<uint32
>(14));
2514 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform3fv::kCmdId
),
2515 cmd
.header
.command
);
2516 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2517 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2518 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2519 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2520 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2521 CheckBytesWrittenMatchesExpectedSize(
2522 next_cmd
, sizeof(cmd
));
2525 TEST_F(GLES2FormatTest
, Uniform3fvImmediate
) {
2526 const int kSomeBaseValueToTestWith
= 51;
2527 static GLfloat data
[] = {
2528 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2529 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2530 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2531 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2532 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2533 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2535 cmds::Uniform3fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3fvImmediate
>();
2536 const GLsizei kNumElements
= 2;
2537 const size_t kExpectedCmdSize
=
2538 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 3;
2539 void* next_cmd
= cmd
.Set(
2541 static_cast<GLint
>(1),
2542 static_cast<GLsizei
>(2),
2544 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform3fvImmediate::kCmdId
),
2545 cmd
.header
.command
);
2546 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2547 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2548 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2549 CheckBytesWrittenMatchesExpectedSize(
2550 next_cmd
, sizeof(cmd
) +
2551 RoundSizeToMultipleOfEntries(sizeof(data
)));
2552 // TODO(gman): Check that data was inserted;
2555 TEST_F(GLES2FormatTest
, Uniform3i
) {
2556 cmds::Uniform3i
& cmd
= *GetBufferAs
<cmds::Uniform3i
>();
2557 void* next_cmd
= cmd
.Set(
2559 static_cast<GLint
>(11),
2560 static_cast<GLint
>(12),
2561 static_cast<GLint
>(13),
2562 static_cast<GLint
>(14));
2563 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform3i::kCmdId
),
2564 cmd
.header
.command
);
2565 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2566 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2567 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2568 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2569 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2570 CheckBytesWrittenMatchesExpectedSize(
2571 next_cmd
, sizeof(cmd
));
2574 TEST_F(GLES2FormatTest
, Uniform3iv
) {
2575 cmds::Uniform3iv
& cmd
= *GetBufferAs
<cmds::Uniform3iv
>();
2576 void* next_cmd
= cmd
.Set(
2578 static_cast<GLint
>(11),
2579 static_cast<GLsizei
>(12),
2580 static_cast<uint32
>(13),
2581 static_cast<uint32
>(14));
2582 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform3iv::kCmdId
),
2583 cmd
.header
.command
);
2584 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2585 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2586 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2587 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2588 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2589 CheckBytesWrittenMatchesExpectedSize(
2590 next_cmd
, sizeof(cmd
));
2593 TEST_F(GLES2FormatTest
, Uniform3ivImmediate
) {
2594 const int kSomeBaseValueToTestWith
= 51;
2595 static GLint data
[] = {
2596 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2597 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2598 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2599 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2600 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2601 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2603 cmds::Uniform3ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3ivImmediate
>();
2604 const GLsizei kNumElements
= 2;
2605 const size_t kExpectedCmdSize
=
2606 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 3;
2607 void* next_cmd
= cmd
.Set(
2609 static_cast<GLint
>(1),
2610 static_cast<GLsizei
>(2),
2612 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform3ivImmediate::kCmdId
),
2613 cmd
.header
.command
);
2614 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2615 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2616 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2617 CheckBytesWrittenMatchesExpectedSize(
2618 next_cmd
, sizeof(cmd
) +
2619 RoundSizeToMultipleOfEntries(sizeof(data
)));
2620 // TODO(gman): Check that data was inserted;
2623 TEST_F(GLES2FormatTest
, Uniform4f
) {
2624 cmds::Uniform4f
& cmd
= *GetBufferAs
<cmds::Uniform4f
>();
2625 void* next_cmd
= cmd
.Set(
2627 static_cast<GLint
>(11),
2628 static_cast<GLfloat
>(12),
2629 static_cast<GLfloat
>(13),
2630 static_cast<GLfloat
>(14),
2631 static_cast<GLfloat
>(15));
2632 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform4f::kCmdId
),
2633 cmd
.header
.command
);
2634 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2635 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2636 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2637 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2638 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2639 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
2640 CheckBytesWrittenMatchesExpectedSize(
2641 next_cmd
, sizeof(cmd
));
2644 TEST_F(GLES2FormatTest
, Uniform4fv
) {
2645 cmds::Uniform4fv
& cmd
= *GetBufferAs
<cmds::Uniform4fv
>();
2646 void* next_cmd
= cmd
.Set(
2648 static_cast<GLint
>(11),
2649 static_cast<GLsizei
>(12),
2650 static_cast<uint32
>(13),
2651 static_cast<uint32
>(14));
2652 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform4fv::kCmdId
),
2653 cmd
.header
.command
);
2654 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2655 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2656 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2657 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2658 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2659 CheckBytesWrittenMatchesExpectedSize(
2660 next_cmd
, sizeof(cmd
));
2663 TEST_F(GLES2FormatTest
, Uniform4fvImmediate
) {
2664 const int kSomeBaseValueToTestWith
= 51;
2665 static GLfloat data
[] = {
2666 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2667 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2668 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2669 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2670 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2671 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2672 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2673 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2675 cmds::Uniform4fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4fvImmediate
>();
2676 const GLsizei kNumElements
= 2;
2677 const size_t kExpectedCmdSize
=
2678 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
2679 void* next_cmd
= cmd
.Set(
2681 static_cast<GLint
>(1),
2682 static_cast<GLsizei
>(2),
2684 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform4fvImmediate::kCmdId
),
2685 cmd
.header
.command
);
2686 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2687 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2688 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2689 CheckBytesWrittenMatchesExpectedSize(
2690 next_cmd
, sizeof(cmd
) +
2691 RoundSizeToMultipleOfEntries(sizeof(data
)));
2692 // TODO(gman): Check that data was inserted;
2695 TEST_F(GLES2FormatTest
, Uniform4i
) {
2696 cmds::Uniform4i
& cmd
= *GetBufferAs
<cmds::Uniform4i
>();
2697 void* next_cmd
= cmd
.Set(
2699 static_cast<GLint
>(11),
2700 static_cast<GLint
>(12),
2701 static_cast<GLint
>(13),
2702 static_cast<GLint
>(14),
2703 static_cast<GLint
>(15));
2704 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform4i::kCmdId
),
2705 cmd
.header
.command
);
2706 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2707 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2708 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2709 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2710 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2711 EXPECT_EQ(static_cast<GLint
>(15), cmd
.w
);
2712 CheckBytesWrittenMatchesExpectedSize(
2713 next_cmd
, sizeof(cmd
));
2716 TEST_F(GLES2FormatTest
, Uniform4iv
) {
2717 cmds::Uniform4iv
& cmd
= *GetBufferAs
<cmds::Uniform4iv
>();
2718 void* next_cmd
= cmd
.Set(
2720 static_cast<GLint
>(11),
2721 static_cast<GLsizei
>(12),
2722 static_cast<uint32
>(13),
2723 static_cast<uint32
>(14));
2724 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform4iv::kCmdId
),
2725 cmd
.header
.command
);
2726 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2727 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2728 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2729 EXPECT_EQ(static_cast<uint32
>(13), cmd
.v_shm_id
);
2730 EXPECT_EQ(static_cast<uint32
>(14), cmd
.v_shm_offset
);
2731 CheckBytesWrittenMatchesExpectedSize(
2732 next_cmd
, sizeof(cmd
));
2735 TEST_F(GLES2FormatTest
, Uniform4ivImmediate
) {
2736 const int kSomeBaseValueToTestWith
= 51;
2737 static GLint data
[] = {
2738 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2739 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2740 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2741 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2742 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2743 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2744 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 6),
2745 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 7),
2747 cmds::Uniform4ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4ivImmediate
>();
2748 const GLsizei kNumElements
= 2;
2749 const size_t kExpectedCmdSize
=
2750 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 4;
2751 void* next_cmd
= cmd
.Set(
2753 static_cast<GLint
>(1),
2754 static_cast<GLsizei
>(2),
2756 EXPECT_EQ(static_cast<uint32
>(cmds::Uniform4ivImmediate::kCmdId
),
2757 cmd
.header
.command
);
2758 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2759 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2760 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2761 CheckBytesWrittenMatchesExpectedSize(
2762 next_cmd
, sizeof(cmd
) +
2763 RoundSizeToMultipleOfEntries(sizeof(data
)));
2764 // TODO(gman): Check that data was inserted;
2767 TEST_F(GLES2FormatTest
, UniformMatrix2fv
) {
2768 cmds::UniformMatrix2fv
& cmd
= *GetBufferAs
<cmds::UniformMatrix2fv
>();
2769 void* next_cmd
= cmd
.Set(
2771 static_cast<GLint
>(11),
2772 static_cast<GLsizei
>(12),
2773 static_cast<GLboolean
>(13),
2774 static_cast<uint32
>(14),
2775 static_cast<uint32
>(15));
2776 EXPECT_EQ(static_cast<uint32
>(cmds::UniformMatrix2fv::kCmdId
),
2777 cmd
.header
.command
);
2778 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2779 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2780 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2781 EXPECT_EQ(static_cast<GLboolean
>(13), cmd
.transpose
);
2782 EXPECT_EQ(static_cast<uint32
>(14), cmd
.value_shm_id
);
2783 EXPECT_EQ(static_cast<uint32
>(15), cmd
.value_shm_offset
);
2784 CheckBytesWrittenMatchesExpectedSize(
2785 next_cmd
, sizeof(cmd
));
2788 TEST_F(GLES2FormatTest
, UniformMatrix2fvImmediate
) {
2789 const int kSomeBaseValueToTestWith
= 51;
2790 static GLfloat data
[] = {
2791 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2792 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2793 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2794 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2795 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2796 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2797 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2798 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2800 cmds::UniformMatrix2fvImmediate
& cmd
=
2801 *GetBufferAs
<cmds::UniformMatrix2fvImmediate
>();
2802 const GLsizei kNumElements
= 2;
2803 const size_t kExpectedCmdSize
=
2804 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
2805 void* next_cmd
= cmd
.Set(
2807 static_cast<GLint
>(1),
2808 static_cast<GLsizei
>(2),
2809 static_cast<GLboolean
>(3),
2811 EXPECT_EQ(static_cast<uint32
>(cmds::UniformMatrix2fvImmediate::kCmdId
),
2812 cmd
.header
.command
);
2813 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2814 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2815 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2816 EXPECT_EQ(static_cast<GLboolean
>(3), cmd
.transpose
);
2817 CheckBytesWrittenMatchesExpectedSize(
2818 next_cmd
, sizeof(cmd
) +
2819 RoundSizeToMultipleOfEntries(sizeof(data
)));
2820 // TODO(gman): Check that data was inserted;
2823 TEST_F(GLES2FormatTest
, UniformMatrix3fv
) {
2824 cmds::UniformMatrix3fv
& cmd
= *GetBufferAs
<cmds::UniformMatrix3fv
>();
2825 void* next_cmd
= cmd
.Set(
2827 static_cast<GLint
>(11),
2828 static_cast<GLsizei
>(12),
2829 static_cast<GLboolean
>(13),
2830 static_cast<uint32
>(14),
2831 static_cast<uint32
>(15));
2832 EXPECT_EQ(static_cast<uint32
>(cmds::UniformMatrix3fv::kCmdId
),
2833 cmd
.header
.command
);
2834 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2835 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2836 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2837 EXPECT_EQ(static_cast<GLboolean
>(13), cmd
.transpose
);
2838 EXPECT_EQ(static_cast<uint32
>(14), cmd
.value_shm_id
);
2839 EXPECT_EQ(static_cast<uint32
>(15), cmd
.value_shm_offset
);
2840 CheckBytesWrittenMatchesExpectedSize(
2841 next_cmd
, sizeof(cmd
));
2844 TEST_F(GLES2FormatTest
, UniformMatrix3fvImmediate
) {
2845 const int kSomeBaseValueToTestWith
= 51;
2846 static GLfloat data
[] = {
2847 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2848 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2849 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2850 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2851 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2852 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2853 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2854 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2855 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2856 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2857 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2858 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2859 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
2860 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
2861 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
2862 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
2863 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
2864 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
2866 cmds::UniformMatrix3fvImmediate
& cmd
=
2867 *GetBufferAs
<cmds::UniformMatrix3fvImmediate
>();
2868 const GLsizei kNumElements
= 2;
2869 const size_t kExpectedCmdSize
=
2870 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 9;
2871 void* next_cmd
= cmd
.Set(
2873 static_cast<GLint
>(1),
2874 static_cast<GLsizei
>(2),
2875 static_cast<GLboolean
>(3),
2877 EXPECT_EQ(static_cast<uint32
>(cmds::UniformMatrix3fvImmediate::kCmdId
),
2878 cmd
.header
.command
);
2879 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2880 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2881 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2882 EXPECT_EQ(static_cast<GLboolean
>(3), cmd
.transpose
);
2883 CheckBytesWrittenMatchesExpectedSize(
2884 next_cmd
, sizeof(cmd
) +
2885 RoundSizeToMultipleOfEntries(sizeof(data
)));
2886 // TODO(gman): Check that data was inserted;
2889 TEST_F(GLES2FormatTest
, UniformMatrix4fv
) {
2890 cmds::UniformMatrix4fv
& cmd
= *GetBufferAs
<cmds::UniformMatrix4fv
>();
2891 void* next_cmd
= cmd
.Set(
2893 static_cast<GLint
>(11),
2894 static_cast<GLsizei
>(12),
2895 static_cast<GLboolean
>(13),
2896 static_cast<uint32
>(14),
2897 static_cast<uint32
>(15));
2898 EXPECT_EQ(static_cast<uint32
>(cmds::UniformMatrix4fv::kCmdId
),
2899 cmd
.header
.command
);
2900 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2901 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2902 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2903 EXPECT_EQ(static_cast<GLboolean
>(13), cmd
.transpose
);
2904 EXPECT_EQ(static_cast<uint32
>(14), cmd
.value_shm_id
);
2905 EXPECT_EQ(static_cast<uint32
>(15), cmd
.value_shm_offset
);
2906 CheckBytesWrittenMatchesExpectedSize(
2907 next_cmd
, sizeof(cmd
));
2910 TEST_F(GLES2FormatTest
, UniformMatrix4fvImmediate
) {
2911 const int kSomeBaseValueToTestWith
= 51;
2912 static GLfloat data
[] = {
2913 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2914 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2915 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2916 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2917 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2918 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2919 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2920 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2921 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2922 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2923 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2924 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2925 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
2926 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
2927 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
2928 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
2929 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
2930 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
2931 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
2932 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
2933 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
2934 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
2935 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
2936 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
2937 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 24),
2938 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 25),
2939 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 26),
2940 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 27),
2941 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 28),
2942 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 29),
2943 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 30),
2944 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 31),
2946 cmds::UniformMatrix4fvImmediate
& cmd
=
2947 *GetBufferAs
<cmds::UniformMatrix4fvImmediate
>();
2948 const GLsizei kNumElements
= 2;
2949 const size_t kExpectedCmdSize
=
2950 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 16;
2951 void* next_cmd
= cmd
.Set(
2953 static_cast<GLint
>(1),
2954 static_cast<GLsizei
>(2),
2955 static_cast<GLboolean
>(3),
2957 EXPECT_EQ(static_cast<uint32
>(cmds::UniformMatrix4fvImmediate::kCmdId
),
2958 cmd
.header
.command
);
2959 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2960 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2961 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2962 EXPECT_EQ(static_cast<GLboolean
>(3), cmd
.transpose
);
2963 CheckBytesWrittenMatchesExpectedSize(
2964 next_cmd
, sizeof(cmd
) +
2965 RoundSizeToMultipleOfEntries(sizeof(data
)));
2966 // TODO(gman): Check that data was inserted;
2969 TEST_F(GLES2FormatTest
, UseProgram
) {
2970 cmds::UseProgram
& cmd
= *GetBufferAs
<cmds::UseProgram
>();
2971 void* next_cmd
= cmd
.Set(
2973 static_cast<GLuint
>(11));
2974 EXPECT_EQ(static_cast<uint32
>(cmds::UseProgram::kCmdId
),
2975 cmd
.header
.command
);
2976 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2977 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2978 CheckBytesWrittenMatchesExpectedSize(
2979 next_cmd
, sizeof(cmd
));
2982 TEST_F(GLES2FormatTest
, ValidateProgram
) {
2983 cmds::ValidateProgram
& cmd
= *GetBufferAs
<cmds::ValidateProgram
>();
2984 void* next_cmd
= cmd
.Set(
2986 static_cast<GLuint
>(11));
2987 EXPECT_EQ(static_cast<uint32
>(cmds::ValidateProgram::kCmdId
),
2988 cmd
.header
.command
);
2989 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2990 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2991 CheckBytesWrittenMatchesExpectedSize(
2992 next_cmd
, sizeof(cmd
));
2995 TEST_F(GLES2FormatTest
, VertexAttrib1f
) {
2996 cmds::VertexAttrib1f
& cmd
= *GetBufferAs
<cmds::VertexAttrib1f
>();
2997 void* next_cmd
= cmd
.Set(
2999 static_cast<GLuint
>(11),
3000 static_cast<GLfloat
>(12));
3001 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib1f::kCmdId
),
3002 cmd
.header
.command
);
3003 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3004 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3005 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3006 CheckBytesWrittenMatchesExpectedSize(
3007 next_cmd
, sizeof(cmd
));
3010 TEST_F(GLES2FormatTest
, VertexAttrib1fv
) {
3011 cmds::VertexAttrib1fv
& cmd
= *GetBufferAs
<cmds::VertexAttrib1fv
>();
3012 void* next_cmd
= cmd
.Set(
3014 static_cast<GLuint
>(11),
3015 static_cast<uint32
>(12),
3016 static_cast<uint32
>(13));
3017 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib1fv::kCmdId
),
3018 cmd
.header
.command
);
3019 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3020 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3021 EXPECT_EQ(static_cast<uint32
>(12), cmd
.values_shm_id
);
3022 EXPECT_EQ(static_cast<uint32
>(13), cmd
.values_shm_offset
);
3023 CheckBytesWrittenMatchesExpectedSize(
3024 next_cmd
, sizeof(cmd
));
3027 TEST_F(GLES2FormatTest
, VertexAttrib1fvImmediate
) {
3028 const int kSomeBaseValueToTestWith
= 51;
3029 static GLfloat data
[] = {
3030 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3032 cmds::VertexAttrib1fvImmediate
& cmd
=
3033 *GetBufferAs
<cmds::VertexAttrib1fvImmediate
>();
3034 void* next_cmd
= cmd
.Set(
3036 static_cast<GLuint
>(11),
3038 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib1fvImmediate::kCmdId
),
3039 cmd
.header
.command
);
3040 EXPECT_EQ(sizeof(cmd
) +
3041 RoundSizeToMultipleOfEntries(sizeof(data
)),
3042 cmd
.header
.size
* 4u);
3043 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3044 CheckBytesWrittenMatchesExpectedSize(
3045 next_cmd
, sizeof(cmd
) +
3046 RoundSizeToMultipleOfEntries(sizeof(data
)));
3047 // TODO(gman): Check that data was inserted;
3050 TEST_F(GLES2FormatTest
, VertexAttrib2f
) {
3051 cmds::VertexAttrib2f
& cmd
= *GetBufferAs
<cmds::VertexAttrib2f
>();
3052 void* next_cmd
= cmd
.Set(
3054 static_cast<GLuint
>(11),
3055 static_cast<GLfloat
>(12),
3056 static_cast<GLfloat
>(13));
3057 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib2f::kCmdId
),
3058 cmd
.header
.command
);
3059 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3060 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3061 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3062 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3063 CheckBytesWrittenMatchesExpectedSize(
3064 next_cmd
, sizeof(cmd
));
3067 TEST_F(GLES2FormatTest
, VertexAttrib2fv
) {
3068 cmds::VertexAttrib2fv
& cmd
= *GetBufferAs
<cmds::VertexAttrib2fv
>();
3069 void* next_cmd
= cmd
.Set(
3071 static_cast<GLuint
>(11),
3072 static_cast<uint32
>(12),
3073 static_cast<uint32
>(13));
3074 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib2fv::kCmdId
),
3075 cmd
.header
.command
);
3076 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3077 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3078 EXPECT_EQ(static_cast<uint32
>(12), cmd
.values_shm_id
);
3079 EXPECT_EQ(static_cast<uint32
>(13), cmd
.values_shm_offset
);
3080 CheckBytesWrittenMatchesExpectedSize(
3081 next_cmd
, sizeof(cmd
));
3084 TEST_F(GLES2FormatTest
, VertexAttrib2fvImmediate
) {
3085 const int kSomeBaseValueToTestWith
= 51;
3086 static GLfloat data
[] = {
3087 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3088 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3090 cmds::VertexAttrib2fvImmediate
& cmd
=
3091 *GetBufferAs
<cmds::VertexAttrib2fvImmediate
>();
3092 void* next_cmd
= cmd
.Set(
3094 static_cast<GLuint
>(11),
3096 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib2fvImmediate::kCmdId
),
3097 cmd
.header
.command
);
3098 EXPECT_EQ(sizeof(cmd
) +
3099 RoundSizeToMultipleOfEntries(sizeof(data
)),
3100 cmd
.header
.size
* 4u);
3101 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3102 CheckBytesWrittenMatchesExpectedSize(
3103 next_cmd
, sizeof(cmd
) +
3104 RoundSizeToMultipleOfEntries(sizeof(data
)));
3105 // TODO(gman): Check that data was inserted;
3108 TEST_F(GLES2FormatTest
, VertexAttrib3f
) {
3109 cmds::VertexAttrib3f
& cmd
= *GetBufferAs
<cmds::VertexAttrib3f
>();
3110 void* next_cmd
= cmd
.Set(
3112 static_cast<GLuint
>(11),
3113 static_cast<GLfloat
>(12),
3114 static_cast<GLfloat
>(13),
3115 static_cast<GLfloat
>(14));
3116 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib3f::kCmdId
),
3117 cmd
.header
.command
);
3118 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3119 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3120 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3121 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3122 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
3123 CheckBytesWrittenMatchesExpectedSize(
3124 next_cmd
, sizeof(cmd
));
3127 TEST_F(GLES2FormatTest
, VertexAttrib3fv
) {
3128 cmds::VertexAttrib3fv
& cmd
= *GetBufferAs
<cmds::VertexAttrib3fv
>();
3129 void* next_cmd
= cmd
.Set(
3131 static_cast<GLuint
>(11),
3132 static_cast<uint32
>(12),
3133 static_cast<uint32
>(13));
3134 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib3fv::kCmdId
),
3135 cmd
.header
.command
);
3136 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3137 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3138 EXPECT_EQ(static_cast<uint32
>(12), cmd
.values_shm_id
);
3139 EXPECT_EQ(static_cast<uint32
>(13), cmd
.values_shm_offset
);
3140 CheckBytesWrittenMatchesExpectedSize(
3141 next_cmd
, sizeof(cmd
));
3144 TEST_F(GLES2FormatTest
, VertexAttrib3fvImmediate
) {
3145 const int kSomeBaseValueToTestWith
= 51;
3146 static GLfloat data
[] = {
3147 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3148 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3149 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3151 cmds::VertexAttrib3fvImmediate
& cmd
=
3152 *GetBufferAs
<cmds::VertexAttrib3fvImmediate
>();
3153 void* next_cmd
= cmd
.Set(
3155 static_cast<GLuint
>(11),
3157 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib3fvImmediate::kCmdId
),
3158 cmd
.header
.command
);
3159 EXPECT_EQ(sizeof(cmd
) +
3160 RoundSizeToMultipleOfEntries(sizeof(data
)),
3161 cmd
.header
.size
* 4u);
3162 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3163 CheckBytesWrittenMatchesExpectedSize(
3164 next_cmd
, sizeof(cmd
) +
3165 RoundSizeToMultipleOfEntries(sizeof(data
)));
3166 // TODO(gman): Check that data was inserted;
3169 TEST_F(GLES2FormatTest
, VertexAttrib4f
) {
3170 cmds::VertexAttrib4f
& cmd
= *GetBufferAs
<cmds::VertexAttrib4f
>();
3171 void* next_cmd
= cmd
.Set(
3173 static_cast<GLuint
>(11),
3174 static_cast<GLfloat
>(12),
3175 static_cast<GLfloat
>(13),
3176 static_cast<GLfloat
>(14),
3177 static_cast<GLfloat
>(15));
3178 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib4f::kCmdId
),
3179 cmd
.header
.command
);
3180 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3181 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3182 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3183 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3184 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
3185 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
3186 CheckBytesWrittenMatchesExpectedSize(
3187 next_cmd
, sizeof(cmd
));
3190 TEST_F(GLES2FormatTest
, VertexAttrib4fv
) {
3191 cmds::VertexAttrib4fv
& cmd
= *GetBufferAs
<cmds::VertexAttrib4fv
>();
3192 void* next_cmd
= cmd
.Set(
3194 static_cast<GLuint
>(11),
3195 static_cast<uint32
>(12),
3196 static_cast<uint32
>(13));
3197 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib4fv::kCmdId
),
3198 cmd
.header
.command
);
3199 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3200 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3201 EXPECT_EQ(static_cast<uint32
>(12), cmd
.values_shm_id
);
3202 EXPECT_EQ(static_cast<uint32
>(13), cmd
.values_shm_offset
);
3203 CheckBytesWrittenMatchesExpectedSize(
3204 next_cmd
, sizeof(cmd
));
3207 TEST_F(GLES2FormatTest
, VertexAttrib4fvImmediate
) {
3208 const int kSomeBaseValueToTestWith
= 51;
3209 static GLfloat data
[] = {
3210 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3211 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3212 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3213 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3215 cmds::VertexAttrib4fvImmediate
& cmd
=
3216 *GetBufferAs
<cmds::VertexAttrib4fvImmediate
>();
3217 void* next_cmd
= cmd
.Set(
3219 static_cast<GLuint
>(11),
3221 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttrib4fvImmediate::kCmdId
),
3222 cmd
.header
.command
);
3223 EXPECT_EQ(sizeof(cmd
) +
3224 RoundSizeToMultipleOfEntries(sizeof(data
)),
3225 cmd
.header
.size
* 4u);
3226 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3227 CheckBytesWrittenMatchesExpectedSize(
3228 next_cmd
, sizeof(cmd
) +
3229 RoundSizeToMultipleOfEntries(sizeof(data
)));
3230 // TODO(gman): Check that data was inserted;
3233 TEST_F(GLES2FormatTest
, VertexAttribPointer
) {
3234 cmds::VertexAttribPointer
& cmd
= *GetBufferAs
<cmds::VertexAttribPointer
>();
3235 void* next_cmd
= cmd
.Set(
3237 static_cast<GLuint
>(11),
3238 static_cast<GLint
>(12),
3239 static_cast<GLenum
>(13),
3240 static_cast<GLboolean
>(14),
3241 static_cast<GLsizei
>(15),
3242 static_cast<GLuint
>(16));
3243 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttribPointer::kCmdId
),
3244 cmd
.header
.command
);
3245 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3246 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3247 EXPECT_EQ(static_cast<GLint
>(12), cmd
.size
);
3248 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3249 EXPECT_EQ(static_cast<GLboolean
>(14), cmd
.normalized
);
3250 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.stride
);
3251 EXPECT_EQ(static_cast<GLuint
>(16), cmd
.offset
);
3252 CheckBytesWrittenMatchesExpectedSize(
3253 next_cmd
, sizeof(cmd
));
3256 TEST_F(GLES2FormatTest
, Viewport
) {
3257 cmds::Viewport
& cmd
= *GetBufferAs
<cmds::Viewport
>();
3258 void* next_cmd
= cmd
.Set(
3260 static_cast<GLint
>(11),
3261 static_cast<GLint
>(12),
3262 static_cast<GLsizei
>(13),
3263 static_cast<GLsizei
>(14));
3264 EXPECT_EQ(static_cast<uint32
>(cmds::Viewport::kCmdId
),
3265 cmd
.header
.command
);
3266 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3267 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
3268 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
3269 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
3270 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
3271 CheckBytesWrittenMatchesExpectedSize(
3272 next_cmd
, sizeof(cmd
));
3275 TEST_F(GLES2FormatTest
, BlitFramebufferEXT
) {
3276 cmds::BlitFramebufferEXT
& cmd
= *GetBufferAs
<cmds::BlitFramebufferEXT
>();
3277 void* next_cmd
= cmd
.Set(
3279 static_cast<GLint
>(11),
3280 static_cast<GLint
>(12),
3281 static_cast<GLint
>(13),
3282 static_cast<GLint
>(14),
3283 static_cast<GLint
>(15),
3284 static_cast<GLint
>(16),
3285 static_cast<GLint
>(17),
3286 static_cast<GLint
>(18),
3287 static_cast<GLbitfield
>(19),
3288 static_cast<GLenum
>(20));
3289 EXPECT_EQ(static_cast<uint32
>(cmds::BlitFramebufferEXT::kCmdId
),
3290 cmd
.header
.command
);
3291 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3292 EXPECT_EQ(static_cast<GLint
>(11), cmd
.srcX0
);
3293 EXPECT_EQ(static_cast<GLint
>(12), cmd
.srcY0
);
3294 EXPECT_EQ(static_cast<GLint
>(13), cmd
.srcX1
);
3295 EXPECT_EQ(static_cast<GLint
>(14), cmd
.srcY1
);
3296 EXPECT_EQ(static_cast<GLint
>(15), cmd
.dstX0
);
3297 EXPECT_EQ(static_cast<GLint
>(16), cmd
.dstY0
);
3298 EXPECT_EQ(static_cast<GLint
>(17), cmd
.dstX1
);
3299 EXPECT_EQ(static_cast<GLint
>(18), cmd
.dstY1
);
3300 EXPECT_EQ(static_cast<GLbitfield
>(19), cmd
.mask
);
3301 EXPECT_EQ(static_cast<GLenum
>(20), cmd
.filter
);
3302 CheckBytesWrittenMatchesExpectedSize(
3303 next_cmd
, sizeof(cmd
));
3306 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleEXT
) {
3307 cmds::RenderbufferStorageMultisampleEXT
& cmd
=
3308 *GetBufferAs
<cmds::RenderbufferStorageMultisampleEXT
>();
3309 void* next_cmd
= cmd
.Set(
3311 static_cast<GLenum
>(11),
3312 static_cast<GLsizei
>(12),
3313 static_cast<GLenum
>(13),
3314 static_cast<GLsizei
>(14),
3315 static_cast<GLsizei
>(15));
3317 static_cast<uint32
>(cmds::RenderbufferStorageMultisampleEXT::kCmdId
),
3318 cmd
.header
.command
);
3319 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3320 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3321 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
3322 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
3323 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3324 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3325 CheckBytesWrittenMatchesExpectedSize(
3326 next_cmd
, sizeof(cmd
));
3329 TEST_F(GLES2FormatTest
, FramebufferTexture2DMultisampleEXT
) {
3330 cmds::FramebufferTexture2DMultisampleEXT
& cmd
=
3331 *GetBufferAs
<cmds::FramebufferTexture2DMultisampleEXT
>();
3332 void* next_cmd
= cmd
.Set(
3334 static_cast<GLenum
>(11),
3335 static_cast<GLenum
>(12),
3336 static_cast<GLenum
>(13),
3337 static_cast<GLuint
>(14),
3338 static_cast<GLint
>(15),
3339 static_cast<GLsizei
>(16));
3341 static_cast<uint32
>(cmds::FramebufferTexture2DMultisampleEXT::kCmdId
),
3342 cmd
.header
.command
);
3343 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3344 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3345 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
3346 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
3347 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
3348 EXPECT_EQ(static_cast<GLint
>(15), cmd
.level
);
3349 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.samples
);
3350 CheckBytesWrittenMatchesExpectedSize(
3351 next_cmd
, sizeof(cmd
));
3354 TEST_F(GLES2FormatTest
, TexStorage2DEXT
) {
3355 cmds::TexStorage2DEXT
& cmd
= *GetBufferAs
<cmds::TexStorage2DEXT
>();
3356 void* next_cmd
= cmd
.Set(
3358 static_cast<GLenum
>(11),
3359 static_cast<GLsizei
>(12),
3360 static_cast<GLenum
>(13),
3361 static_cast<GLsizei
>(14),
3362 static_cast<GLsizei
>(15));
3363 EXPECT_EQ(static_cast<uint32
>(cmds::TexStorage2DEXT::kCmdId
),
3364 cmd
.header
.command
);
3365 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3366 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3367 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.levels
);
3368 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalFormat
);
3369 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3370 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3371 CheckBytesWrittenMatchesExpectedSize(
3372 next_cmd
, sizeof(cmd
));
3375 TEST_F(GLES2FormatTest
, GenQueriesEXT
) {
3376 cmds::GenQueriesEXT
& cmd
= *GetBufferAs
<cmds::GenQueriesEXT
>();
3377 void* next_cmd
= cmd
.Set(
3379 static_cast<GLsizei
>(11),
3380 static_cast<uint32
>(12),
3381 static_cast<uint32
>(13));
3382 EXPECT_EQ(static_cast<uint32
>(cmds::GenQueriesEXT::kCmdId
),
3383 cmd
.header
.command
);
3384 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3385 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
3386 EXPECT_EQ(static_cast<uint32
>(12), cmd
.queries_shm_id
);
3387 EXPECT_EQ(static_cast<uint32
>(13), cmd
.queries_shm_offset
);
3388 CheckBytesWrittenMatchesExpectedSize(
3389 next_cmd
, sizeof(cmd
));
3392 TEST_F(GLES2FormatTest
, GenQueriesEXTImmediate
) {
3393 static GLuint ids
[] = { 12, 23, 34, };
3394 cmds::GenQueriesEXTImmediate
& cmd
=
3395 *GetBufferAs
<cmds::GenQueriesEXTImmediate
>();
3396 void* next_cmd
= cmd
.Set(
3397 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3398 EXPECT_EQ(static_cast<uint32
>(cmds::GenQueriesEXTImmediate::kCmdId
),
3399 cmd
.header
.command
);
3400 EXPECT_EQ(sizeof(cmd
) +
3401 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3402 cmd
.header
.size
* 4u);
3403 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3404 CheckBytesWrittenMatchesExpectedSize(
3405 next_cmd
, sizeof(cmd
) +
3406 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3407 // TODO(gman): Check that ids were inserted;
3410 TEST_F(GLES2FormatTest
, DeleteQueriesEXT
) {
3411 cmds::DeleteQueriesEXT
& cmd
= *GetBufferAs
<cmds::DeleteQueriesEXT
>();
3412 void* next_cmd
= cmd
.Set(
3414 static_cast<GLsizei
>(11),
3415 static_cast<uint32
>(12),
3416 static_cast<uint32
>(13));
3417 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteQueriesEXT::kCmdId
),
3418 cmd
.header
.command
);
3419 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3420 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
3421 EXPECT_EQ(static_cast<uint32
>(12), cmd
.queries_shm_id
);
3422 EXPECT_EQ(static_cast<uint32
>(13), cmd
.queries_shm_offset
);
3423 CheckBytesWrittenMatchesExpectedSize(
3424 next_cmd
, sizeof(cmd
));
3427 TEST_F(GLES2FormatTest
, DeleteQueriesEXTImmediate
) {
3428 static GLuint ids
[] = { 12, 23, 34, };
3429 cmds::DeleteQueriesEXTImmediate
& cmd
=
3430 *GetBufferAs
<cmds::DeleteQueriesEXTImmediate
>();
3431 void* next_cmd
= cmd
.Set(
3432 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3433 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteQueriesEXTImmediate::kCmdId
),
3434 cmd
.header
.command
);
3435 EXPECT_EQ(sizeof(cmd
) +
3436 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3437 cmd
.header
.size
* 4u);
3438 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3439 CheckBytesWrittenMatchesExpectedSize(
3440 next_cmd
, sizeof(cmd
) +
3441 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3442 // TODO(gman): Check that ids were inserted;
3445 TEST_F(GLES2FormatTest
, BeginQueryEXT
) {
3446 cmds::BeginQueryEXT
& cmd
= *GetBufferAs
<cmds::BeginQueryEXT
>();
3447 void* next_cmd
= cmd
.Set(
3449 static_cast<GLenum
>(11),
3450 static_cast<GLuint
>(12),
3451 static_cast<uint32
>(13),
3452 static_cast<uint32
>(14));
3453 EXPECT_EQ(static_cast<uint32
>(cmds::BeginQueryEXT::kCmdId
),
3454 cmd
.header
.command
);
3455 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3456 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3457 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.id
);
3458 EXPECT_EQ(static_cast<uint32
>(13), cmd
.sync_data_shm_id
);
3459 EXPECT_EQ(static_cast<uint32
>(14), cmd
.sync_data_shm_offset
);
3460 CheckBytesWrittenMatchesExpectedSize(
3461 next_cmd
, sizeof(cmd
));
3464 TEST_F(GLES2FormatTest
, EndQueryEXT
) {
3465 cmds::EndQueryEXT
& cmd
= *GetBufferAs
<cmds::EndQueryEXT
>();
3466 void* next_cmd
= cmd
.Set(
3468 static_cast<GLenum
>(11),
3469 static_cast<GLuint
>(12));
3470 EXPECT_EQ(static_cast<uint32
>(cmds::EndQueryEXT::kCmdId
),
3471 cmd
.header
.command
);
3472 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3473 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3474 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.submit_count
);
3475 CheckBytesWrittenMatchesExpectedSize(
3476 next_cmd
, sizeof(cmd
));
3479 TEST_F(GLES2FormatTest
, InsertEventMarkerEXT
) {
3480 cmds::InsertEventMarkerEXT
& cmd
= *GetBufferAs
<cmds::InsertEventMarkerEXT
>();
3481 void* next_cmd
= cmd
.Set(
3483 static_cast<GLuint
>(11));
3484 EXPECT_EQ(static_cast<uint32
>(cmds::InsertEventMarkerEXT::kCmdId
),
3485 cmd
.header
.command
);
3486 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3487 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3488 CheckBytesWrittenMatchesExpectedSize(
3489 next_cmd
, sizeof(cmd
));
3492 TEST_F(GLES2FormatTest
, PushGroupMarkerEXT
) {
3493 cmds::PushGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PushGroupMarkerEXT
>();
3494 void* next_cmd
= cmd
.Set(
3496 static_cast<GLuint
>(11));
3497 EXPECT_EQ(static_cast<uint32
>(cmds::PushGroupMarkerEXT::kCmdId
),
3498 cmd
.header
.command
);
3499 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3500 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3501 CheckBytesWrittenMatchesExpectedSize(
3502 next_cmd
, sizeof(cmd
));
3505 TEST_F(GLES2FormatTest
, PopGroupMarkerEXT
) {
3506 cmds::PopGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PopGroupMarkerEXT
>();
3507 void* next_cmd
= cmd
.Set(
3509 EXPECT_EQ(static_cast<uint32
>(cmds::PopGroupMarkerEXT::kCmdId
),
3510 cmd
.header
.command
);
3511 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3512 CheckBytesWrittenMatchesExpectedSize(
3513 next_cmd
, sizeof(cmd
));
3516 TEST_F(GLES2FormatTest
, GenVertexArraysOES
) {
3517 cmds::GenVertexArraysOES
& cmd
= *GetBufferAs
<cmds::GenVertexArraysOES
>();
3518 void* next_cmd
= cmd
.Set(
3520 static_cast<GLsizei
>(11),
3521 static_cast<uint32
>(12),
3522 static_cast<uint32
>(13));
3523 EXPECT_EQ(static_cast<uint32
>(cmds::GenVertexArraysOES::kCmdId
),
3524 cmd
.header
.command
);
3525 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3526 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
3527 EXPECT_EQ(static_cast<uint32
>(12), cmd
.arrays_shm_id
);
3528 EXPECT_EQ(static_cast<uint32
>(13), cmd
.arrays_shm_offset
);
3529 CheckBytesWrittenMatchesExpectedSize(
3530 next_cmd
, sizeof(cmd
));
3533 TEST_F(GLES2FormatTest
, GenVertexArraysOESImmediate
) {
3534 static GLuint ids
[] = { 12, 23, 34, };
3535 cmds::GenVertexArraysOESImmediate
& cmd
=
3536 *GetBufferAs
<cmds::GenVertexArraysOESImmediate
>();
3537 void* next_cmd
= cmd
.Set(
3538 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3539 EXPECT_EQ(static_cast<uint32
>(cmds::GenVertexArraysOESImmediate::kCmdId
),
3540 cmd
.header
.command
);
3541 EXPECT_EQ(sizeof(cmd
) +
3542 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3543 cmd
.header
.size
* 4u);
3544 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3545 CheckBytesWrittenMatchesExpectedSize(
3546 next_cmd
, sizeof(cmd
) +
3547 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3548 // TODO(gman): Check that ids were inserted;
3551 TEST_F(GLES2FormatTest
, DeleteVertexArraysOES
) {
3552 cmds::DeleteVertexArraysOES
& cmd
=
3553 *GetBufferAs
<cmds::DeleteVertexArraysOES
>();
3554 void* next_cmd
= cmd
.Set(
3556 static_cast<GLsizei
>(11),
3557 static_cast<uint32
>(12),
3558 static_cast<uint32
>(13));
3559 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteVertexArraysOES::kCmdId
),
3560 cmd
.header
.command
);
3561 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3562 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
3563 EXPECT_EQ(static_cast<uint32
>(12), cmd
.arrays_shm_id
);
3564 EXPECT_EQ(static_cast<uint32
>(13), cmd
.arrays_shm_offset
);
3565 CheckBytesWrittenMatchesExpectedSize(
3566 next_cmd
, sizeof(cmd
));
3569 TEST_F(GLES2FormatTest
, DeleteVertexArraysOESImmediate
) {
3570 static GLuint ids
[] = { 12, 23, 34, };
3571 cmds::DeleteVertexArraysOESImmediate
& cmd
=
3572 *GetBufferAs
<cmds::DeleteVertexArraysOESImmediate
>();
3573 void* next_cmd
= cmd
.Set(
3574 &cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3575 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteVertexArraysOESImmediate::kCmdId
),
3576 cmd
.header
.command
);
3577 EXPECT_EQ(sizeof(cmd
) +
3578 RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3579 cmd
.header
.size
* 4u);
3580 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3581 CheckBytesWrittenMatchesExpectedSize(
3582 next_cmd
, sizeof(cmd
) +
3583 RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3584 // TODO(gman): Check that ids were inserted;
3587 TEST_F(GLES2FormatTest
, IsVertexArrayOES
) {
3588 cmds::IsVertexArrayOES
& cmd
= *GetBufferAs
<cmds::IsVertexArrayOES
>();
3589 void* next_cmd
= cmd
.Set(
3591 static_cast<GLuint
>(11),
3592 static_cast<uint32
>(12),
3593 static_cast<uint32
>(13));
3594 EXPECT_EQ(static_cast<uint32
>(cmds::IsVertexArrayOES::kCmdId
),
3595 cmd
.header
.command
);
3596 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3597 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
3598 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
3599 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
3600 CheckBytesWrittenMatchesExpectedSize(
3601 next_cmd
, sizeof(cmd
));
3604 TEST_F(GLES2FormatTest
, BindVertexArrayOES
) {
3605 cmds::BindVertexArrayOES
& cmd
= *GetBufferAs
<cmds::BindVertexArrayOES
>();
3606 void* next_cmd
= cmd
.Set(
3608 static_cast<GLuint
>(11));
3609 EXPECT_EQ(static_cast<uint32
>(cmds::BindVertexArrayOES::kCmdId
),
3610 cmd
.header
.command
);
3611 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3612 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
3613 CheckBytesWrittenMatchesExpectedSize(
3614 next_cmd
, sizeof(cmd
));
3617 TEST_F(GLES2FormatTest
, SwapBuffers
) {
3618 cmds::SwapBuffers
& cmd
= *GetBufferAs
<cmds::SwapBuffers
>();
3619 void* next_cmd
= cmd
.Set(
3621 EXPECT_EQ(static_cast<uint32
>(cmds::SwapBuffers::kCmdId
),
3622 cmd
.header
.command
);
3623 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3624 CheckBytesWrittenMatchesExpectedSize(
3625 next_cmd
, sizeof(cmd
));
3628 TEST_F(GLES2FormatTest
, GetMaxValueInBufferCHROMIUM
) {
3629 cmds::GetMaxValueInBufferCHROMIUM
& cmd
=
3630 *GetBufferAs
<cmds::GetMaxValueInBufferCHROMIUM
>();
3631 void* next_cmd
= cmd
.Set(
3633 static_cast<GLuint
>(11),
3634 static_cast<GLsizei
>(12),
3635 static_cast<GLenum
>(13),
3636 static_cast<GLuint
>(14),
3637 static_cast<uint32
>(15),
3638 static_cast<uint32
>(16));
3639 EXPECT_EQ(static_cast<uint32
>(cmds::GetMaxValueInBufferCHROMIUM::kCmdId
),
3640 cmd
.header
.command
);
3641 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3642 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer_id
);
3643 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
3644 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3645 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.offset
);
3646 EXPECT_EQ(static_cast<uint32
>(15), cmd
.result_shm_id
);
3647 EXPECT_EQ(static_cast<uint32
>(16), cmd
.result_shm_offset
);
3648 CheckBytesWrittenMatchesExpectedSize(
3649 next_cmd
, sizeof(cmd
));
3652 TEST_F(GLES2FormatTest
, GenSharedIdsCHROMIUM
) {
3653 cmds::GenSharedIdsCHROMIUM
& cmd
= *GetBufferAs
<cmds::GenSharedIdsCHROMIUM
>();
3654 void* next_cmd
= cmd
.Set(
3656 static_cast<GLuint
>(11),
3657 static_cast<GLuint
>(12),
3658 static_cast<GLsizei
>(13),
3659 static_cast<uint32
>(14),
3660 static_cast<uint32
>(15));
3661 EXPECT_EQ(static_cast<uint32
>(cmds::GenSharedIdsCHROMIUM::kCmdId
),
3662 cmd
.header
.command
);
3663 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3664 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.namespace_id
);
3665 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.id_offset
);
3666 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.n
);
3667 EXPECT_EQ(static_cast<uint32
>(14), cmd
.ids_shm_id
);
3668 EXPECT_EQ(static_cast<uint32
>(15), cmd
.ids_shm_offset
);
3669 CheckBytesWrittenMatchesExpectedSize(
3670 next_cmd
, sizeof(cmd
));
3673 TEST_F(GLES2FormatTest
, DeleteSharedIdsCHROMIUM
) {
3674 cmds::DeleteSharedIdsCHROMIUM
& cmd
=
3675 *GetBufferAs
<cmds::DeleteSharedIdsCHROMIUM
>();
3676 void* next_cmd
= cmd
.Set(
3678 static_cast<GLuint
>(11),
3679 static_cast<GLsizei
>(12),
3680 static_cast<uint32
>(13),
3681 static_cast<uint32
>(14));
3682 EXPECT_EQ(static_cast<uint32
>(cmds::DeleteSharedIdsCHROMIUM::kCmdId
),
3683 cmd
.header
.command
);
3684 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3685 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.namespace_id
);
3686 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.n
);
3687 EXPECT_EQ(static_cast<uint32
>(13), cmd
.ids_shm_id
);
3688 EXPECT_EQ(static_cast<uint32
>(14), cmd
.ids_shm_offset
);
3689 CheckBytesWrittenMatchesExpectedSize(
3690 next_cmd
, sizeof(cmd
));
3693 TEST_F(GLES2FormatTest
, RegisterSharedIdsCHROMIUM
) {
3694 cmds::RegisterSharedIdsCHROMIUM
& cmd
=
3695 *GetBufferAs
<cmds::RegisterSharedIdsCHROMIUM
>();
3696 void* next_cmd
= cmd
.Set(
3698 static_cast<GLuint
>(11),
3699 static_cast<GLsizei
>(12),
3700 static_cast<uint32
>(13),
3701 static_cast<uint32
>(14));
3702 EXPECT_EQ(static_cast<uint32
>(cmds::RegisterSharedIdsCHROMIUM::kCmdId
),
3703 cmd
.header
.command
);
3704 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3705 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.namespace_id
);
3706 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.n
);
3707 EXPECT_EQ(static_cast<uint32
>(13), cmd
.ids_shm_id
);
3708 EXPECT_EQ(static_cast<uint32
>(14), cmd
.ids_shm_offset
);
3709 CheckBytesWrittenMatchesExpectedSize(
3710 next_cmd
, sizeof(cmd
));
3713 TEST_F(GLES2FormatTest
, EnableFeatureCHROMIUM
) {
3714 cmds::EnableFeatureCHROMIUM
& cmd
=
3715 *GetBufferAs
<cmds::EnableFeatureCHROMIUM
>();
3716 void* next_cmd
= cmd
.Set(
3718 static_cast<GLuint
>(11),
3719 static_cast<uint32
>(12),
3720 static_cast<uint32
>(13));
3721 EXPECT_EQ(static_cast<uint32
>(cmds::EnableFeatureCHROMIUM::kCmdId
),
3722 cmd
.header
.command
);
3723 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3724 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3725 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
3726 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
3727 CheckBytesWrittenMatchesExpectedSize(
3728 next_cmd
, sizeof(cmd
));
3731 TEST_F(GLES2FormatTest
, ResizeCHROMIUM
) {
3732 cmds::ResizeCHROMIUM
& cmd
= *GetBufferAs
<cmds::ResizeCHROMIUM
>();
3733 void* next_cmd
= cmd
.Set(
3735 static_cast<GLuint
>(11),
3736 static_cast<GLuint
>(12),
3737 static_cast<GLfloat
>(13));
3738 EXPECT_EQ(static_cast<uint32
>(cmds::ResizeCHROMIUM::kCmdId
),
3739 cmd
.header
.command
);
3740 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3741 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.width
);
3742 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.height
);
3743 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.scale_factor
);
3744 CheckBytesWrittenMatchesExpectedSize(
3745 next_cmd
, sizeof(cmd
));
3748 TEST_F(GLES2FormatTest
, GetRequestableExtensionsCHROMIUM
) {
3749 cmds::GetRequestableExtensionsCHROMIUM
& cmd
=
3750 *GetBufferAs
<cmds::GetRequestableExtensionsCHROMIUM
>();
3751 void* next_cmd
= cmd
.Set(
3753 static_cast<uint32
>(11));
3755 static_cast<uint32
>(cmds::GetRequestableExtensionsCHROMIUM::kCmdId
),
3756 cmd
.header
.command
);
3757 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3758 EXPECT_EQ(static_cast<uint32
>(11), cmd
.bucket_id
);
3759 CheckBytesWrittenMatchesExpectedSize(
3760 next_cmd
, sizeof(cmd
));
3763 TEST_F(GLES2FormatTest
, RequestExtensionCHROMIUM
) {
3764 cmds::RequestExtensionCHROMIUM
& cmd
=
3765 *GetBufferAs
<cmds::RequestExtensionCHROMIUM
>();
3766 void* next_cmd
= cmd
.Set(
3768 static_cast<uint32
>(11));
3769 EXPECT_EQ(static_cast<uint32
>(cmds::RequestExtensionCHROMIUM::kCmdId
),
3770 cmd
.header
.command
);
3771 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3772 EXPECT_EQ(static_cast<uint32
>(11), cmd
.bucket_id
);
3773 CheckBytesWrittenMatchesExpectedSize(
3774 next_cmd
, sizeof(cmd
));
3777 TEST_F(GLES2FormatTest
, GetMultipleIntegervCHROMIUM
) {
3778 cmds::GetMultipleIntegervCHROMIUM
& cmd
=
3779 *GetBufferAs
<cmds::GetMultipleIntegervCHROMIUM
>();
3780 void* next_cmd
= cmd
.Set(
3782 static_cast<uint32
>(11),
3783 static_cast<uint32
>(12),
3784 static_cast<GLuint
>(13),
3785 static_cast<uint32
>(14),
3786 static_cast<uint32
>(15),
3787 static_cast<GLsizeiptr
>(16));
3788 EXPECT_EQ(static_cast<uint32
>(cmds::GetMultipleIntegervCHROMIUM::kCmdId
),
3789 cmd
.header
.command
);
3790 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3791 EXPECT_EQ(static_cast<uint32
>(11), cmd
.pnames_shm_id
);
3792 EXPECT_EQ(static_cast<uint32
>(12), cmd
.pnames_shm_offset
);
3793 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.count
);
3794 EXPECT_EQ(static_cast<uint32
>(14), cmd
.results_shm_id
);
3795 EXPECT_EQ(static_cast<uint32
>(15), cmd
.results_shm_offset
);
3796 EXPECT_EQ(static_cast<GLsizeiptr
>(16), cmd
.size
);
3797 CheckBytesWrittenMatchesExpectedSize(
3798 next_cmd
, sizeof(cmd
));
3801 TEST_F(GLES2FormatTest
, GetProgramInfoCHROMIUM
) {
3802 cmds::GetProgramInfoCHROMIUM
& cmd
=
3803 *GetBufferAs
<cmds::GetProgramInfoCHROMIUM
>();
3804 void* next_cmd
= cmd
.Set(
3806 static_cast<GLuint
>(11),
3807 static_cast<uint32
>(12));
3808 EXPECT_EQ(static_cast<uint32
>(cmds::GetProgramInfoCHROMIUM::kCmdId
),
3809 cmd
.header
.command
);
3810 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3811 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3812 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bucket_id
);
3813 CheckBytesWrittenMatchesExpectedSize(
3814 next_cmd
, sizeof(cmd
));
3817 TEST_F(GLES2FormatTest
, CreateStreamTextureCHROMIUM
) {
3818 cmds::CreateStreamTextureCHROMIUM
& cmd
=
3819 *GetBufferAs
<cmds::CreateStreamTextureCHROMIUM
>();
3820 void* next_cmd
= cmd
.Set(
3822 static_cast<GLuint
>(11),
3823 static_cast<uint32
>(12),
3824 static_cast<uint32
>(13));
3825 EXPECT_EQ(static_cast<uint32
>(cmds::CreateStreamTextureCHROMIUM::kCmdId
),
3826 cmd
.header
.command
);
3827 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3828 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.client_id
);
3829 EXPECT_EQ(static_cast<uint32
>(12), cmd
.result_shm_id
);
3830 EXPECT_EQ(static_cast<uint32
>(13), cmd
.result_shm_offset
);
3831 CheckBytesWrittenMatchesExpectedSize(
3832 next_cmd
, sizeof(cmd
));
3835 TEST_F(GLES2FormatTest
, DestroyStreamTextureCHROMIUM
) {
3836 cmds::DestroyStreamTextureCHROMIUM
& cmd
=
3837 *GetBufferAs
<cmds::DestroyStreamTextureCHROMIUM
>();
3838 void* next_cmd
= cmd
.Set(
3840 static_cast<GLuint
>(11));
3841 EXPECT_EQ(static_cast<uint32
>(cmds::DestroyStreamTextureCHROMIUM::kCmdId
),
3842 cmd
.header
.command
);
3843 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3844 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
3845 CheckBytesWrittenMatchesExpectedSize(
3846 next_cmd
, sizeof(cmd
));
3849 TEST_F(GLES2FormatTest
, GetTranslatedShaderSourceANGLE
) {
3850 cmds::GetTranslatedShaderSourceANGLE
& cmd
=
3851 *GetBufferAs
<cmds::GetTranslatedShaderSourceANGLE
>();
3852 void* next_cmd
= cmd
.Set(
3854 static_cast<GLuint
>(11),
3855 static_cast<uint32
>(12));
3856 EXPECT_EQ(static_cast<uint32
>(cmds::GetTranslatedShaderSourceANGLE::kCmdId
),
3857 cmd
.header
.command
);
3858 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3859 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
3860 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bucket_id
);
3861 CheckBytesWrittenMatchesExpectedSize(
3862 next_cmd
, sizeof(cmd
));
3865 TEST_F(GLES2FormatTest
, PostSubBufferCHROMIUM
) {
3866 cmds::PostSubBufferCHROMIUM
& cmd
=
3867 *GetBufferAs
<cmds::PostSubBufferCHROMIUM
>();
3868 void* next_cmd
= cmd
.Set(
3870 static_cast<GLint
>(11),
3871 static_cast<GLint
>(12),
3872 static_cast<GLint
>(13),
3873 static_cast<GLint
>(14));
3874 EXPECT_EQ(static_cast<uint32
>(cmds::PostSubBufferCHROMIUM::kCmdId
),
3875 cmd
.header
.command
);
3876 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3877 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
3878 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
3879 EXPECT_EQ(static_cast<GLint
>(13), cmd
.width
);
3880 EXPECT_EQ(static_cast<GLint
>(14), cmd
.height
);
3881 CheckBytesWrittenMatchesExpectedSize(
3882 next_cmd
, sizeof(cmd
));
3885 TEST_F(GLES2FormatTest
, TexImageIOSurface2DCHROMIUM
) {
3886 cmds::TexImageIOSurface2DCHROMIUM
& cmd
=
3887 *GetBufferAs
<cmds::TexImageIOSurface2DCHROMIUM
>();
3888 void* next_cmd
= cmd
.Set(
3890 static_cast<GLenum
>(11),
3891 static_cast<GLsizei
>(12),
3892 static_cast<GLsizei
>(13),
3893 static_cast<GLuint
>(14),
3894 static_cast<GLuint
>(15));
3895 EXPECT_EQ(static_cast<uint32
>(cmds::TexImageIOSurface2DCHROMIUM::kCmdId
),
3896 cmd
.header
.command
);
3897 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3898 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3899 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.width
);
3900 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.height
);
3901 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.ioSurfaceId
);
3902 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.plane
);
3903 CheckBytesWrittenMatchesExpectedSize(
3904 next_cmd
, sizeof(cmd
));
3907 TEST_F(GLES2FormatTest
, CopyTextureCHROMIUM
) {
3908 cmds::CopyTextureCHROMIUM
& cmd
= *GetBufferAs
<cmds::CopyTextureCHROMIUM
>();
3909 void* next_cmd
= cmd
.Set(
3911 static_cast<GLenum
>(11),
3912 static_cast<GLenum
>(12),
3913 static_cast<GLenum
>(13),
3914 static_cast<GLint
>(14),
3915 static_cast<GLint
>(15),
3916 static_cast<GLenum
>(16));
3917 EXPECT_EQ(static_cast<uint32
>(cmds::CopyTextureCHROMIUM::kCmdId
),
3918 cmd
.header
.command
);
3919 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3920 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3921 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
3922 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
3923 EXPECT_EQ(static_cast<GLint
>(14), cmd
.level
);
3924 EXPECT_EQ(static_cast<GLint
>(15), cmd
.internalformat
);
3925 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.dest_type
);
3926 CheckBytesWrittenMatchesExpectedSize(
3927 next_cmd
, sizeof(cmd
));
3930 TEST_F(GLES2FormatTest
, DrawArraysInstancedANGLE
) {
3931 cmds::DrawArraysInstancedANGLE
& cmd
=
3932 *GetBufferAs
<cmds::DrawArraysInstancedANGLE
>();
3933 void* next_cmd
= cmd
.Set(
3935 static_cast<GLenum
>(11),
3936 static_cast<GLint
>(12),
3937 static_cast<GLsizei
>(13),
3938 static_cast<GLsizei
>(14));
3939 EXPECT_EQ(static_cast<uint32
>(cmds::DrawArraysInstancedANGLE::kCmdId
),
3940 cmd
.header
.command
);
3941 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3942 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
3943 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
3944 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
3945 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.primcount
);
3946 CheckBytesWrittenMatchesExpectedSize(
3947 next_cmd
, sizeof(cmd
));
3950 TEST_F(GLES2FormatTest
, DrawElementsInstancedANGLE
) {
3951 cmds::DrawElementsInstancedANGLE
& cmd
=
3952 *GetBufferAs
<cmds::DrawElementsInstancedANGLE
>();
3953 void* next_cmd
= cmd
.Set(
3955 static_cast<GLenum
>(11),
3956 static_cast<GLsizei
>(12),
3957 static_cast<GLenum
>(13),
3958 static_cast<GLuint
>(14),
3959 static_cast<GLsizei
>(15));
3960 EXPECT_EQ(static_cast<uint32
>(cmds::DrawElementsInstancedANGLE::kCmdId
),
3961 cmd
.header
.command
);
3962 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3963 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
3964 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
3965 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3966 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
3967 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.primcount
);
3968 CheckBytesWrittenMatchesExpectedSize(
3969 next_cmd
, sizeof(cmd
));
3972 TEST_F(GLES2FormatTest
, VertexAttribDivisorANGLE
) {
3973 cmds::VertexAttribDivisorANGLE
& cmd
=
3974 *GetBufferAs
<cmds::VertexAttribDivisorANGLE
>();
3975 void* next_cmd
= cmd
.Set(
3977 static_cast<GLuint
>(11),
3978 static_cast<GLuint
>(12));
3979 EXPECT_EQ(static_cast<uint32
>(cmds::VertexAttribDivisorANGLE::kCmdId
),
3980 cmd
.header
.command
);
3981 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3982 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
3983 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.divisor
);
3984 CheckBytesWrittenMatchesExpectedSize(
3985 next_cmd
, sizeof(cmd
));
3988 TEST_F(GLES2FormatTest
, GenMailboxCHROMIUM
) {
3989 cmds::GenMailboxCHROMIUM
& cmd
= *GetBufferAs
<cmds::GenMailboxCHROMIUM
>();
3990 void* next_cmd
= cmd
.Set(
3992 static_cast<GLuint
>(11));
3993 EXPECT_EQ(static_cast<uint32
>(cmds::GenMailboxCHROMIUM::kCmdId
),
3994 cmd
.header
.command
);
3995 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3996 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3997 CheckBytesWrittenMatchesExpectedSize(
3998 next_cmd
, sizeof(cmd
));
4001 TEST_F(GLES2FormatTest
, ProduceTextureCHROMIUM
) {
4002 cmds::ProduceTextureCHROMIUM
& cmd
=
4003 *GetBufferAs
<cmds::ProduceTextureCHROMIUM
>();
4004 void* next_cmd
= cmd
.Set(
4006 static_cast<GLenum
>(11),
4007 static_cast<uint32
>(12),
4008 static_cast<uint32
>(13));
4009 EXPECT_EQ(static_cast<uint32
>(cmds::ProduceTextureCHROMIUM::kCmdId
),
4010 cmd
.header
.command
);
4011 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4012 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4013 EXPECT_EQ(static_cast<uint32
>(12), cmd
.mailbox_shm_id
);
4014 EXPECT_EQ(static_cast<uint32
>(13), cmd
.mailbox_shm_offset
);
4015 CheckBytesWrittenMatchesExpectedSize(
4016 next_cmd
, sizeof(cmd
));
4019 TEST_F(GLES2FormatTest
, ProduceTextureCHROMIUMImmediate
) {
4020 const int kSomeBaseValueToTestWith
= 51;
4021 static GLbyte data
[] = {
4022 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4023 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4024 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4025 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4026 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4027 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4028 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4029 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4030 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4031 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4032 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4033 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4034 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4035 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4036 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4037 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4038 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4039 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4040 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4041 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4042 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4043 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4044 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4045 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4046 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4047 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4048 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4049 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4050 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4051 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4052 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4053 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4054 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4055 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4056 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4057 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4058 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4059 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4060 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4061 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4062 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4063 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4064 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4065 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4066 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4067 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4068 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4069 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4070 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4071 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4072 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4073 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4074 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4075 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4076 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4077 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4078 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4079 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4080 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4081 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4082 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4083 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4084 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4085 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4087 cmds::ProduceTextureCHROMIUMImmediate
& cmd
=
4088 *GetBufferAs
<cmds::ProduceTextureCHROMIUMImmediate
>();
4089 void* next_cmd
= cmd
.Set(
4091 static_cast<GLenum
>(11),
4093 EXPECT_EQ(static_cast<uint32
>(cmds::ProduceTextureCHROMIUMImmediate::kCmdId
),
4094 cmd
.header
.command
);
4095 EXPECT_EQ(sizeof(cmd
) +
4096 RoundSizeToMultipleOfEntries(sizeof(data
)),
4097 cmd
.header
.size
* 4u);
4098 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4099 CheckBytesWrittenMatchesExpectedSize(
4100 next_cmd
, sizeof(cmd
) +
4101 RoundSizeToMultipleOfEntries(sizeof(data
)));
4102 // TODO(gman): Check that data was inserted;
4105 TEST_F(GLES2FormatTest
, ConsumeTextureCHROMIUM
) {
4106 cmds::ConsumeTextureCHROMIUM
& cmd
=
4107 *GetBufferAs
<cmds::ConsumeTextureCHROMIUM
>();
4108 void* next_cmd
= cmd
.Set(
4110 static_cast<GLenum
>(11),
4111 static_cast<uint32
>(12),
4112 static_cast<uint32
>(13));
4113 EXPECT_EQ(static_cast<uint32
>(cmds::ConsumeTextureCHROMIUM::kCmdId
),
4114 cmd
.header
.command
);
4115 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4116 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4117 EXPECT_EQ(static_cast<uint32
>(12), cmd
.mailbox_shm_id
);
4118 EXPECT_EQ(static_cast<uint32
>(13), cmd
.mailbox_shm_offset
);
4119 CheckBytesWrittenMatchesExpectedSize(
4120 next_cmd
, sizeof(cmd
));
4123 TEST_F(GLES2FormatTest
, ConsumeTextureCHROMIUMImmediate
) {
4124 const int kSomeBaseValueToTestWith
= 51;
4125 static GLbyte data
[] = {
4126 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4127 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4128 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4129 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4130 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4131 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4132 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4133 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4134 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4135 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4136 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4137 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4138 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4139 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4140 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4141 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4142 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4143 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4144 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4145 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4146 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4147 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4148 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4149 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4150 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4151 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4152 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4153 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4154 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4155 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4156 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4157 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4158 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4159 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4160 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4161 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4162 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4163 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4164 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4165 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4166 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4167 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4168 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4169 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4170 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4171 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4172 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4173 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4174 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4175 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4176 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4177 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4178 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4179 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4180 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4181 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4182 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4183 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4184 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4185 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4186 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4187 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4188 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4189 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4191 cmds::ConsumeTextureCHROMIUMImmediate
& cmd
=
4192 *GetBufferAs
<cmds::ConsumeTextureCHROMIUMImmediate
>();
4193 void* next_cmd
= cmd
.Set(
4195 static_cast<GLenum
>(11),
4197 EXPECT_EQ(static_cast<uint32
>(cmds::ConsumeTextureCHROMIUMImmediate::kCmdId
),
4198 cmd
.header
.command
);
4199 EXPECT_EQ(sizeof(cmd
) +
4200 RoundSizeToMultipleOfEntries(sizeof(data
)),
4201 cmd
.header
.size
* 4u);
4202 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4203 CheckBytesWrittenMatchesExpectedSize(
4204 next_cmd
, sizeof(cmd
) +
4205 RoundSizeToMultipleOfEntries(sizeof(data
)));
4206 // TODO(gman): Check that data was inserted;
4209 TEST_F(GLES2FormatTest
, BindUniformLocationCHROMIUM
) {
4210 cmds::BindUniformLocationCHROMIUM
& cmd
=
4211 *GetBufferAs
<cmds::BindUniformLocationCHROMIUM
>();
4212 void* next_cmd
= cmd
.Set(
4214 static_cast<GLuint
>(11),
4215 static_cast<GLint
>(12),
4216 static_cast<uint32
>(13),
4217 static_cast<uint32
>(14),
4218 static_cast<uint32
>(15));
4219 EXPECT_EQ(static_cast<uint32
>(cmds::BindUniformLocationCHROMIUM::kCmdId
),
4220 cmd
.header
.command
);
4221 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4222 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4223 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
4224 EXPECT_EQ(static_cast<uint32
>(13), cmd
.name_shm_id
);
4225 EXPECT_EQ(static_cast<uint32
>(14), cmd
.name_shm_offset
);
4226 EXPECT_EQ(static_cast<uint32
>(15), cmd
.data_size
);
4227 CheckBytesWrittenMatchesExpectedSize(
4228 next_cmd
, sizeof(cmd
));
4232 TEST_F(GLES2FormatTest
, BindUniformLocationCHROMIUMImmediate
) {
4233 cmds::BindUniformLocationCHROMIUMImmediate
& cmd
=
4234 *GetBufferAs
<cmds::BindUniformLocationCHROMIUMImmediate
>();
4235 static const char* const test_str
= "test string";
4236 void* next_cmd
= cmd
.Set(
4238 static_cast<GLuint
>(11),
4239 static_cast<GLint
>(12),
4243 static_cast<uint32
>(cmds::BindUniformLocationCHROMIUMImmediate::kCmdId
),
4244 cmd
.header
.command
);
4245 EXPECT_EQ(sizeof(cmd
) +
4246 RoundSizeToMultipleOfEntries(strlen(test_str
)),
4247 cmd
.header
.size
* 4u);
4248 EXPECT_EQ(static_cast<char*>(next_cmd
),
4249 reinterpret_cast<char*>(&cmd
) + sizeof(cmd
) +
4250 RoundSizeToMultipleOfEntries(strlen(test_str
)));
4251 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4252 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
4253 EXPECT_EQ(static_cast<uint32
>(strlen(test_str
)), cmd
.data_size
);
4254 EXPECT_EQ(0, memcmp(test_str
, ImmediateDataAddress(&cmd
), strlen(test_str
)));
4257 sizeof(cmd
) + RoundSizeToMultipleOfEntries(strlen(test_str
)),
4258 sizeof(cmd
) + strlen(test_str
));
4261 TEST_F(GLES2FormatTest
, BindUniformLocationCHROMIUMBucket
) {
4262 cmds::BindUniformLocationCHROMIUMBucket
& cmd
=
4263 *GetBufferAs
<cmds::BindUniformLocationCHROMIUMBucket
>();
4264 void* next_cmd
= cmd
.Set(
4266 static_cast<GLuint
>(11),
4267 static_cast<GLint
>(12),
4268 static_cast<uint32
>(13));
4270 static_cast<uint32
>(cmds::BindUniformLocationCHROMIUMBucket::kCmdId
),
4271 cmd
.header
.command
);
4272 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4273 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4274 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
4275 EXPECT_EQ(static_cast<uint32
>(13), cmd
.name_bucket_id
);
4276 CheckBytesWrittenMatchesExpectedSize(
4277 next_cmd
, sizeof(cmd
));
4280 TEST_F(GLES2FormatTest
, BindTexImage2DCHROMIUM
) {
4281 cmds::BindTexImage2DCHROMIUM
& cmd
=
4282 *GetBufferAs
<cmds::BindTexImage2DCHROMIUM
>();
4283 void* next_cmd
= cmd
.Set(
4285 static_cast<GLenum
>(11),
4286 static_cast<GLint
>(12));
4287 EXPECT_EQ(static_cast<uint32
>(cmds::BindTexImage2DCHROMIUM::kCmdId
),
4288 cmd
.header
.command
);
4289 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4290 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4291 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
4292 CheckBytesWrittenMatchesExpectedSize(
4293 next_cmd
, sizeof(cmd
));
4296 TEST_F(GLES2FormatTest
, ReleaseTexImage2DCHROMIUM
) {
4297 cmds::ReleaseTexImage2DCHROMIUM
& cmd
=
4298 *GetBufferAs
<cmds::ReleaseTexImage2DCHROMIUM
>();
4299 void* next_cmd
= cmd
.Set(
4301 static_cast<GLenum
>(11),
4302 static_cast<GLint
>(12));
4303 EXPECT_EQ(static_cast<uint32
>(cmds::ReleaseTexImage2DCHROMIUM::kCmdId
),
4304 cmd
.header
.command
);
4305 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4306 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4307 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
4308 CheckBytesWrittenMatchesExpectedSize(
4309 next_cmd
, sizeof(cmd
));
4312 TEST_F(GLES2FormatTest
, TraceBeginCHROMIUM
) {
4313 cmds::TraceBeginCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceBeginCHROMIUM
>();
4314 void* next_cmd
= cmd
.Set(
4316 static_cast<GLuint
>(11));
4317 EXPECT_EQ(static_cast<uint32
>(cmds::TraceBeginCHROMIUM::kCmdId
),
4318 cmd
.header
.command
);
4319 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4320 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
4321 CheckBytesWrittenMatchesExpectedSize(
4322 next_cmd
, sizeof(cmd
));
4325 TEST_F(GLES2FormatTest
, TraceEndCHROMIUM
) {
4326 cmds::TraceEndCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceEndCHROMIUM
>();
4327 void* next_cmd
= cmd
.Set(
4329 EXPECT_EQ(static_cast<uint32
>(cmds::TraceEndCHROMIUM::kCmdId
),
4330 cmd
.header
.command
);
4331 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4332 CheckBytesWrittenMatchesExpectedSize(
4333 next_cmd
, sizeof(cmd
));
4336 TEST_F(GLES2FormatTest
, AsyncTexSubImage2DCHROMIUM
) {
4337 cmds::AsyncTexSubImage2DCHROMIUM
& cmd
=
4338 *GetBufferAs
<cmds::AsyncTexSubImage2DCHROMIUM
>();
4339 void* next_cmd
= cmd
.Set(
4341 static_cast<GLenum
>(11),
4342 static_cast<GLint
>(12),
4343 static_cast<GLint
>(13),
4344 static_cast<GLint
>(14),
4345 static_cast<GLsizei
>(15),
4346 static_cast<GLsizei
>(16),
4347 static_cast<GLenum
>(17),
4348 static_cast<GLenum
>(18),
4349 static_cast<uint32
>(19),
4350 static_cast<uint32
>(20));
4351 EXPECT_EQ(static_cast<uint32
>(cmds::AsyncTexSubImage2DCHROMIUM::kCmdId
),
4352 cmd
.header
.command
);
4353 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4354 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4355 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
4356 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
4357 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
4358 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
4359 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
4360 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
4361 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
4362 EXPECT_EQ(static_cast<uint32
>(19), cmd
.data_shm_id
);
4363 EXPECT_EQ(static_cast<uint32
>(20), cmd
.data_shm_offset
);
4364 CheckBytesWrittenMatchesExpectedSize(
4365 next_cmd
, sizeof(cmd
));
4368 TEST_F(GLES2FormatTest
, AsyncTexImage2DCHROMIUM
) {
4369 cmds::AsyncTexImage2DCHROMIUM
& cmd
=
4370 *GetBufferAs
<cmds::AsyncTexImage2DCHROMIUM
>();
4371 void* next_cmd
= cmd
.Set(
4373 static_cast<GLenum
>(11),
4374 static_cast<GLint
>(12),
4375 static_cast<GLint
>(13),
4376 static_cast<GLsizei
>(14),
4377 static_cast<GLsizei
>(15),
4378 static_cast<GLint
>(16),
4379 static_cast<GLenum
>(17),
4380 static_cast<GLenum
>(18),
4381 static_cast<uint32
>(19),
4382 static_cast<uint32
>(20));
4383 EXPECT_EQ(static_cast<uint32
>(cmds::AsyncTexImage2DCHROMIUM::kCmdId
),
4384 cmd
.header
.command
);
4385 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4386 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4387 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
4388 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
4389 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
4390 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
4391 EXPECT_EQ(static_cast<GLint
>(16), cmd
.border
);
4392 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
4393 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
4394 EXPECT_EQ(static_cast<uint32
>(19), cmd
.pixels_shm_id
);
4395 EXPECT_EQ(static_cast<uint32
>(20), cmd
.pixels_shm_offset
);
4396 CheckBytesWrittenMatchesExpectedSize(
4397 next_cmd
, sizeof(cmd
));
4400 TEST_F(GLES2FormatTest
, WaitAsyncTexImage2DCHROMIUM
) {
4401 cmds::WaitAsyncTexImage2DCHROMIUM
& cmd
=
4402 *GetBufferAs
<cmds::WaitAsyncTexImage2DCHROMIUM
>();
4403 void* next_cmd
= cmd
.Set(
4405 static_cast<GLenum
>(11));
4406 EXPECT_EQ(static_cast<uint32
>(cmds::WaitAsyncTexImage2DCHROMIUM::kCmdId
),
4407 cmd
.header
.command
);
4408 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4409 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4410 CheckBytesWrittenMatchesExpectedSize(
4411 next_cmd
, sizeof(cmd
));
4414 TEST_F(GLES2FormatTest
, DiscardFramebufferEXT
) {
4415 cmds::DiscardFramebufferEXT
& cmd
=
4416 *GetBufferAs
<cmds::DiscardFramebufferEXT
>();
4417 void* next_cmd
= cmd
.Set(
4419 static_cast<GLenum
>(11),
4420 static_cast<GLsizei
>(12),
4421 static_cast<uint32
>(13),
4422 static_cast<uint32
>(14));
4423 EXPECT_EQ(static_cast<uint32
>(cmds::DiscardFramebufferEXT::kCmdId
),
4424 cmd
.header
.command
);
4425 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4426 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4427 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
4428 EXPECT_EQ(static_cast<uint32
>(13), cmd
.attachments_shm_id
);
4429 EXPECT_EQ(static_cast<uint32
>(14), cmd
.attachments_shm_offset
);
4430 CheckBytesWrittenMatchesExpectedSize(
4431 next_cmd
, sizeof(cmd
));
4434 TEST_F(GLES2FormatTest
, DiscardFramebufferEXTImmediate
) {
4435 const int kSomeBaseValueToTestWith
= 51;
4436 static GLenum data
[] = {
4437 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
4438 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
4440 cmds::DiscardFramebufferEXTImmediate
& cmd
=
4441 *GetBufferAs
<cmds::DiscardFramebufferEXTImmediate
>();
4442 const GLsizei kNumElements
= 2;
4443 const size_t kExpectedCmdSize
=
4444 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
4445 void* next_cmd
= cmd
.Set(
4447 static_cast<GLenum
>(1),
4448 static_cast<GLsizei
>(2),
4450 EXPECT_EQ(static_cast<uint32
>(cmds::DiscardFramebufferEXTImmediate::kCmdId
),
4451 cmd
.header
.command
);
4452 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
4453 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
4454 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
4455 CheckBytesWrittenMatchesExpectedSize(
4456 next_cmd
, sizeof(cmd
) +
4457 RoundSizeToMultipleOfEntries(sizeof(data
)));
4458 // TODO(gman): Check that data was inserted;
4461 TEST_F(GLES2FormatTest
, LoseContextCHROMIUM
) {
4462 cmds::LoseContextCHROMIUM
& cmd
= *GetBufferAs
<cmds::LoseContextCHROMIUM
>();
4463 void* next_cmd
= cmd
.Set(
4465 static_cast<GLenum
>(11),
4466 static_cast<GLenum
>(12));
4467 EXPECT_EQ(static_cast<uint32
>(cmds::LoseContextCHROMIUM::kCmdId
),
4468 cmd
.header
.command
);
4469 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4470 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.current
);
4471 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.other
);
4472 CheckBytesWrittenMatchesExpectedSize(
4473 next_cmd
, sizeof(cmd
));
4476 // TODO(gman): Write test for InsertSyncPointCHROMIUM
4477 TEST_F(GLES2FormatTest
, WaitSyncPointCHROMIUM
) {
4478 cmds::WaitSyncPointCHROMIUM
& cmd
=
4479 *GetBufferAs
<cmds::WaitSyncPointCHROMIUM
>();
4480 void* next_cmd
= cmd
.Set(
4482 static_cast<GLuint
>(11));
4483 EXPECT_EQ(static_cast<uint32
>(cmds::WaitSyncPointCHROMIUM::kCmdId
),
4484 cmd
.header
.command
);
4485 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4486 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync_point
);
4487 CheckBytesWrittenMatchesExpectedSize(
4488 next_cmd
, sizeof(cmd
));
4491 TEST_F(GLES2FormatTest
, DrawBuffersEXT
) {
4492 cmds::DrawBuffersEXT
& cmd
= *GetBufferAs
<cmds::DrawBuffersEXT
>();
4493 void* next_cmd
= cmd
.Set(
4495 static_cast<GLsizei
>(11),
4496 static_cast<uint32
>(12),
4497 static_cast<uint32
>(13));
4498 EXPECT_EQ(static_cast<uint32
>(cmds::DrawBuffersEXT::kCmdId
),
4499 cmd
.header
.command
);
4500 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4501 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.count
);
4502 EXPECT_EQ(static_cast<uint32
>(12), cmd
.bufs_shm_id
);
4503 EXPECT_EQ(static_cast<uint32
>(13), cmd
.bufs_shm_offset
);
4504 CheckBytesWrittenMatchesExpectedSize(
4505 next_cmd
, sizeof(cmd
));
4508 TEST_F(GLES2FormatTest
, DrawBuffersEXTImmediate
) {
4509 const int kSomeBaseValueToTestWith
= 51;
4510 static GLenum data
[] = {
4511 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
4513 cmds::DrawBuffersEXTImmediate
& cmd
=
4514 *GetBufferAs
<cmds::DrawBuffersEXTImmediate
>();
4515 const GLsizei kNumElements
= 1;
4516 const size_t kExpectedCmdSize
=
4517 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
4518 void* next_cmd
= cmd
.Set(
4520 static_cast<GLsizei
>(1),
4522 EXPECT_EQ(static_cast<uint32
>(cmds::DrawBuffersEXTImmediate::kCmdId
),
4523 cmd
.header
.command
);
4524 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
4525 EXPECT_EQ(static_cast<GLsizei
>(1), cmd
.count
);
4526 CheckBytesWrittenMatchesExpectedSize(
4527 next_cmd
, sizeof(cmd
) +
4528 RoundSizeToMultipleOfEntries(sizeof(data
)));
4529 // TODO(gman): Check that data was inserted;
4532 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_