1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 // This file contains unit tests for gles2 commmands
12 // It is included by gles2_cmd_format_test.cc
14 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
15 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
17 TEST_F(GLES2FormatTest
, ActiveTexture
) {
18 cmds::ActiveTexture
& cmd
= *GetBufferAs
<cmds::ActiveTexture
>();
19 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
20 EXPECT_EQ(static_cast<uint32_t>(cmds::ActiveTexture::kCmdId
),
22 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
23 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.texture
);
24 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
27 TEST_F(GLES2FormatTest
, AttachShader
) {
28 cmds::AttachShader
& cmd
= *GetBufferAs
<cmds::AttachShader
>();
30 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
31 EXPECT_EQ(static_cast<uint32_t>(cmds::AttachShader::kCmdId
),
33 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
34 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
35 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
36 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
39 TEST_F(GLES2FormatTest
, BindAttribLocationBucket
) {
40 cmds::BindAttribLocationBucket
& cmd
=
41 *GetBufferAs
<cmds::BindAttribLocationBucket
>();
42 void* next_cmd
= cmd
.Set(&cmd
,
43 static_cast<GLuint
>(11),
44 static_cast<GLuint
>(12),
45 static_cast<uint32_t>(13));
46 EXPECT_EQ(static_cast<uint32_t>(cmds::BindAttribLocationBucket::kCmdId
),
48 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
49 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
50 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
51 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
52 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
55 TEST_F(GLES2FormatTest
, BindBuffer
) {
56 cmds::BindBuffer
& cmd
= *GetBufferAs
<cmds::BindBuffer
>();
58 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
59 EXPECT_EQ(static_cast<uint32_t>(cmds::BindBuffer::kCmdId
),
61 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
62 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
63 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.buffer
);
64 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
67 TEST_F(GLES2FormatTest
, BindFramebuffer
) {
68 cmds::BindFramebuffer
& cmd
= *GetBufferAs
<cmds::BindFramebuffer
>();
70 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
71 EXPECT_EQ(static_cast<uint32_t>(cmds::BindFramebuffer::kCmdId
),
73 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
74 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
75 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.framebuffer
);
76 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
79 TEST_F(GLES2FormatTest
, BindRenderbuffer
) {
80 cmds::BindRenderbuffer
& cmd
= *GetBufferAs
<cmds::BindRenderbuffer
>();
82 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
83 EXPECT_EQ(static_cast<uint32_t>(cmds::BindRenderbuffer::kCmdId
),
85 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
86 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
87 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.renderbuffer
);
88 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
91 TEST_F(GLES2FormatTest
, BindTexture
) {
92 cmds::BindTexture
& cmd
= *GetBufferAs
<cmds::BindTexture
>();
94 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
95 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexture::kCmdId
),
97 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
98 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
99 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.texture
);
100 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
103 TEST_F(GLES2FormatTest
, BlendColor
) {
104 cmds::BlendColor
& cmd
= *GetBufferAs
<cmds::BlendColor
>();
105 void* next_cmd
= cmd
.Set(&cmd
,
106 static_cast<GLclampf
>(11),
107 static_cast<GLclampf
>(12),
108 static_cast<GLclampf
>(13),
109 static_cast<GLclampf
>(14));
110 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendColor::kCmdId
),
112 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
113 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.red
);
114 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.green
);
115 EXPECT_EQ(static_cast<GLclampf
>(13), cmd
.blue
);
116 EXPECT_EQ(static_cast<GLclampf
>(14), cmd
.alpha
);
117 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
120 TEST_F(GLES2FormatTest
, BlendEquation
) {
121 cmds::BlendEquation
& cmd
= *GetBufferAs
<cmds::BlendEquation
>();
122 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
123 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquation::kCmdId
),
125 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
126 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
127 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
130 TEST_F(GLES2FormatTest
, BlendEquationSeparate
) {
131 cmds::BlendEquationSeparate
& cmd
=
132 *GetBufferAs
<cmds::BlendEquationSeparate
>();
134 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
135 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquationSeparate::kCmdId
),
137 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
138 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.modeRGB
);
139 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.modeAlpha
);
140 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
143 TEST_F(GLES2FormatTest
, BlendFunc
) {
144 cmds::BlendFunc
& cmd
= *GetBufferAs
<cmds::BlendFunc
>();
146 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
147 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFunc::kCmdId
), cmd
.header
.command
);
148 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
149 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.sfactor
);
150 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.dfactor
);
151 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
154 TEST_F(GLES2FormatTest
, BlendFuncSeparate
) {
155 cmds::BlendFuncSeparate
& cmd
= *GetBufferAs
<cmds::BlendFuncSeparate
>();
156 void* next_cmd
= cmd
.Set(&cmd
,
157 static_cast<GLenum
>(11),
158 static_cast<GLenum
>(12),
159 static_cast<GLenum
>(13),
160 static_cast<GLenum
>(14));
161 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFuncSeparate::kCmdId
),
163 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
164 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.srcRGB
);
165 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.dstRGB
);
166 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.srcAlpha
);
167 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.dstAlpha
);
168 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
171 TEST_F(GLES2FormatTest
, BufferData
) {
172 cmds::BufferData
& cmd
= *GetBufferAs
<cmds::BufferData
>();
173 void* next_cmd
= cmd
.Set(&cmd
,
174 static_cast<GLenum
>(11),
175 static_cast<GLsizeiptr
>(12),
176 static_cast<uint32_t>(13),
177 static_cast<uint32_t>(14),
178 static_cast<GLenum
>(15));
179 EXPECT_EQ(static_cast<uint32_t>(cmds::BufferData::kCmdId
),
181 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
182 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
183 EXPECT_EQ(static_cast<GLsizeiptr
>(12), cmd
.size
);
184 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.data_shm_id
);
185 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.data_shm_offset
);
186 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.usage
);
187 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
190 TEST_F(GLES2FormatTest
, BufferSubData
) {
191 cmds::BufferSubData
& cmd
= *GetBufferAs
<cmds::BufferSubData
>();
192 void* next_cmd
= cmd
.Set(&cmd
,
193 static_cast<GLenum
>(11),
194 static_cast<GLintptr
>(12),
195 static_cast<GLsizeiptr
>(13),
196 static_cast<uint32_t>(14),
197 static_cast<uint32_t>(15));
198 EXPECT_EQ(static_cast<uint32_t>(cmds::BufferSubData::kCmdId
),
200 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
201 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
202 EXPECT_EQ(static_cast<GLintptr
>(12), cmd
.offset
);
203 EXPECT_EQ(static_cast<GLsizeiptr
>(13), cmd
.size
);
204 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.data_shm_id
);
205 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.data_shm_offset
);
206 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
209 TEST_F(GLES2FormatTest
, CheckFramebufferStatus
) {
210 cmds::CheckFramebufferStatus
& cmd
=
211 *GetBufferAs
<cmds::CheckFramebufferStatus
>();
212 void* next_cmd
= cmd
.Set(&cmd
,
213 static_cast<GLenum
>(11),
214 static_cast<uint32_t>(12),
215 static_cast<uint32_t>(13));
216 EXPECT_EQ(static_cast<uint32_t>(cmds::CheckFramebufferStatus::kCmdId
),
218 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
219 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
220 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
221 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
222 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
225 TEST_F(GLES2FormatTest
, Clear
) {
226 cmds::Clear
& cmd
= *GetBufferAs
<cmds::Clear
>();
227 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLbitfield
>(11));
228 EXPECT_EQ(static_cast<uint32_t>(cmds::Clear::kCmdId
), cmd
.header
.command
);
229 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
230 EXPECT_EQ(static_cast<GLbitfield
>(11), cmd
.mask
);
231 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
234 TEST_F(GLES2FormatTest
, ClearColor
) {
235 cmds::ClearColor
& cmd
= *GetBufferAs
<cmds::ClearColor
>();
236 void* next_cmd
= cmd
.Set(&cmd
,
237 static_cast<GLclampf
>(11),
238 static_cast<GLclampf
>(12),
239 static_cast<GLclampf
>(13),
240 static_cast<GLclampf
>(14));
241 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearColor::kCmdId
),
243 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
244 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.red
);
245 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.green
);
246 EXPECT_EQ(static_cast<GLclampf
>(13), cmd
.blue
);
247 EXPECT_EQ(static_cast<GLclampf
>(14), cmd
.alpha
);
248 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
251 TEST_F(GLES2FormatTest
, ClearDepthf
) {
252 cmds::ClearDepthf
& cmd
= *GetBufferAs
<cmds::ClearDepthf
>();
253 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLclampf
>(11));
254 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearDepthf::kCmdId
),
256 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
257 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.depth
);
258 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
261 TEST_F(GLES2FormatTest
, ClearStencil
) {
262 cmds::ClearStencil
& cmd
= *GetBufferAs
<cmds::ClearStencil
>();
263 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11));
264 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearStencil::kCmdId
),
266 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
267 EXPECT_EQ(static_cast<GLint
>(11), cmd
.s
);
268 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
271 TEST_F(GLES2FormatTest
, ColorMask
) {
272 cmds::ColorMask
& cmd
= *GetBufferAs
<cmds::ColorMask
>();
273 void* next_cmd
= cmd
.Set(&cmd
,
274 static_cast<GLboolean
>(11),
275 static_cast<GLboolean
>(12),
276 static_cast<GLboolean
>(13),
277 static_cast<GLboolean
>(14));
278 EXPECT_EQ(static_cast<uint32_t>(cmds::ColorMask::kCmdId
), cmd
.header
.command
);
279 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
280 EXPECT_EQ(static_cast<GLboolean
>(11), cmd
.red
);
281 EXPECT_EQ(static_cast<GLboolean
>(12), cmd
.green
);
282 EXPECT_EQ(static_cast<GLboolean
>(13), cmd
.blue
);
283 EXPECT_EQ(static_cast<GLboolean
>(14), cmd
.alpha
);
284 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
287 TEST_F(GLES2FormatTest
, CompileShader
) {
288 cmds::CompileShader
& cmd
= *GetBufferAs
<cmds::CompileShader
>();
289 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
290 EXPECT_EQ(static_cast<uint32_t>(cmds::CompileShader::kCmdId
),
292 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
293 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
294 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
297 TEST_F(GLES2FormatTest
, CompressedTexImage2DBucket
) {
298 cmds::CompressedTexImage2DBucket
& cmd
=
299 *GetBufferAs
<cmds::CompressedTexImage2DBucket
>();
300 void* next_cmd
= cmd
.Set(&cmd
,
301 static_cast<GLenum
>(11),
302 static_cast<GLint
>(12),
303 static_cast<GLenum
>(13),
304 static_cast<GLsizei
>(14),
305 static_cast<GLsizei
>(15),
306 static_cast<GLuint
>(16));
307 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2DBucket::kCmdId
),
309 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
310 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
311 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
312 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
313 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
314 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
315 EXPECT_EQ(static_cast<GLuint
>(16), cmd
.bucket_id
);
316 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
319 TEST_F(GLES2FormatTest
, CompressedTexImage2D
) {
320 cmds::CompressedTexImage2D
& cmd
= *GetBufferAs
<cmds::CompressedTexImage2D
>();
321 void* next_cmd
= cmd
.Set(&cmd
,
322 static_cast<GLenum
>(11),
323 static_cast<GLint
>(12),
324 static_cast<GLenum
>(13),
325 static_cast<GLsizei
>(14),
326 static_cast<GLsizei
>(15),
327 static_cast<GLsizei
>(16),
328 static_cast<uint32_t>(17),
329 static_cast<uint32_t>(18));
330 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2D::kCmdId
),
332 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
333 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
334 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
335 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
336 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
337 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
338 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.imageSize
);
339 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.data_shm_id
);
340 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.data_shm_offset
);
341 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
344 TEST_F(GLES2FormatTest
, CompressedTexSubImage2DBucket
) {
345 cmds::CompressedTexSubImage2DBucket
& cmd
=
346 *GetBufferAs
<cmds::CompressedTexSubImage2DBucket
>();
347 void* next_cmd
= cmd
.Set(&cmd
,
348 static_cast<GLenum
>(11),
349 static_cast<GLint
>(12),
350 static_cast<GLint
>(13),
351 static_cast<GLint
>(14),
352 static_cast<GLsizei
>(15),
353 static_cast<GLsizei
>(16),
354 static_cast<GLenum
>(17),
355 static_cast<GLuint
>(18));
356 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2DBucket::kCmdId
),
358 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
359 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
360 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
361 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
362 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
363 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
364 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
365 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
366 EXPECT_EQ(static_cast<GLuint
>(18), cmd
.bucket_id
);
367 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
370 TEST_F(GLES2FormatTest
, CompressedTexSubImage2D
) {
371 cmds::CompressedTexSubImage2D
& cmd
=
372 *GetBufferAs
<cmds::CompressedTexSubImage2D
>();
373 void* next_cmd
= cmd
.Set(&cmd
,
374 static_cast<GLenum
>(11),
375 static_cast<GLint
>(12),
376 static_cast<GLint
>(13),
377 static_cast<GLint
>(14),
378 static_cast<GLsizei
>(15),
379 static_cast<GLsizei
>(16),
380 static_cast<GLenum
>(17),
381 static_cast<GLsizei
>(18),
382 static_cast<uint32_t>(19),
383 static_cast<uint32_t>(20));
384 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2D::kCmdId
),
386 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
387 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
388 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
389 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
390 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
391 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
392 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
393 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
394 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.imageSize
);
395 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.data_shm_id
);
396 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.data_shm_offset
);
397 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
400 TEST_F(GLES2FormatTest
, CopyTexImage2D
) {
401 cmds::CopyTexImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexImage2D
>();
402 void* next_cmd
= cmd
.Set(&cmd
,
403 static_cast<GLenum
>(11),
404 static_cast<GLint
>(12),
405 static_cast<GLenum
>(13),
406 static_cast<GLint
>(14),
407 static_cast<GLint
>(15),
408 static_cast<GLsizei
>(16),
409 static_cast<GLsizei
>(17));
410 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexImage2D::kCmdId
),
412 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
413 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
414 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
415 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
416 EXPECT_EQ(static_cast<GLint
>(14), cmd
.x
);
417 EXPECT_EQ(static_cast<GLint
>(15), cmd
.y
);
418 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
419 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
420 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
423 TEST_F(GLES2FormatTest
, CopyTexSubImage2D
) {
424 cmds::CopyTexSubImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexSubImage2D
>();
425 void* next_cmd
= cmd
.Set(&cmd
,
426 static_cast<GLenum
>(11),
427 static_cast<GLint
>(12),
428 static_cast<GLint
>(13),
429 static_cast<GLint
>(14),
430 static_cast<GLint
>(15),
431 static_cast<GLint
>(16),
432 static_cast<GLsizei
>(17),
433 static_cast<GLsizei
>(18));
434 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage2D::kCmdId
),
436 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
437 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
438 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
439 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
440 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
441 EXPECT_EQ(static_cast<GLint
>(15), cmd
.x
);
442 EXPECT_EQ(static_cast<GLint
>(16), cmd
.y
);
443 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.width
);
444 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.height
);
445 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
448 TEST_F(GLES2FormatTest
, CreateProgram
) {
449 cmds::CreateProgram
& cmd
= *GetBufferAs
<cmds::CreateProgram
>();
450 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
451 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateProgram::kCmdId
),
453 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
454 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.client_id
);
455 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
458 TEST_F(GLES2FormatTest
, CreateShader
) {
459 cmds::CreateShader
& cmd
= *GetBufferAs
<cmds::CreateShader
>();
461 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12));
462 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateShader::kCmdId
),
464 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
465 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.type
);
466 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.client_id
);
467 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
470 TEST_F(GLES2FormatTest
, CullFace
) {
471 cmds::CullFace
& cmd
= *GetBufferAs
<cmds::CullFace
>();
472 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
473 EXPECT_EQ(static_cast<uint32_t>(cmds::CullFace::kCmdId
), cmd
.header
.command
);
474 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
475 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
476 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
479 TEST_F(GLES2FormatTest
, DeleteBuffersImmediate
) {
480 static GLuint ids
[] = {
483 cmds::DeleteBuffersImmediate
& cmd
=
484 *GetBufferAs
<cmds::DeleteBuffersImmediate
>();
485 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
486 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteBuffersImmediate::kCmdId
),
488 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
489 cmd
.header
.size
* 4u);
490 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
491 CheckBytesWrittenMatchesExpectedSize(
493 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
494 // TODO(gman): Check that ids were inserted;
497 TEST_F(GLES2FormatTest
, DeleteFramebuffersImmediate
) {
498 static GLuint ids
[] = {
501 cmds::DeleteFramebuffersImmediate
& cmd
=
502 *GetBufferAs
<cmds::DeleteFramebuffersImmediate
>();
503 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
504 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteFramebuffersImmediate::kCmdId
),
506 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
507 cmd
.header
.size
* 4u);
508 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
509 CheckBytesWrittenMatchesExpectedSize(
511 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
512 // TODO(gman): Check that ids were inserted;
515 TEST_F(GLES2FormatTest
, DeleteProgram
) {
516 cmds::DeleteProgram
& cmd
= *GetBufferAs
<cmds::DeleteProgram
>();
517 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
518 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteProgram::kCmdId
),
520 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
521 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
522 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
525 TEST_F(GLES2FormatTest
, DeleteRenderbuffersImmediate
) {
526 static GLuint ids
[] = {
529 cmds::DeleteRenderbuffersImmediate
& cmd
=
530 *GetBufferAs
<cmds::DeleteRenderbuffersImmediate
>();
531 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
532 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteRenderbuffersImmediate::kCmdId
),
534 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
535 cmd
.header
.size
* 4u);
536 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
537 CheckBytesWrittenMatchesExpectedSize(
539 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
540 // TODO(gman): Check that ids were inserted;
543 TEST_F(GLES2FormatTest
, DeleteShader
) {
544 cmds::DeleteShader
& cmd
= *GetBufferAs
<cmds::DeleteShader
>();
545 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
546 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteShader::kCmdId
),
548 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
549 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
550 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
553 TEST_F(GLES2FormatTest
, DeleteTexturesImmediate
) {
554 static GLuint ids
[] = {
557 cmds::DeleteTexturesImmediate
& cmd
=
558 *GetBufferAs
<cmds::DeleteTexturesImmediate
>();
559 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
560 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteTexturesImmediate::kCmdId
),
562 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
563 cmd
.header
.size
* 4u);
564 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
565 CheckBytesWrittenMatchesExpectedSize(
567 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
568 // TODO(gman): Check that ids were inserted;
571 TEST_F(GLES2FormatTest
, DepthFunc
) {
572 cmds::DepthFunc
& cmd
= *GetBufferAs
<cmds::DepthFunc
>();
573 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
574 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthFunc::kCmdId
), cmd
.header
.command
);
575 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
576 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
577 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
580 TEST_F(GLES2FormatTest
, DepthMask
) {
581 cmds::DepthMask
& cmd
= *GetBufferAs
<cmds::DepthMask
>();
582 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLboolean
>(11));
583 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthMask::kCmdId
), cmd
.header
.command
);
584 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
585 EXPECT_EQ(static_cast<GLboolean
>(11), cmd
.flag
);
586 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
589 TEST_F(GLES2FormatTest
, DepthRangef
) {
590 cmds::DepthRangef
& cmd
= *GetBufferAs
<cmds::DepthRangef
>();
592 cmd
.Set(&cmd
, static_cast<GLclampf
>(11), static_cast<GLclampf
>(12));
593 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthRangef::kCmdId
),
595 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
596 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.zNear
);
597 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.zFar
);
598 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
601 TEST_F(GLES2FormatTest
, DetachShader
) {
602 cmds::DetachShader
& cmd
= *GetBufferAs
<cmds::DetachShader
>();
604 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
605 EXPECT_EQ(static_cast<uint32_t>(cmds::DetachShader::kCmdId
),
607 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
608 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
609 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
610 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
613 TEST_F(GLES2FormatTest
, Disable
) {
614 cmds::Disable
& cmd
= *GetBufferAs
<cmds::Disable
>();
615 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
616 EXPECT_EQ(static_cast<uint32_t>(cmds::Disable::kCmdId
), cmd
.header
.command
);
617 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
618 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
619 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
622 TEST_F(GLES2FormatTest
, DisableVertexAttribArray
) {
623 cmds::DisableVertexAttribArray
& cmd
=
624 *GetBufferAs
<cmds::DisableVertexAttribArray
>();
625 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
626 EXPECT_EQ(static_cast<uint32_t>(cmds::DisableVertexAttribArray::kCmdId
),
628 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
629 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
630 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
633 TEST_F(GLES2FormatTest
, DrawArrays
) {
634 cmds::DrawArrays
& cmd
= *GetBufferAs
<cmds::DrawArrays
>();
635 void* next_cmd
= cmd
.Set(&cmd
,
636 static_cast<GLenum
>(11),
637 static_cast<GLint
>(12),
638 static_cast<GLsizei
>(13));
639 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArrays::kCmdId
),
641 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
642 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
643 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
644 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
645 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
648 TEST_F(GLES2FormatTest
, DrawElements
) {
649 cmds::DrawElements
& cmd
= *GetBufferAs
<cmds::DrawElements
>();
650 void* next_cmd
= cmd
.Set(&cmd
,
651 static_cast<GLenum
>(11),
652 static_cast<GLsizei
>(12),
653 static_cast<GLenum
>(13),
654 static_cast<GLuint
>(14));
655 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElements::kCmdId
),
657 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
658 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
659 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
660 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
661 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
662 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
665 TEST_F(GLES2FormatTest
, Enable
) {
666 cmds::Enable
& cmd
= *GetBufferAs
<cmds::Enable
>();
667 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
668 EXPECT_EQ(static_cast<uint32_t>(cmds::Enable::kCmdId
), cmd
.header
.command
);
669 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
670 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
671 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
674 TEST_F(GLES2FormatTest
, EnableVertexAttribArray
) {
675 cmds::EnableVertexAttribArray
& cmd
=
676 *GetBufferAs
<cmds::EnableVertexAttribArray
>();
677 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
678 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableVertexAttribArray::kCmdId
),
680 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
681 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
682 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
685 TEST_F(GLES2FormatTest
, Finish
) {
686 cmds::Finish
& cmd
= *GetBufferAs
<cmds::Finish
>();
687 void* next_cmd
= cmd
.Set(&cmd
);
688 EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId
), cmd
.header
.command
);
689 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
690 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
693 TEST_F(GLES2FormatTest
, Flush
) {
694 cmds::Flush
& cmd
= *GetBufferAs
<cmds::Flush
>();
695 void* next_cmd
= cmd
.Set(&cmd
);
696 EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId
), cmd
.header
.command
);
697 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
698 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
701 TEST_F(GLES2FormatTest
, FramebufferRenderbuffer
) {
702 cmds::FramebufferRenderbuffer
& cmd
=
703 *GetBufferAs
<cmds::FramebufferRenderbuffer
>();
704 void* next_cmd
= cmd
.Set(&cmd
,
705 static_cast<GLenum
>(11),
706 static_cast<GLenum
>(12),
707 static_cast<GLenum
>(13),
708 static_cast<GLuint
>(14));
709 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferRenderbuffer::kCmdId
),
711 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
712 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
713 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
714 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.renderbuffertarget
);
715 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.renderbuffer
);
716 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
719 TEST_F(GLES2FormatTest
, FramebufferTexture2D
) {
720 cmds::FramebufferTexture2D
& cmd
= *GetBufferAs
<cmds::FramebufferTexture2D
>();
721 void* next_cmd
= cmd
.Set(&cmd
,
722 static_cast<GLenum
>(11),
723 static_cast<GLenum
>(12),
724 static_cast<GLenum
>(13),
725 static_cast<GLuint
>(14));
726 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTexture2D::kCmdId
),
728 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
729 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
730 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
731 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
732 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
733 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
736 TEST_F(GLES2FormatTest
, FrontFace
) {
737 cmds::FrontFace
& cmd
= *GetBufferAs
<cmds::FrontFace
>();
738 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
739 EXPECT_EQ(static_cast<uint32_t>(cmds::FrontFace::kCmdId
), cmd
.header
.command
);
740 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
741 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
742 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
745 TEST_F(GLES2FormatTest
, GenBuffersImmediate
) {
746 static GLuint ids
[] = {
749 cmds::GenBuffersImmediate
& cmd
= *GetBufferAs
<cmds::GenBuffersImmediate
>();
750 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
751 EXPECT_EQ(static_cast<uint32_t>(cmds::GenBuffersImmediate::kCmdId
),
753 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
754 cmd
.header
.size
* 4u);
755 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
756 CheckBytesWrittenMatchesExpectedSize(
758 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
759 // TODO(gman): Check that ids were inserted;
762 TEST_F(GLES2FormatTest
, GenerateMipmap
) {
763 cmds::GenerateMipmap
& cmd
= *GetBufferAs
<cmds::GenerateMipmap
>();
764 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
765 EXPECT_EQ(static_cast<uint32_t>(cmds::GenerateMipmap::kCmdId
),
767 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
768 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
769 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
772 TEST_F(GLES2FormatTest
, GenFramebuffersImmediate
) {
773 static GLuint ids
[] = {
776 cmds::GenFramebuffersImmediate
& cmd
=
777 *GetBufferAs
<cmds::GenFramebuffersImmediate
>();
778 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
779 EXPECT_EQ(static_cast<uint32_t>(cmds::GenFramebuffersImmediate::kCmdId
),
781 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
782 cmd
.header
.size
* 4u);
783 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
784 CheckBytesWrittenMatchesExpectedSize(
786 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
787 // TODO(gman): Check that ids were inserted;
790 TEST_F(GLES2FormatTest
, GenRenderbuffersImmediate
) {
791 static GLuint ids
[] = {
794 cmds::GenRenderbuffersImmediate
& cmd
=
795 *GetBufferAs
<cmds::GenRenderbuffersImmediate
>();
796 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
797 EXPECT_EQ(static_cast<uint32_t>(cmds::GenRenderbuffersImmediate::kCmdId
),
799 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
800 cmd
.header
.size
* 4u);
801 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
802 CheckBytesWrittenMatchesExpectedSize(
804 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
805 // TODO(gman): Check that ids were inserted;
808 TEST_F(GLES2FormatTest
, GenTexturesImmediate
) {
809 static GLuint ids
[] = {
812 cmds::GenTexturesImmediate
& cmd
= *GetBufferAs
<cmds::GenTexturesImmediate
>();
813 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
814 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTexturesImmediate::kCmdId
),
816 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
817 cmd
.header
.size
* 4u);
818 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
819 CheckBytesWrittenMatchesExpectedSize(
821 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
822 // TODO(gman): Check that ids were inserted;
825 TEST_F(GLES2FormatTest
, GetActiveAttrib
) {
826 cmds::GetActiveAttrib
& cmd
= *GetBufferAs
<cmds::GetActiveAttrib
>();
827 void* next_cmd
= cmd
.Set(&cmd
,
828 static_cast<GLuint
>(11),
829 static_cast<GLuint
>(12),
830 static_cast<uint32_t>(13),
831 static_cast<uint32_t>(14),
832 static_cast<uint32_t>(15));
833 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveAttrib::kCmdId
),
835 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
836 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
837 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
838 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
839 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
840 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
841 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
844 TEST_F(GLES2FormatTest
, GetActiveUniform
) {
845 cmds::GetActiveUniform
& cmd
= *GetBufferAs
<cmds::GetActiveUniform
>();
846 void* next_cmd
= cmd
.Set(&cmd
,
847 static_cast<GLuint
>(11),
848 static_cast<GLuint
>(12),
849 static_cast<uint32_t>(13),
850 static_cast<uint32_t>(14),
851 static_cast<uint32_t>(15));
852 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniform::kCmdId
),
854 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
855 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
856 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
857 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
858 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
859 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
860 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
863 TEST_F(GLES2FormatTest
, GetAttachedShaders
) {
864 cmds::GetAttachedShaders
& cmd
= *GetBufferAs
<cmds::GetAttachedShaders
>();
865 void* next_cmd
= cmd
.Set(&cmd
,
866 static_cast<GLuint
>(11),
867 static_cast<uint32_t>(12),
868 static_cast<uint32_t>(13),
869 static_cast<uint32_t>(14));
870 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttachedShaders::kCmdId
),
872 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
873 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
874 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
875 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
876 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_size
);
877 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
880 TEST_F(GLES2FormatTest
, GetAttribLocation
) {
881 cmds::GetAttribLocation
& cmd
= *GetBufferAs
<cmds::GetAttribLocation
>();
882 void* next_cmd
= cmd
.Set(&cmd
,
883 static_cast<GLuint
>(11),
884 static_cast<uint32_t>(12),
885 static_cast<uint32_t>(13),
886 static_cast<uint32_t>(14));
887 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttribLocation::kCmdId
),
889 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
890 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
891 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
892 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
893 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
894 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
897 TEST_F(GLES2FormatTest
, GetBooleanv
) {
898 cmds::GetBooleanv
& cmd
= *GetBufferAs
<cmds::GetBooleanv
>();
899 void* next_cmd
= cmd
.Set(&cmd
,
900 static_cast<GLenum
>(11),
901 static_cast<uint32_t>(12),
902 static_cast<uint32_t>(13));
903 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBooleanv::kCmdId
),
905 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
906 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
907 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
908 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
909 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
912 TEST_F(GLES2FormatTest
, GetBufferParameteriv
) {
913 cmds::GetBufferParameteriv
& cmd
= *GetBufferAs
<cmds::GetBufferParameteriv
>();
914 void* next_cmd
= cmd
.Set(&cmd
,
915 static_cast<GLenum
>(11),
916 static_cast<GLenum
>(12),
917 static_cast<uint32_t>(13),
918 static_cast<uint32_t>(14));
919 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteriv::kCmdId
),
921 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
922 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
923 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
924 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
925 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
926 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
929 TEST_F(GLES2FormatTest
, GetError
) {
930 cmds::GetError
& cmd
= *GetBufferAs
<cmds::GetError
>();
932 cmd
.Set(&cmd
, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
933 EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId
), cmd
.header
.command
);
934 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
935 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.result_shm_id
);
936 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_offset
);
937 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
940 TEST_F(GLES2FormatTest
, GetFloatv
) {
941 cmds::GetFloatv
& cmd
= *GetBufferAs
<cmds::GetFloatv
>();
942 void* next_cmd
= cmd
.Set(&cmd
,
943 static_cast<GLenum
>(11),
944 static_cast<uint32_t>(12),
945 static_cast<uint32_t>(13));
946 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFloatv::kCmdId
), cmd
.header
.command
);
947 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
948 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
949 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
950 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
951 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
954 TEST_F(GLES2FormatTest
, GetFramebufferAttachmentParameteriv
) {
955 cmds::GetFramebufferAttachmentParameteriv
& cmd
=
956 *GetBufferAs
<cmds::GetFramebufferAttachmentParameteriv
>();
957 void* next_cmd
= cmd
.Set(&cmd
,
958 static_cast<GLenum
>(11),
959 static_cast<GLenum
>(12),
960 static_cast<GLenum
>(13),
961 static_cast<uint32_t>(14),
962 static_cast<uint32_t>(15));
964 static_cast<uint32_t>(cmds::GetFramebufferAttachmentParameteriv::kCmdId
),
966 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
967 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
968 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
969 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
970 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
971 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
972 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
975 TEST_F(GLES2FormatTest
, GetIntegerv
) {
976 cmds::GetIntegerv
& cmd
= *GetBufferAs
<cmds::GetIntegerv
>();
977 void* next_cmd
= cmd
.Set(&cmd
,
978 static_cast<GLenum
>(11),
979 static_cast<uint32_t>(12),
980 static_cast<uint32_t>(13));
981 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegerv::kCmdId
),
983 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
984 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
985 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
986 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
987 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
990 TEST_F(GLES2FormatTest
, GetProgramiv
) {
991 cmds::GetProgramiv
& cmd
= *GetBufferAs
<cmds::GetProgramiv
>();
992 void* next_cmd
= cmd
.Set(&cmd
,
993 static_cast<GLuint
>(11),
994 static_cast<GLenum
>(12),
995 static_cast<uint32_t>(13),
996 static_cast<uint32_t>(14));
997 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramiv::kCmdId
),
999 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1000 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1001 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1002 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1003 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1004 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1007 TEST_F(GLES2FormatTest
, GetProgramInfoLog
) {
1008 cmds::GetProgramInfoLog
& cmd
= *GetBufferAs
<cmds::GetProgramInfoLog
>();
1010 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1011 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoLog::kCmdId
),
1012 cmd
.header
.command
);
1013 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1014 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1015 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1016 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1019 TEST_F(GLES2FormatTest
, GetRenderbufferParameteriv
) {
1020 cmds::GetRenderbufferParameteriv
& cmd
=
1021 *GetBufferAs
<cmds::GetRenderbufferParameteriv
>();
1022 void* next_cmd
= cmd
.Set(&cmd
,
1023 static_cast<GLenum
>(11),
1024 static_cast<GLenum
>(12),
1025 static_cast<uint32_t>(13),
1026 static_cast<uint32_t>(14));
1027 EXPECT_EQ(static_cast<uint32_t>(cmds::GetRenderbufferParameteriv::kCmdId
),
1028 cmd
.header
.command
);
1029 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1030 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1031 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1032 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1033 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1034 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1037 TEST_F(GLES2FormatTest
, GetShaderiv
) {
1038 cmds::GetShaderiv
& cmd
= *GetBufferAs
<cmds::GetShaderiv
>();
1039 void* next_cmd
= cmd
.Set(&cmd
,
1040 static_cast<GLuint
>(11),
1041 static_cast<GLenum
>(12),
1042 static_cast<uint32_t>(13),
1043 static_cast<uint32_t>(14));
1044 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderiv::kCmdId
),
1045 cmd
.header
.command
);
1046 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1047 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1048 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1049 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1050 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1051 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1054 TEST_F(GLES2FormatTest
, GetShaderInfoLog
) {
1055 cmds::GetShaderInfoLog
& cmd
= *GetBufferAs
<cmds::GetShaderInfoLog
>();
1057 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1058 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderInfoLog::kCmdId
),
1059 cmd
.header
.command
);
1060 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1061 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1062 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1063 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1066 TEST_F(GLES2FormatTest
, GetShaderPrecisionFormat
) {
1067 cmds::GetShaderPrecisionFormat
& cmd
=
1068 *GetBufferAs
<cmds::GetShaderPrecisionFormat
>();
1069 void* next_cmd
= cmd
.Set(&cmd
,
1070 static_cast<GLenum
>(11),
1071 static_cast<GLenum
>(12),
1072 static_cast<uint32_t>(13),
1073 static_cast<uint32_t>(14));
1074 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderPrecisionFormat::kCmdId
),
1075 cmd
.header
.command
);
1076 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1077 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.shadertype
);
1078 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.precisiontype
);
1079 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_id
);
1080 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_offset
);
1081 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1084 TEST_F(GLES2FormatTest
, GetShaderSource
) {
1085 cmds::GetShaderSource
& cmd
= *GetBufferAs
<cmds::GetShaderSource
>();
1087 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1088 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderSource::kCmdId
),
1089 cmd
.header
.command
);
1090 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1091 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1092 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1093 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1096 TEST_F(GLES2FormatTest
, GetString
) {
1097 cmds::GetString
& cmd
= *GetBufferAs
<cmds::GetString
>();
1099 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12));
1100 EXPECT_EQ(static_cast<uint32_t>(cmds::GetString::kCmdId
), cmd
.header
.command
);
1101 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1102 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.name
);
1103 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1104 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1107 TEST_F(GLES2FormatTest
, GetTexParameterfv
) {
1108 cmds::GetTexParameterfv
& cmd
= *GetBufferAs
<cmds::GetTexParameterfv
>();
1109 void* next_cmd
= cmd
.Set(&cmd
,
1110 static_cast<GLenum
>(11),
1111 static_cast<GLenum
>(12),
1112 static_cast<uint32_t>(13),
1113 static_cast<uint32_t>(14));
1114 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameterfv::kCmdId
),
1115 cmd
.header
.command
);
1116 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1117 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1118 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1119 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1120 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1121 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1124 TEST_F(GLES2FormatTest
, GetTexParameteriv
) {
1125 cmds::GetTexParameteriv
& cmd
= *GetBufferAs
<cmds::GetTexParameteriv
>();
1126 void* next_cmd
= cmd
.Set(&cmd
,
1127 static_cast<GLenum
>(11),
1128 static_cast<GLenum
>(12),
1129 static_cast<uint32_t>(13),
1130 static_cast<uint32_t>(14));
1131 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameteriv::kCmdId
),
1132 cmd
.header
.command
);
1133 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1134 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1135 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1136 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1137 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1138 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1141 TEST_F(GLES2FormatTest
, GetUniformfv
) {
1142 cmds::GetUniformfv
& cmd
= *GetBufferAs
<cmds::GetUniformfv
>();
1143 void* next_cmd
= cmd
.Set(&cmd
,
1144 static_cast<GLuint
>(11),
1145 static_cast<GLint
>(12),
1146 static_cast<uint32_t>(13),
1147 static_cast<uint32_t>(14));
1148 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformfv::kCmdId
),
1149 cmd
.header
.command
);
1150 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1151 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1152 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1153 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1154 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1155 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1158 TEST_F(GLES2FormatTest
, GetUniformiv
) {
1159 cmds::GetUniformiv
& cmd
= *GetBufferAs
<cmds::GetUniformiv
>();
1160 void* next_cmd
= cmd
.Set(&cmd
,
1161 static_cast<GLuint
>(11),
1162 static_cast<GLint
>(12),
1163 static_cast<uint32_t>(13),
1164 static_cast<uint32_t>(14));
1165 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformiv::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<GLint
>(12), cmd
.location
);
1170 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1171 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1172 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1175 TEST_F(GLES2FormatTest
, GetUniformLocation
) {
1176 cmds::GetUniformLocation
& cmd
= *GetBufferAs
<cmds::GetUniformLocation
>();
1177 void* next_cmd
= cmd
.Set(&cmd
,
1178 static_cast<GLuint
>(11),
1179 static_cast<uint32_t>(12),
1180 static_cast<uint32_t>(13),
1181 static_cast<uint32_t>(14));
1182 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformLocation::kCmdId
),
1183 cmd
.header
.command
);
1184 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1185 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1186 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1187 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1188 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1189 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1192 TEST_F(GLES2FormatTest
, GetVertexAttribfv
) {
1193 cmds::GetVertexAttribfv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribfv
>();
1194 void* next_cmd
= cmd
.Set(&cmd
,
1195 static_cast<GLuint
>(11),
1196 static_cast<GLenum
>(12),
1197 static_cast<uint32_t>(13),
1198 static_cast<uint32_t>(14));
1199 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribfv::kCmdId
),
1200 cmd
.header
.command
);
1201 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1202 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1203 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1204 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1205 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1206 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1209 TEST_F(GLES2FormatTest
, GetVertexAttribiv
) {
1210 cmds::GetVertexAttribiv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribiv
>();
1211 void* next_cmd
= cmd
.Set(&cmd
,
1212 static_cast<GLuint
>(11),
1213 static_cast<GLenum
>(12),
1214 static_cast<uint32_t>(13),
1215 static_cast<uint32_t>(14));
1216 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribiv::kCmdId
),
1217 cmd
.header
.command
);
1218 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1219 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1220 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1221 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1222 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1223 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1226 TEST_F(GLES2FormatTest
, GetVertexAttribPointerv
) {
1227 cmds::GetVertexAttribPointerv
& cmd
=
1228 *GetBufferAs
<cmds::GetVertexAttribPointerv
>();
1229 void* next_cmd
= cmd
.Set(&cmd
,
1230 static_cast<GLuint
>(11),
1231 static_cast<GLenum
>(12),
1232 static_cast<uint32_t>(13),
1233 static_cast<uint32_t>(14));
1234 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribPointerv::kCmdId
),
1235 cmd
.header
.command
);
1236 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1237 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1238 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1239 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.pointer_shm_id
);
1240 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.pointer_shm_offset
);
1241 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1244 TEST_F(GLES2FormatTest
, Hint
) {
1245 cmds::Hint
& cmd
= *GetBufferAs
<cmds::Hint
>();
1247 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
1248 EXPECT_EQ(static_cast<uint32_t>(cmds::Hint::kCmdId
), cmd
.header
.command
);
1249 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1250 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1251 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.mode
);
1252 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1255 TEST_F(GLES2FormatTest
, IsBuffer
) {
1256 cmds::IsBuffer
& cmd
= *GetBufferAs
<cmds::IsBuffer
>();
1257 void* next_cmd
= cmd
.Set(&cmd
,
1258 static_cast<GLuint
>(11),
1259 static_cast<uint32_t>(12),
1260 static_cast<uint32_t>(13));
1261 EXPECT_EQ(static_cast<uint32_t>(cmds::IsBuffer::kCmdId
), cmd
.header
.command
);
1262 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1263 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer
);
1264 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1265 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1266 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1269 TEST_F(GLES2FormatTest
, IsEnabled
) {
1270 cmds::IsEnabled
& cmd
= *GetBufferAs
<cmds::IsEnabled
>();
1271 void* next_cmd
= cmd
.Set(&cmd
,
1272 static_cast<GLenum
>(11),
1273 static_cast<uint32_t>(12),
1274 static_cast<uint32_t>(13));
1275 EXPECT_EQ(static_cast<uint32_t>(cmds::IsEnabled::kCmdId
), cmd
.header
.command
);
1276 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1277 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
1278 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1279 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1280 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1283 TEST_F(GLES2FormatTest
, IsFramebuffer
) {
1284 cmds::IsFramebuffer
& cmd
= *GetBufferAs
<cmds::IsFramebuffer
>();
1285 void* next_cmd
= cmd
.Set(&cmd
,
1286 static_cast<GLuint
>(11),
1287 static_cast<uint32_t>(12),
1288 static_cast<uint32_t>(13));
1289 EXPECT_EQ(static_cast<uint32_t>(cmds::IsFramebuffer::kCmdId
),
1290 cmd
.header
.command
);
1291 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1292 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.framebuffer
);
1293 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1294 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1295 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1298 TEST_F(GLES2FormatTest
, IsProgram
) {
1299 cmds::IsProgram
& cmd
= *GetBufferAs
<cmds::IsProgram
>();
1300 void* next_cmd
= cmd
.Set(&cmd
,
1301 static_cast<GLuint
>(11),
1302 static_cast<uint32_t>(12),
1303 static_cast<uint32_t>(13));
1304 EXPECT_EQ(static_cast<uint32_t>(cmds::IsProgram::kCmdId
), cmd
.header
.command
);
1305 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1306 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1307 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1308 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1309 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1312 TEST_F(GLES2FormatTest
, IsRenderbuffer
) {
1313 cmds::IsRenderbuffer
& cmd
= *GetBufferAs
<cmds::IsRenderbuffer
>();
1314 void* next_cmd
= cmd
.Set(&cmd
,
1315 static_cast<GLuint
>(11),
1316 static_cast<uint32_t>(12),
1317 static_cast<uint32_t>(13));
1318 EXPECT_EQ(static_cast<uint32_t>(cmds::IsRenderbuffer::kCmdId
),
1319 cmd
.header
.command
);
1320 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1321 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.renderbuffer
);
1322 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1323 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1324 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1327 TEST_F(GLES2FormatTest
, IsShader
) {
1328 cmds::IsShader
& cmd
= *GetBufferAs
<cmds::IsShader
>();
1329 void* next_cmd
= cmd
.Set(&cmd
,
1330 static_cast<GLuint
>(11),
1331 static_cast<uint32_t>(12),
1332 static_cast<uint32_t>(13));
1333 EXPECT_EQ(static_cast<uint32_t>(cmds::IsShader::kCmdId
), cmd
.header
.command
);
1334 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1335 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1336 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1337 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1338 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1341 TEST_F(GLES2FormatTest
, IsTexture
) {
1342 cmds::IsTexture
& cmd
= *GetBufferAs
<cmds::IsTexture
>();
1343 void* next_cmd
= cmd
.Set(&cmd
,
1344 static_cast<GLuint
>(11),
1345 static_cast<uint32_t>(12),
1346 static_cast<uint32_t>(13));
1347 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTexture::kCmdId
), cmd
.header
.command
);
1348 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1349 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
1350 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1351 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1352 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1355 TEST_F(GLES2FormatTest
, LineWidth
) {
1356 cmds::LineWidth
& cmd
= *GetBufferAs
<cmds::LineWidth
>();
1357 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLfloat
>(11));
1358 EXPECT_EQ(static_cast<uint32_t>(cmds::LineWidth::kCmdId
), cmd
.header
.command
);
1359 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1360 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.width
);
1361 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1364 TEST_F(GLES2FormatTest
, LinkProgram
) {
1365 cmds::LinkProgram
& cmd
= *GetBufferAs
<cmds::LinkProgram
>();
1366 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
1367 EXPECT_EQ(static_cast<uint32_t>(cmds::LinkProgram::kCmdId
),
1368 cmd
.header
.command
);
1369 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1370 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1371 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1374 TEST_F(GLES2FormatTest
, PixelStorei
) {
1375 cmds::PixelStorei
& cmd
= *GetBufferAs
<cmds::PixelStorei
>();
1377 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
1378 EXPECT_EQ(static_cast<uint32_t>(cmds::PixelStorei::kCmdId
),
1379 cmd
.header
.command
);
1380 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1381 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1382 EXPECT_EQ(static_cast<GLint
>(12), cmd
.param
);
1383 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1386 TEST_F(GLES2FormatTest
, PolygonOffset
) {
1387 cmds::PolygonOffset
& cmd
= *GetBufferAs
<cmds::PolygonOffset
>();
1389 cmd
.Set(&cmd
, static_cast<GLfloat
>(11), static_cast<GLfloat
>(12));
1390 EXPECT_EQ(static_cast<uint32_t>(cmds::PolygonOffset::kCmdId
),
1391 cmd
.header
.command
);
1392 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1393 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.factor
);
1394 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.units
);
1395 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1398 TEST_F(GLES2FormatTest
, ReadPixels
) {
1399 cmds::ReadPixels
& cmd
= *GetBufferAs
<cmds::ReadPixels
>();
1400 void* next_cmd
= cmd
.Set(&cmd
,
1401 static_cast<GLint
>(11),
1402 static_cast<GLint
>(12),
1403 static_cast<GLsizei
>(13),
1404 static_cast<GLsizei
>(14),
1405 static_cast<GLenum
>(15),
1406 static_cast<GLenum
>(16),
1407 static_cast<uint32_t>(17),
1408 static_cast<uint32_t>(18),
1409 static_cast<uint32_t>(19),
1410 static_cast<uint32_t>(20),
1411 static_cast<GLboolean
>(21));
1412 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadPixels::kCmdId
),
1413 cmd
.header
.command
);
1414 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1415 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
1416 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
1417 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1418 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1419 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.format
);
1420 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.type
);
1421 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.pixels_shm_id
);
1422 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_offset
);
1423 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.result_shm_id
);
1424 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.result_shm_offset
);
1425 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.async
);
1426 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1429 TEST_F(GLES2FormatTest
, ReleaseShaderCompiler
) {
1430 cmds::ReleaseShaderCompiler
& cmd
=
1431 *GetBufferAs
<cmds::ReleaseShaderCompiler
>();
1432 void* next_cmd
= cmd
.Set(&cmd
);
1433 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseShaderCompiler::kCmdId
),
1434 cmd
.header
.command
);
1435 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1436 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1439 TEST_F(GLES2FormatTest
, RenderbufferStorage
) {
1440 cmds::RenderbufferStorage
& cmd
= *GetBufferAs
<cmds::RenderbufferStorage
>();
1441 void* next_cmd
= cmd
.Set(&cmd
,
1442 static_cast<GLenum
>(11),
1443 static_cast<GLenum
>(12),
1444 static_cast<GLsizei
>(13),
1445 static_cast<GLsizei
>(14));
1446 EXPECT_EQ(static_cast<uint32_t>(cmds::RenderbufferStorage::kCmdId
),
1447 cmd
.header
.command
);
1448 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1449 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1450 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.internalformat
);
1451 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1452 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1453 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1456 TEST_F(GLES2FormatTest
, SampleCoverage
) {
1457 cmds::SampleCoverage
& cmd
= *GetBufferAs
<cmds::SampleCoverage
>();
1459 cmd
.Set(&cmd
, static_cast<GLclampf
>(11), static_cast<GLboolean
>(12));
1460 EXPECT_EQ(static_cast<uint32_t>(cmds::SampleCoverage::kCmdId
),
1461 cmd
.header
.command
);
1462 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1463 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.value
);
1464 EXPECT_EQ(static_cast<GLboolean
>(12), cmd
.invert
);
1465 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1468 TEST_F(GLES2FormatTest
, Scissor
) {
1469 cmds::Scissor
& cmd
= *GetBufferAs
<cmds::Scissor
>();
1470 void* next_cmd
= cmd
.Set(&cmd
,
1471 static_cast<GLint
>(11),
1472 static_cast<GLint
>(12),
1473 static_cast<GLsizei
>(13),
1474 static_cast<GLsizei
>(14));
1475 EXPECT_EQ(static_cast<uint32_t>(cmds::Scissor::kCmdId
), cmd
.header
.command
);
1476 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1477 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
1478 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
1479 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1480 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1481 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1484 TEST_F(GLES2FormatTest
, ShaderBinary
) {
1485 cmds::ShaderBinary
& cmd
= *GetBufferAs
<cmds::ShaderBinary
>();
1486 void* next_cmd
= cmd
.Set(&cmd
,
1487 static_cast<GLsizei
>(11),
1488 static_cast<uint32_t>(12),
1489 static_cast<uint32_t>(13),
1490 static_cast<GLenum
>(14),
1491 static_cast<uint32_t>(15),
1492 static_cast<uint32_t>(16),
1493 static_cast<GLsizei
>(17));
1494 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderBinary::kCmdId
),
1495 cmd
.header
.command
);
1496 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1497 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
1498 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.shaders_shm_id
);
1499 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.shaders_shm_offset
);
1500 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.binaryformat
);
1501 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.binary_shm_id
);
1502 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.binary_shm_offset
);
1503 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.length
);
1504 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1507 TEST_F(GLES2FormatTest
, ShaderSourceBucket
) {
1508 cmds::ShaderSourceBucket
& cmd
= *GetBufferAs
<cmds::ShaderSourceBucket
>();
1510 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1511 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderSourceBucket::kCmdId
),
1512 cmd
.header
.command
);
1513 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1514 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1515 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.data_bucket_id
);
1516 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1519 TEST_F(GLES2FormatTest
, StencilFunc
) {
1520 cmds::StencilFunc
& cmd
= *GetBufferAs
<cmds::StencilFunc
>();
1521 void* next_cmd
= cmd
.Set(&cmd
,
1522 static_cast<GLenum
>(11),
1523 static_cast<GLint
>(12),
1524 static_cast<GLuint
>(13));
1525 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFunc::kCmdId
),
1526 cmd
.header
.command
);
1527 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1528 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
1529 EXPECT_EQ(static_cast<GLint
>(12), cmd
.ref
);
1530 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
1531 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1534 TEST_F(GLES2FormatTest
, StencilFuncSeparate
) {
1535 cmds::StencilFuncSeparate
& cmd
= *GetBufferAs
<cmds::StencilFuncSeparate
>();
1536 void* next_cmd
= cmd
.Set(&cmd
,
1537 static_cast<GLenum
>(11),
1538 static_cast<GLenum
>(12),
1539 static_cast<GLint
>(13),
1540 static_cast<GLuint
>(14));
1541 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFuncSeparate::kCmdId
),
1542 cmd
.header
.command
);
1543 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1544 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
1545 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.func
);
1546 EXPECT_EQ(static_cast<GLint
>(13), cmd
.ref
);
1547 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.mask
);
1548 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1551 TEST_F(GLES2FormatTest
, StencilMask
) {
1552 cmds::StencilMask
& cmd
= *GetBufferAs
<cmds::StencilMask
>();
1553 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
1554 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMask::kCmdId
),
1555 cmd
.header
.command
);
1556 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1557 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.mask
);
1558 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1561 TEST_F(GLES2FormatTest
, StencilMaskSeparate
) {
1562 cmds::StencilMaskSeparate
& cmd
= *GetBufferAs
<cmds::StencilMaskSeparate
>();
1564 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
1565 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMaskSeparate::kCmdId
),
1566 cmd
.header
.command
);
1567 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1568 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
1569 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.mask
);
1570 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1573 TEST_F(GLES2FormatTest
, StencilOp
) {
1574 cmds::StencilOp
& cmd
= *GetBufferAs
<cmds::StencilOp
>();
1575 void* next_cmd
= cmd
.Set(&cmd
,
1576 static_cast<GLenum
>(11),
1577 static_cast<GLenum
>(12),
1578 static_cast<GLenum
>(13));
1579 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOp::kCmdId
), cmd
.header
.command
);
1580 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1581 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.fail
);
1582 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.zfail
);
1583 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zpass
);
1584 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1587 TEST_F(GLES2FormatTest
, StencilOpSeparate
) {
1588 cmds::StencilOpSeparate
& cmd
= *GetBufferAs
<cmds::StencilOpSeparate
>();
1589 void* next_cmd
= cmd
.Set(&cmd
,
1590 static_cast<GLenum
>(11),
1591 static_cast<GLenum
>(12),
1592 static_cast<GLenum
>(13),
1593 static_cast<GLenum
>(14));
1594 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOpSeparate::kCmdId
),
1595 cmd
.header
.command
);
1596 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1597 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
1598 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.fail
);
1599 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zfail
);
1600 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.zpass
);
1601 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1604 TEST_F(GLES2FormatTest
, TexImage2D
) {
1605 cmds::TexImage2D
& cmd
= *GetBufferAs
<cmds::TexImage2D
>();
1606 void* next_cmd
= cmd
.Set(&cmd
,
1607 static_cast<GLenum
>(11),
1608 static_cast<GLint
>(12),
1609 static_cast<GLint
>(13),
1610 static_cast<GLsizei
>(14),
1611 static_cast<GLsizei
>(15),
1612 static_cast<GLenum
>(16),
1613 static_cast<GLenum
>(17),
1614 static_cast<uint32_t>(18),
1615 static_cast<uint32_t>(19));
1616 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage2D::kCmdId
),
1617 cmd
.header
.command
);
1618 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1619 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1620 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
1621 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
1622 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
1623 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
1624 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.format
);
1625 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.type
);
1626 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_id
);
1627 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_offset
);
1628 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1631 TEST_F(GLES2FormatTest
, TexParameterf
) {
1632 cmds::TexParameterf
& cmd
= *GetBufferAs
<cmds::TexParameterf
>();
1633 void* next_cmd
= cmd
.Set(&cmd
,
1634 static_cast<GLenum
>(11),
1635 static_cast<GLenum
>(12),
1636 static_cast<GLfloat
>(13));
1637 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterf::kCmdId
),
1638 cmd
.header
.command
);
1639 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1640 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1641 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1642 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.param
);
1643 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1646 TEST_F(GLES2FormatTest
, TexParameterfvImmediate
) {
1647 const int kSomeBaseValueToTestWith
= 51;
1648 static GLfloat data
[] = {
1649 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
1651 cmds::TexParameterfvImmediate
& cmd
=
1652 *GetBufferAs
<cmds::TexParameterfvImmediate
>();
1654 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12), data
);
1655 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterfvImmediate::kCmdId
),
1656 cmd
.header
.command
);
1657 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
1658 cmd
.header
.size
* 4u);
1659 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1660 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1661 CheckBytesWrittenMatchesExpectedSize(
1662 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1663 // TODO(gman): Check that data was inserted;
1666 TEST_F(GLES2FormatTest
, TexParameteri
) {
1667 cmds::TexParameteri
& cmd
= *GetBufferAs
<cmds::TexParameteri
>();
1668 void* next_cmd
= cmd
.Set(&cmd
,
1669 static_cast<GLenum
>(11),
1670 static_cast<GLenum
>(12),
1671 static_cast<GLint
>(13));
1672 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameteri::kCmdId
),
1673 cmd
.header
.command
);
1674 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1675 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1676 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1677 EXPECT_EQ(static_cast<GLint
>(13), cmd
.param
);
1678 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1681 TEST_F(GLES2FormatTest
, TexParameterivImmediate
) {
1682 const int kSomeBaseValueToTestWith
= 51;
1683 static GLint data
[] = {
1684 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
1686 cmds::TexParameterivImmediate
& cmd
=
1687 *GetBufferAs
<cmds::TexParameterivImmediate
>();
1689 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12), data
);
1690 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterivImmediate::kCmdId
),
1691 cmd
.header
.command
);
1692 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
1693 cmd
.header
.size
* 4u);
1694 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1695 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1696 CheckBytesWrittenMatchesExpectedSize(
1697 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1698 // TODO(gman): Check that data was inserted;
1701 TEST_F(GLES2FormatTest
, TexSubImage2D
) {
1702 cmds::TexSubImage2D
& cmd
= *GetBufferAs
<cmds::TexSubImage2D
>();
1703 void* next_cmd
= cmd
.Set(&cmd
,
1704 static_cast<GLenum
>(11),
1705 static_cast<GLint
>(12),
1706 static_cast<GLint
>(13),
1707 static_cast<GLint
>(14),
1708 static_cast<GLsizei
>(15),
1709 static_cast<GLsizei
>(16),
1710 static_cast<GLenum
>(17),
1711 static_cast<GLenum
>(18),
1712 static_cast<uint32_t>(19),
1713 static_cast<uint32_t>(20),
1714 static_cast<GLboolean
>(21));
1715 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage2D::kCmdId
),
1716 cmd
.header
.command
);
1717 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1718 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1719 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
1720 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
1721 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
1722 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
1723 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
1724 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
1725 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
1726 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_id
);
1727 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.pixels_shm_offset
);
1728 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.internal
);
1729 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1732 TEST_F(GLES2FormatTest
, Uniform1f
) {
1733 cmds::Uniform1f
& cmd
= *GetBufferAs
<cmds::Uniform1f
>();
1735 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLfloat
>(12));
1736 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1f::kCmdId
), cmd
.header
.command
);
1737 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1738 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1739 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
1740 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1743 TEST_F(GLES2FormatTest
, Uniform1fvImmediate
) {
1744 const int kSomeBaseValueToTestWith
= 51;
1745 static GLfloat data
[] = {
1746 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
1747 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
1749 cmds::Uniform1fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1fvImmediate
>();
1750 const GLsizei kNumElements
= 2;
1751 const size_t kExpectedCmdSize
=
1752 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 1;
1754 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1755 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1fvImmediate::kCmdId
),
1756 cmd
.header
.command
);
1757 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1758 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1759 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1760 CheckBytesWrittenMatchesExpectedSize(
1761 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1762 // TODO(gman): Check that data was inserted;
1765 TEST_F(GLES2FormatTest
, Uniform1i
) {
1766 cmds::Uniform1i
& cmd
= *GetBufferAs
<cmds::Uniform1i
>();
1768 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12));
1769 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1i::kCmdId
), cmd
.header
.command
);
1770 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1771 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1772 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
1773 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1776 TEST_F(GLES2FormatTest
, Uniform1ivImmediate
) {
1777 const int kSomeBaseValueToTestWith
= 51;
1778 static GLint data
[] = {
1779 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
1780 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
1782 cmds::Uniform1ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1ivImmediate
>();
1783 const GLsizei kNumElements
= 2;
1784 const size_t kExpectedCmdSize
=
1785 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 1;
1787 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1788 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ivImmediate::kCmdId
),
1789 cmd
.header
.command
);
1790 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1791 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1792 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1793 CheckBytesWrittenMatchesExpectedSize(
1794 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1795 // TODO(gman): Check that data was inserted;
1798 TEST_F(GLES2FormatTest
, Uniform2f
) {
1799 cmds::Uniform2f
& cmd
= *GetBufferAs
<cmds::Uniform2f
>();
1800 void* next_cmd
= cmd
.Set(&cmd
,
1801 static_cast<GLint
>(11),
1802 static_cast<GLfloat
>(12),
1803 static_cast<GLfloat
>(13));
1804 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2f::kCmdId
), cmd
.header
.command
);
1805 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1806 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1807 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
1808 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
1809 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1812 TEST_F(GLES2FormatTest
, Uniform2fvImmediate
) {
1813 const int kSomeBaseValueToTestWith
= 51;
1814 static GLfloat data
[] = {
1815 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
1816 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
1817 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
1818 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
1820 cmds::Uniform2fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2fvImmediate
>();
1821 const GLsizei kNumElements
= 2;
1822 const size_t kExpectedCmdSize
=
1823 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 2;
1825 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1826 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2fvImmediate::kCmdId
),
1827 cmd
.header
.command
);
1828 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1829 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1830 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1831 CheckBytesWrittenMatchesExpectedSize(
1832 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1833 // TODO(gman): Check that data was inserted;
1836 TEST_F(GLES2FormatTest
, Uniform2i
) {
1837 cmds::Uniform2i
& cmd
= *GetBufferAs
<cmds::Uniform2i
>();
1838 void* next_cmd
= cmd
.Set(&cmd
,
1839 static_cast<GLint
>(11),
1840 static_cast<GLint
>(12),
1841 static_cast<GLint
>(13));
1842 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2i::kCmdId
), cmd
.header
.command
);
1843 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1844 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1845 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
1846 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
1847 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1850 TEST_F(GLES2FormatTest
, Uniform2ivImmediate
) {
1851 const int kSomeBaseValueToTestWith
= 51;
1852 static GLint data
[] = {
1853 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
1854 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
1855 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
1856 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
1858 cmds::Uniform2ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2ivImmediate
>();
1859 const GLsizei kNumElements
= 2;
1860 const size_t kExpectedCmdSize
=
1861 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 2;
1863 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1864 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ivImmediate::kCmdId
),
1865 cmd
.header
.command
);
1866 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1867 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1868 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1869 CheckBytesWrittenMatchesExpectedSize(
1870 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1871 // TODO(gman): Check that data was inserted;
1874 TEST_F(GLES2FormatTest
, Uniform3f
) {
1875 cmds::Uniform3f
& cmd
= *GetBufferAs
<cmds::Uniform3f
>();
1876 void* next_cmd
= cmd
.Set(&cmd
,
1877 static_cast<GLint
>(11),
1878 static_cast<GLfloat
>(12),
1879 static_cast<GLfloat
>(13),
1880 static_cast<GLfloat
>(14));
1881 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3f::kCmdId
), cmd
.header
.command
);
1882 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1883 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1884 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
1885 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
1886 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
1887 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1890 TEST_F(GLES2FormatTest
, Uniform3fvImmediate
) {
1891 const int kSomeBaseValueToTestWith
= 51;
1892 static GLfloat data
[] = {
1893 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
1894 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
1895 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
1896 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
1897 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
1898 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
1900 cmds::Uniform3fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3fvImmediate
>();
1901 const GLsizei kNumElements
= 2;
1902 const size_t kExpectedCmdSize
=
1903 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 3;
1905 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1906 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3fvImmediate::kCmdId
),
1907 cmd
.header
.command
);
1908 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1909 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1910 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1911 CheckBytesWrittenMatchesExpectedSize(
1912 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1913 // TODO(gman): Check that data was inserted;
1916 TEST_F(GLES2FormatTest
, Uniform3i
) {
1917 cmds::Uniform3i
& cmd
= *GetBufferAs
<cmds::Uniform3i
>();
1918 void* next_cmd
= cmd
.Set(&cmd
,
1919 static_cast<GLint
>(11),
1920 static_cast<GLint
>(12),
1921 static_cast<GLint
>(13),
1922 static_cast<GLint
>(14));
1923 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3i::kCmdId
), cmd
.header
.command
);
1924 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1925 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1926 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
1927 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
1928 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
1929 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1932 TEST_F(GLES2FormatTest
, Uniform3ivImmediate
) {
1933 const int kSomeBaseValueToTestWith
= 51;
1934 static GLint data
[] = {
1935 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
1936 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
1937 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
1938 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
1939 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
1940 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
1942 cmds::Uniform3ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3ivImmediate
>();
1943 const GLsizei kNumElements
= 2;
1944 const size_t kExpectedCmdSize
=
1945 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 3;
1947 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1948 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ivImmediate::kCmdId
),
1949 cmd
.header
.command
);
1950 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1951 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1952 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1953 CheckBytesWrittenMatchesExpectedSize(
1954 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1955 // TODO(gman): Check that data was inserted;
1958 TEST_F(GLES2FormatTest
, Uniform4f
) {
1959 cmds::Uniform4f
& cmd
= *GetBufferAs
<cmds::Uniform4f
>();
1960 void* next_cmd
= cmd
.Set(&cmd
,
1961 static_cast<GLint
>(11),
1962 static_cast<GLfloat
>(12),
1963 static_cast<GLfloat
>(13),
1964 static_cast<GLfloat
>(14),
1965 static_cast<GLfloat
>(15));
1966 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4f::kCmdId
), cmd
.header
.command
);
1967 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1968 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
1969 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
1970 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
1971 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
1972 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
1973 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1976 TEST_F(GLES2FormatTest
, Uniform4fvImmediate
) {
1977 const int kSomeBaseValueToTestWith
= 51;
1978 static GLfloat data
[] = {
1979 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
1980 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
1981 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
1982 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
1983 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
1984 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
1985 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
1986 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
1988 cmds::Uniform4fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4fvImmediate
>();
1989 const GLsizei kNumElements
= 2;
1990 const size_t kExpectedCmdSize
=
1991 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
1993 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
1994 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4fvImmediate::kCmdId
),
1995 cmd
.header
.command
);
1996 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1997 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
1998 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1999 CheckBytesWrittenMatchesExpectedSize(
2000 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2001 // TODO(gman): Check that data was inserted;
2004 TEST_F(GLES2FormatTest
, Uniform4i
) {
2005 cmds::Uniform4i
& cmd
= *GetBufferAs
<cmds::Uniform4i
>();
2006 void* next_cmd
= cmd
.Set(&cmd
,
2007 static_cast<GLint
>(11),
2008 static_cast<GLint
>(12),
2009 static_cast<GLint
>(13),
2010 static_cast<GLint
>(14),
2011 static_cast<GLint
>(15));
2012 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4i::kCmdId
), cmd
.header
.command
);
2013 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2014 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2015 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2016 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2017 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2018 EXPECT_EQ(static_cast<GLint
>(15), cmd
.w
);
2019 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2022 TEST_F(GLES2FormatTest
, Uniform4ivImmediate
) {
2023 const int kSomeBaseValueToTestWith
= 51;
2024 static GLint data
[] = {
2025 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2026 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2027 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2028 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2029 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2030 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2031 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 6),
2032 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 7),
2034 cmds::Uniform4ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4ivImmediate
>();
2035 const GLsizei kNumElements
= 2;
2036 const size_t kExpectedCmdSize
=
2037 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 4;
2039 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2040 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ivImmediate::kCmdId
),
2041 cmd
.header
.command
);
2042 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2043 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2044 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2045 CheckBytesWrittenMatchesExpectedSize(
2046 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2047 // TODO(gman): Check that data was inserted;
2050 TEST_F(GLES2FormatTest
, UniformMatrix2fvImmediate
) {
2051 const int kSomeBaseValueToTestWith
= 51;
2052 static GLfloat data
[] = {
2053 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2054 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2055 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2056 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2057 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2058 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2059 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2060 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2062 cmds::UniformMatrix2fvImmediate
& cmd
=
2063 *GetBufferAs
<cmds::UniformMatrix2fvImmediate
>();
2064 const GLsizei kNumElements
= 2;
2065 const size_t kExpectedCmdSize
=
2066 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
2068 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2069 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2fvImmediate::kCmdId
),
2070 cmd
.header
.command
);
2071 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2072 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2073 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2074 CheckBytesWrittenMatchesExpectedSize(
2075 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2076 // TODO(gman): Check that data was inserted;
2079 TEST_F(GLES2FormatTest
, UniformMatrix3fvImmediate
) {
2080 const int kSomeBaseValueToTestWith
= 51;
2081 static GLfloat data
[] = {
2082 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2083 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2084 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2085 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2086 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2087 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2088 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2089 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2090 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2091 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2092 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2093 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2094 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
2095 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
2096 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
2097 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
2098 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
2099 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
2101 cmds::UniformMatrix3fvImmediate
& cmd
=
2102 *GetBufferAs
<cmds::UniformMatrix3fvImmediate
>();
2103 const GLsizei kNumElements
= 2;
2104 const size_t kExpectedCmdSize
=
2105 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 9;
2107 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2108 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3fvImmediate::kCmdId
),
2109 cmd
.header
.command
);
2110 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2111 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2112 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2113 CheckBytesWrittenMatchesExpectedSize(
2114 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2115 // TODO(gman): Check that data was inserted;
2118 TEST_F(GLES2FormatTest
, UniformMatrix4fvImmediate
) {
2119 const int kSomeBaseValueToTestWith
= 51;
2120 static GLfloat data
[] = {
2121 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2122 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2123 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2124 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2125 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2126 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2127 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2128 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2129 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2130 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2131 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2132 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2133 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
2134 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
2135 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
2136 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
2137 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
2138 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
2139 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
2140 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
2141 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
2142 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
2143 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
2144 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
2145 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 24),
2146 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 25),
2147 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 26),
2148 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 27),
2149 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 28),
2150 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 29),
2151 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 30),
2152 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 31),
2154 cmds::UniformMatrix4fvImmediate
& cmd
=
2155 *GetBufferAs
<cmds::UniformMatrix4fvImmediate
>();
2156 const GLsizei kNumElements
= 2;
2157 const size_t kExpectedCmdSize
=
2158 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 16;
2160 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2161 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4fvImmediate::kCmdId
),
2162 cmd
.header
.command
);
2163 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2164 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2165 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2166 CheckBytesWrittenMatchesExpectedSize(
2167 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2168 // TODO(gman): Check that data was inserted;
2171 TEST_F(GLES2FormatTest
, UseProgram
) {
2172 cmds::UseProgram
& cmd
= *GetBufferAs
<cmds::UseProgram
>();
2173 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2174 EXPECT_EQ(static_cast<uint32_t>(cmds::UseProgram::kCmdId
),
2175 cmd
.header
.command
);
2176 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2177 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2178 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2181 TEST_F(GLES2FormatTest
, ValidateProgram
) {
2182 cmds::ValidateProgram
& cmd
= *GetBufferAs
<cmds::ValidateProgram
>();
2183 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2184 EXPECT_EQ(static_cast<uint32_t>(cmds::ValidateProgram::kCmdId
),
2185 cmd
.header
.command
);
2186 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2187 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2188 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2191 TEST_F(GLES2FormatTest
, VertexAttrib1f
) {
2192 cmds::VertexAttrib1f
& cmd
= *GetBufferAs
<cmds::VertexAttrib1f
>();
2194 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLfloat
>(12));
2195 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1f::kCmdId
),
2196 cmd
.header
.command
);
2197 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2198 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2199 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2200 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2203 TEST_F(GLES2FormatTest
, VertexAttrib1fvImmediate
) {
2204 const int kSomeBaseValueToTestWith
= 51;
2205 static GLfloat data
[] = {
2206 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2208 cmds::VertexAttrib1fvImmediate
& cmd
=
2209 *GetBufferAs
<cmds::VertexAttrib1fvImmediate
>();
2210 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
2211 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1fvImmediate::kCmdId
),
2212 cmd
.header
.command
);
2213 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2214 cmd
.header
.size
* 4u);
2215 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2216 CheckBytesWrittenMatchesExpectedSize(
2217 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2218 // TODO(gman): Check that data was inserted;
2221 TEST_F(GLES2FormatTest
, VertexAttrib2f
) {
2222 cmds::VertexAttrib2f
& cmd
= *GetBufferAs
<cmds::VertexAttrib2f
>();
2223 void* next_cmd
= cmd
.Set(&cmd
,
2224 static_cast<GLuint
>(11),
2225 static_cast<GLfloat
>(12),
2226 static_cast<GLfloat
>(13));
2227 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2f::kCmdId
),
2228 cmd
.header
.command
);
2229 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2230 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2231 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2232 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2233 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2236 TEST_F(GLES2FormatTest
, VertexAttrib2fvImmediate
) {
2237 const int kSomeBaseValueToTestWith
= 51;
2238 static GLfloat data
[] = {
2239 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2240 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2242 cmds::VertexAttrib2fvImmediate
& cmd
=
2243 *GetBufferAs
<cmds::VertexAttrib2fvImmediate
>();
2244 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
2245 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2fvImmediate::kCmdId
),
2246 cmd
.header
.command
);
2247 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2248 cmd
.header
.size
* 4u);
2249 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2250 CheckBytesWrittenMatchesExpectedSize(
2251 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2252 // TODO(gman): Check that data was inserted;
2255 TEST_F(GLES2FormatTest
, VertexAttrib3f
) {
2256 cmds::VertexAttrib3f
& cmd
= *GetBufferAs
<cmds::VertexAttrib3f
>();
2257 void* next_cmd
= cmd
.Set(&cmd
,
2258 static_cast<GLuint
>(11),
2259 static_cast<GLfloat
>(12),
2260 static_cast<GLfloat
>(13),
2261 static_cast<GLfloat
>(14));
2262 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3f::kCmdId
),
2263 cmd
.header
.command
);
2264 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2265 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2266 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2267 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2268 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2269 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2272 TEST_F(GLES2FormatTest
, VertexAttrib3fvImmediate
) {
2273 const int kSomeBaseValueToTestWith
= 51;
2274 static GLfloat data
[] = {
2275 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2276 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2277 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2279 cmds::VertexAttrib3fvImmediate
& cmd
=
2280 *GetBufferAs
<cmds::VertexAttrib3fvImmediate
>();
2281 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
2282 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3fvImmediate::kCmdId
),
2283 cmd
.header
.command
);
2284 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2285 cmd
.header
.size
* 4u);
2286 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2287 CheckBytesWrittenMatchesExpectedSize(
2288 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2289 // TODO(gman): Check that data was inserted;
2292 TEST_F(GLES2FormatTest
, VertexAttrib4f
) {
2293 cmds::VertexAttrib4f
& cmd
= *GetBufferAs
<cmds::VertexAttrib4f
>();
2294 void* next_cmd
= cmd
.Set(&cmd
,
2295 static_cast<GLuint
>(11),
2296 static_cast<GLfloat
>(12),
2297 static_cast<GLfloat
>(13),
2298 static_cast<GLfloat
>(14),
2299 static_cast<GLfloat
>(15));
2300 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4f::kCmdId
),
2301 cmd
.header
.command
);
2302 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2303 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2304 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2305 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2306 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2307 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
2308 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2311 TEST_F(GLES2FormatTest
, VertexAttrib4fvImmediate
) {
2312 const int kSomeBaseValueToTestWith
= 51;
2313 static GLfloat data
[] = {
2314 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2315 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2316 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2317 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2319 cmds::VertexAttrib4fvImmediate
& cmd
=
2320 *GetBufferAs
<cmds::VertexAttrib4fvImmediate
>();
2321 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
2322 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4fvImmediate::kCmdId
),
2323 cmd
.header
.command
);
2324 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2325 cmd
.header
.size
* 4u);
2326 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2327 CheckBytesWrittenMatchesExpectedSize(
2328 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2329 // TODO(gman): Check that data was inserted;
2332 TEST_F(GLES2FormatTest
, VertexAttribPointer
) {
2333 cmds::VertexAttribPointer
& cmd
= *GetBufferAs
<cmds::VertexAttribPointer
>();
2334 void* next_cmd
= cmd
.Set(&cmd
,
2335 static_cast<GLuint
>(11),
2336 static_cast<GLint
>(12),
2337 static_cast<GLenum
>(13),
2338 static_cast<GLboolean
>(14),
2339 static_cast<GLsizei
>(15),
2340 static_cast<GLuint
>(16));
2341 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribPointer::kCmdId
),
2342 cmd
.header
.command
);
2343 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2344 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
2345 EXPECT_EQ(static_cast<GLint
>(12), cmd
.size
);
2346 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
2347 EXPECT_EQ(static_cast<GLboolean
>(14), cmd
.normalized
);
2348 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.stride
);
2349 EXPECT_EQ(static_cast<GLuint
>(16), cmd
.offset
);
2350 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2353 TEST_F(GLES2FormatTest
, Viewport
) {
2354 cmds::Viewport
& cmd
= *GetBufferAs
<cmds::Viewport
>();
2355 void* next_cmd
= cmd
.Set(&cmd
,
2356 static_cast<GLint
>(11),
2357 static_cast<GLint
>(12),
2358 static_cast<GLsizei
>(13),
2359 static_cast<GLsizei
>(14));
2360 EXPECT_EQ(static_cast<uint32_t>(cmds::Viewport::kCmdId
), cmd
.header
.command
);
2361 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2362 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
2363 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
2364 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
2365 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
2366 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2369 TEST_F(GLES2FormatTest
, BlitFramebufferCHROMIUM
) {
2370 cmds::BlitFramebufferCHROMIUM
& cmd
=
2371 *GetBufferAs
<cmds::BlitFramebufferCHROMIUM
>();
2372 void* next_cmd
= cmd
.Set(&cmd
,
2373 static_cast<GLint
>(11),
2374 static_cast<GLint
>(12),
2375 static_cast<GLint
>(13),
2376 static_cast<GLint
>(14),
2377 static_cast<GLint
>(15),
2378 static_cast<GLint
>(16),
2379 static_cast<GLint
>(17),
2380 static_cast<GLint
>(18),
2381 static_cast<GLbitfield
>(19),
2382 static_cast<GLenum
>(20));
2383 EXPECT_EQ(static_cast<uint32_t>(cmds::BlitFramebufferCHROMIUM::kCmdId
),
2384 cmd
.header
.command
);
2385 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2386 EXPECT_EQ(static_cast<GLint
>(11), cmd
.srcX0
);
2387 EXPECT_EQ(static_cast<GLint
>(12), cmd
.srcY0
);
2388 EXPECT_EQ(static_cast<GLint
>(13), cmd
.srcX1
);
2389 EXPECT_EQ(static_cast<GLint
>(14), cmd
.srcY1
);
2390 EXPECT_EQ(static_cast<GLint
>(15), cmd
.dstX0
);
2391 EXPECT_EQ(static_cast<GLint
>(16), cmd
.dstY0
);
2392 EXPECT_EQ(static_cast<GLint
>(17), cmd
.dstX1
);
2393 EXPECT_EQ(static_cast<GLint
>(18), cmd
.dstY1
);
2394 EXPECT_EQ(static_cast<GLbitfield
>(19), cmd
.mask
);
2395 EXPECT_EQ(static_cast<GLenum
>(20), cmd
.filter
);
2396 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2399 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleCHROMIUM
) {
2400 cmds::RenderbufferStorageMultisampleCHROMIUM
& cmd
=
2401 *GetBufferAs
<cmds::RenderbufferStorageMultisampleCHROMIUM
>();
2402 void* next_cmd
= cmd
.Set(&cmd
,
2403 static_cast<GLenum
>(11),
2404 static_cast<GLsizei
>(12),
2405 static_cast<GLenum
>(13),
2406 static_cast<GLsizei
>(14),
2407 static_cast<GLsizei
>(15));
2408 EXPECT_EQ(static_cast<uint32_t>(
2409 cmds::RenderbufferStorageMultisampleCHROMIUM::kCmdId
),
2410 cmd
.header
.command
);
2411 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2412 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2413 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
2414 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
2415 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2416 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2417 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2420 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleEXT
) {
2421 cmds::RenderbufferStorageMultisampleEXT
& cmd
=
2422 *GetBufferAs
<cmds::RenderbufferStorageMultisampleEXT
>();
2423 void* next_cmd
= cmd
.Set(&cmd
,
2424 static_cast<GLenum
>(11),
2425 static_cast<GLsizei
>(12),
2426 static_cast<GLenum
>(13),
2427 static_cast<GLsizei
>(14),
2428 static_cast<GLsizei
>(15));
2430 static_cast<uint32_t>(cmds::RenderbufferStorageMultisampleEXT::kCmdId
),
2431 cmd
.header
.command
);
2432 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2433 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2434 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
2435 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
2436 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2437 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2438 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2441 TEST_F(GLES2FormatTest
, FramebufferTexture2DMultisampleEXT
) {
2442 cmds::FramebufferTexture2DMultisampleEXT
& cmd
=
2443 *GetBufferAs
<cmds::FramebufferTexture2DMultisampleEXT
>();
2444 void* next_cmd
= cmd
.Set(&cmd
,
2445 static_cast<GLenum
>(11),
2446 static_cast<GLenum
>(12),
2447 static_cast<GLenum
>(13),
2448 static_cast<GLuint
>(14),
2449 static_cast<GLsizei
>(15));
2451 static_cast<uint32_t>(cmds::FramebufferTexture2DMultisampleEXT::kCmdId
),
2452 cmd
.header
.command
);
2453 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2454 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2455 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
2456 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
2457 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
2458 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.samples
);
2459 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2462 TEST_F(GLES2FormatTest
, TexStorage2DEXT
) {
2463 cmds::TexStorage2DEXT
& cmd
= *GetBufferAs
<cmds::TexStorage2DEXT
>();
2464 void* next_cmd
= cmd
.Set(&cmd
,
2465 static_cast<GLenum
>(11),
2466 static_cast<GLsizei
>(12),
2467 static_cast<GLenum
>(13),
2468 static_cast<GLsizei
>(14),
2469 static_cast<GLsizei
>(15));
2470 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage2DEXT::kCmdId
),
2471 cmd
.header
.command
);
2472 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2473 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2474 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.levels
);
2475 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalFormat
);
2476 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2477 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2478 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2481 TEST_F(GLES2FormatTest
, GenQueriesEXTImmediate
) {
2482 static GLuint ids
[] = {
2485 cmds::GenQueriesEXTImmediate
& cmd
=
2486 *GetBufferAs
<cmds::GenQueriesEXTImmediate
>();
2487 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
2488 EXPECT_EQ(static_cast<uint32_t>(cmds::GenQueriesEXTImmediate::kCmdId
),
2489 cmd
.header
.command
);
2490 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
2491 cmd
.header
.size
* 4u);
2492 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
2493 CheckBytesWrittenMatchesExpectedSize(
2495 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
2496 // TODO(gman): Check that ids were inserted;
2499 TEST_F(GLES2FormatTest
, DeleteQueriesEXTImmediate
) {
2500 static GLuint ids
[] = {
2503 cmds::DeleteQueriesEXTImmediate
& cmd
=
2504 *GetBufferAs
<cmds::DeleteQueriesEXTImmediate
>();
2505 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
2506 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteQueriesEXTImmediate::kCmdId
),
2507 cmd
.header
.command
);
2508 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
2509 cmd
.header
.size
* 4u);
2510 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
2511 CheckBytesWrittenMatchesExpectedSize(
2513 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
2514 // TODO(gman): Check that ids were inserted;
2517 TEST_F(GLES2FormatTest
, BeginQueryEXT
) {
2518 cmds::BeginQueryEXT
& cmd
= *GetBufferAs
<cmds::BeginQueryEXT
>();
2519 void* next_cmd
= cmd
.Set(&cmd
,
2520 static_cast<GLenum
>(11),
2521 static_cast<GLuint
>(12),
2522 static_cast<uint32_t>(13),
2523 static_cast<uint32_t>(14));
2524 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginQueryEXT::kCmdId
),
2525 cmd
.header
.command
);
2526 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2527 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2528 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.id
);
2529 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.sync_data_shm_id
);
2530 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.sync_data_shm_offset
);
2531 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2534 TEST_F(GLES2FormatTest
, EndQueryEXT
) {
2535 cmds::EndQueryEXT
& cmd
= *GetBufferAs
<cmds::EndQueryEXT
>();
2537 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
2538 EXPECT_EQ(static_cast<uint32_t>(cmds::EndQueryEXT::kCmdId
),
2539 cmd
.header
.command
);
2540 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2541 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2542 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.submit_count
);
2543 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2546 TEST_F(GLES2FormatTest
, InsertEventMarkerEXT
) {
2547 cmds::InsertEventMarkerEXT
& cmd
= *GetBufferAs
<cmds::InsertEventMarkerEXT
>();
2548 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2549 EXPECT_EQ(static_cast<uint32_t>(cmds::InsertEventMarkerEXT::kCmdId
),
2550 cmd
.header
.command
);
2551 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2552 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
2553 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2556 TEST_F(GLES2FormatTest
, PushGroupMarkerEXT
) {
2557 cmds::PushGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PushGroupMarkerEXT
>();
2558 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2559 EXPECT_EQ(static_cast<uint32_t>(cmds::PushGroupMarkerEXT::kCmdId
),
2560 cmd
.header
.command
);
2561 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2562 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
2563 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2566 TEST_F(GLES2FormatTest
, PopGroupMarkerEXT
) {
2567 cmds::PopGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PopGroupMarkerEXT
>();
2568 void* next_cmd
= cmd
.Set(&cmd
);
2569 EXPECT_EQ(static_cast<uint32_t>(cmds::PopGroupMarkerEXT::kCmdId
),
2570 cmd
.header
.command
);
2571 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2572 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2575 TEST_F(GLES2FormatTest
, GenVertexArraysOESImmediate
) {
2576 static GLuint ids
[] = {
2579 cmds::GenVertexArraysOESImmediate
& cmd
=
2580 *GetBufferAs
<cmds::GenVertexArraysOESImmediate
>();
2581 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
2582 EXPECT_EQ(static_cast<uint32_t>(cmds::GenVertexArraysOESImmediate::kCmdId
),
2583 cmd
.header
.command
);
2584 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
2585 cmd
.header
.size
* 4u);
2586 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
2587 CheckBytesWrittenMatchesExpectedSize(
2589 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
2590 // TODO(gman): Check that ids were inserted;
2593 TEST_F(GLES2FormatTest
, DeleteVertexArraysOESImmediate
) {
2594 static GLuint ids
[] = {
2597 cmds::DeleteVertexArraysOESImmediate
& cmd
=
2598 *GetBufferAs
<cmds::DeleteVertexArraysOESImmediate
>();
2599 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
2600 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteVertexArraysOESImmediate::kCmdId
),
2601 cmd
.header
.command
);
2602 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
2603 cmd
.header
.size
* 4u);
2604 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
2605 CheckBytesWrittenMatchesExpectedSize(
2607 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
2608 // TODO(gman): Check that ids were inserted;
2611 TEST_F(GLES2FormatTest
, IsVertexArrayOES
) {
2612 cmds::IsVertexArrayOES
& cmd
= *GetBufferAs
<cmds::IsVertexArrayOES
>();
2613 void* next_cmd
= cmd
.Set(&cmd
,
2614 static_cast<GLuint
>(11),
2615 static_cast<uint32_t>(12),
2616 static_cast<uint32_t>(13));
2617 EXPECT_EQ(static_cast<uint32_t>(cmds::IsVertexArrayOES::kCmdId
),
2618 cmd
.header
.command
);
2619 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2620 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
2621 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
2622 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
2623 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2626 TEST_F(GLES2FormatTest
, BindVertexArrayOES
) {
2627 cmds::BindVertexArrayOES
& cmd
= *GetBufferAs
<cmds::BindVertexArrayOES
>();
2628 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2629 EXPECT_EQ(static_cast<uint32_t>(cmds::BindVertexArrayOES::kCmdId
),
2630 cmd
.header
.command
);
2631 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2632 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
2633 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2636 TEST_F(GLES2FormatTest
, SwapBuffers
) {
2637 cmds::SwapBuffers
& cmd
= *GetBufferAs
<cmds::SwapBuffers
>();
2638 void* next_cmd
= cmd
.Set(&cmd
);
2639 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapBuffers::kCmdId
),
2640 cmd
.header
.command
);
2641 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2642 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2645 TEST_F(GLES2FormatTest
, GetMaxValueInBufferCHROMIUM
) {
2646 cmds::GetMaxValueInBufferCHROMIUM
& cmd
=
2647 *GetBufferAs
<cmds::GetMaxValueInBufferCHROMIUM
>();
2648 void* next_cmd
= cmd
.Set(&cmd
,
2649 static_cast<GLuint
>(11),
2650 static_cast<GLsizei
>(12),
2651 static_cast<GLenum
>(13),
2652 static_cast<GLuint
>(14),
2653 static_cast<uint32_t>(15),
2654 static_cast<uint32_t>(16));
2655 EXPECT_EQ(static_cast<uint32_t>(cmds::GetMaxValueInBufferCHROMIUM::kCmdId
),
2656 cmd
.header
.command
);
2657 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2658 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer_id
);
2659 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2660 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
2661 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.offset
);
2662 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_id
);
2663 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.result_shm_offset
);
2664 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2667 TEST_F(GLES2FormatTest
, EnableFeatureCHROMIUM
) {
2668 cmds::EnableFeatureCHROMIUM
& cmd
=
2669 *GetBufferAs
<cmds::EnableFeatureCHROMIUM
>();
2670 void* next_cmd
= cmd
.Set(&cmd
,
2671 static_cast<GLuint
>(11),
2672 static_cast<uint32_t>(12),
2673 static_cast<uint32_t>(13));
2674 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableFeatureCHROMIUM::kCmdId
),
2675 cmd
.header
.command
);
2676 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2677 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
2678 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
2679 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
2680 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2683 TEST_F(GLES2FormatTest
, ResizeCHROMIUM
) {
2684 cmds::ResizeCHROMIUM
& cmd
= *GetBufferAs
<cmds::ResizeCHROMIUM
>();
2685 void* next_cmd
= cmd
.Set(&cmd
,
2686 static_cast<GLuint
>(11),
2687 static_cast<GLuint
>(12),
2688 static_cast<GLfloat
>(13));
2689 EXPECT_EQ(static_cast<uint32_t>(cmds::ResizeCHROMIUM::kCmdId
),
2690 cmd
.header
.command
);
2691 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2692 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.width
);
2693 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.height
);
2694 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.scale_factor
);
2695 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2698 TEST_F(GLES2FormatTest
, GetRequestableExtensionsCHROMIUM
) {
2699 cmds::GetRequestableExtensionsCHROMIUM
& cmd
=
2700 *GetBufferAs
<cmds::GetRequestableExtensionsCHROMIUM
>();
2701 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
2703 static_cast<uint32_t>(cmds::GetRequestableExtensionsCHROMIUM::kCmdId
),
2704 cmd
.header
.command
);
2705 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2706 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.bucket_id
);
2707 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2710 TEST_F(GLES2FormatTest
, RequestExtensionCHROMIUM
) {
2711 cmds::RequestExtensionCHROMIUM
& cmd
=
2712 *GetBufferAs
<cmds::RequestExtensionCHROMIUM
>();
2713 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
2714 EXPECT_EQ(static_cast<uint32_t>(cmds::RequestExtensionCHROMIUM::kCmdId
),
2715 cmd
.header
.command
);
2716 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2717 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.bucket_id
);
2718 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2721 TEST_F(GLES2FormatTest
, GetMultipleIntegervCHROMIUM
) {
2722 cmds::GetMultipleIntegervCHROMIUM
& cmd
=
2723 *GetBufferAs
<cmds::GetMultipleIntegervCHROMIUM
>();
2724 void* next_cmd
= cmd
.Set(&cmd
,
2725 static_cast<uint32_t>(11),
2726 static_cast<uint32_t>(12),
2727 static_cast<GLuint
>(13),
2728 static_cast<uint32_t>(14),
2729 static_cast<uint32_t>(15),
2730 static_cast<GLsizeiptr
>(16));
2731 EXPECT_EQ(static_cast<uint32_t>(cmds::GetMultipleIntegervCHROMIUM::kCmdId
),
2732 cmd
.header
.command
);
2733 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2734 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.pnames_shm_id
);
2735 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.pnames_shm_offset
);
2736 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.count
);
2737 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.results_shm_id
);
2738 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.results_shm_offset
);
2739 EXPECT_EQ(static_cast<GLsizeiptr
>(16), cmd
.size
);
2740 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2743 TEST_F(GLES2FormatTest
, GetProgramInfoCHROMIUM
) {
2744 cmds::GetProgramInfoCHROMIUM
& cmd
=
2745 *GetBufferAs
<cmds::GetProgramInfoCHROMIUM
>();
2747 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
2748 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoCHROMIUM::kCmdId
),
2749 cmd
.header
.command
);
2750 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2751 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2752 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
2753 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2756 TEST_F(GLES2FormatTest
, GetTranslatedShaderSourceANGLE
) {
2757 cmds::GetTranslatedShaderSourceANGLE
& cmd
=
2758 *GetBufferAs
<cmds::GetTranslatedShaderSourceANGLE
>();
2760 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
2761 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTranslatedShaderSourceANGLE::kCmdId
),
2762 cmd
.header
.command
);
2763 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2764 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
2765 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
2766 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2769 TEST_F(GLES2FormatTest
, PostSubBufferCHROMIUM
) {
2770 cmds::PostSubBufferCHROMIUM
& cmd
=
2771 *GetBufferAs
<cmds::PostSubBufferCHROMIUM
>();
2772 void* next_cmd
= cmd
.Set(&cmd
,
2773 static_cast<GLint
>(11),
2774 static_cast<GLint
>(12),
2775 static_cast<GLint
>(13),
2776 static_cast<GLint
>(14));
2777 EXPECT_EQ(static_cast<uint32_t>(cmds::PostSubBufferCHROMIUM::kCmdId
),
2778 cmd
.header
.command
);
2779 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2780 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
2781 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
2782 EXPECT_EQ(static_cast<GLint
>(13), cmd
.width
);
2783 EXPECT_EQ(static_cast<GLint
>(14), cmd
.height
);
2784 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2787 TEST_F(GLES2FormatTest
, TexImageIOSurface2DCHROMIUM
) {
2788 cmds::TexImageIOSurface2DCHROMIUM
& cmd
=
2789 *GetBufferAs
<cmds::TexImageIOSurface2DCHROMIUM
>();
2790 void* next_cmd
= cmd
.Set(&cmd
,
2791 static_cast<GLenum
>(11),
2792 static_cast<GLsizei
>(12),
2793 static_cast<GLsizei
>(13),
2794 static_cast<GLuint
>(14),
2795 static_cast<GLuint
>(15));
2796 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImageIOSurface2DCHROMIUM::kCmdId
),
2797 cmd
.header
.command
);
2798 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2799 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2800 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.width
);
2801 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.height
);
2802 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.ioSurfaceId
);
2803 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.plane
);
2804 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2807 TEST_F(GLES2FormatTest
, CopyTextureCHROMIUM
) {
2808 cmds::CopyTextureCHROMIUM
& cmd
= *GetBufferAs
<cmds::CopyTextureCHROMIUM
>();
2809 void* next_cmd
= cmd
.Set(&cmd
,
2810 static_cast<GLenum
>(11),
2811 static_cast<GLenum
>(12),
2812 static_cast<GLenum
>(13),
2813 static_cast<GLint
>(14),
2814 static_cast<GLint
>(15),
2815 static_cast<GLenum
>(16));
2816 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTextureCHROMIUM::kCmdId
),
2817 cmd
.header
.command
);
2818 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2819 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2820 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
2821 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
2822 EXPECT_EQ(static_cast<GLint
>(14), cmd
.level
);
2823 EXPECT_EQ(static_cast<GLint
>(15), cmd
.internalformat
);
2824 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.dest_type
);
2825 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2828 TEST_F(GLES2FormatTest
, DrawArraysInstancedANGLE
) {
2829 cmds::DrawArraysInstancedANGLE
& cmd
=
2830 *GetBufferAs
<cmds::DrawArraysInstancedANGLE
>();
2831 void* next_cmd
= cmd
.Set(&cmd
,
2832 static_cast<GLenum
>(11),
2833 static_cast<GLint
>(12),
2834 static_cast<GLsizei
>(13),
2835 static_cast<GLsizei
>(14));
2836 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArraysInstancedANGLE::kCmdId
),
2837 cmd
.header
.command
);
2838 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2839 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
2840 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
2841 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
2842 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.primcount
);
2843 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2846 TEST_F(GLES2FormatTest
, DrawElementsInstancedANGLE
) {
2847 cmds::DrawElementsInstancedANGLE
& cmd
=
2848 *GetBufferAs
<cmds::DrawElementsInstancedANGLE
>();
2849 void* next_cmd
= cmd
.Set(&cmd
,
2850 static_cast<GLenum
>(11),
2851 static_cast<GLsizei
>(12),
2852 static_cast<GLenum
>(13),
2853 static_cast<GLuint
>(14),
2854 static_cast<GLsizei
>(15));
2855 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElementsInstancedANGLE::kCmdId
),
2856 cmd
.header
.command
);
2857 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2858 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
2859 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
2860 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
2861 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
2862 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.primcount
);
2863 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2866 TEST_F(GLES2FormatTest
, VertexAttribDivisorANGLE
) {
2867 cmds::VertexAttribDivisorANGLE
& cmd
=
2868 *GetBufferAs
<cmds::VertexAttribDivisorANGLE
>();
2870 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
2871 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribDivisorANGLE::kCmdId
),
2872 cmd
.header
.command
);
2873 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2874 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
2875 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.divisor
);
2876 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2879 // TODO(gman): Write test for GenMailboxCHROMIUM
2880 TEST_F(GLES2FormatTest
, ProduceTextureCHROMIUMImmediate
) {
2881 const int kSomeBaseValueToTestWith
= 51;
2882 static GLbyte data
[] = {
2883 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
2884 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
2885 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
2886 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
2887 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
2888 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
2889 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
2890 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
2891 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
2892 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
2893 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
2894 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
2895 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
2896 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
2897 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
2898 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
2899 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
2900 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
2901 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
2902 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
2903 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
2904 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
2905 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
2906 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
2907 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
2908 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
2909 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
2910 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
2911 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
2912 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
2913 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
2914 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
2915 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
2916 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
2917 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
2918 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
2919 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
2920 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
2921 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
2922 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
2923 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
2924 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
2925 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
2926 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
2927 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
2928 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
2929 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
2930 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
2931 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
2932 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
2933 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
2934 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
2935 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
2936 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
2937 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
2938 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
2939 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
2940 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
2941 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
2942 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
2943 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
2944 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
2945 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
2946 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
2948 cmds::ProduceTextureCHROMIUMImmediate
& cmd
=
2949 *GetBufferAs
<cmds::ProduceTextureCHROMIUMImmediate
>();
2950 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
2952 static_cast<uint32_t>(cmds::ProduceTextureCHROMIUMImmediate::kCmdId
),
2953 cmd
.header
.command
);
2954 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2955 cmd
.header
.size
* 4u);
2956 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2957 CheckBytesWrittenMatchesExpectedSize(
2958 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2959 // TODO(gman): Check that data was inserted;
2962 TEST_F(GLES2FormatTest
, ProduceTextureDirectCHROMIUMImmediate
) {
2963 const int kSomeBaseValueToTestWith
= 51;
2964 static GLbyte data
[] = {
2965 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
2966 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
2967 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
2968 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
2969 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
2970 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
2971 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
2972 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
2973 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
2974 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
2975 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
2976 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
2977 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
2978 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
2979 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
2980 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
2981 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
2982 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
2983 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
2984 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
2985 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
2986 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
2987 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
2988 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
2989 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
2990 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
2991 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
2992 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
2993 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
2994 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
2995 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
2996 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
2997 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
2998 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
2999 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
3000 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
3001 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
3002 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
3003 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
3004 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
3005 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
3006 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
3007 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
3008 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
3009 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
3010 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
3011 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
3012 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
3013 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
3014 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
3015 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
3016 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
3017 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
3018 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
3019 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
3020 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
3021 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
3022 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
3023 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
3024 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
3025 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
3026 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
3027 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
3028 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
3030 cmds::ProduceTextureDirectCHROMIUMImmediate
& cmd
=
3031 *GetBufferAs
<cmds::ProduceTextureDirectCHROMIUMImmediate
>();
3033 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
3034 EXPECT_EQ(static_cast<uint32_t>(
3035 cmds::ProduceTextureDirectCHROMIUMImmediate::kCmdId
),
3036 cmd
.header
.command
);
3037 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3038 cmd
.header
.size
* 4u);
3039 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
3040 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.target
);
3041 CheckBytesWrittenMatchesExpectedSize(
3042 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3043 // TODO(gman): Check that data was inserted;
3046 TEST_F(GLES2FormatTest
, ConsumeTextureCHROMIUMImmediate
) {
3047 const int kSomeBaseValueToTestWith
= 51;
3048 static GLbyte data
[] = {
3049 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
3050 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
3051 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
3052 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
3053 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
3054 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
3055 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
3056 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
3057 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
3058 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
3059 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
3060 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
3061 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
3062 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
3063 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
3064 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
3065 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
3066 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
3067 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
3068 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
3069 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
3070 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
3071 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
3072 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
3073 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
3074 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
3075 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
3076 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
3077 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
3078 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
3079 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
3080 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
3081 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
3082 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
3083 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
3084 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
3085 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
3086 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
3087 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
3088 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
3089 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
3090 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
3091 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
3092 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
3093 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
3094 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
3095 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
3096 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
3097 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
3098 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
3099 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
3100 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
3101 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
3102 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
3103 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
3104 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
3105 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
3106 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
3107 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
3108 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
3109 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
3110 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
3111 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
3112 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
3114 cmds::ConsumeTextureCHROMIUMImmediate
& cmd
=
3115 *GetBufferAs
<cmds::ConsumeTextureCHROMIUMImmediate
>();
3116 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
3118 static_cast<uint32_t>(cmds::ConsumeTextureCHROMIUMImmediate::kCmdId
),
3119 cmd
.header
.command
);
3120 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3121 cmd
.header
.size
* 4u);
3122 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3123 CheckBytesWrittenMatchesExpectedSize(
3124 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3125 // TODO(gman): Check that data was inserted;
3128 // TODO(gman): Write test for CreateAndConsumeTextureCHROMIUMImmediate
3129 TEST_F(GLES2FormatTest
, BindUniformLocationCHROMIUMBucket
) {
3130 cmds::BindUniformLocationCHROMIUMBucket
& cmd
=
3131 *GetBufferAs
<cmds::BindUniformLocationCHROMIUMBucket
>();
3132 void* next_cmd
= cmd
.Set(&cmd
,
3133 static_cast<GLuint
>(11),
3134 static_cast<GLint
>(12),
3135 static_cast<uint32_t>(13));
3137 static_cast<uint32_t>(cmds::BindUniformLocationCHROMIUMBucket::kCmdId
),
3138 cmd
.header
.command
);
3139 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3140 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3141 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
3142 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
3143 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3146 TEST_F(GLES2FormatTest
, BindTexImage2DCHROMIUM
) {
3147 cmds::BindTexImage2DCHROMIUM
& cmd
=
3148 *GetBufferAs
<cmds::BindTexImage2DCHROMIUM
>();
3150 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
3151 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexImage2DCHROMIUM::kCmdId
),
3152 cmd
.header
.command
);
3153 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3154 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3155 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
3156 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3159 TEST_F(GLES2FormatTest
, ReleaseTexImage2DCHROMIUM
) {
3160 cmds::ReleaseTexImage2DCHROMIUM
& cmd
=
3161 *GetBufferAs
<cmds::ReleaseTexImage2DCHROMIUM
>();
3163 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
3164 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseTexImage2DCHROMIUM::kCmdId
),
3165 cmd
.header
.command
);
3166 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3167 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3168 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
3169 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3172 TEST_F(GLES2FormatTest
, TraceBeginCHROMIUM
) {
3173 cmds::TraceBeginCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceBeginCHROMIUM
>();
3174 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3175 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceBeginCHROMIUM::kCmdId
),
3176 cmd
.header
.command
);
3177 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3178 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3179 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3182 TEST_F(GLES2FormatTest
, TraceEndCHROMIUM
) {
3183 cmds::TraceEndCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceEndCHROMIUM
>();
3184 void* next_cmd
= cmd
.Set(&cmd
);
3185 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceEndCHROMIUM::kCmdId
),
3186 cmd
.header
.command
);
3187 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3188 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3191 TEST_F(GLES2FormatTest
, AsyncTexSubImage2DCHROMIUM
) {
3192 cmds::AsyncTexSubImage2DCHROMIUM
& cmd
=
3193 *GetBufferAs
<cmds::AsyncTexSubImage2DCHROMIUM
>();
3194 void* next_cmd
= cmd
.Set(&cmd
,
3195 static_cast<GLenum
>(11),
3196 static_cast<GLint
>(12),
3197 static_cast<GLint
>(13),
3198 static_cast<GLint
>(14),
3199 static_cast<GLsizei
>(15),
3200 static_cast<GLsizei
>(16),
3201 static_cast<GLenum
>(17),
3202 static_cast<GLenum
>(18),
3203 static_cast<uint32_t>(19),
3204 static_cast<uint32_t>(20),
3205 static_cast<uint32_t>(21),
3206 static_cast<uint32_t>(22),
3207 static_cast<uint32_t>(23));
3208 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexSubImage2DCHROMIUM::kCmdId
),
3209 cmd
.header
.command
);
3210 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3211 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3212 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
3213 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
3214 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
3215 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
3216 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
3217 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
3218 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
3219 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.data_shm_id
);
3220 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.data_shm_offset
);
3221 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.async_upload_token
);
3222 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.sync_data_shm_id
);
3223 EXPECT_EQ(static_cast<uint32_t>(23), cmd
.sync_data_shm_offset
);
3224 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3227 TEST_F(GLES2FormatTest
, AsyncTexImage2DCHROMIUM
) {
3228 cmds::AsyncTexImage2DCHROMIUM
& cmd
=
3229 *GetBufferAs
<cmds::AsyncTexImage2DCHROMIUM
>();
3230 void* next_cmd
= cmd
.Set(&cmd
,
3231 static_cast<GLenum
>(11),
3232 static_cast<GLint
>(12),
3233 static_cast<GLint
>(13),
3234 static_cast<GLsizei
>(14),
3235 static_cast<GLsizei
>(15),
3236 static_cast<GLenum
>(16),
3237 static_cast<GLenum
>(17),
3238 static_cast<uint32_t>(18),
3239 static_cast<uint32_t>(19),
3240 static_cast<uint32_t>(20),
3241 static_cast<uint32_t>(21),
3242 static_cast<uint32_t>(22));
3243 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexImage2DCHROMIUM::kCmdId
),
3244 cmd
.header
.command
);
3245 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3246 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3247 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
3248 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
3249 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3250 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3251 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.format
);
3252 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.type
);
3253 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_id
);
3254 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_offset
);
3255 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.async_upload_token
);
3256 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.sync_data_shm_id
);
3257 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.sync_data_shm_offset
);
3258 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3261 TEST_F(GLES2FormatTest
, WaitAsyncTexImage2DCHROMIUM
) {
3262 cmds::WaitAsyncTexImage2DCHROMIUM
& cmd
=
3263 *GetBufferAs
<cmds::WaitAsyncTexImage2DCHROMIUM
>();
3264 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
3265 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAsyncTexImage2DCHROMIUM::kCmdId
),
3266 cmd
.header
.command
);
3267 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3268 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3269 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3272 TEST_F(GLES2FormatTest
, WaitAllAsyncTexImage2DCHROMIUM
) {
3273 cmds::WaitAllAsyncTexImage2DCHROMIUM
& cmd
=
3274 *GetBufferAs
<cmds::WaitAllAsyncTexImage2DCHROMIUM
>();
3275 void* next_cmd
= cmd
.Set(&cmd
);
3276 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAllAsyncTexImage2DCHROMIUM::kCmdId
),
3277 cmd
.header
.command
);
3278 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3279 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3282 TEST_F(GLES2FormatTest
, DiscardFramebufferEXTImmediate
) {
3283 const int kSomeBaseValueToTestWith
= 51;
3284 static GLenum data
[] = {
3285 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
3286 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
3288 cmds::DiscardFramebufferEXTImmediate
& cmd
=
3289 *GetBufferAs
<cmds::DiscardFramebufferEXTImmediate
>();
3290 const GLsizei kNumElements
= 2;
3291 const size_t kExpectedCmdSize
=
3292 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
3294 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
);
3295 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardFramebufferEXTImmediate::kCmdId
),
3296 cmd
.header
.command
);
3297 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3298 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
3299 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3300 CheckBytesWrittenMatchesExpectedSize(
3301 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3302 // TODO(gman): Check that data was inserted;
3305 TEST_F(GLES2FormatTest
, LoseContextCHROMIUM
) {
3306 cmds::LoseContextCHROMIUM
& cmd
= *GetBufferAs
<cmds::LoseContextCHROMIUM
>();
3308 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
3309 EXPECT_EQ(static_cast<uint32_t>(cmds::LoseContextCHROMIUM::kCmdId
),
3310 cmd
.header
.command
);
3311 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3312 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.current
);
3313 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.other
);
3314 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3317 // TODO(gman): Write test for InsertSyncPointCHROMIUM
3318 TEST_F(GLES2FormatTest
, WaitSyncPointCHROMIUM
) {
3319 cmds::WaitSyncPointCHROMIUM
& cmd
=
3320 *GetBufferAs
<cmds::WaitSyncPointCHROMIUM
>();
3321 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3322 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSyncPointCHROMIUM::kCmdId
),
3323 cmd
.header
.command
);
3324 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3325 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync_point
);
3326 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3329 TEST_F(GLES2FormatTest
, DrawBuffersEXTImmediate
) {
3330 const int kSomeBaseValueToTestWith
= 51;
3331 static GLenum data
[] = {
3332 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
3334 cmds::DrawBuffersEXTImmediate
& cmd
=
3335 *GetBufferAs
<cmds::DrawBuffersEXTImmediate
>();
3336 const GLsizei kNumElements
= 1;
3337 const size_t kExpectedCmdSize
=
3338 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
3339 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(1), data
);
3340 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawBuffersEXTImmediate::kCmdId
),
3341 cmd
.header
.command
);
3342 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3343 EXPECT_EQ(static_cast<GLsizei
>(1), cmd
.count
);
3344 CheckBytesWrittenMatchesExpectedSize(
3345 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3346 // TODO(gman): Check that data was inserted;
3349 TEST_F(GLES2FormatTest
, DiscardBackbufferCHROMIUM
) {
3350 cmds::DiscardBackbufferCHROMIUM
& cmd
=
3351 *GetBufferAs
<cmds::DiscardBackbufferCHROMIUM
>();
3352 void* next_cmd
= cmd
.Set(&cmd
);
3353 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardBackbufferCHROMIUM::kCmdId
),
3354 cmd
.header
.command
);
3355 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3356 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3359 TEST_F(GLES2FormatTest
, ScheduleOverlayPlaneCHROMIUM
) {
3360 cmds::ScheduleOverlayPlaneCHROMIUM
& cmd
=
3361 *GetBufferAs
<cmds::ScheduleOverlayPlaneCHROMIUM
>();
3362 void* next_cmd
= cmd
.Set(&cmd
,
3363 static_cast<GLint
>(11),
3364 static_cast<GLenum
>(12),
3365 static_cast<GLuint
>(13),
3366 static_cast<GLint
>(14),
3367 static_cast<GLint
>(15),
3368 static_cast<GLint
>(16),
3369 static_cast<GLint
>(17),
3370 static_cast<GLfloat
>(18),
3371 static_cast<GLfloat
>(19),
3372 static_cast<GLfloat
>(20),
3373 static_cast<GLfloat
>(21));
3374 EXPECT_EQ(static_cast<uint32_t>(cmds::ScheduleOverlayPlaneCHROMIUM::kCmdId
),
3375 cmd
.header
.command
);
3376 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3377 EXPECT_EQ(static_cast<GLint
>(11), cmd
.plane_z_order
);
3378 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.plane_transform
);
3379 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.overlay_texture_id
);
3380 EXPECT_EQ(static_cast<GLint
>(14), cmd
.bounds_x
);
3381 EXPECT_EQ(static_cast<GLint
>(15), cmd
.bounds_y
);
3382 EXPECT_EQ(static_cast<GLint
>(16), cmd
.bounds_width
);
3383 EXPECT_EQ(static_cast<GLint
>(17), cmd
.bounds_height
);
3384 EXPECT_EQ(static_cast<GLfloat
>(18), cmd
.uv_x
);
3385 EXPECT_EQ(static_cast<GLfloat
>(19), cmd
.uv_y
);
3386 EXPECT_EQ(static_cast<GLfloat
>(20), cmd
.uv_width
);
3387 EXPECT_EQ(static_cast<GLfloat
>(21), cmd
.uv_height
);
3388 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3391 TEST_F(GLES2FormatTest
, MatrixLoadfCHROMIUMImmediate
) {
3392 const int kSomeBaseValueToTestWith
= 51;
3393 static GLfloat data
[] = {
3394 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3395 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3396 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3397 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3398 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3399 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3400 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3401 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3402 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3403 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3404 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3405 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3406 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3407 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3408 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3409 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3411 cmds::MatrixLoadfCHROMIUMImmediate
& cmd
=
3412 *GetBufferAs
<cmds::MatrixLoadfCHROMIUMImmediate
>();
3413 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
3414 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadfCHROMIUMImmediate::kCmdId
),
3415 cmd
.header
.command
);
3416 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3417 cmd
.header
.size
* 4u);
3418 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.matrixMode
);
3419 CheckBytesWrittenMatchesExpectedSize(
3420 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3421 // TODO(gman): Check that data was inserted;
3424 TEST_F(GLES2FormatTest
, MatrixLoadIdentityCHROMIUM
) {
3425 cmds::MatrixLoadIdentityCHROMIUM
& cmd
=
3426 *GetBufferAs
<cmds::MatrixLoadIdentityCHROMIUM
>();
3427 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
3428 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadIdentityCHROMIUM::kCmdId
),
3429 cmd
.header
.command
);
3430 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3431 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.matrixMode
);
3432 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3435 TEST_F(GLES2FormatTest
, BlendBarrierKHR
) {
3436 cmds::BlendBarrierKHR
& cmd
= *GetBufferAs
<cmds::BlendBarrierKHR
>();
3437 void* next_cmd
= cmd
.Set(&cmd
);
3438 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendBarrierKHR::kCmdId
),
3439 cmd
.header
.command
);
3440 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3441 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3444 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_