Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / gpu / command_buffer / common / gles2_cmd_format_test_autogen.h
bloba7ff6bd7b316d3672a1c1dc5708d21c86b2b0d38
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // This file contains unit tests for gles2 commmands
12 // It is included by gles2_cmd_format_test.cc
14 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
15 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
17 TEST_F(GLES2FormatTest, ActiveTexture) {
18 cmds::ActiveTexture& cmd = *GetBufferAs<cmds::ActiveTexture>();
19 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
20 EXPECT_EQ(static_cast<uint32_t>(cmds::ActiveTexture::kCmdId),
21 cmd.header.command);
22 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
23 EXPECT_EQ(static_cast<GLenum>(11), cmd.texture);
24 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
27 TEST_F(GLES2FormatTest, AttachShader) {
28 cmds::AttachShader& cmd = *GetBufferAs<cmds::AttachShader>();
29 void* next_cmd =
30 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
31 EXPECT_EQ(static_cast<uint32_t>(cmds::AttachShader::kCmdId),
32 cmd.header.command);
33 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
34 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
35 EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
36 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
39 TEST_F(GLES2FormatTest, BindAttribLocationBucket) {
40 cmds::BindAttribLocationBucket& cmd =
41 *GetBufferAs<cmds::BindAttribLocationBucket>();
42 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
43 static_cast<GLuint>(12), static_cast<uint32_t>(13));
44 EXPECT_EQ(static_cast<uint32_t>(cmds::BindAttribLocationBucket::kCmdId),
45 cmd.header.command);
46 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
47 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
48 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
49 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
50 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
53 TEST_F(GLES2FormatTest, BindBuffer) {
54 cmds::BindBuffer& cmd = *GetBufferAs<cmds::BindBuffer>();
55 void* next_cmd =
56 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
57 EXPECT_EQ(static_cast<uint32_t>(cmds::BindBuffer::kCmdId),
58 cmd.header.command);
59 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
60 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
61 EXPECT_EQ(static_cast<GLuint>(12), cmd.buffer);
62 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
65 TEST_F(GLES2FormatTest, BindBufferBase) {
66 cmds::BindBufferBase& cmd = *GetBufferAs<cmds::BindBufferBase>();
67 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
68 static_cast<GLuint>(12), static_cast<GLuint>(13));
69 EXPECT_EQ(static_cast<uint32_t>(cmds::BindBufferBase::kCmdId),
70 cmd.header.command);
71 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
72 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
73 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
74 EXPECT_EQ(static_cast<GLuint>(13), cmd.buffer);
75 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
78 TEST_F(GLES2FormatTest, BindBufferRange) {
79 cmds::BindBufferRange& cmd = *GetBufferAs<cmds::BindBufferRange>();
80 void* next_cmd =
81 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
82 static_cast<GLuint>(13), static_cast<GLintptr>(14),
83 static_cast<GLsizeiptr>(15));
84 EXPECT_EQ(static_cast<uint32_t>(cmds::BindBufferRange::kCmdId),
85 cmd.header.command);
86 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
87 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
88 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
89 EXPECT_EQ(static_cast<GLuint>(13), cmd.buffer);
90 EXPECT_EQ(static_cast<GLintptr>(14), cmd.offset);
91 EXPECT_EQ(static_cast<GLsizeiptr>(15), cmd.size);
92 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
95 TEST_F(GLES2FormatTest, BindFramebuffer) {
96 cmds::BindFramebuffer& cmd = *GetBufferAs<cmds::BindFramebuffer>();
97 void* next_cmd =
98 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
99 EXPECT_EQ(static_cast<uint32_t>(cmds::BindFramebuffer::kCmdId),
100 cmd.header.command);
101 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
102 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
103 EXPECT_EQ(static_cast<GLuint>(12), cmd.framebuffer);
104 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
107 TEST_F(GLES2FormatTest, BindRenderbuffer) {
108 cmds::BindRenderbuffer& cmd = *GetBufferAs<cmds::BindRenderbuffer>();
109 void* next_cmd =
110 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
111 EXPECT_EQ(static_cast<uint32_t>(cmds::BindRenderbuffer::kCmdId),
112 cmd.header.command);
113 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
114 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
115 EXPECT_EQ(static_cast<GLuint>(12), cmd.renderbuffer);
116 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
119 TEST_F(GLES2FormatTest, BindSampler) {
120 cmds::BindSampler& cmd = *GetBufferAs<cmds::BindSampler>();
121 void* next_cmd =
122 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
123 EXPECT_EQ(static_cast<uint32_t>(cmds::BindSampler::kCmdId),
124 cmd.header.command);
125 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
126 EXPECT_EQ(static_cast<GLuint>(11), cmd.unit);
127 EXPECT_EQ(static_cast<GLuint>(12), cmd.sampler);
128 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
131 TEST_F(GLES2FormatTest, BindTexture) {
132 cmds::BindTexture& cmd = *GetBufferAs<cmds::BindTexture>();
133 void* next_cmd =
134 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
135 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexture::kCmdId),
136 cmd.header.command);
137 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
138 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
139 EXPECT_EQ(static_cast<GLuint>(12), cmd.texture);
140 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
143 TEST_F(GLES2FormatTest, BindTransformFeedback) {
144 cmds::BindTransformFeedback& cmd =
145 *GetBufferAs<cmds::BindTransformFeedback>();
146 void* next_cmd =
147 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
148 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTransformFeedback::kCmdId),
149 cmd.header.command);
150 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
151 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
152 EXPECT_EQ(static_cast<GLuint>(12), cmd.transformfeedback);
153 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
156 TEST_F(GLES2FormatTest, BlendColor) {
157 cmds::BlendColor& cmd = *GetBufferAs<cmds::BlendColor>();
158 void* next_cmd =
159 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12),
160 static_cast<GLclampf>(13), static_cast<GLclampf>(14));
161 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendColor::kCmdId),
162 cmd.header.command);
163 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
164 EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
165 EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
166 EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
167 EXPECT_EQ(static_cast<GLclampf>(14), cmd.alpha);
168 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
171 TEST_F(GLES2FormatTest, BlendEquation) {
172 cmds::BlendEquation& cmd = *GetBufferAs<cmds::BlendEquation>();
173 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
174 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquation::kCmdId),
175 cmd.header.command);
176 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
177 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
178 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
181 TEST_F(GLES2FormatTest, BlendEquationSeparate) {
182 cmds::BlendEquationSeparate& cmd =
183 *GetBufferAs<cmds::BlendEquationSeparate>();
184 void* next_cmd =
185 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
186 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquationSeparate::kCmdId),
187 cmd.header.command);
188 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
189 EXPECT_EQ(static_cast<GLenum>(11), cmd.modeRGB);
190 EXPECT_EQ(static_cast<GLenum>(12), cmd.modeAlpha);
191 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
194 TEST_F(GLES2FormatTest, BlendFunc) {
195 cmds::BlendFunc& cmd = *GetBufferAs<cmds::BlendFunc>();
196 void* next_cmd =
197 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
198 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFunc::kCmdId), cmd.header.command);
199 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
200 EXPECT_EQ(static_cast<GLenum>(11), cmd.sfactor);
201 EXPECT_EQ(static_cast<GLenum>(12), cmd.dfactor);
202 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
205 TEST_F(GLES2FormatTest, BlendFuncSeparate) {
206 cmds::BlendFuncSeparate& cmd = *GetBufferAs<cmds::BlendFuncSeparate>();
207 void* next_cmd =
208 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
209 static_cast<GLenum>(13), static_cast<GLenum>(14));
210 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFuncSeparate::kCmdId),
211 cmd.header.command);
212 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
213 EXPECT_EQ(static_cast<GLenum>(11), cmd.srcRGB);
214 EXPECT_EQ(static_cast<GLenum>(12), cmd.dstRGB);
215 EXPECT_EQ(static_cast<GLenum>(13), cmd.srcAlpha);
216 EXPECT_EQ(static_cast<GLenum>(14), cmd.dstAlpha);
217 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
220 TEST_F(GLES2FormatTest, BufferData) {
221 cmds::BufferData& cmd = *GetBufferAs<cmds::BufferData>();
222 void* next_cmd =
223 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizeiptr>(12),
224 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
225 static_cast<GLenum>(15));
226 EXPECT_EQ(static_cast<uint32_t>(cmds::BufferData::kCmdId),
227 cmd.header.command);
228 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
229 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
230 EXPECT_EQ(static_cast<GLsizeiptr>(12), cmd.size);
231 EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
232 EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
233 EXPECT_EQ(static_cast<GLenum>(15), cmd.usage);
234 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
237 TEST_F(GLES2FormatTest, BufferSubData) {
238 cmds::BufferSubData& cmd = *GetBufferAs<cmds::BufferSubData>();
239 void* next_cmd =
240 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLintptr>(12),
241 static_cast<GLsizeiptr>(13), static_cast<uint32_t>(14),
242 static_cast<uint32_t>(15));
243 EXPECT_EQ(static_cast<uint32_t>(cmds::BufferSubData::kCmdId),
244 cmd.header.command);
245 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
246 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
247 EXPECT_EQ(static_cast<GLintptr>(12), cmd.offset);
248 EXPECT_EQ(static_cast<GLsizeiptr>(13), cmd.size);
249 EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_id);
250 EXPECT_EQ(static_cast<uint32_t>(15), cmd.data_shm_offset);
251 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
254 TEST_F(GLES2FormatTest, CheckFramebufferStatus) {
255 cmds::CheckFramebufferStatus& cmd =
256 *GetBufferAs<cmds::CheckFramebufferStatus>();
257 void* next_cmd =
258 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
259 static_cast<uint32_t>(13));
260 EXPECT_EQ(static_cast<uint32_t>(cmds::CheckFramebufferStatus::kCmdId),
261 cmd.header.command);
262 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
263 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
264 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
265 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
266 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
269 TEST_F(GLES2FormatTest, Clear) {
270 cmds::Clear& cmd = *GetBufferAs<cmds::Clear>();
271 void* next_cmd = cmd.Set(&cmd, static_cast<GLbitfield>(11));
272 EXPECT_EQ(static_cast<uint32_t>(cmds::Clear::kCmdId), cmd.header.command);
273 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
274 EXPECT_EQ(static_cast<GLbitfield>(11), cmd.mask);
275 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
278 TEST_F(GLES2FormatTest, ClearBufferfi) {
279 cmds::ClearBufferfi& cmd = *GetBufferAs<cmds::ClearBufferfi>();
280 void* next_cmd =
281 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
282 static_cast<GLfloat>(13), static_cast<GLint>(14));
283 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferfi::kCmdId),
284 cmd.header.command);
285 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
286 EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
287 EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
288 EXPECT_EQ(static_cast<GLfloat>(13), cmd.depth);
289 EXPECT_EQ(static_cast<GLint>(14), cmd.stencil);
290 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
293 TEST_F(GLES2FormatTest, ClearBufferfvImmediate) {
294 const int kSomeBaseValueToTestWith = 51;
295 static GLfloat data[] = {
296 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
297 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
298 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
299 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
301 cmds::ClearBufferfvImmediate& cmd =
302 *GetBufferAs<cmds::ClearBufferfvImmediate>();
303 void* next_cmd =
304 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), data);
305 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferfvImmediate::kCmdId),
306 cmd.header.command);
307 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
308 cmd.header.size * 4u);
309 EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
310 EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
311 CheckBytesWrittenMatchesExpectedSize(
312 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
313 // TODO(gman): Check that data was inserted;
316 TEST_F(GLES2FormatTest, ClearBufferivImmediate) {
317 const int kSomeBaseValueToTestWith = 51;
318 static GLint data[] = {
319 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
320 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
321 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
322 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
324 cmds::ClearBufferivImmediate& cmd =
325 *GetBufferAs<cmds::ClearBufferivImmediate>();
326 void* next_cmd =
327 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), data);
328 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferivImmediate::kCmdId),
329 cmd.header.command);
330 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
331 cmd.header.size * 4u);
332 EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
333 EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
334 CheckBytesWrittenMatchesExpectedSize(
335 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
336 // TODO(gman): Check that data was inserted;
339 TEST_F(GLES2FormatTest, ClearBufferuivImmediate) {
340 const int kSomeBaseValueToTestWith = 51;
341 static GLuint data[] = {
342 static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
343 static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
344 static_cast<GLuint>(kSomeBaseValueToTestWith + 2),
345 static_cast<GLuint>(kSomeBaseValueToTestWith + 3),
347 cmds::ClearBufferuivImmediate& cmd =
348 *GetBufferAs<cmds::ClearBufferuivImmediate>();
349 void* next_cmd =
350 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), data);
351 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferuivImmediate::kCmdId),
352 cmd.header.command);
353 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
354 cmd.header.size * 4u);
355 EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
356 EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
357 CheckBytesWrittenMatchesExpectedSize(
358 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
359 // TODO(gman): Check that data was inserted;
362 TEST_F(GLES2FormatTest, ClearColor) {
363 cmds::ClearColor& cmd = *GetBufferAs<cmds::ClearColor>();
364 void* next_cmd =
365 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12),
366 static_cast<GLclampf>(13), static_cast<GLclampf>(14));
367 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearColor::kCmdId),
368 cmd.header.command);
369 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
370 EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
371 EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
372 EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
373 EXPECT_EQ(static_cast<GLclampf>(14), cmd.alpha);
374 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
377 TEST_F(GLES2FormatTest, ClearDepthf) {
378 cmds::ClearDepthf& cmd = *GetBufferAs<cmds::ClearDepthf>();
379 void* next_cmd = cmd.Set(&cmd, static_cast<GLclampf>(11));
380 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearDepthf::kCmdId),
381 cmd.header.command);
382 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
383 EXPECT_EQ(static_cast<GLclampf>(11), cmd.depth);
384 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
387 TEST_F(GLES2FormatTest, ClearStencil) {
388 cmds::ClearStencil& cmd = *GetBufferAs<cmds::ClearStencil>();
389 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11));
390 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearStencil::kCmdId),
391 cmd.header.command);
392 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
393 EXPECT_EQ(static_cast<GLint>(11), cmd.s);
394 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
397 TEST_F(GLES2FormatTest, ClientWaitSync) {
398 cmds::ClientWaitSync& cmd = *GetBufferAs<cmds::ClientWaitSync>();
399 void* next_cmd =
400 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLbitfield>(12),
401 static_cast<GLuint>(13), static_cast<GLuint>(14),
402 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
403 EXPECT_EQ(static_cast<uint32_t>(cmds::ClientWaitSync::kCmdId),
404 cmd.header.command);
405 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
406 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
407 EXPECT_EQ(static_cast<GLbitfield>(12), cmd.flags);
408 EXPECT_EQ(static_cast<GLuint>(13), cmd.timeout_0);
409 EXPECT_EQ(static_cast<GLuint>(14), cmd.timeout_1);
410 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_id);
411 EXPECT_EQ(static_cast<uint32_t>(16), cmd.result_shm_offset);
412 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
415 TEST_F(GLES2FormatTest, ColorMask) {
416 cmds::ColorMask& cmd = *GetBufferAs<cmds::ColorMask>();
417 void* next_cmd =
418 cmd.Set(&cmd, static_cast<GLboolean>(11), static_cast<GLboolean>(12),
419 static_cast<GLboolean>(13), static_cast<GLboolean>(14));
420 EXPECT_EQ(static_cast<uint32_t>(cmds::ColorMask::kCmdId), cmd.header.command);
421 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
422 EXPECT_EQ(static_cast<GLboolean>(11), cmd.red);
423 EXPECT_EQ(static_cast<GLboolean>(12), cmd.green);
424 EXPECT_EQ(static_cast<GLboolean>(13), cmd.blue);
425 EXPECT_EQ(static_cast<GLboolean>(14), cmd.alpha);
426 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
429 TEST_F(GLES2FormatTest, CompileShader) {
430 cmds::CompileShader& cmd = *GetBufferAs<cmds::CompileShader>();
431 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
432 EXPECT_EQ(static_cast<uint32_t>(cmds::CompileShader::kCmdId),
433 cmd.header.command);
434 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
435 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
436 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
439 TEST_F(GLES2FormatTest, CompressedTexImage2DBucket) {
440 cmds::CompressedTexImage2DBucket& cmd =
441 *GetBufferAs<cmds::CompressedTexImage2DBucket>();
442 void* next_cmd =
443 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
444 static_cast<GLenum>(13), static_cast<GLsizei>(14),
445 static_cast<GLsizei>(15), static_cast<GLuint>(16));
446 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2DBucket::kCmdId),
447 cmd.header.command);
448 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
449 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
450 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
451 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
452 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
453 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
454 EXPECT_EQ(static_cast<GLuint>(16), cmd.bucket_id);
455 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
458 TEST_F(GLES2FormatTest, CompressedTexImage2D) {
459 cmds::CompressedTexImage2D& cmd = *GetBufferAs<cmds::CompressedTexImage2D>();
460 void* next_cmd =
461 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
462 static_cast<GLenum>(13), static_cast<GLsizei>(14),
463 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
464 static_cast<uint32_t>(17), static_cast<uint32_t>(18));
465 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2D::kCmdId),
466 cmd.header.command);
467 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
468 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
469 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
470 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
471 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
472 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
473 EXPECT_EQ(static_cast<GLsizei>(16), cmd.imageSize);
474 EXPECT_EQ(static_cast<uint32_t>(17), cmd.data_shm_id);
475 EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_offset);
476 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
479 TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) {
480 cmds::CompressedTexSubImage2DBucket& cmd =
481 *GetBufferAs<cmds::CompressedTexSubImage2DBucket>();
482 void* next_cmd =
483 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
484 static_cast<GLint>(13), static_cast<GLint>(14),
485 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
486 static_cast<GLenum>(17), static_cast<GLuint>(18));
487 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2DBucket::kCmdId),
488 cmd.header.command);
489 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
490 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
491 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
492 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
493 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
494 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
495 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
496 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
497 EXPECT_EQ(static_cast<GLuint>(18), cmd.bucket_id);
498 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
501 TEST_F(GLES2FormatTest, CompressedTexSubImage2D) {
502 cmds::CompressedTexSubImage2D& cmd =
503 *GetBufferAs<cmds::CompressedTexSubImage2D>();
504 void* next_cmd =
505 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
506 static_cast<GLint>(13), static_cast<GLint>(14),
507 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
508 static_cast<GLenum>(17), static_cast<GLsizei>(18),
509 static_cast<uint32_t>(19), static_cast<uint32_t>(20));
510 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2D::kCmdId),
511 cmd.header.command);
512 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
513 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
514 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
515 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
516 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
517 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
518 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
519 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
520 EXPECT_EQ(static_cast<GLsizei>(18), cmd.imageSize);
521 EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id);
522 EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset);
523 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
526 TEST_F(GLES2FormatTest, CompressedTexImage3DBucket) {
527 cmds::CompressedTexImage3DBucket& cmd =
528 *GetBufferAs<cmds::CompressedTexImage3DBucket>();
529 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
530 static_cast<GLint>(12), static_cast<GLenum>(13),
531 static_cast<GLsizei>(14), static_cast<GLsizei>(15),
532 static_cast<GLsizei>(16), static_cast<GLuint>(17));
533 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage3DBucket::kCmdId),
534 cmd.header.command);
535 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
536 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
537 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
538 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
539 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
540 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
541 EXPECT_EQ(static_cast<GLsizei>(16), cmd.depth);
542 EXPECT_EQ(static_cast<GLuint>(17), cmd.bucket_id);
543 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
546 TEST_F(GLES2FormatTest, CompressedTexImage3D) {
547 cmds::CompressedTexImage3D& cmd = *GetBufferAs<cmds::CompressedTexImage3D>();
548 void* next_cmd =
549 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
550 static_cast<GLenum>(13), static_cast<GLsizei>(14),
551 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
552 static_cast<GLsizei>(17), static_cast<uint32_t>(18),
553 static_cast<uint32_t>(19));
554 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage3D::kCmdId),
555 cmd.header.command);
556 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
557 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
558 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
559 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
560 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
561 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
562 EXPECT_EQ(static_cast<GLsizei>(16), cmd.depth);
563 EXPECT_EQ(static_cast<GLsizei>(17), cmd.imageSize);
564 EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_id);
565 EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_offset);
566 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
569 TEST_F(GLES2FormatTest, CompressedTexSubImage3DBucket) {
570 cmds::CompressedTexSubImage3DBucket& cmd =
571 *GetBufferAs<cmds::CompressedTexSubImage3DBucket>();
572 void* next_cmd =
573 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
574 static_cast<GLint>(13), static_cast<GLint>(14),
575 static_cast<GLint>(15), static_cast<GLsizei>(16),
576 static_cast<GLsizei>(17), static_cast<GLsizei>(18),
577 static_cast<GLenum>(19), static_cast<GLuint>(20));
578 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage3DBucket::kCmdId),
579 cmd.header.command);
580 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
581 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
582 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
583 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
584 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
585 EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
586 EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
587 EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
588 EXPECT_EQ(static_cast<GLsizei>(18), cmd.depth);
589 EXPECT_EQ(static_cast<GLenum>(19), cmd.format);
590 EXPECT_EQ(static_cast<GLuint>(20), cmd.bucket_id);
591 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
594 TEST_F(GLES2FormatTest, CompressedTexSubImage3D) {
595 cmds::CompressedTexSubImage3D& cmd =
596 *GetBufferAs<cmds::CompressedTexSubImage3D>();
597 void* next_cmd =
598 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
599 static_cast<GLint>(13), static_cast<GLint>(14),
600 static_cast<GLint>(15), static_cast<GLsizei>(16),
601 static_cast<GLsizei>(17), static_cast<GLsizei>(18),
602 static_cast<GLenum>(19), static_cast<GLsizei>(20),
603 static_cast<uint32_t>(21), static_cast<uint32_t>(22));
604 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage3D::kCmdId),
605 cmd.header.command);
606 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
607 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
608 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
609 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
610 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
611 EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
612 EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
613 EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
614 EXPECT_EQ(static_cast<GLsizei>(18), cmd.depth);
615 EXPECT_EQ(static_cast<GLenum>(19), cmd.format);
616 EXPECT_EQ(static_cast<GLsizei>(20), cmd.imageSize);
617 EXPECT_EQ(static_cast<uint32_t>(21), cmd.data_shm_id);
618 EXPECT_EQ(static_cast<uint32_t>(22), cmd.data_shm_offset);
619 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
622 TEST_F(GLES2FormatTest, CopyBufferSubData) {
623 cmds::CopyBufferSubData& cmd = *GetBufferAs<cmds::CopyBufferSubData>();
624 void* next_cmd =
625 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
626 static_cast<GLintptr>(13), static_cast<GLintptr>(14),
627 static_cast<GLsizeiptr>(15));
628 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyBufferSubData::kCmdId),
629 cmd.header.command);
630 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
631 EXPECT_EQ(static_cast<GLenum>(11), cmd.readtarget);
632 EXPECT_EQ(static_cast<GLenum>(12), cmd.writetarget);
633 EXPECT_EQ(static_cast<GLintptr>(13), cmd.readoffset);
634 EXPECT_EQ(static_cast<GLintptr>(14), cmd.writeoffset);
635 EXPECT_EQ(static_cast<GLsizeiptr>(15), cmd.size);
636 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
639 TEST_F(GLES2FormatTest, CopyTexImage2D) {
640 cmds::CopyTexImage2D& cmd = *GetBufferAs<cmds::CopyTexImage2D>();
641 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
642 static_cast<GLint>(12), static_cast<GLenum>(13),
643 static_cast<GLint>(14), static_cast<GLint>(15),
644 static_cast<GLsizei>(16), static_cast<GLsizei>(17));
645 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexImage2D::kCmdId),
646 cmd.header.command);
647 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
648 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
649 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
650 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
651 EXPECT_EQ(static_cast<GLint>(14), cmd.x);
652 EXPECT_EQ(static_cast<GLint>(15), cmd.y);
653 EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
654 EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
655 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
658 TEST_F(GLES2FormatTest, CopyTexSubImage2D) {
659 cmds::CopyTexSubImage2D& cmd = *GetBufferAs<cmds::CopyTexSubImage2D>();
660 void* next_cmd =
661 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
662 static_cast<GLint>(13), static_cast<GLint>(14),
663 static_cast<GLint>(15), static_cast<GLint>(16),
664 static_cast<GLsizei>(17), static_cast<GLsizei>(18));
665 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage2D::kCmdId),
666 cmd.header.command);
667 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
668 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
669 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
670 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
671 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
672 EXPECT_EQ(static_cast<GLint>(15), cmd.x);
673 EXPECT_EQ(static_cast<GLint>(16), cmd.y);
674 EXPECT_EQ(static_cast<GLsizei>(17), cmd.width);
675 EXPECT_EQ(static_cast<GLsizei>(18), cmd.height);
676 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
679 TEST_F(GLES2FormatTest, CopyTexSubImage3D) {
680 cmds::CopyTexSubImage3D& cmd = *GetBufferAs<cmds::CopyTexSubImage3D>();
681 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
682 static_cast<GLint>(12), static_cast<GLint>(13),
683 static_cast<GLint>(14), static_cast<GLint>(15),
684 static_cast<GLint>(16), static_cast<GLint>(17),
685 static_cast<GLsizei>(18), static_cast<GLsizei>(19));
686 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage3D::kCmdId),
687 cmd.header.command);
688 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
689 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
690 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
691 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
692 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
693 EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
694 EXPECT_EQ(static_cast<GLint>(16), cmd.x);
695 EXPECT_EQ(static_cast<GLint>(17), cmd.y);
696 EXPECT_EQ(static_cast<GLsizei>(18), cmd.width);
697 EXPECT_EQ(static_cast<GLsizei>(19), cmd.height);
698 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
701 TEST_F(GLES2FormatTest, CreateProgram) {
702 cmds::CreateProgram& cmd = *GetBufferAs<cmds::CreateProgram>();
703 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
704 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateProgram::kCmdId),
705 cmd.header.command);
706 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
707 EXPECT_EQ(static_cast<uint32_t>(11), cmd.client_id);
708 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
711 TEST_F(GLES2FormatTest, CreateShader) {
712 cmds::CreateShader& cmd = *GetBufferAs<cmds::CreateShader>();
713 void* next_cmd =
714 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12));
715 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateShader::kCmdId),
716 cmd.header.command);
717 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
718 EXPECT_EQ(static_cast<GLenum>(11), cmd.type);
719 EXPECT_EQ(static_cast<uint32_t>(12), cmd.client_id);
720 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
723 TEST_F(GLES2FormatTest, CullFace) {
724 cmds::CullFace& cmd = *GetBufferAs<cmds::CullFace>();
725 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
726 EXPECT_EQ(static_cast<uint32_t>(cmds::CullFace::kCmdId), cmd.header.command);
727 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
728 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
729 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
732 TEST_F(GLES2FormatTest, DeleteBuffersImmediate) {
733 static GLuint ids[] = {
734 12, 23, 34,
736 cmds::DeleteBuffersImmediate& cmd =
737 *GetBufferAs<cmds::DeleteBuffersImmediate>();
738 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
739 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteBuffersImmediate::kCmdId),
740 cmd.header.command);
741 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
742 cmd.header.size * 4u);
743 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
744 CheckBytesWrittenMatchesExpectedSize(
745 next_cmd,
746 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
747 // TODO(gman): Check that ids were inserted;
750 TEST_F(GLES2FormatTest, DeleteFramebuffersImmediate) {
751 static GLuint ids[] = {
752 12, 23, 34,
754 cmds::DeleteFramebuffersImmediate& cmd =
755 *GetBufferAs<cmds::DeleteFramebuffersImmediate>();
756 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
757 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteFramebuffersImmediate::kCmdId),
758 cmd.header.command);
759 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
760 cmd.header.size * 4u);
761 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
762 CheckBytesWrittenMatchesExpectedSize(
763 next_cmd,
764 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
765 // TODO(gman): Check that ids were inserted;
768 TEST_F(GLES2FormatTest, DeleteProgram) {
769 cmds::DeleteProgram& cmd = *GetBufferAs<cmds::DeleteProgram>();
770 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
771 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteProgram::kCmdId),
772 cmd.header.command);
773 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
774 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
775 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
778 TEST_F(GLES2FormatTest, DeleteRenderbuffersImmediate) {
779 static GLuint ids[] = {
780 12, 23, 34,
782 cmds::DeleteRenderbuffersImmediate& cmd =
783 *GetBufferAs<cmds::DeleteRenderbuffersImmediate>();
784 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
785 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteRenderbuffersImmediate::kCmdId),
786 cmd.header.command);
787 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
788 cmd.header.size * 4u);
789 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
790 CheckBytesWrittenMatchesExpectedSize(
791 next_cmd,
792 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
793 // TODO(gman): Check that ids were inserted;
796 TEST_F(GLES2FormatTest, DeleteSamplersImmediate) {
797 static GLuint ids[] = {
798 12, 23, 34,
800 cmds::DeleteSamplersImmediate& cmd =
801 *GetBufferAs<cmds::DeleteSamplersImmediate>();
802 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
803 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSamplersImmediate::kCmdId),
804 cmd.header.command);
805 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
806 cmd.header.size * 4u);
807 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
808 CheckBytesWrittenMatchesExpectedSize(
809 next_cmd,
810 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
811 // TODO(gman): Check that ids were inserted;
814 TEST_F(GLES2FormatTest, DeleteSync) {
815 cmds::DeleteSync& cmd = *GetBufferAs<cmds::DeleteSync>();
816 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
817 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSync::kCmdId),
818 cmd.header.command);
819 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
820 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
821 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
824 TEST_F(GLES2FormatTest, DeleteShader) {
825 cmds::DeleteShader& cmd = *GetBufferAs<cmds::DeleteShader>();
826 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
827 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteShader::kCmdId),
828 cmd.header.command);
829 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
830 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
831 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
834 TEST_F(GLES2FormatTest, DeleteTexturesImmediate) {
835 static GLuint ids[] = {
836 12, 23, 34,
838 cmds::DeleteTexturesImmediate& cmd =
839 *GetBufferAs<cmds::DeleteTexturesImmediate>();
840 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
841 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteTexturesImmediate::kCmdId),
842 cmd.header.command);
843 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
844 cmd.header.size * 4u);
845 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
846 CheckBytesWrittenMatchesExpectedSize(
847 next_cmd,
848 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
849 // TODO(gman): Check that ids were inserted;
852 TEST_F(GLES2FormatTest, DeleteTransformFeedbacksImmediate) {
853 static GLuint ids[] = {
854 12, 23, 34,
856 cmds::DeleteTransformFeedbacksImmediate& cmd =
857 *GetBufferAs<cmds::DeleteTransformFeedbacksImmediate>();
858 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
859 EXPECT_EQ(
860 static_cast<uint32_t>(cmds::DeleteTransformFeedbacksImmediate::kCmdId),
861 cmd.header.command);
862 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
863 cmd.header.size * 4u);
864 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
865 CheckBytesWrittenMatchesExpectedSize(
866 next_cmd,
867 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
868 // TODO(gman): Check that ids were inserted;
871 TEST_F(GLES2FormatTest, DepthFunc) {
872 cmds::DepthFunc& cmd = *GetBufferAs<cmds::DepthFunc>();
873 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
874 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthFunc::kCmdId), cmd.header.command);
875 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
876 EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
877 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
880 TEST_F(GLES2FormatTest, DepthMask) {
881 cmds::DepthMask& cmd = *GetBufferAs<cmds::DepthMask>();
882 void* next_cmd = cmd.Set(&cmd, static_cast<GLboolean>(11));
883 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthMask::kCmdId), cmd.header.command);
884 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
885 EXPECT_EQ(static_cast<GLboolean>(11), cmd.flag);
886 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
889 TEST_F(GLES2FormatTest, DepthRangef) {
890 cmds::DepthRangef& cmd = *GetBufferAs<cmds::DepthRangef>();
891 void* next_cmd =
892 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12));
893 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthRangef::kCmdId),
894 cmd.header.command);
895 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
896 EXPECT_EQ(static_cast<GLclampf>(11), cmd.zNear);
897 EXPECT_EQ(static_cast<GLclampf>(12), cmd.zFar);
898 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
901 TEST_F(GLES2FormatTest, DetachShader) {
902 cmds::DetachShader& cmd = *GetBufferAs<cmds::DetachShader>();
903 void* next_cmd =
904 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
905 EXPECT_EQ(static_cast<uint32_t>(cmds::DetachShader::kCmdId),
906 cmd.header.command);
907 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
908 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
909 EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
910 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
913 TEST_F(GLES2FormatTest, Disable) {
914 cmds::Disable& cmd = *GetBufferAs<cmds::Disable>();
915 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
916 EXPECT_EQ(static_cast<uint32_t>(cmds::Disable::kCmdId), cmd.header.command);
917 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
918 EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
919 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
922 TEST_F(GLES2FormatTest, DisableVertexAttribArray) {
923 cmds::DisableVertexAttribArray& cmd =
924 *GetBufferAs<cmds::DisableVertexAttribArray>();
925 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
926 EXPECT_EQ(static_cast<uint32_t>(cmds::DisableVertexAttribArray::kCmdId),
927 cmd.header.command);
928 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
929 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
930 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
933 TEST_F(GLES2FormatTest, DrawArrays) {
934 cmds::DrawArrays& cmd = *GetBufferAs<cmds::DrawArrays>();
935 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
936 static_cast<GLint>(12), static_cast<GLsizei>(13));
937 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArrays::kCmdId),
938 cmd.header.command);
939 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
940 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
941 EXPECT_EQ(static_cast<GLint>(12), cmd.first);
942 EXPECT_EQ(static_cast<GLsizei>(13), cmd.count);
943 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
946 TEST_F(GLES2FormatTest, DrawElements) {
947 cmds::DrawElements& cmd = *GetBufferAs<cmds::DrawElements>();
948 void* next_cmd =
949 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizei>(12),
950 static_cast<GLenum>(13), static_cast<GLuint>(14));
951 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElements::kCmdId),
952 cmd.header.command);
953 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
954 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
955 EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
956 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
957 EXPECT_EQ(static_cast<GLuint>(14), cmd.index_offset);
958 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
961 TEST_F(GLES2FormatTest, Enable) {
962 cmds::Enable& cmd = *GetBufferAs<cmds::Enable>();
963 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
964 EXPECT_EQ(static_cast<uint32_t>(cmds::Enable::kCmdId), cmd.header.command);
965 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
966 EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
967 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
970 TEST_F(GLES2FormatTest, EnableVertexAttribArray) {
971 cmds::EnableVertexAttribArray& cmd =
972 *GetBufferAs<cmds::EnableVertexAttribArray>();
973 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
974 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableVertexAttribArray::kCmdId),
975 cmd.header.command);
976 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
977 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
978 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
981 TEST_F(GLES2FormatTest, FenceSync) {
982 cmds::FenceSync& cmd = *GetBufferAs<cmds::FenceSync>();
983 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
984 EXPECT_EQ(static_cast<uint32_t>(cmds::FenceSync::kCmdId), cmd.header.command);
985 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
986 EXPECT_EQ(static_cast<uint32_t>(11), cmd.client_id);
987 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
990 TEST_F(GLES2FormatTest, Finish) {
991 cmds::Finish& cmd = *GetBufferAs<cmds::Finish>();
992 void* next_cmd = cmd.Set(&cmd);
993 EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId), cmd.header.command);
994 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
995 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
998 TEST_F(GLES2FormatTest, Flush) {
999 cmds::Flush& cmd = *GetBufferAs<cmds::Flush>();
1000 void* next_cmd = cmd.Set(&cmd);
1001 EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId), cmd.header.command);
1002 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1003 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1006 TEST_F(GLES2FormatTest, FramebufferRenderbuffer) {
1007 cmds::FramebufferRenderbuffer& cmd =
1008 *GetBufferAs<cmds::FramebufferRenderbuffer>();
1009 void* next_cmd =
1010 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1011 static_cast<GLenum>(13), static_cast<GLuint>(14));
1012 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferRenderbuffer::kCmdId),
1013 cmd.header.command);
1014 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1015 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1016 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
1017 EXPECT_EQ(static_cast<GLenum>(13), cmd.renderbuffertarget);
1018 EXPECT_EQ(static_cast<GLuint>(14), cmd.renderbuffer);
1019 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1022 TEST_F(GLES2FormatTest, FramebufferTexture2D) {
1023 cmds::FramebufferTexture2D& cmd = *GetBufferAs<cmds::FramebufferTexture2D>();
1024 void* next_cmd =
1025 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1026 static_cast<GLenum>(13), static_cast<GLuint>(14));
1027 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTexture2D::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.attachment);
1032 EXPECT_EQ(static_cast<GLenum>(13), cmd.textarget);
1033 EXPECT_EQ(static_cast<GLuint>(14), cmd.texture);
1034 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1037 TEST_F(GLES2FormatTest, FramebufferTextureLayer) {
1038 cmds::FramebufferTextureLayer& cmd =
1039 *GetBufferAs<cmds::FramebufferTextureLayer>();
1040 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
1041 static_cast<GLenum>(12), static_cast<GLuint>(13),
1042 static_cast<GLint>(14), static_cast<GLint>(15));
1043 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTextureLayer::kCmdId),
1044 cmd.header.command);
1045 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1046 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1047 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
1048 EXPECT_EQ(static_cast<GLuint>(13), cmd.texture);
1049 EXPECT_EQ(static_cast<GLint>(14), cmd.level);
1050 EXPECT_EQ(static_cast<GLint>(15), cmd.layer);
1051 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1054 TEST_F(GLES2FormatTest, FrontFace) {
1055 cmds::FrontFace& cmd = *GetBufferAs<cmds::FrontFace>();
1056 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
1057 EXPECT_EQ(static_cast<uint32_t>(cmds::FrontFace::kCmdId), cmd.header.command);
1058 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1059 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
1060 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1063 TEST_F(GLES2FormatTest, GenBuffersImmediate) {
1064 static GLuint ids[] = {
1065 12, 23, 34,
1067 cmds::GenBuffersImmediate& cmd = *GetBufferAs<cmds::GenBuffersImmediate>();
1068 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
1069 EXPECT_EQ(static_cast<uint32_t>(cmds::GenBuffersImmediate::kCmdId),
1070 cmd.header.command);
1071 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
1072 cmd.header.size * 4u);
1073 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
1074 CheckBytesWrittenMatchesExpectedSize(
1075 next_cmd,
1076 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
1077 // TODO(gman): Check that ids were inserted;
1080 TEST_F(GLES2FormatTest, GenerateMipmap) {
1081 cmds::GenerateMipmap& cmd = *GetBufferAs<cmds::GenerateMipmap>();
1082 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
1083 EXPECT_EQ(static_cast<uint32_t>(cmds::GenerateMipmap::kCmdId),
1084 cmd.header.command);
1085 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1086 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1087 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1090 TEST_F(GLES2FormatTest, GenFramebuffersImmediate) {
1091 static GLuint ids[] = {
1092 12, 23, 34,
1094 cmds::GenFramebuffersImmediate& cmd =
1095 *GetBufferAs<cmds::GenFramebuffersImmediate>();
1096 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
1097 EXPECT_EQ(static_cast<uint32_t>(cmds::GenFramebuffersImmediate::kCmdId),
1098 cmd.header.command);
1099 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
1100 cmd.header.size * 4u);
1101 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
1102 CheckBytesWrittenMatchesExpectedSize(
1103 next_cmd,
1104 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
1105 // TODO(gman): Check that ids were inserted;
1108 TEST_F(GLES2FormatTest, GenRenderbuffersImmediate) {
1109 static GLuint ids[] = {
1110 12, 23, 34,
1112 cmds::GenRenderbuffersImmediate& cmd =
1113 *GetBufferAs<cmds::GenRenderbuffersImmediate>();
1114 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
1115 EXPECT_EQ(static_cast<uint32_t>(cmds::GenRenderbuffersImmediate::kCmdId),
1116 cmd.header.command);
1117 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
1118 cmd.header.size * 4u);
1119 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
1120 CheckBytesWrittenMatchesExpectedSize(
1121 next_cmd,
1122 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
1123 // TODO(gman): Check that ids were inserted;
1126 TEST_F(GLES2FormatTest, GenSamplersImmediate) {
1127 static GLuint ids[] = {
1128 12, 23, 34,
1130 cmds::GenSamplersImmediate& cmd = *GetBufferAs<cmds::GenSamplersImmediate>();
1131 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
1132 EXPECT_EQ(static_cast<uint32_t>(cmds::GenSamplersImmediate::kCmdId),
1133 cmd.header.command);
1134 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
1135 cmd.header.size * 4u);
1136 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
1137 CheckBytesWrittenMatchesExpectedSize(
1138 next_cmd,
1139 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
1140 // TODO(gman): Check that ids were inserted;
1143 TEST_F(GLES2FormatTest, GenTexturesImmediate) {
1144 static GLuint ids[] = {
1145 12, 23, 34,
1147 cmds::GenTexturesImmediate& cmd = *GetBufferAs<cmds::GenTexturesImmediate>();
1148 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
1149 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTexturesImmediate::kCmdId),
1150 cmd.header.command);
1151 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
1152 cmd.header.size * 4u);
1153 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
1154 CheckBytesWrittenMatchesExpectedSize(
1155 next_cmd,
1156 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
1157 // TODO(gman): Check that ids were inserted;
1160 TEST_F(GLES2FormatTest, GenTransformFeedbacksImmediate) {
1161 static GLuint ids[] = {
1162 12, 23, 34,
1164 cmds::GenTransformFeedbacksImmediate& cmd =
1165 *GetBufferAs<cmds::GenTransformFeedbacksImmediate>();
1166 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
1167 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTransformFeedbacksImmediate::kCmdId),
1168 cmd.header.command);
1169 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
1170 cmd.header.size * 4u);
1171 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
1172 CheckBytesWrittenMatchesExpectedSize(
1173 next_cmd,
1174 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
1175 // TODO(gman): Check that ids were inserted;
1178 TEST_F(GLES2FormatTest, GetActiveAttrib) {
1179 cmds::GetActiveAttrib& cmd = *GetBufferAs<cmds::GetActiveAttrib>();
1180 void* next_cmd =
1181 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
1182 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1183 static_cast<uint32_t>(15));
1184 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveAttrib::kCmdId),
1185 cmd.header.command);
1186 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1187 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1188 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1189 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
1190 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
1191 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
1192 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1195 TEST_F(GLES2FormatTest, GetActiveUniform) {
1196 cmds::GetActiveUniform& cmd = *GetBufferAs<cmds::GetActiveUniform>();
1197 void* next_cmd =
1198 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
1199 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1200 static_cast<uint32_t>(15));
1201 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniform::kCmdId),
1202 cmd.header.command);
1203 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1204 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1205 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1206 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
1207 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
1208 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
1209 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1212 TEST_F(GLES2FormatTest, GetActiveUniformBlockiv) {
1213 cmds::GetActiveUniformBlockiv& cmd =
1214 *GetBufferAs<cmds::GetActiveUniformBlockiv>();
1215 void* next_cmd =
1216 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
1217 static_cast<GLenum>(13), static_cast<uint32_t>(14),
1218 static_cast<uint32_t>(15));
1219 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockiv::kCmdId),
1220 cmd.header.command);
1221 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1222 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1223 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1224 EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
1225 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
1226 EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
1227 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1230 TEST_F(GLES2FormatTest, GetActiveUniformBlockName) {
1231 cmds::GetActiveUniformBlockName& cmd =
1232 *GetBufferAs<cmds::GetActiveUniformBlockName>();
1233 void* next_cmd =
1234 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
1235 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1236 static_cast<uint32_t>(15));
1237 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockName::kCmdId),
1238 cmd.header.command);
1239 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1240 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1241 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1242 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
1243 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
1244 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
1245 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1248 TEST_F(GLES2FormatTest, GetActiveUniformsiv) {
1249 cmds::GetActiveUniformsiv& cmd = *GetBufferAs<cmds::GetActiveUniformsiv>();
1250 void* next_cmd =
1251 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1252 static_cast<GLenum>(13), static_cast<uint32_t>(14),
1253 static_cast<uint32_t>(15));
1254 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformsiv::kCmdId),
1255 cmd.header.command);
1256 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1257 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1258 EXPECT_EQ(static_cast<uint32_t>(12), cmd.indices_bucket_id);
1259 EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
1260 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
1261 EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
1262 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1265 TEST_F(GLES2FormatTest, GetAttachedShaders) {
1266 cmds::GetAttachedShaders& cmd = *GetBufferAs<cmds::GetAttachedShaders>();
1267 void* next_cmd =
1268 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1269 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1270 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttachedShaders::kCmdId),
1271 cmd.header.command);
1272 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1273 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1274 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1275 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1276 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_size);
1277 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1280 TEST_F(GLES2FormatTest, GetAttribLocation) {
1281 cmds::GetAttribLocation& cmd = *GetBufferAs<cmds::GetAttribLocation>();
1282 void* next_cmd =
1283 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1284 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1285 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttribLocation::kCmdId),
1286 cmd.header.command);
1287 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1288 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1289 EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
1290 EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
1291 EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
1292 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1295 TEST_F(GLES2FormatTest, GetBooleanv) {
1296 cmds::GetBooleanv& cmd = *GetBufferAs<cmds::GetBooleanv>();
1297 void* next_cmd =
1298 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
1299 static_cast<uint32_t>(13));
1300 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBooleanv::kCmdId),
1301 cmd.header.command);
1302 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1303 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1304 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
1305 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
1306 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1309 TEST_F(GLES2FormatTest, GetBufferParameteriv) {
1310 cmds::GetBufferParameteriv& cmd = *GetBufferAs<cmds::GetBufferParameteriv>();
1311 void* next_cmd =
1312 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1313 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1314 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteriv::kCmdId),
1315 cmd.header.command);
1316 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1317 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1318 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1319 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1320 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1321 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1324 TEST_F(GLES2FormatTest, GetError) {
1325 cmds::GetError& cmd = *GetBufferAs<cmds::GetError>();
1326 void* next_cmd =
1327 cmd.Set(&cmd, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
1328 EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId), cmd.header.command);
1329 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1330 EXPECT_EQ(static_cast<uint32_t>(11), cmd.result_shm_id);
1331 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_offset);
1332 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1335 TEST_F(GLES2FormatTest, GetFloatv) {
1336 cmds::GetFloatv& cmd = *GetBufferAs<cmds::GetFloatv>();
1337 void* next_cmd =
1338 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
1339 static_cast<uint32_t>(13));
1340 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFloatv::kCmdId), cmd.header.command);
1341 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1342 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1343 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
1344 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
1345 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1348 TEST_F(GLES2FormatTest, GetFragDataLocation) {
1349 cmds::GetFragDataLocation& cmd = *GetBufferAs<cmds::GetFragDataLocation>();
1350 void* next_cmd =
1351 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1352 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1353 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFragDataLocation::kCmdId),
1354 cmd.header.command);
1355 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1356 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1357 EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
1358 EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
1359 EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
1360 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1363 TEST_F(GLES2FormatTest, GetFramebufferAttachmentParameteriv) {
1364 cmds::GetFramebufferAttachmentParameteriv& cmd =
1365 *GetBufferAs<cmds::GetFramebufferAttachmentParameteriv>();
1366 void* next_cmd =
1367 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1368 static_cast<GLenum>(13), static_cast<uint32_t>(14),
1369 static_cast<uint32_t>(15));
1370 EXPECT_EQ(
1371 static_cast<uint32_t>(cmds::GetFramebufferAttachmentParameteriv::kCmdId),
1372 cmd.header.command);
1373 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1374 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1375 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
1376 EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
1377 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
1378 EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
1379 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1382 TEST_F(GLES2FormatTest, GetInteger64v) {
1383 cmds::GetInteger64v& cmd = *GetBufferAs<cmds::GetInteger64v>();
1384 void* next_cmd =
1385 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
1386 static_cast<uint32_t>(13));
1387 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInteger64v::kCmdId),
1388 cmd.header.command);
1389 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1390 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1391 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
1392 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
1393 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1396 TEST_F(GLES2FormatTest, GetIntegeri_v) {
1397 cmds::GetIntegeri_v& cmd = *GetBufferAs<cmds::GetIntegeri_v>();
1398 void* next_cmd =
1399 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
1400 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1401 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegeri_v::kCmdId),
1402 cmd.header.command);
1403 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1404 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1405 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1406 EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
1407 EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
1408 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1411 TEST_F(GLES2FormatTest, GetInteger64i_v) {
1412 cmds::GetInteger64i_v& cmd = *GetBufferAs<cmds::GetInteger64i_v>();
1413 void* next_cmd =
1414 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
1415 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1416 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInteger64i_v::kCmdId),
1417 cmd.header.command);
1418 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1419 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1420 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1421 EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
1422 EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
1423 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1426 TEST_F(GLES2FormatTest, GetIntegerv) {
1427 cmds::GetIntegerv& cmd = *GetBufferAs<cmds::GetIntegerv>();
1428 void* next_cmd =
1429 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
1430 static_cast<uint32_t>(13));
1431 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegerv::kCmdId),
1432 cmd.header.command);
1433 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1434 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
1435 EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
1436 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
1437 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1440 TEST_F(GLES2FormatTest, GetInternalformativ) {
1441 cmds::GetInternalformativ& cmd = *GetBufferAs<cmds::GetInternalformativ>();
1442 void* next_cmd =
1443 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1444 static_cast<GLenum>(13), static_cast<GLsizei>(14),
1445 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
1446 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInternalformativ::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.format);
1451 EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
1452 EXPECT_EQ(static_cast<GLsizei>(14), cmd.bufSize);
1453 EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_id);
1454 EXPECT_EQ(static_cast<uint32_t>(16), cmd.params_shm_offset);
1455 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1458 TEST_F(GLES2FormatTest, GetProgramiv) {
1459 cmds::GetProgramiv& cmd = *GetBufferAs<cmds::GetProgramiv>();
1460 void* next_cmd =
1461 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1462 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1463 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramiv::kCmdId),
1464 cmd.header.command);
1465 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1466 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1467 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1468 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1469 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1470 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1473 TEST_F(GLES2FormatTest, GetProgramInfoLog) {
1474 cmds::GetProgramInfoLog& cmd = *GetBufferAs<cmds::GetProgramInfoLog>();
1475 void* next_cmd =
1476 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
1477 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoLog::kCmdId),
1478 cmd.header.command);
1479 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1480 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1481 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
1482 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1485 TEST_F(GLES2FormatTest, GetRenderbufferParameteriv) {
1486 cmds::GetRenderbufferParameteriv& cmd =
1487 *GetBufferAs<cmds::GetRenderbufferParameteriv>();
1488 void* next_cmd =
1489 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1490 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1491 EXPECT_EQ(static_cast<uint32_t>(cmds::GetRenderbufferParameteriv::kCmdId),
1492 cmd.header.command);
1493 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1494 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1495 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1496 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1497 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1498 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1501 TEST_F(GLES2FormatTest, GetSamplerParameterfv) {
1502 cmds::GetSamplerParameterfv& cmd =
1503 *GetBufferAs<cmds::GetSamplerParameterfv>();
1504 void* next_cmd =
1505 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1506 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1507 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameterfv::kCmdId),
1508 cmd.header.command);
1509 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1510 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
1511 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1512 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1513 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1514 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1517 TEST_F(GLES2FormatTest, GetSamplerParameteriv) {
1518 cmds::GetSamplerParameteriv& cmd =
1519 *GetBufferAs<cmds::GetSamplerParameteriv>();
1520 void* next_cmd =
1521 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1522 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1523 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameteriv::kCmdId),
1524 cmd.header.command);
1525 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1526 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
1527 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1528 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1529 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1530 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1533 TEST_F(GLES2FormatTest, GetShaderiv) {
1534 cmds::GetShaderiv& cmd = *GetBufferAs<cmds::GetShaderiv>();
1535 void* next_cmd =
1536 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1537 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1538 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderiv::kCmdId),
1539 cmd.header.command);
1540 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1541 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1542 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1543 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1544 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1545 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1548 TEST_F(GLES2FormatTest, GetShaderInfoLog) {
1549 cmds::GetShaderInfoLog& cmd = *GetBufferAs<cmds::GetShaderInfoLog>();
1550 void* next_cmd =
1551 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
1552 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderInfoLog::kCmdId),
1553 cmd.header.command);
1554 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1555 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1556 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
1557 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1560 TEST_F(GLES2FormatTest, GetShaderPrecisionFormat) {
1561 cmds::GetShaderPrecisionFormat& cmd =
1562 *GetBufferAs<cmds::GetShaderPrecisionFormat>();
1563 void* next_cmd =
1564 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1565 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1566 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderPrecisionFormat::kCmdId),
1567 cmd.header.command);
1568 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1569 EXPECT_EQ(static_cast<GLenum>(11), cmd.shadertype);
1570 EXPECT_EQ(static_cast<GLenum>(12), cmd.precisiontype);
1571 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_id);
1572 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_offset);
1573 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1576 TEST_F(GLES2FormatTest, GetShaderSource) {
1577 cmds::GetShaderSource& cmd = *GetBufferAs<cmds::GetShaderSource>();
1578 void* next_cmd =
1579 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
1580 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderSource::kCmdId),
1581 cmd.header.command);
1582 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1583 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1584 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
1585 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1588 TEST_F(GLES2FormatTest, GetString) {
1589 cmds::GetString& cmd = *GetBufferAs<cmds::GetString>();
1590 void* next_cmd =
1591 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12));
1592 EXPECT_EQ(static_cast<uint32_t>(cmds::GetString::kCmdId), cmd.header.command);
1593 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1594 EXPECT_EQ(static_cast<GLenum>(11), cmd.name);
1595 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
1596 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1599 TEST_F(GLES2FormatTest, GetSynciv) {
1600 cmds::GetSynciv& cmd = *GetBufferAs<cmds::GetSynciv>();
1601 void* next_cmd =
1602 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1603 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1604 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSynciv::kCmdId), cmd.header.command);
1605 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1606 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
1607 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1608 EXPECT_EQ(static_cast<uint32_t>(13), cmd.values_shm_id);
1609 EXPECT_EQ(static_cast<uint32_t>(14), cmd.values_shm_offset);
1610 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1613 TEST_F(GLES2FormatTest, GetTexParameterfv) {
1614 cmds::GetTexParameterfv& cmd = *GetBufferAs<cmds::GetTexParameterfv>();
1615 void* next_cmd =
1616 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1617 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1618 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameterfv::kCmdId),
1619 cmd.header.command);
1620 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1621 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1622 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1623 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1624 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1625 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1628 TEST_F(GLES2FormatTest, GetTexParameteriv) {
1629 cmds::GetTexParameteriv& cmd = *GetBufferAs<cmds::GetTexParameteriv>();
1630 void* next_cmd =
1631 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
1632 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1633 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameteriv::kCmdId),
1634 cmd.header.command);
1635 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1636 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1637 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1638 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1639 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1640 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1643 TEST_F(GLES2FormatTest, GetTransformFeedbackVarying) {
1644 cmds::GetTransformFeedbackVarying& cmd =
1645 *GetBufferAs<cmds::GetTransformFeedbackVarying>();
1646 void* next_cmd =
1647 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
1648 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1649 static_cast<uint32_t>(15));
1650 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTransformFeedbackVarying::kCmdId),
1651 cmd.header.command);
1652 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1653 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1654 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
1655 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
1656 EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
1657 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
1658 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1661 TEST_F(GLES2FormatTest, GetUniformBlockIndex) {
1662 cmds::GetUniformBlockIndex& cmd = *GetBufferAs<cmds::GetUniformBlockIndex>();
1663 void* next_cmd =
1664 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1665 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1666 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlockIndex::kCmdId),
1667 cmd.header.command);
1668 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1669 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1670 EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
1671 EXPECT_EQ(static_cast<uint32_t>(13), cmd.index_shm_id);
1672 EXPECT_EQ(static_cast<uint32_t>(14), cmd.index_shm_offset);
1673 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1676 TEST_F(GLES2FormatTest, GetUniformfv) {
1677 cmds::GetUniformfv& cmd = *GetBufferAs<cmds::GetUniformfv>();
1678 void* next_cmd =
1679 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
1680 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1681 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformfv::kCmdId),
1682 cmd.header.command);
1683 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1684 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1685 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
1686 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1687 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1688 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1691 TEST_F(GLES2FormatTest, GetUniformiv) {
1692 cmds::GetUniformiv& cmd = *GetBufferAs<cmds::GetUniformiv>();
1693 void* next_cmd =
1694 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
1695 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1696 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformiv::kCmdId),
1697 cmd.header.command);
1698 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1699 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1700 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
1701 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1702 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1703 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1706 TEST_F(GLES2FormatTest, GetUniformuiv) {
1707 cmds::GetUniformuiv& cmd = *GetBufferAs<cmds::GetUniformuiv>();
1708 void* next_cmd =
1709 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
1710 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1711 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformuiv::kCmdId),
1712 cmd.header.command);
1713 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1714 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1715 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
1716 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1717 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1718 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1721 TEST_F(GLES2FormatTest, GetUniformIndices) {
1722 cmds::GetUniformIndices& cmd = *GetBufferAs<cmds::GetUniformIndices>();
1723 void* next_cmd =
1724 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1725 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1726 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformIndices::kCmdId),
1727 cmd.header.command);
1728 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1729 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1730 EXPECT_EQ(static_cast<uint32_t>(12), cmd.names_bucket_id);
1731 EXPECT_EQ(static_cast<uint32_t>(13), cmd.indices_shm_id);
1732 EXPECT_EQ(static_cast<uint32_t>(14), cmd.indices_shm_offset);
1733 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1736 TEST_F(GLES2FormatTest, GetUniformLocation) {
1737 cmds::GetUniformLocation& cmd = *GetBufferAs<cmds::GetUniformLocation>();
1738 void* next_cmd =
1739 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1740 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1741 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformLocation::kCmdId),
1742 cmd.header.command);
1743 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1744 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1745 EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
1746 EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
1747 EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
1748 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1751 TEST_F(GLES2FormatTest, GetVertexAttribfv) {
1752 cmds::GetVertexAttribfv& cmd = *GetBufferAs<cmds::GetVertexAttribfv>();
1753 void* next_cmd =
1754 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1755 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1756 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribfv::kCmdId),
1757 cmd.header.command);
1758 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1759 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1760 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1761 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1762 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1763 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1766 TEST_F(GLES2FormatTest, GetVertexAttribiv) {
1767 cmds::GetVertexAttribiv& cmd = *GetBufferAs<cmds::GetVertexAttribiv>();
1768 void* next_cmd =
1769 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1770 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1771 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribiv::kCmdId),
1772 cmd.header.command);
1773 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1774 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1775 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1776 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1777 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1778 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1781 TEST_F(GLES2FormatTest, GetVertexAttribIiv) {
1782 cmds::GetVertexAttribIiv& cmd = *GetBufferAs<cmds::GetVertexAttribIiv>();
1783 void* next_cmd =
1784 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1785 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1786 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIiv::kCmdId),
1787 cmd.header.command);
1788 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1789 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1790 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1791 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1792 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1793 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1796 TEST_F(GLES2FormatTest, GetVertexAttribIuiv) {
1797 cmds::GetVertexAttribIuiv& cmd = *GetBufferAs<cmds::GetVertexAttribIuiv>();
1798 void* next_cmd =
1799 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1800 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1801 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIuiv::kCmdId),
1802 cmd.header.command);
1803 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1804 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1805 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1806 EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
1807 EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
1808 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1811 TEST_F(GLES2FormatTest, GetVertexAttribPointerv) {
1812 cmds::GetVertexAttribPointerv& cmd =
1813 *GetBufferAs<cmds::GetVertexAttribPointerv>();
1814 void* next_cmd =
1815 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
1816 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1817 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribPointerv::kCmdId),
1818 cmd.header.command);
1819 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1820 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
1821 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
1822 EXPECT_EQ(static_cast<uint32_t>(13), cmd.pointer_shm_id);
1823 EXPECT_EQ(static_cast<uint32_t>(14), cmd.pointer_shm_offset);
1824 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1827 TEST_F(GLES2FormatTest, Hint) {
1828 cmds::Hint& cmd = *GetBufferAs<cmds::Hint>();
1829 void* next_cmd =
1830 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
1831 EXPECT_EQ(static_cast<uint32_t>(cmds::Hint::kCmdId), cmd.header.command);
1832 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1833 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
1834 EXPECT_EQ(static_cast<GLenum>(12), cmd.mode);
1835 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1838 TEST_F(GLES2FormatTest, InvalidateFramebufferImmediate) {
1839 const int kSomeBaseValueToTestWith = 51;
1840 static GLenum data[] = {
1841 static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
1842 static_cast<GLenum>(kSomeBaseValueToTestWith + 1),
1844 cmds::InvalidateFramebufferImmediate& cmd =
1845 *GetBufferAs<cmds::InvalidateFramebufferImmediate>();
1846 const GLsizei kNumElements = 2;
1847 const size_t kExpectedCmdSize =
1848 sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
1849 void* next_cmd =
1850 cmd.Set(&cmd, static_cast<GLenum>(1), static_cast<GLsizei>(2), data);
1851 EXPECT_EQ(static_cast<uint32_t>(cmds::InvalidateFramebufferImmediate::kCmdId),
1852 cmd.header.command);
1853 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1854 EXPECT_EQ(static_cast<GLenum>(1), cmd.target);
1855 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1856 CheckBytesWrittenMatchesExpectedSize(
1857 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1858 // TODO(gman): Check that data was inserted;
1861 TEST_F(GLES2FormatTest, InvalidateSubFramebufferImmediate) {
1862 const int kSomeBaseValueToTestWith = 51;
1863 static GLenum data[] = {
1864 static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
1865 static_cast<GLenum>(kSomeBaseValueToTestWith + 1),
1867 cmds::InvalidateSubFramebufferImmediate& cmd =
1868 *GetBufferAs<cmds::InvalidateSubFramebufferImmediate>();
1869 const GLsizei kNumElements = 2;
1870 const size_t kExpectedCmdSize =
1871 sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
1872 void* next_cmd =
1873 cmd.Set(&cmd, static_cast<GLenum>(1), static_cast<GLsizei>(2), data,
1874 static_cast<GLint>(4), static_cast<GLint>(5),
1875 static_cast<GLsizei>(6), static_cast<GLsizei>(7));
1876 EXPECT_EQ(
1877 static_cast<uint32_t>(cmds::InvalidateSubFramebufferImmediate::kCmdId),
1878 cmd.header.command);
1879 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
1880 EXPECT_EQ(static_cast<GLenum>(1), cmd.target);
1881 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
1882 EXPECT_EQ(static_cast<GLint>(4), cmd.x);
1883 EXPECT_EQ(static_cast<GLint>(5), cmd.y);
1884 EXPECT_EQ(static_cast<GLsizei>(6), cmd.width);
1885 EXPECT_EQ(static_cast<GLsizei>(7), cmd.height);
1886 CheckBytesWrittenMatchesExpectedSize(
1887 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
1888 // TODO(gman): Check that data was inserted;
1891 TEST_F(GLES2FormatTest, IsBuffer) {
1892 cmds::IsBuffer& cmd = *GetBufferAs<cmds::IsBuffer>();
1893 void* next_cmd =
1894 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1895 static_cast<uint32_t>(13));
1896 EXPECT_EQ(static_cast<uint32_t>(cmds::IsBuffer::kCmdId), cmd.header.command);
1897 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1898 EXPECT_EQ(static_cast<GLuint>(11), cmd.buffer);
1899 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1900 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1901 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1904 TEST_F(GLES2FormatTest, IsEnabled) {
1905 cmds::IsEnabled& cmd = *GetBufferAs<cmds::IsEnabled>();
1906 void* next_cmd =
1907 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
1908 static_cast<uint32_t>(13));
1909 EXPECT_EQ(static_cast<uint32_t>(cmds::IsEnabled::kCmdId), cmd.header.command);
1910 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1911 EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
1912 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1913 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1914 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1917 TEST_F(GLES2FormatTest, IsFramebuffer) {
1918 cmds::IsFramebuffer& cmd = *GetBufferAs<cmds::IsFramebuffer>();
1919 void* next_cmd =
1920 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1921 static_cast<uint32_t>(13));
1922 EXPECT_EQ(static_cast<uint32_t>(cmds::IsFramebuffer::kCmdId),
1923 cmd.header.command);
1924 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1925 EXPECT_EQ(static_cast<GLuint>(11), cmd.framebuffer);
1926 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1927 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1928 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1931 TEST_F(GLES2FormatTest, IsProgram) {
1932 cmds::IsProgram& cmd = *GetBufferAs<cmds::IsProgram>();
1933 void* next_cmd =
1934 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1935 static_cast<uint32_t>(13));
1936 EXPECT_EQ(static_cast<uint32_t>(cmds::IsProgram::kCmdId), cmd.header.command);
1937 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1938 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
1939 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1940 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1941 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1944 TEST_F(GLES2FormatTest, IsRenderbuffer) {
1945 cmds::IsRenderbuffer& cmd = *GetBufferAs<cmds::IsRenderbuffer>();
1946 void* next_cmd =
1947 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1948 static_cast<uint32_t>(13));
1949 EXPECT_EQ(static_cast<uint32_t>(cmds::IsRenderbuffer::kCmdId),
1950 cmd.header.command);
1951 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1952 EXPECT_EQ(static_cast<GLuint>(11), cmd.renderbuffer);
1953 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1954 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1955 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1958 TEST_F(GLES2FormatTest, IsSampler) {
1959 cmds::IsSampler& cmd = *GetBufferAs<cmds::IsSampler>();
1960 void* next_cmd =
1961 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1962 static_cast<uint32_t>(13));
1963 EXPECT_EQ(static_cast<uint32_t>(cmds::IsSampler::kCmdId), cmd.header.command);
1964 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1965 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
1966 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1967 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1968 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1971 TEST_F(GLES2FormatTest, IsShader) {
1972 cmds::IsShader& cmd = *GetBufferAs<cmds::IsShader>();
1973 void* next_cmd =
1974 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1975 static_cast<uint32_t>(13));
1976 EXPECT_EQ(static_cast<uint32_t>(cmds::IsShader::kCmdId), cmd.header.command);
1977 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1978 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
1979 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1980 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1981 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1984 TEST_F(GLES2FormatTest, IsSync) {
1985 cmds::IsSync& cmd = *GetBufferAs<cmds::IsSync>();
1986 void* next_cmd =
1987 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
1988 static_cast<uint32_t>(13));
1989 EXPECT_EQ(static_cast<uint32_t>(cmds::IsSync::kCmdId), cmd.header.command);
1990 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
1991 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
1992 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
1993 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
1994 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
1997 TEST_F(GLES2FormatTest, IsTexture) {
1998 cmds::IsTexture& cmd = *GetBufferAs<cmds::IsTexture>();
1999 void* next_cmd =
2000 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
2001 static_cast<uint32_t>(13));
2002 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTexture::kCmdId), cmd.header.command);
2003 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2004 EXPECT_EQ(static_cast<GLuint>(11), cmd.texture);
2005 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
2006 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
2007 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2010 TEST_F(GLES2FormatTest, IsTransformFeedback) {
2011 cmds::IsTransformFeedback& cmd = *GetBufferAs<cmds::IsTransformFeedback>();
2012 void* next_cmd =
2013 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
2014 static_cast<uint32_t>(13));
2015 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTransformFeedback::kCmdId),
2016 cmd.header.command);
2017 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2018 EXPECT_EQ(static_cast<GLuint>(11), cmd.transformfeedback);
2019 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
2020 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
2021 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2024 TEST_F(GLES2FormatTest, LineWidth) {
2025 cmds::LineWidth& cmd = *GetBufferAs<cmds::LineWidth>();
2026 void* next_cmd = cmd.Set(&cmd, static_cast<GLfloat>(11));
2027 EXPECT_EQ(static_cast<uint32_t>(cmds::LineWidth::kCmdId), cmd.header.command);
2028 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2029 EXPECT_EQ(static_cast<GLfloat>(11), cmd.width);
2030 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2033 TEST_F(GLES2FormatTest, LinkProgram) {
2034 cmds::LinkProgram& cmd = *GetBufferAs<cmds::LinkProgram>();
2035 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2036 EXPECT_EQ(static_cast<uint32_t>(cmds::LinkProgram::kCmdId),
2037 cmd.header.command);
2038 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2039 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
2040 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2043 TEST_F(GLES2FormatTest, PauseTransformFeedback) {
2044 cmds::PauseTransformFeedback& cmd =
2045 *GetBufferAs<cmds::PauseTransformFeedback>();
2046 void* next_cmd = cmd.Set(&cmd);
2047 EXPECT_EQ(static_cast<uint32_t>(cmds::PauseTransformFeedback::kCmdId),
2048 cmd.header.command);
2049 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2050 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2053 TEST_F(GLES2FormatTest, PixelStorei) {
2054 cmds::PixelStorei& cmd = *GetBufferAs<cmds::PixelStorei>();
2055 void* next_cmd =
2056 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12));
2057 EXPECT_EQ(static_cast<uint32_t>(cmds::PixelStorei::kCmdId),
2058 cmd.header.command);
2059 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2060 EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
2061 EXPECT_EQ(static_cast<GLint>(12), cmd.param);
2062 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2065 TEST_F(GLES2FormatTest, PolygonOffset) {
2066 cmds::PolygonOffset& cmd = *GetBufferAs<cmds::PolygonOffset>();
2067 void* next_cmd =
2068 cmd.Set(&cmd, static_cast<GLfloat>(11), static_cast<GLfloat>(12));
2069 EXPECT_EQ(static_cast<uint32_t>(cmds::PolygonOffset::kCmdId),
2070 cmd.header.command);
2071 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2072 EXPECT_EQ(static_cast<GLfloat>(11), cmd.factor);
2073 EXPECT_EQ(static_cast<GLfloat>(12), cmd.units);
2074 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2077 TEST_F(GLES2FormatTest, ReadBuffer) {
2078 cmds::ReadBuffer& cmd = *GetBufferAs<cmds::ReadBuffer>();
2079 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
2080 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadBuffer::kCmdId),
2081 cmd.header.command);
2082 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2083 EXPECT_EQ(static_cast<GLenum>(11), cmd.src);
2084 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2087 TEST_F(GLES2FormatTest, ReadPixels) {
2088 cmds::ReadPixels& cmd = *GetBufferAs<cmds::ReadPixels>();
2089 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2090 static_cast<GLsizei>(13), static_cast<GLsizei>(14),
2091 static_cast<GLenum>(15), static_cast<GLenum>(16),
2092 static_cast<uint32_t>(17), static_cast<uint32_t>(18),
2093 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
2094 static_cast<GLboolean>(21));
2095 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadPixels::kCmdId),
2096 cmd.header.command);
2097 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2098 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
2099 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
2100 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
2101 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
2102 EXPECT_EQ(static_cast<GLenum>(15), cmd.format);
2103 EXPECT_EQ(static_cast<GLenum>(16), cmd.type);
2104 EXPECT_EQ(static_cast<uint32_t>(17), cmd.pixels_shm_id);
2105 EXPECT_EQ(static_cast<uint32_t>(18), cmd.pixels_shm_offset);
2106 EXPECT_EQ(static_cast<uint32_t>(19), cmd.result_shm_id);
2107 EXPECT_EQ(static_cast<uint32_t>(20), cmd.result_shm_offset);
2108 EXPECT_EQ(static_cast<GLboolean>(21), cmd.async);
2109 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2112 TEST_F(GLES2FormatTest, ReleaseShaderCompiler) {
2113 cmds::ReleaseShaderCompiler& cmd =
2114 *GetBufferAs<cmds::ReleaseShaderCompiler>();
2115 void* next_cmd = cmd.Set(&cmd);
2116 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseShaderCompiler::kCmdId),
2117 cmd.header.command);
2118 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2119 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2122 TEST_F(GLES2FormatTest, RenderbufferStorage) {
2123 cmds::RenderbufferStorage& cmd = *GetBufferAs<cmds::RenderbufferStorage>();
2124 void* next_cmd =
2125 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
2126 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
2127 EXPECT_EQ(static_cast<uint32_t>(cmds::RenderbufferStorage::kCmdId),
2128 cmd.header.command);
2129 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2130 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2131 EXPECT_EQ(static_cast<GLenum>(12), cmd.internalformat);
2132 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
2133 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
2134 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2137 TEST_F(GLES2FormatTest, ResumeTransformFeedback) {
2138 cmds::ResumeTransformFeedback& cmd =
2139 *GetBufferAs<cmds::ResumeTransformFeedback>();
2140 void* next_cmd = cmd.Set(&cmd);
2141 EXPECT_EQ(static_cast<uint32_t>(cmds::ResumeTransformFeedback::kCmdId),
2142 cmd.header.command);
2143 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2144 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2147 TEST_F(GLES2FormatTest, SampleCoverage) {
2148 cmds::SampleCoverage& cmd = *GetBufferAs<cmds::SampleCoverage>();
2149 void* next_cmd =
2150 cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLboolean>(12));
2151 EXPECT_EQ(static_cast<uint32_t>(cmds::SampleCoverage::kCmdId),
2152 cmd.header.command);
2153 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2154 EXPECT_EQ(static_cast<GLclampf>(11), cmd.value);
2155 EXPECT_EQ(static_cast<GLboolean>(12), cmd.invert);
2156 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2159 TEST_F(GLES2FormatTest, SamplerParameterf) {
2160 cmds::SamplerParameterf& cmd = *GetBufferAs<cmds::SamplerParameterf>();
2161 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2162 static_cast<GLenum>(12), static_cast<GLfloat>(13));
2163 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterf::kCmdId),
2164 cmd.header.command);
2165 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2166 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
2167 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2168 EXPECT_EQ(static_cast<GLfloat>(13), cmd.param);
2169 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2172 TEST_F(GLES2FormatTest, SamplerParameterfvImmediate) {
2173 const int kSomeBaseValueToTestWith = 51;
2174 static GLfloat data[] = {
2175 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2177 cmds::SamplerParameterfvImmediate& cmd =
2178 *GetBufferAs<cmds::SamplerParameterfvImmediate>();
2179 void* next_cmd =
2180 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), data);
2181 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterfvImmediate::kCmdId),
2182 cmd.header.command);
2183 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2184 cmd.header.size * 4u);
2185 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
2186 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2187 CheckBytesWrittenMatchesExpectedSize(
2188 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2189 // TODO(gman): Check that data was inserted;
2192 TEST_F(GLES2FormatTest, SamplerParameteri) {
2193 cmds::SamplerParameteri& cmd = *GetBufferAs<cmds::SamplerParameteri>();
2194 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2195 static_cast<GLenum>(12), static_cast<GLint>(13));
2196 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameteri::kCmdId),
2197 cmd.header.command);
2198 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2199 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
2200 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2201 EXPECT_EQ(static_cast<GLint>(13), cmd.param);
2202 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2205 TEST_F(GLES2FormatTest, SamplerParameterivImmediate) {
2206 const int kSomeBaseValueToTestWith = 51;
2207 static GLint data[] = {
2208 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
2210 cmds::SamplerParameterivImmediate& cmd =
2211 *GetBufferAs<cmds::SamplerParameterivImmediate>();
2212 void* next_cmd =
2213 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), data);
2214 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterivImmediate::kCmdId),
2215 cmd.header.command);
2216 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2217 cmd.header.size * 4u);
2218 EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
2219 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2220 CheckBytesWrittenMatchesExpectedSize(
2221 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2222 // TODO(gman): Check that data was inserted;
2225 TEST_F(GLES2FormatTest, Scissor) {
2226 cmds::Scissor& cmd = *GetBufferAs<cmds::Scissor>();
2227 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2228 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
2229 EXPECT_EQ(static_cast<uint32_t>(cmds::Scissor::kCmdId), cmd.header.command);
2230 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2231 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
2232 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
2233 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
2234 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
2235 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2238 TEST_F(GLES2FormatTest, ShaderBinary) {
2239 cmds::ShaderBinary& cmd = *GetBufferAs<cmds::ShaderBinary>();
2240 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(11),
2241 static_cast<uint32_t>(12), static_cast<uint32_t>(13),
2242 static_cast<GLenum>(14), static_cast<uint32_t>(15),
2243 static_cast<uint32_t>(16), static_cast<GLsizei>(17));
2244 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderBinary::kCmdId),
2245 cmd.header.command);
2246 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2247 EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
2248 EXPECT_EQ(static_cast<uint32_t>(12), cmd.shaders_shm_id);
2249 EXPECT_EQ(static_cast<uint32_t>(13), cmd.shaders_shm_offset);
2250 EXPECT_EQ(static_cast<GLenum>(14), cmd.binaryformat);
2251 EXPECT_EQ(static_cast<uint32_t>(15), cmd.binary_shm_id);
2252 EXPECT_EQ(static_cast<uint32_t>(16), cmd.binary_shm_offset);
2253 EXPECT_EQ(static_cast<GLsizei>(17), cmd.length);
2254 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2257 TEST_F(GLES2FormatTest, ShaderSourceBucket) {
2258 cmds::ShaderSourceBucket& cmd = *GetBufferAs<cmds::ShaderSourceBucket>();
2259 void* next_cmd =
2260 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
2261 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderSourceBucket::kCmdId),
2262 cmd.header.command);
2263 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2264 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
2265 EXPECT_EQ(static_cast<uint32_t>(12), cmd.str_bucket_id);
2266 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2269 TEST_F(GLES2FormatTest, StencilFunc) {
2270 cmds::StencilFunc& cmd = *GetBufferAs<cmds::StencilFunc>();
2271 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2272 static_cast<GLint>(12), static_cast<GLuint>(13));
2273 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFunc::kCmdId),
2274 cmd.header.command);
2275 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2276 EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
2277 EXPECT_EQ(static_cast<GLint>(12), cmd.ref);
2278 EXPECT_EQ(static_cast<GLuint>(13), cmd.mask);
2279 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2282 TEST_F(GLES2FormatTest, StencilFuncSeparate) {
2283 cmds::StencilFuncSeparate& cmd = *GetBufferAs<cmds::StencilFuncSeparate>();
2284 void* next_cmd =
2285 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
2286 static_cast<GLint>(13), static_cast<GLuint>(14));
2287 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFuncSeparate::kCmdId),
2288 cmd.header.command);
2289 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2290 EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
2291 EXPECT_EQ(static_cast<GLenum>(12), cmd.func);
2292 EXPECT_EQ(static_cast<GLint>(13), cmd.ref);
2293 EXPECT_EQ(static_cast<GLuint>(14), cmd.mask);
2294 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2297 TEST_F(GLES2FormatTest, StencilMask) {
2298 cmds::StencilMask& cmd = *GetBufferAs<cmds::StencilMask>();
2299 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
2300 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMask::kCmdId),
2301 cmd.header.command);
2302 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2303 EXPECT_EQ(static_cast<GLuint>(11), cmd.mask);
2304 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2307 TEST_F(GLES2FormatTest, StencilMaskSeparate) {
2308 cmds::StencilMaskSeparate& cmd = *GetBufferAs<cmds::StencilMaskSeparate>();
2309 void* next_cmd =
2310 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
2311 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMaskSeparate::kCmdId),
2312 cmd.header.command);
2313 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2314 EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
2315 EXPECT_EQ(static_cast<GLuint>(12), cmd.mask);
2316 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2319 TEST_F(GLES2FormatTest, StencilOp) {
2320 cmds::StencilOp& cmd = *GetBufferAs<cmds::StencilOp>();
2321 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2322 static_cast<GLenum>(12), static_cast<GLenum>(13));
2323 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOp::kCmdId), cmd.header.command);
2324 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2325 EXPECT_EQ(static_cast<GLenum>(11), cmd.fail);
2326 EXPECT_EQ(static_cast<GLenum>(12), cmd.zfail);
2327 EXPECT_EQ(static_cast<GLenum>(13), cmd.zpass);
2328 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2331 TEST_F(GLES2FormatTest, StencilOpSeparate) {
2332 cmds::StencilOpSeparate& cmd = *GetBufferAs<cmds::StencilOpSeparate>();
2333 void* next_cmd =
2334 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
2335 static_cast<GLenum>(13), static_cast<GLenum>(14));
2336 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOpSeparate::kCmdId),
2337 cmd.header.command);
2338 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2339 EXPECT_EQ(static_cast<GLenum>(11), cmd.face);
2340 EXPECT_EQ(static_cast<GLenum>(12), cmd.fail);
2341 EXPECT_EQ(static_cast<GLenum>(13), cmd.zfail);
2342 EXPECT_EQ(static_cast<GLenum>(14), cmd.zpass);
2343 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2346 TEST_F(GLES2FormatTest, TexImage2D) {
2347 cmds::TexImage2D& cmd = *GetBufferAs<cmds::TexImage2D>();
2348 void* next_cmd =
2349 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
2350 static_cast<GLint>(13), static_cast<GLsizei>(14),
2351 static_cast<GLsizei>(15), static_cast<GLenum>(16),
2352 static_cast<GLenum>(17), static_cast<uint32_t>(18),
2353 static_cast<uint32_t>(19));
2354 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage2D::kCmdId),
2355 cmd.header.command);
2356 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2357 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2358 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
2359 EXPECT_EQ(static_cast<GLint>(13), cmd.internalformat);
2360 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
2361 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
2362 EXPECT_EQ(static_cast<GLenum>(16), cmd.format);
2363 EXPECT_EQ(static_cast<GLenum>(17), cmd.type);
2364 EXPECT_EQ(static_cast<uint32_t>(18), cmd.pixels_shm_id);
2365 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_offset);
2366 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2369 TEST_F(GLES2FormatTest, TexImage3D) {
2370 cmds::TexImage3D& cmd = *GetBufferAs<cmds::TexImage3D>();
2371 void* next_cmd =
2372 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
2373 static_cast<GLint>(13), static_cast<GLsizei>(14),
2374 static_cast<GLsizei>(15), static_cast<GLsizei>(16),
2375 static_cast<GLenum>(17), static_cast<GLenum>(18),
2376 static_cast<uint32_t>(19), static_cast<uint32_t>(20));
2377 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage3D::kCmdId),
2378 cmd.header.command);
2379 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2380 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2381 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
2382 EXPECT_EQ(static_cast<GLint>(13), cmd.internalformat);
2383 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
2384 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
2385 EXPECT_EQ(static_cast<GLsizei>(16), cmd.depth);
2386 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
2387 EXPECT_EQ(static_cast<GLenum>(18), cmd.type);
2388 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_id);
2389 EXPECT_EQ(static_cast<uint32_t>(20), cmd.pixels_shm_offset);
2390 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2393 TEST_F(GLES2FormatTest, TexParameterf) {
2394 cmds::TexParameterf& cmd = *GetBufferAs<cmds::TexParameterf>();
2395 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2396 static_cast<GLenum>(12), static_cast<GLfloat>(13));
2397 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterf::kCmdId),
2398 cmd.header.command);
2399 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2400 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2401 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2402 EXPECT_EQ(static_cast<GLfloat>(13), cmd.param);
2403 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2406 TEST_F(GLES2FormatTest, TexParameterfvImmediate) {
2407 const int kSomeBaseValueToTestWith = 51;
2408 static GLfloat data[] = {
2409 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2411 cmds::TexParameterfvImmediate& cmd =
2412 *GetBufferAs<cmds::TexParameterfvImmediate>();
2413 void* next_cmd =
2414 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12), data);
2415 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterfvImmediate::kCmdId),
2416 cmd.header.command);
2417 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2418 cmd.header.size * 4u);
2419 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2420 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2421 CheckBytesWrittenMatchesExpectedSize(
2422 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2423 // TODO(gman): Check that data was inserted;
2426 TEST_F(GLES2FormatTest, TexParameteri) {
2427 cmds::TexParameteri& cmd = *GetBufferAs<cmds::TexParameteri>();
2428 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
2429 static_cast<GLenum>(12), static_cast<GLint>(13));
2430 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameteri::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<GLenum>(12), cmd.pname);
2435 EXPECT_EQ(static_cast<GLint>(13), cmd.param);
2436 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2439 TEST_F(GLES2FormatTest, TexParameterivImmediate) {
2440 const int kSomeBaseValueToTestWith = 51;
2441 static GLint data[] = {
2442 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
2444 cmds::TexParameterivImmediate& cmd =
2445 *GetBufferAs<cmds::TexParameterivImmediate>();
2446 void* next_cmd =
2447 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12), data);
2448 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterivImmediate::kCmdId),
2449 cmd.header.command);
2450 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
2451 cmd.header.size * 4u);
2452 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2453 EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
2454 CheckBytesWrittenMatchesExpectedSize(
2455 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2456 // TODO(gman): Check that data was inserted;
2459 TEST_F(GLES2FormatTest, TexStorage3D) {
2460 cmds::TexStorage3D& cmd = *GetBufferAs<cmds::TexStorage3D>();
2461 void* next_cmd =
2462 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizei>(12),
2463 static_cast<GLenum>(13), static_cast<GLsizei>(14),
2464 static_cast<GLsizei>(15), static_cast<GLsizei>(16));
2465 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage3D::kCmdId),
2466 cmd.header.command);
2467 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2468 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2469 EXPECT_EQ(static_cast<GLsizei>(12), cmd.levels);
2470 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalFormat);
2471 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
2472 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
2473 EXPECT_EQ(static_cast<GLsizei>(16), cmd.depth);
2474 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2477 TEST_F(GLES2FormatTest, TexSubImage2D) {
2478 cmds::TexSubImage2D& cmd = *GetBufferAs<cmds::TexSubImage2D>();
2479 void* next_cmd = cmd.Set(
2480 &cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
2481 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLsizei>(15),
2482 static_cast<GLsizei>(16), static_cast<GLenum>(17),
2483 static_cast<GLenum>(18), static_cast<uint32_t>(19),
2484 static_cast<uint32_t>(20), static_cast<GLboolean>(21));
2485 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage2D::kCmdId),
2486 cmd.header.command);
2487 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2488 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2489 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
2490 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
2491 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
2492 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
2493 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
2494 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
2495 EXPECT_EQ(static_cast<GLenum>(18), cmd.type);
2496 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_id);
2497 EXPECT_EQ(static_cast<uint32_t>(20), cmd.pixels_shm_offset);
2498 EXPECT_EQ(static_cast<GLboolean>(21), cmd.internal);
2499 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2502 TEST_F(GLES2FormatTest, TexSubImage3D) {
2503 cmds::TexSubImage3D& cmd = *GetBufferAs<cmds::TexSubImage3D>();
2504 void* next_cmd = cmd.Set(
2505 &cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
2506 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLint>(15),
2507 static_cast<GLsizei>(16), static_cast<GLsizei>(17),
2508 static_cast<GLsizei>(18), static_cast<GLenum>(19),
2509 static_cast<GLenum>(20), static_cast<uint32_t>(21),
2510 static_cast<uint32_t>(22), static_cast<GLboolean>(23));
2511 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage3D::kCmdId),
2512 cmd.header.command);
2513 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2514 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
2515 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
2516 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
2517 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
2518 EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
2519 EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
2520 EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
2521 EXPECT_EQ(static_cast<GLsizei>(18), cmd.depth);
2522 EXPECT_EQ(static_cast<GLenum>(19), cmd.format);
2523 EXPECT_EQ(static_cast<GLenum>(20), cmd.type);
2524 EXPECT_EQ(static_cast<uint32_t>(21), cmd.pixels_shm_id);
2525 EXPECT_EQ(static_cast<uint32_t>(22), cmd.pixels_shm_offset);
2526 EXPECT_EQ(static_cast<GLboolean>(23), cmd.internal);
2527 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2530 TEST_F(GLES2FormatTest, TransformFeedbackVaryingsBucket) {
2531 cmds::TransformFeedbackVaryingsBucket& cmd =
2532 *GetBufferAs<cmds::TransformFeedbackVaryingsBucket>();
2533 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
2534 static_cast<uint32_t>(12), static_cast<GLenum>(13));
2535 EXPECT_EQ(
2536 static_cast<uint32_t>(cmds::TransformFeedbackVaryingsBucket::kCmdId),
2537 cmd.header.command);
2538 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2539 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
2540 EXPECT_EQ(static_cast<uint32_t>(12), cmd.varyings_bucket_id);
2541 EXPECT_EQ(static_cast<GLenum>(13), cmd.buffermode);
2542 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2545 TEST_F(GLES2FormatTest, Uniform1f) {
2546 cmds::Uniform1f& cmd = *GetBufferAs<cmds::Uniform1f>();
2547 void* next_cmd =
2548 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLfloat>(12));
2549 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1f::kCmdId), cmd.header.command);
2550 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2551 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2552 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2553 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2556 TEST_F(GLES2FormatTest, Uniform1fvImmediate) {
2557 const int kSomeBaseValueToTestWith = 51;
2558 static GLfloat data[] = {
2559 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2560 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2562 cmds::Uniform1fvImmediate& cmd = *GetBufferAs<cmds::Uniform1fvImmediate>();
2563 const GLsizei kNumElements = 2;
2564 const size_t kExpectedCmdSize =
2565 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 1;
2566 void* next_cmd =
2567 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2568 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1fvImmediate::kCmdId),
2569 cmd.header.command);
2570 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2571 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2572 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2573 CheckBytesWrittenMatchesExpectedSize(
2574 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2575 // TODO(gman): Check that data was inserted;
2578 TEST_F(GLES2FormatTest, Uniform1i) {
2579 cmds::Uniform1i& cmd = *GetBufferAs<cmds::Uniform1i>();
2580 void* next_cmd =
2581 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12));
2582 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1i::kCmdId), cmd.header.command);
2583 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2584 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2585 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
2586 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2589 TEST_F(GLES2FormatTest, Uniform1ivImmediate) {
2590 const int kSomeBaseValueToTestWith = 51;
2591 static GLint data[] = {
2592 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
2593 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
2595 cmds::Uniform1ivImmediate& cmd = *GetBufferAs<cmds::Uniform1ivImmediate>();
2596 const GLsizei kNumElements = 2;
2597 const size_t kExpectedCmdSize =
2598 sizeof(cmd) + kNumElements * sizeof(GLint) * 1;
2599 void* next_cmd =
2600 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2601 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ivImmediate::kCmdId),
2602 cmd.header.command);
2603 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2604 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2605 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2606 CheckBytesWrittenMatchesExpectedSize(
2607 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2608 // TODO(gman): Check that data was inserted;
2611 TEST_F(GLES2FormatTest, Uniform1ui) {
2612 cmds::Uniform1ui& cmd = *GetBufferAs<cmds::Uniform1ui>();
2613 void* next_cmd =
2614 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLuint>(12));
2615 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ui::kCmdId),
2616 cmd.header.command);
2617 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2618 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2619 EXPECT_EQ(static_cast<GLuint>(12), cmd.x);
2620 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2623 TEST_F(GLES2FormatTest, Uniform1uivImmediate) {
2624 const int kSomeBaseValueToTestWith = 51;
2625 static GLuint data[] = {
2626 static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
2627 static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
2629 cmds::Uniform1uivImmediate& cmd = *GetBufferAs<cmds::Uniform1uivImmediate>();
2630 const GLsizei kNumElements = 2;
2631 const size_t kExpectedCmdSize =
2632 sizeof(cmd) + kNumElements * sizeof(GLuint) * 1;
2633 void* next_cmd =
2634 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2635 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1uivImmediate::kCmdId),
2636 cmd.header.command);
2637 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2638 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2639 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2640 CheckBytesWrittenMatchesExpectedSize(
2641 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2642 // TODO(gman): Check that data was inserted;
2645 TEST_F(GLES2FormatTest, Uniform2f) {
2646 cmds::Uniform2f& cmd = *GetBufferAs<cmds::Uniform2f>();
2647 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
2648 static_cast<GLfloat>(12), static_cast<GLfloat>(13));
2649 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2f::kCmdId), cmd.header.command);
2650 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2651 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2652 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2653 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
2654 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2657 TEST_F(GLES2FormatTest, Uniform2fvImmediate) {
2658 const int kSomeBaseValueToTestWith = 51;
2659 static GLfloat data[] = {
2660 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2661 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2662 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
2663 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
2665 cmds::Uniform2fvImmediate& cmd = *GetBufferAs<cmds::Uniform2fvImmediate>();
2666 const GLsizei kNumElements = 2;
2667 const size_t kExpectedCmdSize =
2668 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 2;
2669 void* next_cmd =
2670 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2671 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2fvImmediate::kCmdId),
2672 cmd.header.command);
2673 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2674 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2675 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2676 CheckBytesWrittenMatchesExpectedSize(
2677 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2678 // TODO(gman): Check that data was inserted;
2681 TEST_F(GLES2FormatTest, Uniform2i) {
2682 cmds::Uniform2i& cmd = *GetBufferAs<cmds::Uniform2i>();
2683 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2684 static_cast<GLint>(13));
2685 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2i::kCmdId), cmd.header.command);
2686 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2687 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2688 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
2689 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
2690 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2693 TEST_F(GLES2FormatTest, Uniform2ivImmediate) {
2694 const int kSomeBaseValueToTestWith = 51;
2695 static GLint data[] = {
2696 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
2697 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
2698 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
2699 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
2701 cmds::Uniform2ivImmediate& cmd = *GetBufferAs<cmds::Uniform2ivImmediate>();
2702 const GLsizei kNumElements = 2;
2703 const size_t kExpectedCmdSize =
2704 sizeof(cmd) + kNumElements * sizeof(GLint) * 2;
2705 void* next_cmd =
2706 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2707 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ivImmediate::kCmdId),
2708 cmd.header.command);
2709 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2710 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2711 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2712 CheckBytesWrittenMatchesExpectedSize(
2713 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2714 // TODO(gman): Check that data was inserted;
2717 TEST_F(GLES2FormatTest, Uniform2ui) {
2718 cmds::Uniform2ui& cmd = *GetBufferAs<cmds::Uniform2ui>();
2719 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
2720 static_cast<GLuint>(12), static_cast<GLuint>(13));
2721 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ui::kCmdId),
2722 cmd.header.command);
2723 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2724 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2725 EXPECT_EQ(static_cast<GLuint>(12), cmd.x);
2726 EXPECT_EQ(static_cast<GLuint>(13), cmd.y);
2727 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2730 TEST_F(GLES2FormatTest, Uniform2uivImmediate) {
2731 const int kSomeBaseValueToTestWith = 51;
2732 static GLuint data[] = {
2733 static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
2734 static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
2735 static_cast<GLuint>(kSomeBaseValueToTestWith + 2),
2736 static_cast<GLuint>(kSomeBaseValueToTestWith + 3),
2738 cmds::Uniform2uivImmediate& cmd = *GetBufferAs<cmds::Uniform2uivImmediate>();
2739 const GLsizei kNumElements = 2;
2740 const size_t kExpectedCmdSize =
2741 sizeof(cmd) + kNumElements * sizeof(GLuint) * 2;
2742 void* next_cmd =
2743 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2744 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2uivImmediate::kCmdId),
2745 cmd.header.command);
2746 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2747 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2748 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2749 CheckBytesWrittenMatchesExpectedSize(
2750 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2751 // TODO(gman): Check that data was inserted;
2754 TEST_F(GLES2FormatTest, Uniform3f) {
2755 cmds::Uniform3f& cmd = *GetBufferAs<cmds::Uniform3f>();
2756 void* next_cmd =
2757 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLfloat>(12),
2758 static_cast<GLfloat>(13), static_cast<GLfloat>(14));
2759 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3f::kCmdId), cmd.header.command);
2760 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2761 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2762 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2763 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
2764 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
2765 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2768 TEST_F(GLES2FormatTest, Uniform3fvImmediate) {
2769 const int kSomeBaseValueToTestWith = 51;
2770 static GLfloat data[] = {
2771 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2772 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2773 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
2774 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
2775 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
2776 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
2778 cmds::Uniform3fvImmediate& cmd = *GetBufferAs<cmds::Uniform3fvImmediate>();
2779 const GLsizei kNumElements = 2;
2780 const size_t kExpectedCmdSize =
2781 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 3;
2782 void* next_cmd =
2783 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2784 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3fvImmediate::kCmdId),
2785 cmd.header.command);
2786 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2787 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2788 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2789 CheckBytesWrittenMatchesExpectedSize(
2790 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2791 // TODO(gman): Check that data was inserted;
2794 TEST_F(GLES2FormatTest, Uniform3i) {
2795 cmds::Uniform3i& cmd = *GetBufferAs<cmds::Uniform3i>();
2796 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2797 static_cast<GLint>(13), static_cast<GLint>(14));
2798 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3i::kCmdId), cmd.header.command);
2799 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2800 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2801 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
2802 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
2803 EXPECT_EQ(static_cast<GLint>(14), cmd.z);
2804 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2807 TEST_F(GLES2FormatTest, Uniform3ivImmediate) {
2808 const int kSomeBaseValueToTestWith = 51;
2809 static GLint data[] = {
2810 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
2811 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
2812 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
2813 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
2814 static_cast<GLint>(kSomeBaseValueToTestWith + 4),
2815 static_cast<GLint>(kSomeBaseValueToTestWith + 5),
2817 cmds::Uniform3ivImmediate& cmd = *GetBufferAs<cmds::Uniform3ivImmediate>();
2818 const GLsizei kNumElements = 2;
2819 const size_t kExpectedCmdSize =
2820 sizeof(cmd) + kNumElements * sizeof(GLint) * 3;
2821 void* next_cmd =
2822 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2823 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ivImmediate::kCmdId),
2824 cmd.header.command);
2825 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2826 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2827 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2828 CheckBytesWrittenMatchesExpectedSize(
2829 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2830 // TODO(gman): Check that data was inserted;
2833 TEST_F(GLES2FormatTest, Uniform3ui) {
2834 cmds::Uniform3ui& cmd = *GetBufferAs<cmds::Uniform3ui>();
2835 void* next_cmd =
2836 cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLuint>(12),
2837 static_cast<GLuint>(13), static_cast<GLuint>(14));
2838 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ui::kCmdId),
2839 cmd.header.command);
2840 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2841 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2842 EXPECT_EQ(static_cast<GLuint>(12), cmd.x);
2843 EXPECT_EQ(static_cast<GLuint>(13), cmd.y);
2844 EXPECT_EQ(static_cast<GLuint>(14), cmd.z);
2845 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2848 TEST_F(GLES2FormatTest, Uniform3uivImmediate) {
2849 const int kSomeBaseValueToTestWith = 51;
2850 static GLuint data[] = {
2851 static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
2852 static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
2853 static_cast<GLuint>(kSomeBaseValueToTestWith + 2),
2854 static_cast<GLuint>(kSomeBaseValueToTestWith + 3),
2855 static_cast<GLuint>(kSomeBaseValueToTestWith + 4),
2856 static_cast<GLuint>(kSomeBaseValueToTestWith + 5),
2858 cmds::Uniform3uivImmediate& cmd = *GetBufferAs<cmds::Uniform3uivImmediate>();
2859 const GLsizei kNumElements = 2;
2860 const size_t kExpectedCmdSize =
2861 sizeof(cmd) + kNumElements * sizeof(GLuint) * 3;
2862 void* next_cmd =
2863 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2864 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3uivImmediate::kCmdId),
2865 cmd.header.command);
2866 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2867 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2868 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2869 CheckBytesWrittenMatchesExpectedSize(
2870 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2871 // TODO(gman): Check that data was inserted;
2874 TEST_F(GLES2FormatTest, Uniform4f) {
2875 cmds::Uniform4f& cmd = *GetBufferAs<cmds::Uniform4f>();
2876 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
2877 static_cast<GLfloat>(12), static_cast<GLfloat>(13),
2878 static_cast<GLfloat>(14), static_cast<GLfloat>(15));
2879 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4f::kCmdId), cmd.header.command);
2880 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2881 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2882 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
2883 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
2884 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
2885 EXPECT_EQ(static_cast<GLfloat>(15), cmd.w);
2886 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2889 TEST_F(GLES2FormatTest, Uniform4fvImmediate) {
2890 const int kSomeBaseValueToTestWith = 51;
2891 static GLfloat data[] = {
2892 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
2893 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
2894 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
2895 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
2896 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
2897 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
2898 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
2899 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
2901 cmds::Uniform4fvImmediate& cmd = *GetBufferAs<cmds::Uniform4fvImmediate>();
2902 const GLsizei kNumElements = 2;
2903 const size_t kExpectedCmdSize =
2904 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 4;
2905 void* next_cmd =
2906 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2907 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4fvImmediate::kCmdId),
2908 cmd.header.command);
2909 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2910 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2911 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2912 CheckBytesWrittenMatchesExpectedSize(
2913 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2914 // TODO(gman): Check that data was inserted;
2917 TEST_F(GLES2FormatTest, Uniform4i) {
2918 cmds::Uniform4i& cmd = *GetBufferAs<cmds::Uniform4i>();
2919 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
2920 static_cast<GLint>(13), static_cast<GLint>(14),
2921 static_cast<GLint>(15));
2922 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4i::kCmdId), cmd.header.command);
2923 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2924 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2925 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
2926 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
2927 EXPECT_EQ(static_cast<GLint>(14), cmd.z);
2928 EXPECT_EQ(static_cast<GLint>(15), cmd.w);
2929 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2932 TEST_F(GLES2FormatTest, Uniform4ivImmediate) {
2933 const int kSomeBaseValueToTestWith = 51;
2934 static GLint data[] = {
2935 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
2936 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
2937 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
2938 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
2939 static_cast<GLint>(kSomeBaseValueToTestWith + 4),
2940 static_cast<GLint>(kSomeBaseValueToTestWith + 5),
2941 static_cast<GLint>(kSomeBaseValueToTestWith + 6),
2942 static_cast<GLint>(kSomeBaseValueToTestWith + 7),
2944 cmds::Uniform4ivImmediate& cmd = *GetBufferAs<cmds::Uniform4ivImmediate>();
2945 const GLsizei kNumElements = 2;
2946 const size_t kExpectedCmdSize =
2947 sizeof(cmd) + kNumElements * sizeof(GLint) * 4;
2948 void* next_cmd =
2949 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2950 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ivImmediate::kCmdId),
2951 cmd.header.command);
2952 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2953 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2954 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2955 CheckBytesWrittenMatchesExpectedSize(
2956 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
2957 // TODO(gman): Check that data was inserted;
2960 TEST_F(GLES2FormatTest, Uniform4ui) {
2961 cmds::Uniform4ui& cmd = *GetBufferAs<cmds::Uniform4ui>();
2962 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
2963 static_cast<GLuint>(12), static_cast<GLuint>(13),
2964 static_cast<GLuint>(14), static_cast<GLuint>(15));
2965 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ui::kCmdId),
2966 cmd.header.command);
2967 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
2968 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
2969 EXPECT_EQ(static_cast<GLuint>(12), cmd.x);
2970 EXPECT_EQ(static_cast<GLuint>(13), cmd.y);
2971 EXPECT_EQ(static_cast<GLuint>(14), cmd.z);
2972 EXPECT_EQ(static_cast<GLuint>(15), cmd.w);
2973 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
2976 TEST_F(GLES2FormatTest, Uniform4uivImmediate) {
2977 const int kSomeBaseValueToTestWith = 51;
2978 static GLuint data[] = {
2979 static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
2980 static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
2981 static_cast<GLuint>(kSomeBaseValueToTestWith + 2),
2982 static_cast<GLuint>(kSomeBaseValueToTestWith + 3),
2983 static_cast<GLuint>(kSomeBaseValueToTestWith + 4),
2984 static_cast<GLuint>(kSomeBaseValueToTestWith + 5),
2985 static_cast<GLuint>(kSomeBaseValueToTestWith + 6),
2986 static_cast<GLuint>(kSomeBaseValueToTestWith + 7),
2988 cmds::Uniform4uivImmediate& cmd = *GetBufferAs<cmds::Uniform4uivImmediate>();
2989 const GLsizei kNumElements = 2;
2990 const size_t kExpectedCmdSize =
2991 sizeof(cmd) + kNumElements * sizeof(GLuint) * 4;
2992 void* next_cmd =
2993 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
2994 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4uivImmediate::kCmdId),
2995 cmd.header.command);
2996 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
2997 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
2998 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
2999 CheckBytesWrittenMatchesExpectedSize(
3000 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3001 // TODO(gman): Check that data was inserted;
3004 TEST_F(GLES2FormatTest, UniformBlockBinding) {
3005 cmds::UniformBlockBinding& cmd = *GetBufferAs<cmds::UniformBlockBinding>();
3006 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
3007 static_cast<GLuint>(12), static_cast<GLuint>(13));
3008 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformBlockBinding::kCmdId),
3009 cmd.header.command);
3010 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3011 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
3012 EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
3013 EXPECT_EQ(static_cast<GLuint>(13), cmd.binding);
3014 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3017 TEST_F(GLES2FormatTest, UniformMatrix2fvImmediate) {
3018 const int kSomeBaseValueToTestWith = 51;
3019 static GLfloat data[] = {
3020 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3021 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3022 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3023 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3024 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3025 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3026 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3027 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3029 cmds::UniformMatrix2fvImmediate& cmd =
3030 *GetBufferAs<cmds::UniformMatrix2fvImmediate>();
3031 const GLsizei kNumElements = 2;
3032 const size_t kExpectedCmdSize =
3033 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 4;
3034 void* next_cmd =
3035 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3036 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2fvImmediate::kCmdId),
3037 cmd.header.command);
3038 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3039 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3040 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3041 CheckBytesWrittenMatchesExpectedSize(
3042 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3043 // TODO(gman): Check that data was inserted;
3046 TEST_F(GLES2FormatTest, UniformMatrix2x3fvImmediate) {
3047 const int kSomeBaseValueToTestWith = 51;
3048 static GLfloat data[] = {
3049 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3050 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3051 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3052 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3053 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3054 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3055 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3056 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3057 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3058 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3059 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3060 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3062 cmds::UniformMatrix2x3fvImmediate& cmd =
3063 *GetBufferAs<cmds::UniformMatrix2x3fvImmediate>();
3064 const GLsizei kNumElements = 2;
3065 const size_t kExpectedCmdSize =
3066 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 6;
3067 void* next_cmd =
3068 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3069 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x3fvImmediate::kCmdId),
3070 cmd.header.command);
3071 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3072 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3073 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3074 CheckBytesWrittenMatchesExpectedSize(
3075 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3076 // TODO(gman): Check that data was inserted;
3079 TEST_F(GLES2FormatTest, UniformMatrix2x4fvImmediate) {
3080 const int kSomeBaseValueToTestWith = 51;
3081 static GLfloat data[] = {
3082 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3083 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3084 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3085 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3086 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3087 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3088 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3089 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3090 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3091 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3092 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3093 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3094 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3095 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3096 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3097 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3099 cmds::UniformMatrix2x4fvImmediate& cmd =
3100 *GetBufferAs<cmds::UniformMatrix2x4fvImmediate>();
3101 const GLsizei kNumElements = 2;
3102 const size_t kExpectedCmdSize =
3103 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 8;
3104 void* next_cmd =
3105 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3106 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x4fvImmediate::kCmdId),
3107 cmd.header.command);
3108 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3109 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3110 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3111 CheckBytesWrittenMatchesExpectedSize(
3112 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3113 // TODO(gman): Check that data was inserted;
3116 TEST_F(GLES2FormatTest, UniformMatrix3fvImmediate) {
3117 const int kSomeBaseValueToTestWith = 51;
3118 static GLfloat data[] = {
3119 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3120 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3121 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3122 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3123 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3124 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3125 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3126 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3127 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3128 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3129 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3130 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3131 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3132 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3133 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3134 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3135 static_cast<GLfloat>(kSomeBaseValueToTestWith + 16),
3136 static_cast<GLfloat>(kSomeBaseValueToTestWith + 17),
3138 cmds::UniformMatrix3fvImmediate& cmd =
3139 *GetBufferAs<cmds::UniformMatrix3fvImmediate>();
3140 const GLsizei kNumElements = 2;
3141 const size_t kExpectedCmdSize =
3142 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 9;
3143 void* next_cmd =
3144 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3145 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3fvImmediate::kCmdId),
3146 cmd.header.command);
3147 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3148 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3149 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3150 CheckBytesWrittenMatchesExpectedSize(
3151 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3152 // TODO(gman): Check that data was inserted;
3155 TEST_F(GLES2FormatTest, UniformMatrix3x2fvImmediate) {
3156 const int kSomeBaseValueToTestWith = 51;
3157 static GLfloat data[] = {
3158 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3159 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3160 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3161 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3162 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3163 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3164 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3165 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3166 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3167 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3168 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3169 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3171 cmds::UniformMatrix3x2fvImmediate& cmd =
3172 *GetBufferAs<cmds::UniformMatrix3x2fvImmediate>();
3173 const GLsizei kNumElements = 2;
3174 const size_t kExpectedCmdSize =
3175 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 6;
3176 void* next_cmd =
3177 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3178 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x2fvImmediate::kCmdId),
3179 cmd.header.command);
3180 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3181 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3182 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3183 CheckBytesWrittenMatchesExpectedSize(
3184 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3185 // TODO(gman): Check that data was inserted;
3188 TEST_F(GLES2FormatTest, UniformMatrix3x4fvImmediate) {
3189 const int kSomeBaseValueToTestWith = 51;
3190 static GLfloat data[] = {
3191 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3192 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3193 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3194 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3195 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3196 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3197 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3198 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3199 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3200 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3201 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3202 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3203 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3204 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3205 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3206 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3207 static_cast<GLfloat>(kSomeBaseValueToTestWith + 16),
3208 static_cast<GLfloat>(kSomeBaseValueToTestWith + 17),
3209 static_cast<GLfloat>(kSomeBaseValueToTestWith + 18),
3210 static_cast<GLfloat>(kSomeBaseValueToTestWith + 19),
3211 static_cast<GLfloat>(kSomeBaseValueToTestWith + 20),
3212 static_cast<GLfloat>(kSomeBaseValueToTestWith + 21),
3213 static_cast<GLfloat>(kSomeBaseValueToTestWith + 22),
3214 static_cast<GLfloat>(kSomeBaseValueToTestWith + 23),
3216 cmds::UniformMatrix3x4fvImmediate& cmd =
3217 *GetBufferAs<cmds::UniformMatrix3x4fvImmediate>();
3218 const GLsizei kNumElements = 2;
3219 const size_t kExpectedCmdSize =
3220 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 12;
3221 void* next_cmd =
3222 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3223 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x4fvImmediate::kCmdId),
3224 cmd.header.command);
3225 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3226 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3227 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3228 CheckBytesWrittenMatchesExpectedSize(
3229 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3230 // TODO(gman): Check that data was inserted;
3233 TEST_F(GLES2FormatTest, UniformMatrix4fvImmediate) {
3234 const int kSomeBaseValueToTestWith = 51;
3235 static GLfloat data[] = {
3236 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3237 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3238 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3239 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3240 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3241 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3242 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3243 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3244 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3245 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3246 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3247 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3248 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3249 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3250 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3251 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3252 static_cast<GLfloat>(kSomeBaseValueToTestWith + 16),
3253 static_cast<GLfloat>(kSomeBaseValueToTestWith + 17),
3254 static_cast<GLfloat>(kSomeBaseValueToTestWith + 18),
3255 static_cast<GLfloat>(kSomeBaseValueToTestWith + 19),
3256 static_cast<GLfloat>(kSomeBaseValueToTestWith + 20),
3257 static_cast<GLfloat>(kSomeBaseValueToTestWith + 21),
3258 static_cast<GLfloat>(kSomeBaseValueToTestWith + 22),
3259 static_cast<GLfloat>(kSomeBaseValueToTestWith + 23),
3260 static_cast<GLfloat>(kSomeBaseValueToTestWith + 24),
3261 static_cast<GLfloat>(kSomeBaseValueToTestWith + 25),
3262 static_cast<GLfloat>(kSomeBaseValueToTestWith + 26),
3263 static_cast<GLfloat>(kSomeBaseValueToTestWith + 27),
3264 static_cast<GLfloat>(kSomeBaseValueToTestWith + 28),
3265 static_cast<GLfloat>(kSomeBaseValueToTestWith + 29),
3266 static_cast<GLfloat>(kSomeBaseValueToTestWith + 30),
3267 static_cast<GLfloat>(kSomeBaseValueToTestWith + 31),
3269 cmds::UniformMatrix4fvImmediate& cmd =
3270 *GetBufferAs<cmds::UniformMatrix4fvImmediate>();
3271 const GLsizei kNumElements = 2;
3272 const size_t kExpectedCmdSize =
3273 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 16;
3274 void* next_cmd =
3275 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3276 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4fvImmediate::kCmdId),
3277 cmd.header.command);
3278 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3279 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3280 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3281 CheckBytesWrittenMatchesExpectedSize(
3282 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3283 // TODO(gman): Check that data was inserted;
3286 TEST_F(GLES2FormatTest, UniformMatrix4x2fvImmediate) {
3287 const int kSomeBaseValueToTestWith = 51;
3288 static GLfloat data[] = {
3289 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3290 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3291 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3292 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3293 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3294 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3295 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3296 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3297 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3298 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3299 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3300 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3301 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3302 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3303 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3304 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3306 cmds::UniformMatrix4x2fvImmediate& cmd =
3307 *GetBufferAs<cmds::UniformMatrix4x2fvImmediate>();
3308 const GLsizei kNumElements = 2;
3309 const size_t kExpectedCmdSize =
3310 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 8;
3311 void* next_cmd =
3312 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3313 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x2fvImmediate::kCmdId),
3314 cmd.header.command);
3315 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3316 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3317 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3318 CheckBytesWrittenMatchesExpectedSize(
3319 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3320 // TODO(gman): Check that data was inserted;
3323 TEST_F(GLES2FormatTest, UniformMatrix4x3fvImmediate) {
3324 const int kSomeBaseValueToTestWith = 51;
3325 static GLfloat data[] = {
3326 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3327 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3328 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3329 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3330 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
3331 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
3332 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
3333 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
3334 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
3335 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
3336 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
3337 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
3338 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
3339 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
3340 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
3341 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
3342 static_cast<GLfloat>(kSomeBaseValueToTestWith + 16),
3343 static_cast<GLfloat>(kSomeBaseValueToTestWith + 17),
3344 static_cast<GLfloat>(kSomeBaseValueToTestWith + 18),
3345 static_cast<GLfloat>(kSomeBaseValueToTestWith + 19),
3346 static_cast<GLfloat>(kSomeBaseValueToTestWith + 20),
3347 static_cast<GLfloat>(kSomeBaseValueToTestWith + 21),
3348 static_cast<GLfloat>(kSomeBaseValueToTestWith + 22),
3349 static_cast<GLfloat>(kSomeBaseValueToTestWith + 23),
3351 cmds::UniformMatrix4x3fvImmediate& cmd =
3352 *GetBufferAs<cmds::UniformMatrix4x3fvImmediate>();
3353 const GLsizei kNumElements = 2;
3354 const size_t kExpectedCmdSize =
3355 sizeof(cmd) + kNumElements * sizeof(GLfloat) * 12;
3356 void* next_cmd =
3357 cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data);
3358 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x3fvImmediate::kCmdId),
3359 cmd.header.command);
3360 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
3361 EXPECT_EQ(static_cast<GLint>(1), cmd.location);
3362 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
3363 CheckBytesWrittenMatchesExpectedSize(
3364 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3365 // TODO(gman): Check that data was inserted;
3368 TEST_F(GLES2FormatTest, UseProgram) {
3369 cmds::UseProgram& cmd = *GetBufferAs<cmds::UseProgram>();
3370 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3371 EXPECT_EQ(static_cast<uint32_t>(cmds::UseProgram::kCmdId),
3372 cmd.header.command);
3373 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3374 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
3375 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3378 TEST_F(GLES2FormatTest, ValidateProgram) {
3379 cmds::ValidateProgram& cmd = *GetBufferAs<cmds::ValidateProgram>();
3380 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3381 EXPECT_EQ(static_cast<uint32_t>(cmds::ValidateProgram::kCmdId),
3382 cmd.header.command);
3383 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3384 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
3385 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3388 TEST_F(GLES2FormatTest, VertexAttrib1f) {
3389 cmds::VertexAttrib1f& cmd = *GetBufferAs<cmds::VertexAttrib1f>();
3390 void* next_cmd =
3391 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLfloat>(12));
3392 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1f::kCmdId),
3393 cmd.header.command);
3394 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3395 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3396 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
3397 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3400 TEST_F(GLES2FormatTest, VertexAttrib1fvImmediate) {
3401 const int kSomeBaseValueToTestWith = 51;
3402 static GLfloat data[] = {
3403 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3405 cmds::VertexAttrib1fvImmediate& cmd =
3406 *GetBufferAs<cmds::VertexAttrib1fvImmediate>();
3407 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
3408 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1fvImmediate::kCmdId),
3409 cmd.header.command);
3410 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3411 cmd.header.size * 4u);
3412 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3413 CheckBytesWrittenMatchesExpectedSize(
3414 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3415 // TODO(gman): Check that data was inserted;
3418 TEST_F(GLES2FormatTest, VertexAttrib2f) {
3419 cmds::VertexAttrib2f& cmd = *GetBufferAs<cmds::VertexAttrib2f>();
3420 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
3421 static_cast<GLfloat>(12), static_cast<GLfloat>(13));
3422 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2f::kCmdId),
3423 cmd.header.command);
3424 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3425 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3426 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
3427 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
3428 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3431 TEST_F(GLES2FormatTest, VertexAttrib2fvImmediate) {
3432 const int kSomeBaseValueToTestWith = 51;
3433 static GLfloat data[] = {
3434 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3435 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3437 cmds::VertexAttrib2fvImmediate& cmd =
3438 *GetBufferAs<cmds::VertexAttrib2fvImmediate>();
3439 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
3440 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2fvImmediate::kCmdId),
3441 cmd.header.command);
3442 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3443 cmd.header.size * 4u);
3444 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3445 CheckBytesWrittenMatchesExpectedSize(
3446 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3447 // TODO(gman): Check that data was inserted;
3450 TEST_F(GLES2FormatTest, VertexAttrib3f) {
3451 cmds::VertexAttrib3f& cmd = *GetBufferAs<cmds::VertexAttrib3f>();
3452 void* next_cmd =
3453 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLfloat>(12),
3454 static_cast<GLfloat>(13), static_cast<GLfloat>(14));
3455 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3f::kCmdId),
3456 cmd.header.command);
3457 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3458 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3459 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
3460 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
3461 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
3462 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3465 TEST_F(GLES2FormatTest, VertexAttrib3fvImmediate) {
3466 const int kSomeBaseValueToTestWith = 51;
3467 static GLfloat data[] = {
3468 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3469 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3470 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3472 cmds::VertexAttrib3fvImmediate& cmd =
3473 *GetBufferAs<cmds::VertexAttrib3fvImmediate>();
3474 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
3475 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3fvImmediate::kCmdId),
3476 cmd.header.command);
3477 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3478 cmd.header.size * 4u);
3479 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3480 CheckBytesWrittenMatchesExpectedSize(
3481 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3482 // TODO(gman): Check that data was inserted;
3485 TEST_F(GLES2FormatTest, VertexAttrib4f) {
3486 cmds::VertexAttrib4f& cmd = *GetBufferAs<cmds::VertexAttrib4f>();
3487 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
3488 static_cast<GLfloat>(12), static_cast<GLfloat>(13),
3489 static_cast<GLfloat>(14), static_cast<GLfloat>(15));
3490 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4f::kCmdId),
3491 cmd.header.command);
3492 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3493 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3494 EXPECT_EQ(static_cast<GLfloat>(12), cmd.x);
3495 EXPECT_EQ(static_cast<GLfloat>(13), cmd.y);
3496 EXPECT_EQ(static_cast<GLfloat>(14), cmd.z);
3497 EXPECT_EQ(static_cast<GLfloat>(15), cmd.w);
3498 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3501 TEST_F(GLES2FormatTest, VertexAttrib4fvImmediate) {
3502 const int kSomeBaseValueToTestWith = 51;
3503 static GLfloat data[] = {
3504 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
3505 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
3506 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
3507 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
3509 cmds::VertexAttrib4fvImmediate& cmd =
3510 *GetBufferAs<cmds::VertexAttrib4fvImmediate>();
3511 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
3512 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4fvImmediate::kCmdId),
3513 cmd.header.command);
3514 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3515 cmd.header.size * 4u);
3516 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3517 CheckBytesWrittenMatchesExpectedSize(
3518 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3519 // TODO(gman): Check that data was inserted;
3522 TEST_F(GLES2FormatTest, VertexAttribI4i) {
3523 cmds::VertexAttribI4i& cmd = *GetBufferAs<cmds::VertexAttribI4i>();
3524 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
3525 static_cast<GLint>(12), static_cast<GLint>(13),
3526 static_cast<GLint>(14), static_cast<GLint>(15));
3527 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4i::kCmdId),
3528 cmd.header.command);
3529 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3530 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3531 EXPECT_EQ(static_cast<GLint>(12), cmd.x);
3532 EXPECT_EQ(static_cast<GLint>(13), cmd.y);
3533 EXPECT_EQ(static_cast<GLint>(14), cmd.z);
3534 EXPECT_EQ(static_cast<GLint>(15), cmd.w);
3535 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3538 TEST_F(GLES2FormatTest, VertexAttribI4ivImmediate) {
3539 const int kSomeBaseValueToTestWith = 51;
3540 static GLint data[] = {
3541 static_cast<GLint>(kSomeBaseValueToTestWith + 0),
3542 static_cast<GLint>(kSomeBaseValueToTestWith + 1),
3543 static_cast<GLint>(kSomeBaseValueToTestWith + 2),
3544 static_cast<GLint>(kSomeBaseValueToTestWith + 3),
3546 cmds::VertexAttribI4ivImmediate& cmd =
3547 *GetBufferAs<cmds::VertexAttribI4ivImmediate>();
3548 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
3549 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4ivImmediate::kCmdId),
3550 cmd.header.command);
3551 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3552 cmd.header.size * 4u);
3553 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3554 CheckBytesWrittenMatchesExpectedSize(
3555 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3556 // TODO(gman): Check that data was inserted;
3559 TEST_F(GLES2FormatTest, VertexAttribI4ui) {
3560 cmds::VertexAttribI4ui& cmd = *GetBufferAs<cmds::VertexAttribI4ui>();
3561 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
3562 static_cast<GLuint>(12), static_cast<GLuint>(13),
3563 static_cast<GLuint>(14), static_cast<GLuint>(15));
3564 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4ui::kCmdId),
3565 cmd.header.command);
3566 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3567 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3568 EXPECT_EQ(static_cast<GLuint>(12), cmd.x);
3569 EXPECT_EQ(static_cast<GLuint>(13), cmd.y);
3570 EXPECT_EQ(static_cast<GLuint>(14), cmd.z);
3571 EXPECT_EQ(static_cast<GLuint>(15), cmd.w);
3572 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3575 TEST_F(GLES2FormatTest, VertexAttribI4uivImmediate) {
3576 const int kSomeBaseValueToTestWith = 51;
3577 static GLuint data[] = {
3578 static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
3579 static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
3580 static_cast<GLuint>(kSomeBaseValueToTestWith + 2),
3581 static_cast<GLuint>(kSomeBaseValueToTestWith + 3),
3583 cmds::VertexAttribI4uivImmediate& cmd =
3584 *GetBufferAs<cmds::VertexAttribI4uivImmediate>();
3585 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
3586 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4uivImmediate::kCmdId),
3587 cmd.header.command);
3588 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
3589 cmd.header.size * 4u);
3590 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3591 CheckBytesWrittenMatchesExpectedSize(
3592 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
3593 // TODO(gman): Check that data was inserted;
3596 TEST_F(GLES2FormatTest, VertexAttribIPointer) {
3597 cmds::VertexAttribIPointer& cmd = *GetBufferAs<cmds::VertexAttribIPointer>();
3598 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
3599 static_cast<GLint>(12), static_cast<GLenum>(13),
3600 static_cast<GLsizei>(14), static_cast<GLuint>(15));
3601 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribIPointer::kCmdId),
3602 cmd.header.command);
3603 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3604 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3605 EXPECT_EQ(static_cast<GLint>(12), cmd.size);
3606 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
3607 EXPECT_EQ(static_cast<GLsizei>(14), cmd.stride);
3608 EXPECT_EQ(static_cast<GLuint>(15), cmd.offset);
3609 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3612 TEST_F(GLES2FormatTest, VertexAttribPointer) {
3613 cmds::VertexAttribPointer& cmd = *GetBufferAs<cmds::VertexAttribPointer>();
3614 void* next_cmd =
3615 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
3616 static_cast<GLenum>(13), static_cast<GLboolean>(14),
3617 static_cast<GLsizei>(15), static_cast<GLuint>(16));
3618 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribPointer::kCmdId),
3619 cmd.header.command);
3620 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3621 EXPECT_EQ(static_cast<GLuint>(11), cmd.indx);
3622 EXPECT_EQ(static_cast<GLint>(12), cmd.size);
3623 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
3624 EXPECT_EQ(static_cast<GLboolean>(14), cmd.normalized);
3625 EXPECT_EQ(static_cast<GLsizei>(15), cmd.stride);
3626 EXPECT_EQ(static_cast<GLuint>(16), cmd.offset);
3627 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3630 TEST_F(GLES2FormatTest, Viewport) {
3631 cmds::Viewport& cmd = *GetBufferAs<cmds::Viewport>();
3632 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
3633 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
3634 EXPECT_EQ(static_cast<uint32_t>(cmds::Viewport::kCmdId), cmd.header.command);
3635 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3636 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
3637 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
3638 EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
3639 EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
3640 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3643 TEST_F(GLES2FormatTest, WaitSync) {
3644 cmds::WaitSync& cmd = *GetBufferAs<cmds::WaitSync>();
3645 void* next_cmd =
3646 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLbitfield>(12),
3647 static_cast<GLuint>(13), static_cast<GLuint>(14));
3648 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSync::kCmdId), cmd.header.command);
3649 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3650 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
3651 EXPECT_EQ(static_cast<GLbitfield>(12), cmd.flags);
3652 EXPECT_EQ(static_cast<GLuint>(13), cmd.timeout_0);
3653 EXPECT_EQ(static_cast<GLuint>(14), cmd.timeout_1);
3654 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3657 TEST_F(GLES2FormatTest, BlitFramebufferCHROMIUM) {
3658 cmds::BlitFramebufferCHROMIUM& cmd =
3659 *GetBufferAs<cmds::BlitFramebufferCHROMIUM>();
3660 void* next_cmd = cmd.Set(
3661 &cmd, static_cast<GLint>(11), static_cast<GLint>(12),
3662 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLint>(15),
3663 static_cast<GLint>(16), static_cast<GLint>(17), static_cast<GLint>(18),
3664 static_cast<GLbitfield>(19), static_cast<GLenum>(20));
3665 EXPECT_EQ(static_cast<uint32_t>(cmds::BlitFramebufferCHROMIUM::kCmdId),
3666 cmd.header.command);
3667 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3668 EXPECT_EQ(static_cast<GLint>(11), cmd.srcX0);
3669 EXPECT_EQ(static_cast<GLint>(12), cmd.srcY0);
3670 EXPECT_EQ(static_cast<GLint>(13), cmd.srcX1);
3671 EXPECT_EQ(static_cast<GLint>(14), cmd.srcY1);
3672 EXPECT_EQ(static_cast<GLint>(15), cmd.dstX0);
3673 EXPECT_EQ(static_cast<GLint>(16), cmd.dstY0);
3674 EXPECT_EQ(static_cast<GLint>(17), cmd.dstX1);
3675 EXPECT_EQ(static_cast<GLint>(18), cmd.dstY1);
3676 EXPECT_EQ(static_cast<GLbitfield>(19), cmd.mask);
3677 EXPECT_EQ(static_cast<GLenum>(20), cmd.filter);
3678 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3681 TEST_F(GLES2FormatTest, RenderbufferStorageMultisampleCHROMIUM) {
3682 cmds::RenderbufferStorageMultisampleCHROMIUM& cmd =
3683 *GetBufferAs<cmds::RenderbufferStorageMultisampleCHROMIUM>();
3684 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
3685 static_cast<GLsizei>(12), static_cast<GLenum>(13),
3686 static_cast<GLsizei>(14), static_cast<GLsizei>(15));
3687 EXPECT_EQ(static_cast<uint32_t>(
3688 cmds::RenderbufferStorageMultisampleCHROMIUM::kCmdId),
3689 cmd.header.command);
3690 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3691 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3692 EXPECT_EQ(static_cast<GLsizei>(12), cmd.samples);
3693 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
3694 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
3695 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
3696 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3699 TEST_F(GLES2FormatTest, RenderbufferStorageMultisampleEXT) {
3700 cmds::RenderbufferStorageMultisampleEXT& cmd =
3701 *GetBufferAs<cmds::RenderbufferStorageMultisampleEXT>();
3702 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
3703 static_cast<GLsizei>(12), static_cast<GLenum>(13),
3704 static_cast<GLsizei>(14), static_cast<GLsizei>(15));
3705 EXPECT_EQ(
3706 static_cast<uint32_t>(cmds::RenderbufferStorageMultisampleEXT::kCmdId),
3707 cmd.header.command);
3708 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3709 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3710 EXPECT_EQ(static_cast<GLsizei>(12), cmd.samples);
3711 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
3712 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
3713 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
3714 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3717 TEST_F(GLES2FormatTest, FramebufferTexture2DMultisampleEXT) {
3718 cmds::FramebufferTexture2DMultisampleEXT& cmd =
3719 *GetBufferAs<cmds::FramebufferTexture2DMultisampleEXT>();
3720 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
3721 static_cast<GLenum>(12), static_cast<GLenum>(13),
3722 static_cast<GLuint>(14), static_cast<GLsizei>(15));
3723 EXPECT_EQ(
3724 static_cast<uint32_t>(cmds::FramebufferTexture2DMultisampleEXT::kCmdId),
3725 cmd.header.command);
3726 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3727 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3728 EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
3729 EXPECT_EQ(static_cast<GLenum>(13), cmd.textarget);
3730 EXPECT_EQ(static_cast<GLuint>(14), cmd.texture);
3731 EXPECT_EQ(static_cast<GLsizei>(15), cmd.samples);
3732 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3735 TEST_F(GLES2FormatTest, TexStorage2DEXT) {
3736 cmds::TexStorage2DEXT& cmd = *GetBufferAs<cmds::TexStorage2DEXT>();
3737 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
3738 static_cast<GLsizei>(12), static_cast<GLenum>(13),
3739 static_cast<GLsizei>(14), static_cast<GLsizei>(15));
3740 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage2DEXT::kCmdId),
3741 cmd.header.command);
3742 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3743 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3744 EXPECT_EQ(static_cast<GLsizei>(12), cmd.levels);
3745 EXPECT_EQ(static_cast<GLenum>(13), cmd.internalFormat);
3746 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
3747 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
3748 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3751 TEST_F(GLES2FormatTest, GenQueriesEXTImmediate) {
3752 static GLuint ids[] = {
3753 12, 23, 34,
3755 cmds::GenQueriesEXTImmediate& cmd =
3756 *GetBufferAs<cmds::GenQueriesEXTImmediate>();
3757 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
3758 EXPECT_EQ(static_cast<uint32_t>(cmds::GenQueriesEXTImmediate::kCmdId),
3759 cmd.header.command);
3760 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
3761 cmd.header.size * 4u);
3762 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
3763 CheckBytesWrittenMatchesExpectedSize(
3764 next_cmd,
3765 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
3766 // TODO(gman): Check that ids were inserted;
3769 TEST_F(GLES2FormatTest, DeleteQueriesEXTImmediate) {
3770 static GLuint ids[] = {
3771 12, 23, 34,
3773 cmds::DeleteQueriesEXTImmediate& cmd =
3774 *GetBufferAs<cmds::DeleteQueriesEXTImmediate>();
3775 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
3776 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteQueriesEXTImmediate::kCmdId),
3777 cmd.header.command);
3778 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
3779 cmd.header.size * 4u);
3780 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
3781 CheckBytesWrittenMatchesExpectedSize(
3782 next_cmd,
3783 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
3784 // TODO(gman): Check that ids were inserted;
3787 TEST_F(GLES2FormatTest, BeginQueryEXT) {
3788 cmds::BeginQueryEXT& cmd = *GetBufferAs<cmds::BeginQueryEXT>();
3789 void* next_cmd =
3790 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
3791 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
3792 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginQueryEXT::kCmdId),
3793 cmd.header.command);
3794 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3795 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3796 EXPECT_EQ(static_cast<GLuint>(12), cmd.id);
3797 EXPECT_EQ(static_cast<uint32_t>(13), cmd.sync_data_shm_id);
3798 EXPECT_EQ(static_cast<uint32_t>(14), cmd.sync_data_shm_offset);
3799 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3802 TEST_F(GLES2FormatTest, BeginTransformFeedback) {
3803 cmds::BeginTransformFeedback& cmd =
3804 *GetBufferAs<cmds::BeginTransformFeedback>();
3805 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
3806 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginTransformFeedback::kCmdId),
3807 cmd.header.command);
3808 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3809 EXPECT_EQ(static_cast<GLenum>(11), cmd.primitivemode);
3810 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3813 TEST_F(GLES2FormatTest, EndQueryEXT) {
3814 cmds::EndQueryEXT& cmd = *GetBufferAs<cmds::EndQueryEXT>();
3815 void* next_cmd =
3816 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
3817 EXPECT_EQ(static_cast<uint32_t>(cmds::EndQueryEXT::kCmdId),
3818 cmd.header.command);
3819 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3820 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3821 EXPECT_EQ(static_cast<GLuint>(12), cmd.submit_count);
3822 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3825 TEST_F(GLES2FormatTest, EndTransformFeedback) {
3826 cmds::EndTransformFeedback& cmd = *GetBufferAs<cmds::EndTransformFeedback>();
3827 void* next_cmd = cmd.Set(&cmd);
3828 EXPECT_EQ(static_cast<uint32_t>(cmds::EndTransformFeedback::kCmdId),
3829 cmd.header.command);
3830 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3831 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3834 TEST_F(GLES2FormatTest, InsertEventMarkerEXT) {
3835 cmds::InsertEventMarkerEXT& cmd = *GetBufferAs<cmds::InsertEventMarkerEXT>();
3836 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3837 EXPECT_EQ(static_cast<uint32_t>(cmds::InsertEventMarkerEXT::kCmdId),
3838 cmd.header.command);
3839 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3840 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
3841 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3844 TEST_F(GLES2FormatTest, PushGroupMarkerEXT) {
3845 cmds::PushGroupMarkerEXT& cmd = *GetBufferAs<cmds::PushGroupMarkerEXT>();
3846 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3847 EXPECT_EQ(static_cast<uint32_t>(cmds::PushGroupMarkerEXT::kCmdId),
3848 cmd.header.command);
3849 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3850 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
3851 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3854 TEST_F(GLES2FormatTest, PopGroupMarkerEXT) {
3855 cmds::PopGroupMarkerEXT& cmd = *GetBufferAs<cmds::PopGroupMarkerEXT>();
3856 void* next_cmd = cmd.Set(&cmd);
3857 EXPECT_EQ(static_cast<uint32_t>(cmds::PopGroupMarkerEXT::kCmdId),
3858 cmd.header.command);
3859 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3860 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3863 TEST_F(GLES2FormatTest, GenVertexArraysOESImmediate) {
3864 static GLuint ids[] = {
3865 12, 23, 34,
3867 cmds::GenVertexArraysOESImmediate& cmd =
3868 *GetBufferAs<cmds::GenVertexArraysOESImmediate>();
3869 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
3870 EXPECT_EQ(static_cast<uint32_t>(cmds::GenVertexArraysOESImmediate::kCmdId),
3871 cmd.header.command);
3872 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
3873 cmd.header.size * 4u);
3874 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
3875 CheckBytesWrittenMatchesExpectedSize(
3876 next_cmd,
3877 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
3878 // TODO(gman): Check that ids were inserted;
3881 TEST_F(GLES2FormatTest, DeleteVertexArraysOESImmediate) {
3882 static GLuint ids[] = {
3883 12, 23, 34,
3885 cmds::DeleteVertexArraysOESImmediate& cmd =
3886 *GetBufferAs<cmds::DeleteVertexArraysOESImmediate>();
3887 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
3888 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteVertexArraysOESImmediate::kCmdId),
3889 cmd.header.command);
3890 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
3891 cmd.header.size * 4u);
3892 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
3893 CheckBytesWrittenMatchesExpectedSize(
3894 next_cmd,
3895 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
3896 // TODO(gman): Check that ids were inserted;
3899 TEST_F(GLES2FormatTest, IsVertexArrayOES) {
3900 cmds::IsVertexArrayOES& cmd = *GetBufferAs<cmds::IsVertexArrayOES>();
3901 void* next_cmd =
3902 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
3903 static_cast<uint32_t>(13));
3904 EXPECT_EQ(static_cast<uint32_t>(cmds::IsVertexArrayOES::kCmdId),
3905 cmd.header.command);
3906 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3907 EXPECT_EQ(static_cast<GLuint>(11), cmd.array);
3908 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
3909 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
3910 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3913 TEST_F(GLES2FormatTest, BindVertexArrayOES) {
3914 cmds::BindVertexArrayOES& cmd = *GetBufferAs<cmds::BindVertexArrayOES>();
3915 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
3916 EXPECT_EQ(static_cast<uint32_t>(cmds::BindVertexArrayOES::kCmdId),
3917 cmd.header.command);
3918 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3919 EXPECT_EQ(static_cast<GLuint>(11), cmd.array);
3920 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3923 TEST_F(GLES2FormatTest, SwapBuffers) {
3924 cmds::SwapBuffers& cmd = *GetBufferAs<cmds::SwapBuffers>();
3925 void* next_cmd = cmd.Set(&cmd);
3926 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapBuffers::kCmdId),
3927 cmd.header.command);
3928 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3929 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3932 TEST_F(GLES2FormatTest, GetMaxValueInBufferCHROMIUM) {
3933 cmds::GetMaxValueInBufferCHROMIUM& cmd =
3934 *GetBufferAs<cmds::GetMaxValueInBufferCHROMIUM>();
3935 void* next_cmd =
3936 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLsizei>(12),
3937 static_cast<GLenum>(13), static_cast<GLuint>(14),
3938 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
3939 EXPECT_EQ(static_cast<uint32_t>(cmds::GetMaxValueInBufferCHROMIUM::kCmdId),
3940 cmd.header.command);
3941 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3942 EXPECT_EQ(static_cast<GLuint>(11), cmd.buffer_id);
3943 EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
3944 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
3945 EXPECT_EQ(static_cast<GLuint>(14), cmd.offset);
3946 EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_id);
3947 EXPECT_EQ(static_cast<uint32_t>(16), cmd.result_shm_offset);
3948 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3951 TEST_F(GLES2FormatTest, EnableFeatureCHROMIUM) {
3952 cmds::EnableFeatureCHROMIUM& cmd =
3953 *GetBufferAs<cmds::EnableFeatureCHROMIUM>();
3954 void* next_cmd =
3955 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
3956 static_cast<uint32_t>(13));
3957 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableFeatureCHROMIUM::kCmdId),
3958 cmd.header.command);
3959 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3960 EXPECT_EQ(static_cast<GLuint>(11), cmd.bucket_id);
3961 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
3962 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
3963 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3966 TEST_F(GLES2FormatTest, MapBufferRange) {
3967 cmds::MapBufferRange& cmd = *GetBufferAs<cmds::MapBufferRange>();
3968 void* next_cmd =
3969 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLintptr>(12),
3970 static_cast<GLsizeiptr>(13), static_cast<GLbitfield>(14),
3971 static_cast<uint32_t>(15), static_cast<uint32_t>(16),
3972 static_cast<uint32_t>(17), static_cast<uint32_t>(18));
3973 EXPECT_EQ(static_cast<uint32_t>(cmds::MapBufferRange::kCmdId),
3974 cmd.header.command);
3975 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3976 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3977 EXPECT_EQ(static_cast<GLintptr>(12), cmd.offset);
3978 EXPECT_EQ(static_cast<GLsizeiptr>(13), cmd.size);
3979 EXPECT_EQ(static_cast<GLbitfield>(14), cmd.access);
3980 EXPECT_EQ(static_cast<uint32_t>(15), cmd.data_shm_id);
3981 EXPECT_EQ(static_cast<uint32_t>(16), cmd.data_shm_offset);
3982 EXPECT_EQ(static_cast<uint32_t>(17), cmd.result_shm_id);
3983 EXPECT_EQ(static_cast<uint32_t>(18), cmd.result_shm_offset);
3984 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3987 TEST_F(GLES2FormatTest, UnmapBuffer) {
3988 cmds::UnmapBuffer& cmd = *GetBufferAs<cmds::UnmapBuffer>();
3989 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
3990 EXPECT_EQ(static_cast<uint32_t>(cmds::UnmapBuffer::kCmdId),
3991 cmd.header.command);
3992 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
3993 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
3994 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
3997 TEST_F(GLES2FormatTest, ResizeCHROMIUM) {
3998 cmds::ResizeCHROMIUM& cmd = *GetBufferAs<cmds::ResizeCHROMIUM>();
3999 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
4000 static_cast<GLuint>(12), static_cast<GLfloat>(13));
4001 EXPECT_EQ(static_cast<uint32_t>(cmds::ResizeCHROMIUM::kCmdId),
4002 cmd.header.command);
4003 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4004 EXPECT_EQ(static_cast<GLuint>(11), cmd.width);
4005 EXPECT_EQ(static_cast<GLuint>(12), cmd.height);
4006 EXPECT_EQ(static_cast<GLfloat>(13), cmd.scale_factor);
4007 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4010 TEST_F(GLES2FormatTest, GetRequestableExtensionsCHROMIUM) {
4011 cmds::GetRequestableExtensionsCHROMIUM& cmd =
4012 *GetBufferAs<cmds::GetRequestableExtensionsCHROMIUM>();
4013 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
4014 EXPECT_EQ(
4015 static_cast<uint32_t>(cmds::GetRequestableExtensionsCHROMIUM::kCmdId),
4016 cmd.header.command);
4017 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4018 EXPECT_EQ(static_cast<uint32_t>(11), cmd.bucket_id);
4019 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4022 TEST_F(GLES2FormatTest, RequestExtensionCHROMIUM) {
4023 cmds::RequestExtensionCHROMIUM& cmd =
4024 *GetBufferAs<cmds::RequestExtensionCHROMIUM>();
4025 void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
4026 EXPECT_EQ(static_cast<uint32_t>(cmds::RequestExtensionCHROMIUM::kCmdId),
4027 cmd.header.command);
4028 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4029 EXPECT_EQ(static_cast<uint32_t>(11), cmd.bucket_id);
4030 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4033 TEST_F(GLES2FormatTest, GetProgramInfoCHROMIUM) {
4034 cmds::GetProgramInfoCHROMIUM& cmd =
4035 *GetBufferAs<cmds::GetProgramInfoCHROMIUM>();
4036 void* next_cmd =
4037 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
4038 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoCHROMIUM::kCmdId),
4039 cmd.header.command);
4040 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4041 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
4042 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
4043 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4046 TEST_F(GLES2FormatTest, GetUniformBlocksCHROMIUM) {
4047 cmds::GetUniformBlocksCHROMIUM& cmd =
4048 *GetBufferAs<cmds::GetUniformBlocksCHROMIUM>();
4049 void* next_cmd =
4050 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
4051 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlocksCHROMIUM::kCmdId),
4052 cmd.header.command);
4053 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4054 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
4055 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
4056 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4059 TEST_F(GLES2FormatTest, GetTransformFeedbackVaryingsCHROMIUM) {
4060 cmds::GetTransformFeedbackVaryingsCHROMIUM& cmd =
4061 *GetBufferAs<cmds::GetTransformFeedbackVaryingsCHROMIUM>();
4062 void* next_cmd =
4063 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
4064 EXPECT_EQ(
4065 static_cast<uint32_t>(cmds::GetTransformFeedbackVaryingsCHROMIUM::kCmdId),
4066 cmd.header.command);
4067 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4068 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
4069 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
4070 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4073 TEST_F(GLES2FormatTest, GetUniformsES3CHROMIUM) {
4074 cmds::GetUniformsES3CHROMIUM& cmd =
4075 *GetBufferAs<cmds::GetUniformsES3CHROMIUM>();
4076 void* next_cmd =
4077 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
4078 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformsES3CHROMIUM::kCmdId),
4079 cmd.header.command);
4080 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4081 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
4082 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
4083 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4086 TEST_F(GLES2FormatTest, GetTranslatedShaderSourceANGLE) {
4087 cmds::GetTranslatedShaderSourceANGLE& cmd =
4088 *GetBufferAs<cmds::GetTranslatedShaderSourceANGLE>();
4089 void* next_cmd =
4090 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
4091 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTranslatedShaderSourceANGLE::kCmdId),
4092 cmd.header.command);
4093 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4094 EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
4095 EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
4096 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4099 TEST_F(GLES2FormatTest, PostSubBufferCHROMIUM) {
4100 cmds::PostSubBufferCHROMIUM& cmd =
4101 *GetBufferAs<cmds::PostSubBufferCHROMIUM>();
4102 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
4103 static_cast<GLint>(13), static_cast<GLint>(14));
4104 EXPECT_EQ(static_cast<uint32_t>(cmds::PostSubBufferCHROMIUM::kCmdId),
4105 cmd.header.command);
4106 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4107 EXPECT_EQ(static_cast<GLint>(11), cmd.x);
4108 EXPECT_EQ(static_cast<GLint>(12), cmd.y);
4109 EXPECT_EQ(static_cast<GLint>(13), cmd.width);
4110 EXPECT_EQ(static_cast<GLint>(14), cmd.height);
4111 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4114 TEST_F(GLES2FormatTest, TexImageIOSurface2DCHROMIUM) {
4115 cmds::TexImageIOSurface2DCHROMIUM& cmd =
4116 *GetBufferAs<cmds::TexImageIOSurface2DCHROMIUM>();
4117 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
4118 static_cast<GLsizei>(12), static_cast<GLsizei>(13),
4119 static_cast<GLuint>(14), static_cast<GLuint>(15));
4120 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImageIOSurface2DCHROMIUM::kCmdId),
4121 cmd.header.command);
4122 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4123 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4124 EXPECT_EQ(static_cast<GLsizei>(12), cmd.width);
4125 EXPECT_EQ(static_cast<GLsizei>(13), cmd.height);
4126 EXPECT_EQ(static_cast<GLuint>(14), cmd.ioSurfaceId);
4127 EXPECT_EQ(static_cast<GLuint>(15), cmd.plane);
4128 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4131 TEST_F(GLES2FormatTest, CopyTextureCHROMIUM) {
4132 cmds::CopyTextureCHROMIUM& cmd = *GetBufferAs<cmds::CopyTextureCHROMIUM>();
4133 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
4134 static_cast<GLenum>(12), static_cast<GLenum>(13),
4135 static_cast<GLint>(14), static_cast<GLenum>(15));
4136 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTextureCHROMIUM::kCmdId),
4137 cmd.header.command);
4138 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4139 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4140 EXPECT_EQ(static_cast<GLenum>(12), cmd.source_id);
4141 EXPECT_EQ(static_cast<GLenum>(13), cmd.dest_id);
4142 EXPECT_EQ(static_cast<GLint>(14), cmd.internalformat);
4143 EXPECT_EQ(static_cast<GLenum>(15), cmd.dest_type);
4144 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4147 TEST_F(GLES2FormatTest, CopySubTextureCHROMIUM) {
4148 cmds::CopySubTextureCHROMIUM& cmd =
4149 *GetBufferAs<cmds::CopySubTextureCHROMIUM>();
4150 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
4151 static_cast<GLenum>(12), static_cast<GLenum>(13),
4152 static_cast<GLint>(14), static_cast<GLint>(15),
4153 static_cast<GLint>(16), static_cast<GLint>(17),
4154 static_cast<GLsizei>(18), static_cast<GLsizei>(19));
4155 EXPECT_EQ(static_cast<uint32_t>(cmds::CopySubTextureCHROMIUM::kCmdId),
4156 cmd.header.command);
4157 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4158 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4159 EXPECT_EQ(static_cast<GLenum>(12), cmd.source_id);
4160 EXPECT_EQ(static_cast<GLenum>(13), cmd.dest_id);
4161 EXPECT_EQ(static_cast<GLint>(14), cmd.xoffset);
4162 EXPECT_EQ(static_cast<GLint>(15), cmd.yoffset);
4163 EXPECT_EQ(static_cast<GLint>(16), cmd.x);
4164 EXPECT_EQ(static_cast<GLint>(17), cmd.y);
4165 EXPECT_EQ(static_cast<GLsizei>(18), cmd.width);
4166 EXPECT_EQ(static_cast<GLsizei>(19), cmd.height);
4167 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4170 TEST_F(GLES2FormatTest, DrawArraysInstancedANGLE) {
4171 cmds::DrawArraysInstancedANGLE& cmd =
4172 *GetBufferAs<cmds::DrawArraysInstancedANGLE>();
4173 void* next_cmd =
4174 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
4175 static_cast<GLsizei>(13), static_cast<GLsizei>(14));
4176 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArraysInstancedANGLE::kCmdId),
4177 cmd.header.command);
4178 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4179 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
4180 EXPECT_EQ(static_cast<GLint>(12), cmd.first);
4181 EXPECT_EQ(static_cast<GLsizei>(13), cmd.count);
4182 EXPECT_EQ(static_cast<GLsizei>(14), cmd.primcount);
4183 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4186 TEST_F(GLES2FormatTest, DrawElementsInstancedANGLE) {
4187 cmds::DrawElementsInstancedANGLE& cmd =
4188 *GetBufferAs<cmds::DrawElementsInstancedANGLE>();
4189 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
4190 static_cast<GLsizei>(12), static_cast<GLenum>(13),
4191 static_cast<GLuint>(14), static_cast<GLsizei>(15));
4192 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElementsInstancedANGLE::kCmdId),
4193 cmd.header.command);
4194 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4195 EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
4196 EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
4197 EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
4198 EXPECT_EQ(static_cast<GLuint>(14), cmd.index_offset);
4199 EXPECT_EQ(static_cast<GLsizei>(15), cmd.primcount);
4200 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4203 TEST_F(GLES2FormatTest, VertexAttribDivisorANGLE) {
4204 cmds::VertexAttribDivisorANGLE& cmd =
4205 *GetBufferAs<cmds::VertexAttribDivisorANGLE>();
4206 void* next_cmd =
4207 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
4208 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribDivisorANGLE::kCmdId),
4209 cmd.header.command);
4210 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4211 EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
4212 EXPECT_EQ(static_cast<GLuint>(12), cmd.divisor);
4213 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4216 // TODO(gman): Write test for GenMailboxCHROMIUM
4217 TEST_F(GLES2FormatTest, ProduceTextureCHROMIUMImmediate) {
4218 const int kSomeBaseValueToTestWith = 51;
4219 static GLbyte data[] = {
4220 static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
4221 static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
4222 static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
4223 static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
4224 static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
4225 static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
4226 static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
4227 static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
4228 static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
4229 static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
4230 static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
4231 static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
4232 static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
4233 static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
4234 static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
4235 static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
4236 static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
4237 static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
4238 static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
4239 static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
4240 static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
4241 static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
4242 static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
4243 static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
4244 static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
4245 static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
4246 static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
4247 static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
4248 static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
4249 static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
4250 static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
4251 static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
4252 static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
4253 static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
4254 static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
4255 static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
4256 static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
4257 static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
4258 static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
4259 static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
4260 static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
4261 static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
4262 static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
4263 static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
4264 static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
4265 static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
4266 static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
4267 static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
4268 static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
4269 static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
4270 static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
4271 static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
4272 static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
4273 static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
4274 static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
4275 static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
4276 static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
4277 static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
4278 static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
4279 static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
4280 static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
4281 static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
4282 static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
4283 static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
4285 cmds::ProduceTextureCHROMIUMImmediate& cmd =
4286 *GetBufferAs<cmds::ProduceTextureCHROMIUMImmediate>();
4287 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), data);
4288 EXPECT_EQ(
4289 static_cast<uint32_t>(cmds::ProduceTextureCHROMIUMImmediate::kCmdId),
4290 cmd.header.command);
4291 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
4292 cmd.header.size * 4u);
4293 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4294 CheckBytesWrittenMatchesExpectedSize(
4295 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
4296 // TODO(gman): Check that data was inserted;
4299 TEST_F(GLES2FormatTest, ProduceTextureDirectCHROMIUMImmediate) {
4300 const int kSomeBaseValueToTestWith = 51;
4301 static GLbyte data[] = {
4302 static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
4303 static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
4304 static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
4305 static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
4306 static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
4307 static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
4308 static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
4309 static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
4310 static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
4311 static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
4312 static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
4313 static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
4314 static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
4315 static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
4316 static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
4317 static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
4318 static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
4319 static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
4320 static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
4321 static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
4322 static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
4323 static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
4324 static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
4325 static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
4326 static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
4327 static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
4328 static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
4329 static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
4330 static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
4331 static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
4332 static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
4333 static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
4334 static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
4335 static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
4336 static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
4337 static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
4338 static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
4339 static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
4340 static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
4341 static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
4342 static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
4343 static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
4344 static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
4345 static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
4346 static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
4347 static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
4348 static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
4349 static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
4350 static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
4351 static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
4352 static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
4353 static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
4354 static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
4355 static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
4356 static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
4357 static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
4358 static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
4359 static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
4360 static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
4361 static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
4362 static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
4363 static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
4364 static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
4365 static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
4367 cmds::ProduceTextureDirectCHROMIUMImmediate& cmd =
4368 *GetBufferAs<cmds::ProduceTextureDirectCHROMIUMImmediate>();
4369 void* next_cmd =
4370 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), data);
4371 EXPECT_EQ(static_cast<uint32_t>(
4372 cmds::ProduceTextureDirectCHROMIUMImmediate::kCmdId),
4373 cmd.header.command);
4374 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
4375 cmd.header.size * 4u);
4376 EXPECT_EQ(static_cast<GLuint>(11), cmd.texture);
4377 EXPECT_EQ(static_cast<GLenum>(12), cmd.target);
4378 CheckBytesWrittenMatchesExpectedSize(
4379 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
4380 // TODO(gman): Check that data was inserted;
4383 TEST_F(GLES2FormatTest, ConsumeTextureCHROMIUMImmediate) {
4384 const int kSomeBaseValueToTestWith = 51;
4385 static GLbyte data[] = {
4386 static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
4387 static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
4388 static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
4389 static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
4390 static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
4391 static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
4392 static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
4393 static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
4394 static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
4395 static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
4396 static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
4397 static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
4398 static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
4399 static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
4400 static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
4401 static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
4402 static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
4403 static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
4404 static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
4405 static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
4406 static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
4407 static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
4408 static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
4409 static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
4410 static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
4411 static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
4412 static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
4413 static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
4414 static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
4415 static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
4416 static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
4417 static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
4418 static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
4419 static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
4420 static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
4421 static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
4422 static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
4423 static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
4424 static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
4425 static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
4426 static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
4427 static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
4428 static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
4429 static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
4430 static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
4431 static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
4432 static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
4433 static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
4434 static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
4435 static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
4436 static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
4437 static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
4438 static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
4439 static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
4440 static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
4441 static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
4442 static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
4443 static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
4444 static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
4445 static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
4446 static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
4447 static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
4448 static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
4449 static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
4451 cmds::ConsumeTextureCHROMIUMImmediate& cmd =
4452 *GetBufferAs<cmds::ConsumeTextureCHROMIUMImmediate>();
4453 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), data);
4454 EXPECT_EQ(
4455 static_cast<uint32_t>(cmds::ConsumeTextureCHROMIUMImmediate::kCmdId),
4456 cmd.header.command);
4457 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
4458 cmd.header.size * 4u);
4459 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4460 CheckBytesWrittenMatchesExpectedSize(
4461 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
4462 // TODO(gman): Check that data was inserted;
4465 // TODO(gman): Write test for CreateAndConsumeTextureCHROMIUMImmediate
4466 TEST_F(GLES2FormatTest, BindUniformLocationCHROMIUMBucket) {
4467 cmds::BindUniformLocationCHROMIUMBucket& cmd =
4468 *GetBufferAs<cmds::BindUniformLocationCHROMIUMBucket>();
4469 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
4470 static_cast<GLint>(12), static_cast<uint32_t>(13));
4471 EXPECT_EQ(
4472 static_cast<uint32_t>(cmds::BindUniformLocationCHROMIUMBucket::kCmdId),
4473 cmd.header.command);
4474 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4475 EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
4476 EXPECT_EQ(static_cast<GLint>(12), cmd.location);
4477 EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
4478 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4481 TEST_F(GLES2FormatTest, GenValuebuffersCHROMIUMImmediate) {
4482 static GLuint ids[] = {
4483 12, 23, 34,
4485 cmds::GenValuebuffersCHROMIUMImmediate& cmd =
4486 *GetBufferAs<cmds::GenValuebuffersCHROMIUMImmediate>();
4487 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
4488 EXPECT_EQ(
4489 static_cast<uint32_t>(cmds::GenValuebuffersCHROMIUMImmediate::kCmdId),
4490 cmd.header.command);
4491 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
4492 cmd.header.size * 4u);
4493 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
4494 CheckBytesWrittenMatchesExpectedSize(
4495 next_cmd,
4496 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
4497 // TODO(gman): Check that ids were inserted;
4500 TEST_F(GLES2FormatTest, DeleteValuebuffersCHROMIUMImmediate) {
4501 static GLuint ids[] = {
4502 12, 23, 34,
4504 cmds::DeleteValuebuffersCHROMIUMImmediate& cmd =
4505 *GetBufferAs<cmds::DeleteValuebuffersCHROMIUMImmediate>();
4506 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(arraysize(ids)), ids);
4507 EXPECT_EQ(
4508 static_cast<uint32_t>(cmds::DeleteValuebuffersCHROMIUMImmediate::kCmdId),
4509 cmd.header.command);
4510 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
4511 cmd.header.size * 4u);
4512 EXPECT_EQ(static_cast<GLsizei>(arraysize(ids)), cmd.n);
4513 CheckBytesWrittenMatchesExpectedSize(
4514 next_cmd,
4515 sizeof(cmd) + RoundSizeToMultipleOfEntries(arraysize(ids) * 4u));
4516 // TODO(gman): Check that ids were inserted;
4519 TEST_F(GLES2FormatTest, IsValuebufferCHROMIUM) {
4520 cmds::IsValuebufferCHROMIUM& cmd =
4521 *GetBufferAs<cmds::IsValuebufferCHROMIUM>();
4522 void* next_cmd =
4523 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
4524 static_cast<uint32_t>(13));
4525 EXPECT_EQ(static_cast<uint32_t>(cmds::IsValuebufferCHROMIUM::kCmdId),
4526 cmd.header.command);
4527 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4528 EXPECT_EQ(static_cast<GLuint>(11), cmd.valuebuffer);
4529 EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
4530 EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
4531 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4534 TEST_F(GLES2FormatTest, BindValuebufferCHROMIUM) {
4535 cmds::BindValuebufferCHROMIUM& cmd =
4536 *GetBufferAs<cmds::BindValuebufferCHROMIUM>();
4537 void* next_cmd =
4538 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
4539 EXPECT_EQ(static_cast<uint32_t>(cmds::BindValuebufferCHROMIUM::kCmdId),
4540 cmd.header.command);
4541 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4542 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4543 EXPECT_EQ(static_cast<GLuint>(12), cmd.valuebuffer);
4544 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4547 TEST_F(GLES2FormatTest, SubscribeValueCHROMIUM) {
4548 cmds::SubscribeValueCHROMIUM& cmd =
4549 *GetBufferAs<cmds::SubscribeValueCHROMIUM>();
4550 void* next_cmd =
4551 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
4552 EXPECT_EQ(static_cast<uint32_t>(cmds::SubscribeValueCHROMIUM::kCmdId),
4553 cmd.header.command);
4554 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4555 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4556 EXPECT_EQ(static_cast<GLenum>(12), cmd.subscription);
4557 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4560 TEST_F(GLES2FormatTest, PopulateSubscribedValuesCHROMIUM) {
4561 cmds::PopulateSubscribedValuesCHROMIUM& cmd =
4562 *GetBufferAs<cmds::PopulateSubscribedValuesCHROMIUM>();
4563 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
4564 EXPECT_EQ(
4565 static_cast<uint32_t>(cmds::PopulateSubscribedValuesCHROMIUM::kCmdId),
4566 cmd.header.command);
4567 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4568 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4569 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4572 TEST_F(GLES2FormatTest, UniformValuebufferCHROMIUM) {
4573 cmds::UniformValuebufferCHROMIUM& cmd =
4574 *GetBufferAs<cmds::UniformValuebufferCHROMIUM>();
4575 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
4576 static_cast<GLenum>(12), static_cast<GLenum>(13));
4577 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformValuebufferCHROMIUM::kCmdId),
4578 cmd.header.command);
4579 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4580 EXPECT_EQ(static_cast<GLint>(11), cmd.location);
4581 EXPECT_EQ(static_cast<GLenum>(12), cmd.target);
4582 EXPECT_EQ(static_cast<GLenum>(13), cmd.subscription);
4583 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4586 TEST_F(GLES2FormatTest, BindTexImage2DCHROMIUM) {
4587 cmds::BindTexImage2DCHROMIUM& cmd =
4588 *GetBufferAs<cmds::BindTexImage2DCHROMIUM>();
4589 void* next_cmd =
4590 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12));
4591 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexImage2DCHROMIUM::kCmdId),
4592 cmd.header.command);
4593 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4594 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4595 EXPECT_EQ(static_cast<GLint>(12), cmd.imageId);
4596 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4599 TEST_F(GLES2FormatTest, ReleaseTexImage2DCHROMIUM) {
4600 cmds::ReleaseTexImage2DCHROMIUM& cmd =
4601 *GetBufferAs<cmds::ReleaseTexImage2DCHROMIUM>();
4602 void* next_cmd =
4603 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12));
4604 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseTexImage2DCHROMIUM::kCmdId),
4605 cmd.header.command);
4606 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4607 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4608 EXPECT_EQ(static_cast<GLint>(12), cmd.imageId);
4609 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4612 TEST_F(GLES2FormatTest, TraceBeginCHROMIUM) {
4613 cmds::TraceBeginCHROMIUM& cmd = *GetBufferAs<cmds::TraceBeginCHROMIUM>();
4614 void* next_cmd =
4615 cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
4616 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceBeginCHROMIUM::kCmdId),
4617 cmd.header.command);
4618 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4619 EXPECT_EQ(static_cast<GLuint>(11), cmd.category_bucket_id);
4620 EXPECT_EQ(static_cast<GLuint>(12), cmd.name_bucket_id);
4621 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4624 TEST_F(GLES2FormatTest, TraceEndCHROMIUM) {
4625 cmds::TraceEndCHROMIUM& cmd = *GetBufferAs<cmds::TraceEndCHROMIUM>();
4626 void* next_cmd = cmd.Set(&cmd);
4627 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceEndCHROMIUM::kCmdId),
4628 cmd.header.command);
4629 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4630 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4633 TEST_F(GLES2FormatTest, AsyncTexSubImage2DCHROMIUM) {
4634 cmds::AsyncTexSubImage2DCHROMIUM& cmd =
4635 *GetBufferAs<cmds::AsyncTexSubImage2DCHROMIUM>();
4636 void* next_cmd = cmd.Set(
4637 &cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
4638 static_cast<GLint>(13), static_cast<GLint>(14), static_cast<GLsizei>(15),
4639 static_cast<GLsizei>(16), static_cast<GLenum>(17),
4640 static_cast<GLenum>(18), static_cast<uint32_t>(19),
4641 static_cast<uint32_t>(20), static_cast<uint32_t>(21),
4642 static_cast<uint32_t>(22), static_cast<uint32_t>(23));
4643 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexSubImage2DCHROMIUM::kCmdId),
4644 cmd.header.command);
4645 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4646 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4647 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
4648 EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
4649 EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
4650 EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
4651 EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
4652 EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
4653 EXPECT_EQ(static_cast<GLenum>(18), cmd.type);
4654 EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id);
4655 EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset);
4656 EXPECT_EQ(static_cast<uint32_t>(21), cmd.async_upload_token);
4657 EXPECT_EQ(static_cast<uint32_t>(22), cmd.sync_data_shm_id);
4658 EXPECT_EQ(static_cast<uint32_t>(23), cmd.sync_data_shm_offset);
4659 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4662 TEST_F(GLES2FormatTest, AsyncTexImage2DCHROMIUM) {
4663 cmds::AsyncTexImage2DCHROMIUM& cmd =
4664 *GetBufferAs<cmds::AsyncTexImage2DCHROMIUM>();
4665 void* next_cmd =
4666 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
4667 static_cast<GLint>(13), static_cast<GLsizei>(14),
4668 static_cast<GLsizei>(15), static_cast<GLenum>(16),
4669 static_cast<GLenum>(17), static_cast<uint32_t>(18),
4670 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
4671 static_cast<uint32_t>(21), static_cast<uint32_t>(22));
4672 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexImage2DCHROMIUM::kCmdId),
4673 cmd.header.command);
4674 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4675 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4676 EXPECT_EQ(static_cast<GLint>(12), cmd.level);
4677 EXPECT_EQ(static_cast<GLint>(13), cmd.internalformat);
4678 EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
4679 EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
4680 EXPECT_EQ(static_cast<GLenum>(16), cmd.format);
4681 EXPECT_EQ(static_cast<GLenum>(17), cmd.type);
4682 EXPECT_EQ(static_cast<uint32_t>(18), cmd.pixels_shm_id);
4683 EXPECT_EQ(static_cast<uint32_t>(19), cmd.pixels_shm_offset);
4684 EXPECT_EQ(static_cast<uint32_t>(20), cmd.async_upload_token);
4685 EXPECT_EQ(static_cast<uint32_t>(21), cmd.sync_data_shm_id);
4686 EXPECT_EQ(static_cast<uint32_t>(22), cmd.sync_data_shm_offset);
4687 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4690 TEST_F(GLES2FormatTest, WaitAsyncTexImage2DCHROMIUM) {
4691 cmds::WaitAsyncTexImage2DCHROMIUM& cmd =
4692 *GetBufferAs<cmds::WaitAsyncTexImage2DCHROMIUM>();
4693 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
4694 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAsyncTexImage2DCHROMIUM::kCmdId),
4695 cmd.header.command);
4696 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4697 EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
4698 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4701 TEST_F(GLES2FormatTest, WaitAllAsyncTexImage2DCHROMIUM) {
4702 cmds::WaitAllAsyncTexImage2DCHROMIUM& cmd =
4703 *GetBufferAs<cmds::WaitAllAsyncTexImage2DCHROMIUM>();
4704 void* next_cmd = cmd.Set(&cmd);
4705 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAllAsyncTexImage2DCHROMIUM::kCmdId),
4706 cmd.header.command);
4707 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4708 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4711 TEST_F(GLES2FormatTest, DiscardFramebufferEXTImmediate) {
4712 const int kSomeBaseValueToTestWith = 51;
4713 static GLenum data[] = {
4714 static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
4715 static_cast<GLenum>(kSomeBaseValueToTestWith + 1),
4717 cmds::DiscardFramebufferEXTImmediate& cmd =
4718 *GetBufferAs<cmds::DiscardFramebufferEXTImmediate>();
4719 const GLsizei kNumElements = 2;
4720 const size_t kExpectedCmdSize =
4721 sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
4722 void* next_cmd =
4723 cmd.Set(&cmd, static_cast<GLenum>(1), static_cast<GLsizei>(2), data);
4724 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardFramebufferEXTImmediate::kCmdId),
4725 cmd.header.command);
4726 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
4727 EXPECT_EQ(static_cast<GLenum>(1), cmd.target);
4728 EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
4729 CheckBytesWrittenMatchesExpectedSize(
4730 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
4731 // TODO(gman): Check that data was inserted;
4734 TEST_F(GLES2FormatTest, LoseContextCHROMIUM) {
4735 cmds::LoseContextCHROMIUM& cmd = *GetBufferAs<cmds::LoseContextCHROMIUM>();
4736 void* next_cmd =
4737 cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
4738 EXPECT_EQ(static_cast<uint32_t>(cmds::LoseContextCHROMIUM::kCmdId),
4739 cmd.header.command);
4740 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4741 EXPECT_EQ(static_cast<GLenum>(11), cmd.current);
4742 EXPECT_EQ(static_cast<GLenum>(12), cmd.other);
4743 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4746 // TODO(gman): Write test for InsertSyncPointCHROMIUM
4747 TEST_F(GLES2FormatTest, WaitSyncPointCHROMIUM) {
4748 cmds::WaitSyncPointCHROMIUM& cmd =
4749 *GetBufferAs<cmds::WaitSyncPointCHROMIUM>();
4750 void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
4751 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSyncPointCHROMIUM::kCmdId),
4752 cmd.header.command);
4753 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4754 EXPECT_EQ(static_cast<GLuint>(11), cmd.sync_point);
4755 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4758 TEST_F(GLES2FormatTest, DrawBuffersEXTImmediate) {
4759 const int kSomeBaseValueToTestWith = 51;
4760 static GLenum data[] = {
4761 static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
4763 cmds::DrawBuffersEXTImmediate& cmd =
4764 *GetBufferAs<cmds::DrawBuffersEXTImmediate>();
4765 const GLsizei kNumElements = 1;
4766 const size_t kExpectedCmdSize =
4767 sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
4768 void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(1), data);
4769 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawBuffersEXTImmediate::kCmdId),
4770 cmd.header.command);
4771 EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
4772 EXPECT_EQ(static_cast<GLsizei>(1), cmd.count);
4773 CheckBytesWrittenMatchesExpectedSize(
4774 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
4775 // TODO(gman): Check that data was inserted;
4778 TEST_F(GLES2FormatTest, DiscardBackbufferCHROMIUM) {
4779 cmds::DiscardBackbufferCHROMIUM& cmd =
4780 *GetBufferAs<cmds::DiscardBackbufferCHROMIUM>();
4781 void* next_cmd = cmd.Set(&cmd);
4782 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardBackbufferCHROMIUM::kCmdId),
4783 cmd.header.command);
4784 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4785 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4788 TEST_F(GLES2FormatTest, ScheduleOverlayPlaneCHROMIUM) {
4789 cmds::ScheduleOverlayPlaneCHROMIUM& cmd =
4790 *GetBufferAs<cmds::ScheduleOverlayPlaneCHROMIUM>();
4791 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11),
4792 static_cast<GLenum>(12), static_cast<GLuint>(13),
4793 static_cast<GLint>(14), static_cast<GLint>(15),
4794 static_cast<GLint>(16), static_cast<GLint>(17),
4795 static_cast<GLfloat>(18), static_cast<GLfloat>(19),
4796 static_cast<GLfloat>(20), static_cast<GLfloat>(21));
4797 EXPECT_EQ(static_cast<uint32_t>(cmds::ScheduleOverlayPlaneCHROMIUM::kCmdId),
4798 cmd.header.command);
4799 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4800 EXPECT_EQ(static_cast<GLint>(11), cmd.plane_z_order);
4801 EXPECT_EQ(static_cast<GLenum>(12), cmd.plane_transform);
4802 EXPECT_EQ(static_cast<GLuint>(13), cmd.overlay_texture_id);
4803 EXPECT_EQ(static_cast<GLint>(14), cmd.bounds_x);
4804 EXPECT_EQ(static_cast<GLint>(15), cmd.bounds_y);
4805 EXPECT_EQ(static_cast<GLint>(16), cmd.bounds_width);
4806 EXPECT_EQ(static_cast<GLint>(17), cmd.bounds_height);
4807 EXPECT_EQ(static_cast<GLfloat>(18), cmd.uv_x);
4808 EXPECT_EQ(static_cast<GLfloat>(19), cmd.uv_y);
4809 EXPECT_EQ(static_cast<GLfloat>(20), cmd.uv_width);
4810 EXPECT_EQ(static_cast<GLfloat>(21), cmd.uv_height);
4811 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4814 TEST_F(GLES2FormatTest, SwapInterval) {
4815 cmds::SwapInterval& cmd = *GetBufferAs<cmds::SwapInterval>();
4816 void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11));
4817 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapInterval::kCmdId),
4818 cmd.header.command);
4819 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4820 EXPECT_EQ(static_cast<GLint>(11), cmd.interval);
4821 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4824 TEST_F(GLES2FormatTest, MatrixLoadfCHROMIUMImmediate) {
4825 const int kSomeBaseValueToTestWith = 51;
4826 static GLfloat data[] = {
4827 static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
4828 static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
4829 static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
4830 static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
4831 static_cast<GLfloat>(kSomeBaseValueToTestWith + 4),
4832 static_cast<GLfloat>(kSomeBaseValueToTestWith + 5),
4833 static_cast<GLfloat>(kSomeBaseValueToTestWith + 6),
4834 static_cast<GLfloat>(kSomeBaseValueToTestWith + 7),
4835 static_cast<GLfloat>(kSomeBaseValueToTestWith + 8),
4836 static_cast<GLfloat>(kSomeBaseValueToTestWith + 9),
4837 static_cast<GLfloat>(kSomeBaseValueToTestWith + 10),
4838 static_cast<GLfloat>(kSomeBaseValueToTestWith + 11),
4839 static_cast<GLfloat>(kSomeBaseValueToTestWith + 12),
4840 static_cast<GLfloat>(kSomeBaseValueToTestWith + 13),
4841 static_cast<GLfloat>(kSomeBaseValueToTestWith + 14),
4842 static_cast<GLfloat>(kSomeBaseValueToTestWith + 15),
4844 cmds::MatrixLoadfCHROMIUMImmediate& cmd =
4845 *GetBufferAs<cmds::MatrixLoadfCHROMIUMImmediate>();
4846 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), data);
4847 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadfCHROMIUMImmediate::kCmdId),
4848 cmd.header.command);
4849 EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
4850 cmd.header.size * 4u);
4851 EXPECT_EQ(static_cast<GLenum>(11), cmd.matrixMode);
4852 CheckBytesWrittenMatchesExpectedSize(
4853 next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
4854 // TODO(gman): Check that data was inserted;
4857 TEST_F(GLES2FormatTest, MatrixLoadIdentityCHROMIUM) {
4858 cmds::MatrixLoadIdentityCHROMIUM& cmd =
4859 *GetBufferAs<cmds::MatrixLoadIdentityCHROMIUM>();
4860 void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
4861 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadIdentityCHROMIUM::kCmdId),
4862 cmd.header.command);
4863 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4864 EXPECT_EQ(static_cast<GLenum>(11), cmd.matrixMode);
4865 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4868 TEST_F(GLES2FormatTest, BlendBarrierKHR) {
4869 cmds::BlendBarrierKHR& cmd = *GetBufferAs<cmds::BlendBarrierKHR>();
4870 void* next_cmd = cmd.Set(&cmd);
4871 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendBarrierKHR::kCmdId),
4872 cmd.header.command);
4873 EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
4874 CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
4877 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_