1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 // This file contains unit tests for gles2 commmands
12 // It is included by gles2_cmd_format_test.cc
14 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
15 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
17 TEST_F(GLES2FormatTest
, ActiveTexture
) {
18 cmds::ActiveTexture
& cmd
= *GetBufferAs
<cmds::ActiveTexture
>();
19 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
20 EXPECT_EQ(static_cast<uint32_t>(cmds::ActiveTexture::kCmdId
),
22 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
23 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.texture
);
24 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
27 TEST_F(GLES2FormatTest
, AttachShader
) {
28 cmds::AttachShader
& cmd
= *GetBufferAs
<cmds::AttachShader
>();
30 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
31 EXPECT_EQ(static_cast<uint32_t>(cmds::AttachShader::kCmdId
),
33 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
34 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
35 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
36 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
39 TEST_F(GLES2FormatTest
, BindAttribLocationBucket
) {
40 cmds::BindAttribLocationBucket
& cmd
=
41 *GetBufferAs
<cmds::BindAttribLocationBucket
>();
42 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
43 static_cast<GLuint
>(12), static_cast<uint32_t>(13));
44 EXPECT_EQ(static_cast<uint32_t>(cmds::BindAttribLocationBucket::kCmdId
),
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
>();
56 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
57 EXPECT_EQ(static_cast<uint32_t>(cmds::BindBuffer::kCmdId
),
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
),
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
>();
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
),
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
>();
98 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
99 EXPECT_EQ(static_cast<uint32_t>(cmds::BindFramebuffer::kCmdId
),
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
>();
110 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
111 EXPECT_EQ(static_cast<uint32_t>(cmds::BindRenderbuffer::kCmdId
),
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
>();
122 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
123 EXPECT_EQ(static_cast<uint32_t>(cmds::BindSampler::kCmdId
),
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
>();
134 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
135 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexture::kCmdId
),
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
>();
147 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
148 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTransformFeedback::kCmdId
),
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
>();
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
),
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
),
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
>();
185 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
186 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquationSeparate::kCmdId
),
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
>();
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
>();
304 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12), data
);
305 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferfvImmediate::kCmdId
),
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
>();
327 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12), data
);
328 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferivImmediate::kCmdId
),
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
>();
350 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12), data
);
351 EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferuivImmediate::kCmdId
),
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
>();
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
),
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
),
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
),
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
>();
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
),
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
, CopyBufferSubData
) {
527 cmds::CopyBufferSubData
& cmd
= *GetBufferAs
<cmds::CopyBufferSubData
>();
529 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
530 static_cast<GLintptr
>(13), static_cast<GLintptr
>(14),
531 static_cast<GLsizeiptr
>(15));
532 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyBufferSubData::kCmdId
),
534 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
535 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.readtarget
);
536 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.writetarget
);
537 EXPECT_EQ(static_cast<GLintptr
>(13), cmd
.readoffset
);
538 EXPECT_EQ(static_cast<GLintptr
>(14), cmd
.writeoffset
);
539 EXPECT_EQ(static_cast<GLsizeiptr
>(15), cmd
.size
);
540 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
543 TEST_F(GLES2FormatTest
, CopyTexImage2D
) {
544 cmds::CopyTexImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexImage2D
>();
545 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
546 static_cast<GLint
>(12), static_cast<GLenum
>(13),
547 static_cast<GLint
>(14), static_cast<GLint
>(15),
548 static_cast<GLsizei
>(16), static_cast<GLsizei
>(17));
549 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexImage2D::kCmdId
),
551 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
552 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
553 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
554 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
555 EXPECT_EQ(static_cast<GLint
>(14), cmd
.x
);
556 EXPECT_EQ(static_cast<GLint
>(15), cmd
.y
);
557 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
558 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
559 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
562 TEST_F(GLES2FormatTest
, CopyTexSubImage2D
) {
563 cmds::CopyTexSubImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexSubImage2D
>();
565 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
566 static_cast<GLint
>(13), static_cast<GLint
>(14),
567 static_cast<GLint
>(15), static_cast<GLint
>(16),
568 static_cast<GLsizei
>(17), static_cast<GLsizei
>(18));
569 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage2D::kCmdId
),
571 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
572 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
573 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
574 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
575 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
576 EXPECT_EQ(static_cast<GLint
>(15), cmd
.x
);
577 EXPECT_EQ(static_cast<GLint
>(16), cmd
.y
);
578 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.width
);
579 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.height
);
580 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
583 TEST_F(GLES2FormatTest
, CopyTexSubImage3D
) {
584 cmds::CopyTexSubImage3D
& cmd
= *GetBufferAs
<cmds::CopyTexSubImage3D
>();
585 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
586 static_cast<GLint
>(12), static_cast<GLint
>(13),
587 static_cast<GLint
>(14), static_cast<GLint
>(15),
588 static_cast<GLint
>(16), static_cast<GLint
>(17),
589 static_cast<GLsizei
>(18), static_cast<GLsizei
>(19));
590 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage3D::kCmdId
),
592 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
593 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
594 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
595 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
596 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
597 EXPECT_EQ(static_cast<GLint
>(15), cmd
.zoffset
);
598 EXPECT_EQ(static_cast<GLint
>(16), cmd
.x
);
599 EXPECT_EQ(static_cast<GLint
>(17), cmd
.y
);
600 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.width
);
601 EXPECT_EQ(static_cast<GLsizei
>(19), cmd
.height
);
602 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
605 TEST_F(GLES2FormatTest
, CreateProgram
) {
606 cmds::CreateProgram
& cmd
= *GetBufferAs
<cmds::CreateProgram
>();
607 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
608 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateProgram::kCmdId
),
610 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
611 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.client_id
);
612 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
615 TEST_F(GLES2FormatTest
, CreateShader
) {
616 cmds::CreateShader
& cmd
= *GetBufferAs
<cmds::CreateShader
>();
618 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12));
619 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateShader::kCmdId
),
621 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
622 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.type
);
623 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.client_id
);
624 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
627 TEST_F(GLES2FormatTest
, CullFace
) {
628 cmds::CullFace
& cmd
= *GetBufferAs
<cmds::CullFace
>();
629 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
630 EXPECT_EQ(static_cast<uint32_t>(cmds::CullFace::kCmdId
), cmd
.header
.command
);
631 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
632 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
633 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
636 TEST_F(GLES2FormatTest
, DeleteBuffersImmediate
) {
637 static GLuint ids
[] = {
640 cmds::DeleteBuffersImmediate
& cmd
=
641 *GetBufferAs
<cmds::DeleteBuffersImmediate
>();
642 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
643 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteBuffersImmediate::kCmdId
),
645 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
646 cmd
.header
.size
* 4u);
647 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
648 CheckBytesWrittenMatchesExpectedSize(
650 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
651 // TODO(gman): Check that ids were inserted;
654 TEST_F(GLES2FormatTest
, DeleteFramebuffersImmediate
) {
655 static GLuint ids
[] = {
658 cmds::DeleteFramebuffersImmediate
& cmd
=
659 *GetBufferAs
<cmds::DeleteFramebuffersImmediate
>();
660 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
661 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteFramebuffersImmediate::kCmdId
),
663 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
664 cmd
.header
.size
* 4u);
665 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
666 CheckBytesWrittenMatchesExpectedSize(
668 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
669 // TODO(gman): Check that ids were inserted;
672 TEST_F(GLES2FormatTest
, DeleteProgram
) {
673 cmds::DeleteProgram
& cmd
= *GetBufferAs
<cmds::DeleteProgram
>();
674 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
675 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteProgram::kCmdId
),
677 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
678 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
679 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
682 TEST_F(GLES2FormatTest
, DeleteRenderbuffersImmediate
) {
683 static GLuint ids
[] = {
686 cmds::DeleteRenderbuffersImmediate
& cmd
=
687 *GetBufferAs
<cmds::DeleteRenderbuffersImmediate
>();
688 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
689 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteRenderbuffersImmediate::kCmdId
),
691 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
692 cmd
.header
.size
* 4u);
693 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
694 CheckBytesWrittenMatchesExpectedSize(
696 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
697 // TODO(gman): Check that ids were inserted;
700 TEST_F(GLES2FormatTest
, DeleteSamplersImmediate
) {
701 static GLuint ids
[] = {
704 cmds::DeleteSamplersImmediate
& cmd
=
705 *GetBufferAs
<cmds::DeleteSamplersImmediate
>();
706 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
707 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSamplersImmediate::kCmdId
),
709 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
710 cmd
.header
.size
* 4u);
711 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
712 CheckBytesWrittenMatchesExpectedSize(
714 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
715 // TODO(gman): Check that ids were inserted;
718 TEST_F(GLES2FormatTest
, DeleteSync
) {
719 cmds::DeleteSync
& cmd
= *GetBufferAs
<cmds::DeleteSync
>();
720 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
721 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSync::kCmdId
),
723 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
724 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
725 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
728 TEST_F(GLES2FormatTest
, DeleteShader
) {
729 cmds::DeleteShader
& cmd
= *GetBufferAs
<cmds::DeleteShader
>();
730 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
731 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteShader::kCmdId
),
733 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
734 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
735 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
738 TEST_F(GLES2FormatTest
, DeleteTexturesImmediate
) {
739 static GLuint ids
[] = {
742 cmds::DeleteTexturesImmediate
& cmd
=
743 *GetBufferAs
<cmds::DeleteTexturesImmediate
>();
744 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
745 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteTexturesImmediate::kCmdId
),
747 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
748 cmd
.header
.size
* 4u);
749 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
750 CheckBytesWrittenMatchesExpectedSize(
752 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
753 // TODO(gman): Check that ids were inserted;
756 TEST_F(GLES2FormatTest
, DeleteTransformFeedbacksImmediate
) {
757 static GLuint ids
[] = {
760 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
761 *GetBufferAs
<cmds::DeleteTransformFeedbacksImmediate
>();
762 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
764 static_cast<uint32_t>(cmds::DeleteTransformFeedbacksImmediate::kCmdId
),
766 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
767 cmd
.header
.size
* 4u);
768 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
769 CheckBytesWrittenMatchesExpectedSize(
771 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
772 // TODO(gman): Check that ids were inserted;
775 TEST_F(GLES2FormatTest
, DepthFunc
) {
776 cmds::DepthFunc
& cmd
= *GetBufferAs
<cmds::DepthFunc
>();
777 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
778 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthFunc::kCmdId
), cmd
.header
.command
);
779 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
780 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
781 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
784 TEST_F(GLES2FormatTest
, DepthMask
) {
785 cmds::DepthMask
& cmd
= *GetBufferAs
<cmds::DepthMask
>();
786 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLboolean
>(11));
787 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthMask::kCmdId
), cmd
.header
.command
);
788 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
789 EXPECT_EQ(static_cast<GLboolean
>(11), cmd
.flag
);
790 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
793 TEST_F(GLES2FormatTest
, DepthRangef
) {
794 cmds::DepthRangef
& cmd
= *GetBufferAs
<cmds::DepthRangef
>();
796 cmd
.Set(&cmd
, static_cast<GLclampf
>(11), static_cast<GLclampf
>(12));
797 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthRangef::kCmdId
),
799 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
800 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.zNear
);
801 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.zFar
);
802 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
805 TEST_F(GLES2FormatTest
, DetachShader
) {
806 cmds::DetachShader
& cmd
= *GetBufferAs
<cmds::DetachShader
>();
808 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
809 EXPECT_EQ(static_cast<uint32_t>(cmds::DetachShader::kCmdId
),
811 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
812 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
813 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
814 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
817 TEST_F(GLES2FormatTest
, Disable
) {
818 cmds::Disable
& cmd
= *GetBufferAs
<cmds::Disable
>();
819 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
820 EXPECT_EQ(static_cast<uint32_t>(cmds::Disable::kCmdId
), cmd
.header
.command
);
821 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
822 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
823 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
826 TEST_F(GLES2FormatTest
, DisableVertexAttribArray
) {
827 cmds::DisableVertexAttribArray
& cmd
=
828 *GetBufferAs
<cmds::DisableVertexAttribArray
>();
829 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
830 EXPECT_EQ(static_cast<uint32_t>(cmds::DisableVertexAttribArray::kCmdId
),
832 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
833 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
834 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
837 TEST_F(GLES2FormatTest
, DrawArrays
) {
838 cmds::DrawArrays
& cmd
= *GetBufferAs
<cmds::DrawArrays
>();
839 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
840 static_cast<GLint
>(12), static_cast<GLsizei
>(13));
841 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArrays::kCmdId
),
843 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
844 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
845 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
846 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
847 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
850 TEST_F(GLES2FormatTest
, DrawElements
) {
851 cmds::DrawElements
& cmd
= *GetBufferAs
<cmds::DrawElements
>();
853 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLsizei
>(12),
854 static_cast<GLenum
>(13), static_cast<GLuint
>(14));
855 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElements::kCmdId
),
857 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
858 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
859 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
860 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
861 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
862 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
865 TEST_F(GLES2FormatTest
, Enable
) {
866 cmds::Enable
& cmd
= *GetBufferAs
<cmds::Enable
>();
867 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
868 EXPECT_EQ(static_cast<uint32_t>(cmds::Enable::kCmdId
), cmd
.header
.command
);
869 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
870 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
871 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
874 TEST_F(GLES2FormatTest
, EnableVertexAttribArray
) {
875 cmds::EnableVertexAttribArray
& cmd
=
876 *GetBufferAs
<cmds::EnableVertexAttribArray
>();
877 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
878 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableVertexAttribArray::kCmdId
),
880 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
881 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
882 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
885 TEST_F(GLES2FormatTest
, FenceSync
) {
886 cmds::FenceSync
& cmd
= *GetBufferAs
<cmds::FenceSync
>();
887 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
888 EXPECT_EQ(static_cast<uint32_t>(cmds::FenceSync::kCmdId
), cmd
.header
.command
);
889 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
890 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.client_id
);
891 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
894 TEST_F(GLES2FormatTest
, Finish
) {
895 cmds::Finish
& cmd
= *GetBufferAs
<cmds::Finish
>();
896 void* next_cmd
= cmd
.Set(&cmd
);
897 EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId
), cmd
.header
.command
);
898 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
899 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
902 TEST_F(GLES2FormatTest
, Flush
) {
903 cmds::Flush
& cmd
= *GetBufferAs
<cmds::Flush
>();
904 void* next_cmd
= cmd
.Set(&cmd
);
905 EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId
), cmd
.header
.command
);
906 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
907 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
910 TEST_F(GLES2FormatTest
, FramebufferRenderbuffer
) {
911 cmds::FramebufferRenderbuffer
& cmd
=
912 *GetBufferAs
<cmds::FramebufferRenderbuffer
>();
914 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
915 static_cast<GLenum
>(13), static_cast<GLuint
>(14));
916 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferRenderbuffer::kCmdId
),
918 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
919 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
920 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
921 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.renderbuffertarget
);
922 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.renderbuffer
);
923 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
926 TEST_F(GLES2FormatTest
, FramebufferTexture2D
) {
927 cmds::FramebufferTexture2D
& cmd
= *GetBufferAs
<cmds::FramebufferTexture2D
>();
929 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
930 static_cast<GLenum
>(13), static_cast<GLuint
>(14));
931 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTexture2D::kCmdId
),
933 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
934 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
935 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
936 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
937 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
938 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
941 TEST_F(GLES2FormatTest
, FramebufferTextureLayer
) {
942 cmds::FramebufferTextureLayer
& cmd
=
943 *GetBufferAs
<cmds::FramebufferTextureLayer
>();
944 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
945 static_cast<GLenum
>(12), static_cast<GLuint
>(13),
946 static_cast<GLint
>(14), static_cast<GLint
>(15));
947 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTextureLayer::kCmdId
),
949 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
950 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
951 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
952 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.texture
);
953 EXPECT_EQ(static_cast<GLint
>(14), cmd
.level
);
954 EXPECT_EQ(static_cast<GLint
>(15), cmd
.layer
);
955 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
958 TEST_F(GLES2FormatTest
, FrontFace
) {
959 cmds::FrontFace
& cmd
= *GetBufferAs
<cmds::FrontFace
>();
960 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
961 EXPECT_EQ(static_cast<uint32_t>(cmds::FrontFace::kCmdId
), cmd
.header
.command
);
962 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
963 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
964 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
967 TEST_F(GLES2FormatTest
, GenBuffersImmediate
) {
968 static GLuint ids
[] = {
971 cmds::GenBuffersImmediate
& cmd
= *GetBufferAs
<cmds::GenBuffersImmediate
>();
972 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
973 EXPECT_EQ(static_cast<uint32_t>(cmds::GenBuffersImmediate::kCmdId
),
975 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
976 cmd
.header
.size
* 4u);
977 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
978 CheckBytesWrittenMatchesExpectedSize(
980 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
981 // TODO(gman): Check that ids were inserted;
984 TEST_F(GLES2FormatTest
, GenerateMipmap
) {
985 cmds::GenerateMipmap
& cmd
= *GetBufferAs
<cmds::GenerateMipmap
>();
986 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
987 EXPECT_EQ(static_cast<uint32_t>(cmds::GenerateMipmap::kCmdId
),
989 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
990 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
991 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
994 TEST_F(GLES2FormatTest
, GenFramebuffersImmediate
) {
995 static GLuint ids
[] = {
998 cmds::GenFramebuffersImmediate
& cmd
=
999 *GetBufferAs
<cmds::GenFramebuffersImmediate
>();
1000 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1001 EXPECT_EQ(static_cast<uint32_t>(cmds::GenFramebuffersImmediate::kCmdId
),
1002 cmd
.header
.command
);
1003 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1004 cmd
.header
.size
* 4u);
1005 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1006 CheckBytesWrittenMatchesExpectedSize(
1008 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1009 // TODO(gman): Check that ids were inserted;
1012 TEST_F(GLES2FormatTest
, GenRenderbuffersImmediate
) {
1013 static GLuint ids
[] = {
1016 cmds::GenRenderbuffersImmediate
& cmd
=
1017 *GetBufferAs
<cmds::GenRenderbuffersImmediate
>();
1018 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1019 EXPECT_EQ(static_cast<uint32_t>(cmds::GenRenderbuffersImmediate::kCmdId
),
1020 cmd
.header
.command
);
1021 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1022 cmd
.header
.size
* 4u);
1023 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1024 CheckBytesWrittenMatchesExpectedSize(
1026 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1027 // TODO(gman): Check that ids were inserted;
1030 TEST_F(GLES2FormatTest
, GenSamplersImmediate
) {
1031 static GLuint ids
[] = {
1034 cmds::GenSamplersImmediate
& cmd
= *GetBufferAs
<cmds::GenSamplersImmediate
>();
1035 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1036 EXPECT_EQ(static_cast<uint32_t>(cmds::GenSamplersImmediate::kCmdId
),
1037 cmd
.header
.command
);
1038 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1039 cmd
.header
.size
* 4u);
1040 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1041 CheckBytesWrittenMatchesExpectedSize(
1043 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1044 // TODO(gman): Check that ids were inserted;
1047 TEST_F(GLES2FormatTest
, GenTexturesImmediate
) {
1048 static GLuint ids
[] = {
1051 cmds::GenTexturesImmediate
& cmd
= *GetBufferAs
<cmds::GenTexturesImmediate
>();
1052 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1053 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTexturesImmediate::kCmdId
),
1054 cmd
.header
.command
);
1055 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1056 cmd
.header
.size
* 4u);
1057 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1058 CheckBytesWrittenMatchesExpectedSize(
1060 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1061 // TODO(gman): Check that ids were inserted;
1064 TEST_F(GLES2FormatTest
, GenTransformFeedbacksImmediate
) {
1065 static GLuint ids
[] = {
1068 cmds::GenTransformFeedbacksImmediate
& cmd
=
1069 *GetBufferAs
<cmds::GenTransformFeedbacksImmediate
>();
1070 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1071 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTransformFeedbacksImmediate::kCmdId
),
1072 cmd
.header
.command
);
1073 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1074 cmd
.header
.size
* 4u);
1075 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1076 CheckBytesWrittenMatchesExpectedSize(
1078 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1079 // TODO(gman): Check that ids were inserted;
1082 TEST_F(GLES2FormatTest
, GetActiveAttrib
) {
1083 cmds::GetActiveAttrib
& cmd
= *GetBufferAs
<cmds::GetActiveAttrib
>();
1085 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1086 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1087 static_cast<uint32_t>(15));
1088 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveAttrib::kCmdId
),
1089 cmd
.header
.command
);
1090 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1091 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1092 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1093 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1094 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1095 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1096 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1099 TEST_F(GLES2FormatTest
, GetActiveUniform
) {
1100 cmds::GetActiveUniform
& cmd
= *GetBufferAs
<cmds::GetActiveUniform
>();
1102 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1103 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1104 static_cast<uint32_t>(15));
1105 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniform::kCmdId
),
1106 cmd
.header
.command
);
1107 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1108 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1109 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1110 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1111 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1112 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1113 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1116 TEST_F(GLES2FormatTest
, GetActiveUniformBlockiv
) {
1117 cmds::GetActiveUniformBlockiv
& cmd
=
1118 *GetBufferAs
<cmds::GetActiveUniformBlockiv
>();
1120 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1121 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1122 static_cast<uint32_t>(15));
1123 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockiv::kCmdId
),
1124 cmd
.header
.command
);
1125 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1126 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1127 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1128 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1129 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1130 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1131 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1134 TEST_F(GLES2FormatTest
, GetActiveUniformBlockName
) {
1135 cmds::GetActiveUniformBlockName
& cmd
=
1136 *GetBufferAs
<cmds::GetActiveUniformBlockName
>();
1138 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1139 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1140 static_cast<uint32_t>(15));
1141 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockName::kCmdId
),
1142 cmd
.header
.command
);
1143 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1144 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1145 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1146 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1147 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1148 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1149 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1152 TEST_F(GLES2FormatTest
, GetActiveUniformsiv
) {
1153 cmds::GetActiveUniformsiv
& cmd
= *GetBufferAs
<cmds::GetActiveUniformsiv
>();
1155 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1156 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1157 static_cast<uint32_t>(15));
1158 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformsiv::kCmdId
),
1159 cmd
.header
.command
);
1160 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1161 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1162 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.indices_bucket_id
);
1163 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1164 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1165 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1166 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1169 TEST_F(GLES2FormatTest
, GetAttachedShaders
) {
1170 cmds::GetAttachedShaders
& cmd
= *GetBufferAs
<cmds::GetAttachedShaders
>();
1172 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1173 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1174 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttachedShaders::kCmdId
),
1175 cmd
.header
.command
);
1176 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1177 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1178 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1179 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1180 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_size
);
1181 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1184 TEST_F(GLES2FormatTest
, GetAttribLocation
) {
1185 cmds::GetAttribLocation
& cmd
= *GetBufferAs
<cmds::GetAttribLocation
>();
1187 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1188 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1189 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttribLocation::kCmdId
),
1190 cmd
.header
.command
);
1191 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1192 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1193 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1194 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1195 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1196 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1199 TEST_F(GLES2FormatTest
, GetBooleanv
) {
1200 cmds::GetBooleanv
& cmd
= *GetBufferAs
<cmds::GetBooleanv
>();
1202 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1203 static_cast<uint32_t>(13));
1204 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBooleanv::kCmdId
),
1205 cmd
.header
.command
);
1206 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1207 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1208 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1209 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1210 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1213 TEST_F(GLES2FormatTest
, GetBufferParameteriv
) {
1214 cmds::GetBufferParameteriv
& cmd
= *GetBufferAs
<cmds::GetBufferParameteriv
>();
1216 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1217 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1218 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteriv::kCmdId
),
1219 cmd
.header
.command
);
1220 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1221 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1222 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1223 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1224 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1225 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1228 TEST_F(GLES2FormatTest
, GetError
) {
1229 cmds::GetError
& cmd
= *GetBufferAs
<cmds::GetError
>();
1231 cmd
.Set(&cmd
, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
1232 EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId
), cmd
.header
.command
);
1233 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1234 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.result_shm_id
);
1235 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_offset
);
1236 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1239 TEST_F(GLES2FormatTest
, GetFloatv
) {
1240 cmds::GetFloatv
& cmd
= *GetBufferAs
<cmds::GetFloatv
>();
1242 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1243 static_cast<uint32_t>(13));
1244 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFloatv::kCmdId
), cmd
.header
.command
);
1245 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1246 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1247 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1248 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1249 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1252 TEST_F(GLES2FormatTest
, GetFragDataLocation
) {
1253 cmds::GetFragDataLocation
& cmd
= *GetBufferAs
<cmds::GetFragDataLocation
>();
1255 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1256 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1257 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFragDataLocation::kCmdId
),
1258 cmd
.header
.command
);
1259 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1260 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1261 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1262 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1263 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1264 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1267 TEST_F(GLES2FormatTest
, GetFramebufferAttachmentParameteriv
) {
1268 cmds::GetFramebufferAttachmentParameteriv
& cmd
=
1269 *GetBufferAs
<cmds::GetFramebufferAttachmentParameteriv
>();
1271 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1272 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1273 static_cast<uint32_t>(15));
1275 static_cast<uint32_t>(cmds::GetFramebufferAttachmentParameteriv::kCmdId
),
1276 cmd
.header
.command
);
1277 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1278 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1279 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
1280 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1281 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1282 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1283 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1286 TEST_F(GLES2FormatTest
, GetIntegerv
) {
1287 cmds::GetIntegerv
& cmd
= *GetBufferAs
<cmds::GetIntegerv
>();
1289 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1290 static_cast<uint32_t>(13));
1291 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegerv::kCmdId
),
1292 cmd
.header
.command
);
1293 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1294 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1295 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1296 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1297 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1300 TEST_F(GLES2FormatTest
, GetInternalformativ
) {
1301 cmds::GetInternalformativ
& cmd
= *GetBufferAs
<cmds::GetInternalformativ
>();
1303 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1304 static_cast<GLenum
>(13), static_cast<GLsizei
>(14),
1305 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
1306 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInternalformativ::kCmdId
),
1307 cmd
.header
.command
);
1308 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1309 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1310 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.format
);
1311 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1312 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.bufSize
);
1313 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_id
);
1314 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.params_shm_offset
);
1315 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1318 TEST_F(GLES2FormatTest
, GetProgramiv
) {
1319 cmds::GetProgramiv
& cmd
= *GetBufferAs
<cmds::GetProgramiv
>();
1321 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1322 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1323 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramiv::kCmdId
),
1324 cmd
.header
.command
);
1325 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1326 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1327 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1328 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1329 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1330 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1333 TEST_F(GLES2FormatTest
, GetProgramInfoLog
) {
1334 cmds::GetProgramInfoLog
& cmd
= *GetBufferAs
<cmds::GetProgramInfoLog
>();
1336 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1337 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoLog::kCmdId
),
1338 cmd
.header
.command
);
1339 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1340 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1341 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1342 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1345 TEST_F(GLES2FormatTest
, GetRenderbufferParameteriv
) {
1346 cmds::GetRenderbufferParameteriv
& cmd
=
1347 *GetBufferAs
<cmds::GetRenderbufferParameteriv
>();
1349 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1350 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1351 EXPECT_EQ(static_cast<uint32_t>(cmds::GetRenderbufferParameteriv::kCmdId
),
1352 cmd
.header
.command
);
1353 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1354 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1355 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1356 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1357 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1358 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1361 TEST_F(GLES2FormatTest
, GetSamplerParameterfv
) {
1362 cmds::GetSamplerParameterfv
& cmd
=
1363 *GetBufferAs
<cmds::GetSamplerParameterfv
>();
1365 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1366 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1367 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameterfv::kCmdId
),
1368 cmd
.header
.command
);
1369 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1370 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1371 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1372 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1373 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1374 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1377 TEST_F(GLES2FormatTest
, GetSamplerParameteriv
) {
1378 cmds::GetSamplerParameteriv
& cmd
=
1379 *GetBufferAs
<cmds::GetSamplerParameteriv
>();
1381 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1382 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1383 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameteriv::kCmdId
),
1384 cmd
.header
.command
);
1385 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1386 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1387 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1388 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1389 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1390 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1393 TEST_F(GLES2FormatTest
, GetShaderiv
) {
1394 cmds::GetShaderiv
& cmd
= *GetBufferAs
<cmds::GetShaderiv
>();
1396 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1397 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1398 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderiv::kCmdId
),
1399 cmd
.header
.command
);
1400 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1401 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1402 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1403 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1404 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1405 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1408 TEST_F(GLES2FormatTest
, GetShaderInfoLog
) {
1409 cmds::GetShaderInfoLog
& cmd
= *GetBufferAs
<cmds::GetShaderInfoLog
>();
1411 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1412 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderInfoLog::kCmdId
),
1413 cmd
.header
.command
);
1414 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1415 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1416 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1417 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1420 TEST_F(GLES2FormatTest
, GetShaderPrecisionFormat
) {
1421 cmds::GetShaderPrecisionFormat
& cmd
=
1422 *GetBufferAs
<cmds::GetShaderPrecisionFormat
>();
1424 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1425 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1426 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderPrecisionFormat::kCmdId
),
1427 cmd
.header
.command
);
1428 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1429 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.shadertype
);
1430 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.precisiontype
);
1431 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_id
);
1432 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_offset
);
1433 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1436 TEST_F(GLES2FormatTest
, GetShaderSource
) {
1437 cmds::GetShaderSource
& cmd
= *GetBufferAs
<cmds::GetShaderSource
>();
1439 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1440 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderSource::kCmdId
),
1441 cmd
.header
.command
);
1442 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1443 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1444 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1445 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1448 TEST_F(GLES2FormatTest
, GetString
) {
1449 cmds::GetString
& cmd
= *GetBufferAs
<cmds::GetString
>();
1451 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12));
1452 EXPECT_EQ(static_cast<uint32_t>(cmds::GetString::kCmdId
), cmd
.header
.command
);
1453 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1454 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.name
);
1455 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1456 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1459 TEST_F(GLES2FormatTest
, GetSynciv
) {
1460 cmds::GetSynciv
& cmd
= *GetBufferAs
<cmds::GetSynciv
>();
1462 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1463 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1464 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSynciv::kCmdId
), cmd
.header
.command
);
1465 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1466 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
1467 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1468 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.values_shm_id
);
1469 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.values_shm_offset
);
1470 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1473 TEST_F(GLES2FormatTest
, GetTexParameterfv
) {
1474 cmds::GetTexParameterfv
& cmd
= *GetBufferAs
<cmds::GetTexParameterfv
>();
1476 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1477 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1478 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameterfv::kCmdId
),
1479 cmd
.header
.command
);
1480 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1481 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1482 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1483 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1484 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1485 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1488 TEST_F(GLES2FormatTest
, GetTexParameteriv
) {
1489 cmds::GetTexParameteriv
& cmd
= *GetBufferAs
<cmds::GetTexParameteriv
>();
1491 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1492 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1493 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameteriv::kCmdId
),
1494 cmd
.header
.command
);
1495 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1496 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1497 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1498 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1499 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1500 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1503 TEST_F(GLES2FormatTest
, GetTransformFeedbackVarying
) {
1504 cmds::GetTransformFeedbackVarying
& cmd
=
1505 *GetBufferAs
<cmds::GetTransformFeedbackVarying
>();
1507 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1508 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1509 static_cast<uint32_t>(15));
1510 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTransformFeedbackVarying::kCmdId
),
1511 cmd
.header
.command
);
1512 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1513 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1514 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1515 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1516 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1517 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1518 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1521 TEST_F(GLES2FormatTest
, GetUniformBlockIndex
) {
1522 cmds::GetUniformBlockIndex
& cmd
= *GetBufferAs
<cmds::GetUniformBlockIndex
>();
1524 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1525 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1526 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlockIndex::kCmdId
),
1527 cmd
.header
.command
);
1528 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1529 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1530 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1531 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.index_shm_id
);
1532 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.index_shm_offset
);
1533 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1536 TEST_F(GLES2FormatTest
, GetUniformfv
) {
1537 cmds::GetUniformfv
& cmd
= *GetBufferAs
<cmds::GetUniformfv
>();
1539 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
1540 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1541 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformfv::kCmdId
),
1542 cmd
.header
.command
);
1543 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1544 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1545 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1546 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1547 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1548 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1551 TEST_F(GLES2FormatTest
, GetUniformiv
) {
1552 cmds::GetUniformiv
& cmd
= *GetBufferAs
<cmds::GetUniformiv
>();
1554 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
1555 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1556 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformiv::kCmdId
),
1557 cmd
.header
.command
);
1558 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1559 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1560 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1561 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1562 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1563 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1566 TEST_F(GLES2FormatTest
, GetUniformIndices
) {
1567 cmds::GetUniformIndices
& cmd
= *GetBufferAs
<cmds::GetUniformIndices
>();
1569 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1570 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1571 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformIndices::kCmdId
),
1572 cmd
.header
.command
);
1573 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1574 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1575 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.names_bucket_id
);
1576 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.indices_shm_id
);
1577 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.indices_shm_offset
);
1578 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1581 TEST_F(GLES2FormatTest
, GetUniformLocation
) {
1582 cmds::GetUniformLocation
& cmd
= *GetBufferAs
<cmds::GetUniformLocation
>();
1584 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1585 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1586 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformLocation::kCmdId
),
1587 cmd
.header
.command
);
1588 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1589 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1590 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1591 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1592 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1593 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1596 TEST_F(GLES2FormatTest
, GetVertexAttribfv
) {
1597 cmds::GetVertexAttribfv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribfv
>();
1599 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1600 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1601 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribfv::kCmdId
),
1602 cmd
.header
.command
);
1603 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1604 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1605 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1606 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1607 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1608 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1611 TEST_F(GLES2FormatTest
, GetVertexAttribiv
) {
1612 cmds::GetVertexAttribiv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribiv
>();
1614 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1615 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1616 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribiv::kCmdId
),
1617 cmd
.header
.command
);
1618 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1619 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1620 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1621 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1622 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1623 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1626 TEST_F(GLES2FormatTest
, GetVertexAttribPointerv
) {
1627 cmds::GetVertexAttribPointerv
& cmd
=
1628 *GetBufferAs
<cmds::GetVertexAttribPointerv
>();
1630 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1631 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1632 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribPointerv::kCmdId
),
1633 cmd
.header
.command
);
1634 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1635 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1636 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1637 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.pointer_shm_id
);
1638 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.pointer_shm_offset
);
1639 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1642 TEST_F(GLES2FormatTest
, Hint
) {
1643 cmds::Hint
& cmd
= *GetBufferAs
<cmds::Hint
>();
1645 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
1646 EXPECT_EQ(static_cast<uint32_t>(cmds::Hint::kCmdId
), cmd
.header
.command
);
1647 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1648 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1649 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.mode
);
1650 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1653 TEST_F(GLES2FormatTest
, InvalidateFramebufferImmediate
) {
1654 const int kSomeBaseValueToTestWith
= 51;
1655 static GLenum data
[] = {
1656 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
1657 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
1659 cmds::InvalidateFramebufferImmediate
& cmd
=
1660 *GetBufferAs
<cmds::InvalidateFramebufferImmediate
>();
1661 const GLsizei kNumElements
= 2;
1662 const size_t kExpectedCmdSize
=
1663 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
1665 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
);
1666 EXPECT_EQ(static_cast<uint32_t>(cmds::InvalidateFramebufferImmediate::kCmdId
),
1667 cmd
.header
.command
);
1668 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1669 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
1670 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1671 CheckBytesWrittenMatchesExpectedSize(
1672 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1673 // TODO(gman): Check that data was inserted;
1676 TEST_F(GLES2FormatTest
, InvalidateSubFramebufferImmediate
) {
1677 const int kSomeBaseValueToTestWith
= 51;
1678 static GLenum data
[] = {
1679 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
1680 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
1682 cmds::InvalidateSubFramebufferImmediate
& cmd
=
1683 *GetBufferAs
<cmds::InvalidateSubFramebufferImmediate
>();
1684 const GLsizei kNumElements
= 2;
1685 const size_t kExpectedCmdSize
=
1686 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
1688 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
,
1689 static_cast<GLint
>(4), static_cast<GLint
>(5),
1690 static_cast<GLsizei
>(6), static_cast<GLsizei
>(7));
1692 static_cast<uint32_t>(cmds::InvalidateSubFramebufferImmediate::kCmdId
),
1693 cmd
.header
.command
);
1694 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1695 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
1696 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1697 EXPECT_EQ(static_cast<GLint
>(4), cmd
.x
);
1698 EXPECT_EQ(static_cast<GLint
>(5), cmd
.y
);
1699 EXPECT_EQ(static_cast<GLsizei
>(6), cmd
.width
);
1700 EXPECT_EQ(static_cast<GLsizei
>(7), cmd
.height
);
1701 CheckBytesWrittenMatchesExpectedSize(
1702 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1703 // TODO(gman): Check that data was inserted;
1706 TEST_F(GLES2FormatTest
, IsBuffer
) {
1707 cmds::IsBuffer
& cmd
= *GetBufferAs
<cmds::IsBuffer
>();
1709 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1710 static_cast<uint32_t>(13));
1711 EXPECT_EQ(static_cast<uint32_t>(cmds::IsBuffer::kCmdId
), cmd
.header
.command
);
1712 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1713 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer
);
1714 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1715 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1716 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1719 TEST_F(GLES2FormatTest
, IsEnabled
) {
1720 cmds::IsEnabled
& cmd
= *GetBufferAs
<cmds::IsEnabled
>();
1722 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1723 static_cast<uint32_t>(13));
1724 EXPECT_EQ(static_cast<uint32_t>(cmds::IsEnabled::kCmdId
), cmd
.header
.command
);
1725 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1726 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
1727 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1728 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1729 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1732 TEST_F(GLES2FormatTest
, IsFramebuffer
) {
1733 cmds::IsFramebuffer
& cmd
= *GetBufferAs
<cmds::IsFramebuffer
>();
1735 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1736 static_cast<uint32_t>(13));
1737 EXPECT_EQ(static_cast<uint32_t>(cmds::IsFramebuffer::kCmdId
),
1738 cmd
.header
.command
);
1739 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1740 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.framebuffer
);
1741 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1742 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1743 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1746 TEST_F(GLES2FormatTest
, IsProgram
) {
1747 cmds::IsProgram
& cmd
= *GetBufferAs
<cmds::IsProgram
>();
1749 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1750 static_cast<uint32_t>(13));
1751 EXPECT_EQ(static_cast<uint32_t>(cmds::IsProgram::kCmdId
), cmd
.header
.command
);
1752 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1753 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1754 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1755 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1756 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1759 TEST_F(GLES2FormatTest
, IsRenderbuffer
) {
1760 cmds::IsRenderbuffer
& cmd
= *GetBufferAs
<cmds::IsRenderbuffer
>();
1762 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1763 static_cast<uint32_t>(13));
1764 EXPECT_EQ(static_cast<uint32_t>(cmds::IsRenderbuffer::kCmdId
),
1765 cmd
.header
.command
);
1766 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1767 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.renderbuffer
);
1768 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1769 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1770 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1773 TEST_F(GLES2FormatTest
, IsSampler
) {
1774 cmds::IsSampler
& cmd
= *GetBufferAs
<cmds::IsSampler
>();
1776 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1777 static_cast<uint32_t>(13));
1778 EXPECT_EQ(static_cast<uint32_t>(cmds::IsSampler::kCmdId
), cmd
.header
.command
);
1779 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1780 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1781 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1782 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1783 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1786 TEST_F(GLES2FormatTest
, IsShader
) {
1787 cmds::IsShader
& cmd
= *GetBufferAs
<cmds::IsShader
>();
1789 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1790 static_cast<uint32_t>(13));
1791 EXPECT_EQ(static_cast<uint32_t>(cmds::IsShader::kCmdId
), cmd
.header
.command
);
1792 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1793 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1794 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1795 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1796 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1799 TEST_F(GLES2FormatTest
, IsSync
) {
1800 cmds::IsSync
& cmd
= *GetBufferAs
<cmds::IsSync
>();
1802 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1803 static_cast<uint32_t>(13));
1804 EXPECT_EQ(static_cast<uint32_t>(cmds::IsSync::kCmdId
), cmd
.header
.command
);
1805 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1806 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
1807 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1808 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1809 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1812 TEST_F(GLES2FormatTest
, IsTexture
) {
1813 cmds::IsTexture
& cmd
= *GetBufferAs
<cmds::IsTexture
>();
1815 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1816 static_cast<uint32_t>(13));
1817 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTexture::kCmdId
), cmd
.header
.command
);
1818 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1819 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
1820 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1821 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1822 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1825 TEST_F(GLES2FormatTest
, IsTransformFeedback
) {
1826 cmds::IsTransformFeedback
& cmd
= *GetBufferAs
<cmds::IsTransformFeedback
>();
1828 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1829 static_cast<uint32_t>(13));
1830 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTransformFeedback::kCmdId
),
1831 cmd
.header
.command
);
1832 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1833 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.transformfeedback
);
1834 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1835 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1836 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1839 TEST_F(GLES2FormatTest
, LineWidth
) {
1840 cmds::LineWidth
& cmd
= *GetBufferAs
<cmds::LineWidth
>();
1841 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLfloat
>(11));
1842 EXPECT_EQ(static_cast<uint32_t>(cmds::LineWidth::kCmdId
), cmd
.header
.command
);
1843 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1844 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.width
);
1845 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1848 TEST_F(GLES2FormatTest
, LinkProgram
) {
1849 cmds::LinkProgram
& cmd
= *GetBufferAs
<cmds::LinkProgram
>();
1850 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
1851 EXPECT_EQ(static_cast<uint32_t>(cmds::LinkProgram::kCmdId
),
1852 cmd
.header
.command
);
1853 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1854 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1855 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1858 TEST_F(GLES2FormatTest
, PauseTransformFeedback
) {
1859 cmds::PauseTransformFeedback
& cmd
=
1860 *GetBufferAs
<cmds::PauseTransformFeedback
>();
1861 void* next_cmd
= cmd
.Set(&cmd
);
1862 EXPECT_EQ(static_cast<uint32_t>(cmds::PauseTransformFeedback::kCmdId
),
1863 cmd
.header
.command
);
1864 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1865 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1868 TEST_F(GLES2FormatTest
, PixelStorei
) {
1869 cmds::PixelStorei
& cmd
= *GetBufferAs
<cmds::PixelStorei
>();
1871 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
1872 EXPECT_EQ(static_cast<uint32_t>(cmds::PixelStorei::kCmdId
),
1873 cmd
.header
.command
);
1874 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1875 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1876 EXPECT_EQ(static_cast<GLint
>(12), cmd
.param
);
1877 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1880 TEST_F(GLES2FormatTest
, PolygonOffset
) {
1881 cmds::PolygonOffset
& cmd
= *GetBufferAs
<cmds::PolygonOffset
>();
1883 cmd
.Set(&cmd
, static_cast<GLfloat
>(11), static_cast<GLfloat
>(12));
1884 EXPECT_EQ(static_cast<uint32_t>(cmds::PolygonOffset::kCmdId
),
1885 cmd
.header
.command
);
1886 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1887 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.factor
);
1888 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.units
);
1889 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1892 TEST_F(GLES2FormatTest
, ReadBuffer
) {
1893 cmds::ReadBuffer
& cmd
= *GetBufferAs
<cmds::ReadBuffer
>();
1894 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
1895 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadBuffer::kCmdId
),
1896 cmd
.header
.command
);
1897 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1898 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.src
);
1899 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1902 TEST_F(GLES2FormatTest
, ReadPixels
) {
1903 cmds::ReadPixels
& cmd
= *GetBufferAs
<cmds::ReadPixels
>();
1904 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
1905 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14),
1906 static_cast<GLenum
>(15), static_cast<GLenum
>(16),
1907 static_cast<uint32_t>(17), static_cast<uint32_t>(18),
1908 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
1909 static_cast<GLboolean
>(21));
1910 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadPixels::kCmdId
),
1911 cmd
.header
.command
);
1912 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1913 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
1914 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
1915 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1916 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1917 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.format
);
1918 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.type
);
1919 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.pixels_shm_id
);
1920 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_offset
);
1921 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.result_shm_id
);
1922 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.result_shm_offset
);
1923 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.async
);
1924 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1927 TEST_F(GLES2FormatTest
, ReleaseShaderCompiler
) {
1928 cmds::ReleaseShaderCompiler
& cmd
=
1929 *GetBufferAs
<cmds::ReleaseShaderCompiler
>();
1930 void* next_cmd
= cmd
.Set(&cmd
);
1931 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseShaderCompiler::kCmdId
),
1932 cmd
.header
.command
);
1933 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1934 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1937 TEST_F(GLES2FormatTest
, RenderbufferStorage
) {
1938 cmds::RenderbufferStorage
& cmd
= *GetBufferAs
<cmds::RenderbufferStorage
>();
1940 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1941 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
1942 EXPECT_EQ(static_cast<uint32_t>(cmds::RenderbufferStorage::kCmdId
),
1943 cmd
.header
.command
);
1944 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1945 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1946 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.internalformat
);
1947 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
1948 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
1949 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1952 TEST_F(GLES2FormatTest
, ResumeTransformFeedback
) {
1953 cmds::ResumeTransformFeedback
& cmd
=
1954 *GetBufferAs
<cmds::ResumeTransformFeedback
>();
1955 void* next_cmd
= cmd
.Set(&cmd
);
1956 EXPECT_EQ(static_cast<uint32_t>(cmds::ResumeTransformFeedback::kCmdId
),
1957 cmd
.header
.command
);
1958 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1959 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1962 TEST_F(GLES2FormatTest
, SampleCoverage
) {
1963 cmds::SampleCoverage
& cmd
= *GetBufferAs
<cmds::SampleCoverage
>();
1965 cmd
.Set(&cmd
, static_cast<GLclampf
>(11), static_cast<GLboolean
>(12));
1966 EXPECT_EQ(static_cast<uint32_t>(cmds::SampleCoverage::kCmdId
),
1967 cmd
.header
.command
);
1968 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1969 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.value
);
1970 EXPECT_EQ(static_cast<GLboolean
>(12), cmd
.invert
);
1971 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1974 TEST_F(GLES2FormatTest
, SamplerParameterf
) {
1975 cmds::SamplerParameterf
& cmd
= *GetBufferAs
<cmds::SamplerParameterf
>();
1976 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
1977 static_cast<GLenum
>(12), static_cast<GLfloat
>(13));
1978 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterf::kCmdId
),
1979 cmd
.header
.command
);
1980 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1981 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1982 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1983 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.param
);
1984 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1987 TEST_F(GLES2FormatTest
, SamplerParameterfvImmediate
) {
1988 const int kSomeBaseValueToTestWith
= 51;
1989 static GLfloat data
[] = {
1990 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
1992 cmds::SamplerParameterfvImmediate
& cmd
=
1993 *GetBufferAs
<cmds::SamplerParameterfvImmediate
>();
1995 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
1996 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterfvImmediate::kCmdId
),
1997 cmd
.header
.command
);
1998 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
1999 cmd
.header
.size
* 4u);
2000 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2001 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2002 CheckBytesWrittenMatchesExpectedSize(
2003 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2004 // TODO(gman): Check that data was inserted;
2007 TEST_F(GLES2FormatTest
, SamplerParameteri
) {
2008 cmds::SamplerParameteri
& cmd
= *GetBufferAs
<cmds::SamplerParameteri
>();
2009 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
2010 static_cast<GLenum
>(12), static_cast<GLint
>(13));
2011 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameteri::kCmdId
),
2012 cmd
.header
.command
);
2013 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2014 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2015 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2016 EXPECT_EQ(static_cast<GLint
>(13), cmd
.param
);
2017 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2020 TEST_F(GLES2FormatTest
, SamplerParameterivImmediate
) {
2021 const int kSomeBaseValueToTestWith
= 51;
2022 static GLint data
[] = {
2023 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2025 cmds::SamplerParameterivImmediate
& cmd
=
2026 *GetBufferAs
<cmds::SamplerParameterivImmediate
>();
2028 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
2029 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterivImmediate::kCmdId
),
2030 cmd
.header
.command
);
2031 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2032 cmd
.header
.size
* 4u);
2033 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2034 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2035 CheckBytesWrittenMatchesExpectedSize(
2036 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2037 // TODO(gman): Check that data was inserted;
2040 TEST_F(GLES2FormatTest
, Scissor
) {
2041 cmds::Scissor
& cmd
= *GetBufferAs
<cmds::Scissor
>();
2042 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2043 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
2044 EXPECT_EQ(static_cast<uint32_t>(cmds::Scissor::kCmdId
), cmd
.header
.command
);
2045 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2046 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
2047 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
2048 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
2049 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
2050 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2053 TEST_F(GLES2FormatTest
, ShaderBinary
) {
2054 cmds::ShaderBinary
& cmd
= *GetBufferAs
<cmds::ShaderBinary
>();
2055 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(11),
2056 static_cast<uint32_t>(12), static_cast<uint32_t>(13),
2057 static_cast<GLenum
>(14), static_cast<uint32_t>(15),
2058 static_cast<uint32_t>(16), static_cast<GLsizei
>(17));
2059 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderBinary::kCmdId
),
2060 cmd
.header
.command
);
2061 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2062 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
2063 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.shaders_shm_id
);
2064 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.shaders_shm_offset
);
2065 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.binaryformat
);
2066 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.binary_shm_id
);
2067 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.binary_shm_offset
);
2068 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.length
);
2069 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2072 TEST_F(GLES2FormatTest
, ShaderSourceBucket
) {
2073 cmds::ShaderSourceBucket
& cmd
= *GetBufferAs
<cmds::ShaderSourceBucket
>();
2075 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
2076 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderSourceBucket::kCmdId
),
2077 cmd
.header
.command
);
2078 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2079 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
2080 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.str_bucket_id
);
2081 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2084 TEST_F(GLES2FormatTest
, StencilFunc
) {
2085 cmds::StencilFunc
& cmd
= *GetBufferAs
<cmds::StencilFunc
>();
2086 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2087 static_cast<GLint
>(12), static_cast<GLuint
>(13));
2088 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFunc::kCmdId
),
2089 cmd
.header
.command
);
2090 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2091 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
2092 EXPECT_EQ(static_cast<GLint
>(12), cmd
.ref
);
2093 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
2094 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2097 TEST_F(GLES2FormatTest
, StencilFuncSeparate
) {
2098 cmds::StencilFuncSeparate
& cmd
= *GetBufferAs
<cmds::StencilFuncSeparate
>();
2100 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
2101 static_cast<GLint
>(13), static_cast<GLuint
>(14));
2102 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFuncSeparate::kCmdId
),
2103 cmd
.header
.command
);
2104 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2105 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2106 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.func
);
2107 EXPECT_EQ(static_cast<GLint
>(13), cmd
.ref
);
2108 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.mask
);
2109 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2112 TEST_F(GLES2FormatTest
, StencilMask
) {
2113 cmds::StencilMask
& cmd
= *GetBufferAs
<cmds::StencilMask
>();
2114 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2115 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMask::kCmdId
),
2116 cmd
.header
.command
);
2117 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2118 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.mask
);
2119 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2122 TEST_F(GLES2FormatTest
, StencilMaskSeparate
) {
2123 cmds::StencilMaskSeparate
& cmd
= *GetBufferAs
<cmds::StencilMaskSeparate
>();
2125 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
2126 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMaskSeparate::kCmdId
),
2127 cmd
.header
.command
);
2128 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2129 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2130 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.mask
);
2131 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2134 TEST_F(GLES2FormatTest
, StencilOp
) {
2135 cmds::StencilOp
& cmd
= *GetBufferAs
<cmds::StencilOp
>();
2136 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2137 static_cast<GLenum
>(12), static_cast<GLenum
>(13));
2138 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOp::kCmdId
), cmd
.header
.command
);
2139 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2140 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.fail
);
2141 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.zfail
);
2142 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zpass
);
2143 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2146 TEST_F(GLES2FormatTest
, StencilOpSeparate
) {
2147 cmds::StencilOpSeparate
& cmd
= *GetBufferAs
<cmds::StencilOpSeparate
>();
2149 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
2150 static_cast<GLenum
>(13), static_cast<GLenum
>(14));
2151 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOpSeparate::kCmdId
),
2152 cmd
.header
.command
);
2153 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2154 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2155 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.fail
);
2156 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zfail
);
2157 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.zpass
);
2158 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2161 TEST_F(GLES2FormatTest
, TexImage2D
) {
2162 cmds::TexImage2D
& cmd
= *GetBufferAs
<cmds::TexImage2D
>();
2164 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2165 static_cast<GLint
>(13), static_cast<GLsizei
>(14),
2166 static_cast<GLsizei
>(15), static_cast<GLenum
>(16),
2167 static_cast<GLenum
>(17), static_cast<uint32_t>(18),
2168 static_cast<uint32_t>(19));
2169 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage2D::kCmdId
),
2170 cmd
.header
.command
);
2171 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2172 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2173 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2174 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
2175 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2176 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2177 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.format
);
2178 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.type
);
2179 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_id
);
2180 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_offset
);
2181 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2184 TEST_F(GLES2FormatTest
, TexImage3D
) {
2185 cmds::TexImage3D
& cmd
= *GetBufferAs
<cmds::TexImage3D
>();
2187 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2188 static_cast<GLint
>(13), static_cast<GLsizei
>(14),
2189 static_cast<GLsizei
>(15), static_cast<GLsizei
>(16),
2190 static_cast<GLenum
>(17), static_cast<GLenum
>(18),
2191 static_cast<uint32_t>(19), static_cast<uint32_t>(20));
2192 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage3D::kCmdId
),
2193 cmd
.header
.command
);
2194 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2195 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2196 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2197 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
2198 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2199 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2200 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.depth
);
2201 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
2202 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
2203 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_id
);
2204 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.pixels_shm_offset
);
2205 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2208 TEST_F(GLES2FormatTest
, TexParameterf
) {
2209 cmds::TexParameterf
& cmd
= *GetBufferAs
<cmds::TexParameterf
>();
2210 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2211 static_cast<GLenum
>(12), static_cast<GLfloat
>(13));
2212 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterf::kCmdId
),
2213 cmd
.header
.command
);
2214 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2215 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2216 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2217 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.param
);
2218 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2221 TEST_F(GLES2FormatTest
, TexParameterfvImmediate
) {
2222 const int kSomeBaseValueToTestWith
= 51;
2223 static GLfloat data
[] = {
2224 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2226 cmds::TexParameterfvImmediate
& cmd
=
2227 *GetBufferAs
<cmds::TexParameterfvImmediate
>();
2229 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12), data
);
2230 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterfvImmediate::kCmdId
),
2231 cmd
.header
.command
);
2232 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2233 cmd
.header
.size
* 4u);
2234 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2235 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2236 CheckBytesWrittenMatchesExpectedSize(
2237 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2238 // TODO(gman): Check that data was inserted;
2241 TEST_F(GLES2FormatTest
, TexParameteri
) {
2242 cmds::TexParameteri
& cmd
= *GetBufferAs
<cmds::TexParameteri
>();
2243 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2244 static_cast<GLenum
>(12), static_cast<GLint
>(13));
2245 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameteri::kCmdId
),
2246 cmd
.header
.command
);
2247 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2248 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2249 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2250 EXPECT_EQ(static_cast<GLint
>(13), cmd
.param
);
2251 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2254 TEST_F(GLES2FormatTest
, TexParameterivImmediate
) {
2255 const int kSomeBaseValueToTestWith
= 51;
2256 static GLint data
[] = {
2257 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2259 cmds::TexParameterivImmediate
& cmd
=
2260 *GetBufferAs
<cmds::TexParameterivImmediate
>();
2262 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12), data
);
2263 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterivImmediate::kCmdId
),
2264 cmd
.header
.command
);
2265 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2266 cmd
.header
.size
* 4u);
2267 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2268 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2269 CheckBytesWrittenMatchesExpectedSize(
2270 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2271 // TODO(gman): Check that data was inserted;
2274 TEST_F(GLES2FormatTest
, TexStorage3D
) {
2275 cmds::TexStorage3D
& cmd
= *GetBufferAs
<cmds::TexStorage3D
>();
2277 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLsizei
>(12),
2278 static_cast<GLenum
>(13), static_cast<GLsizei
>(14),
2279 static_cast<GLsizei
>(15), static_cast<GLsizei
>(16));
2280 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage3D::kCmdId
),
2281 cmd
.header
.command
);
2282 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2283 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2284 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.levels
);
2285 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalFormat
);
2286 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2287 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2288 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.depth
);
2289 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2292 TEST_F(GLES2FormatTest
, TexSubImage2D
) {
2293 cmds::TexSubImage2D
& cmd
= *GetBufferAs
<cmds::TexSubImage2D
>();
2294 void* next_cmd
= cmd
.Set(
2295 &cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2296 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLsizei
>(15),
2297 static_cast<GLsizei
>(16), static_cast<GLenum
>(17),
2298 static_cast<GLenum
>(18), static_cast<uint32_t>(19),
2299 static_cast<uint32_t>(20), static_cast<GLboolean
>(21));
2300 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage2D::kCmdId
),
2301 cmd
.header
.command
);
2302 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2303 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2304 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2305 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
2306 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
2307 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
2308 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
2309 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
2310 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
2311 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_id
);
2312 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.pixels_shm_offset
);
2313 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.internal
);
2314 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2317 TEST_F(GLES2FormatTest
, TexSubImage3D
) {
2318 cmds::TexSubImage3D
& cmd
= *GetBufferAs
<cmds::TexSubImage3D
>();
2319 void* next_cmd
= cmd
.Set(
2320 &cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2321 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLint
>(15),
2322 static_cast<GLsizei
>(16), static_cast<GLsizei
>(17),
2323 static_cast<GLsizei
>(18), static_cast<GLenum
>(19),
2324 static_cast<GLenum
>(20), static_cast<uint32_t>(21),
2325 static_cast<uint32_t>(22), static_cast<GLboolean
>(23));
2326 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage3D::kCmdId
),
2327 cmd
.header
.command
);
2328 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2329 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2330 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2331 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
2332 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
2333 EXPECT_EQ(static_cast<GLint
>(15), cmd
.zoffset
);
2334 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
2335 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
2336 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.depth
);
2337 EXPECT_EQ(static_cast<GLenum
>(19), cmd
.format
);
2338 EXPECT_EQ(static_cast<GLenum
>(20), cmd
.type
);
2339 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.pixels_shm_id
);
2340 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.pixels_shm_offset
);
2341 EXPECT_EQ(static_cast<GLboolean
>(23), cmd
.internal
);
2342 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2345 TEST_F(GLES2FormatTest
, TransformFeedbackVaryingsBucket
) {
2346 cmds::TransformFeedbackVaryingsBucket
& cmd
=
2347 *GetBufferAs
<cmds::TransformFeedbackVaryingsBucket
>();
2348 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
2349 static_cast<uint32_t>(12), static_cast<GLenum
>(13));
2351 static_cast<uint32_t>(cmds::TransformFeedbackVaryingsBucket::kCmdId
),
2352 cmd
.header
.command
);
2353 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2354 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2355 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.varyings_bucket_id
);
2356 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.buffermode
);
2357 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2360 TEST_F(GLES2FormatTest
, Uniform1f
) {
2361 cmds::Uniform1f
& cmd
= *GetBufferAs
<cmds::Uniform1f
>();
2363 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLfloat
>(12));
2364 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1f::kCmdId
), cmd
.header
.command
);
2365 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2366 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2367 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2368 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2371 TEST_F(GLES2FormatTest
, Uniform1fvImmediate
) {
2372 const int kSomeBaseValueToTestWith
= 51;
2373 static GLfloat data
[] = {
2374 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2375 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2377 cmds::Uniform1fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1fvImmediate
>();
2378 const GLsizei kNumElements
= 2;
2379 const size_t kExpectedCmdSize
=
2380 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 1;
2382 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2383 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1fvImmediate::kCmdId
),
2384 cmd
.header
.command
);
2385 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2386 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2387 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2388 CheckBytesWrittenMatchesExpectedSize(
2389 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2390 // TODO(gman): Check that data was inserted;
2393 TEST_F(GLES2FormatTest
, Uniform1i
) {
2394 cmds::Uniform1i
& cmd
= *GetBufferAs
<cmds::Uniform1i
>();
2396 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12));
2397 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1i::kCmdId
), cmd
.header
.command
);
2398 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2399 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2400 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2401 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2404 TEST_F(GLES2FormatTest
, Uniform1ivImmediate
) {
2405 const int kSomeBaseValueToTestWith
= 51;
2406 static GLint data
[] = {
2407 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2408 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2410 cmds::Uniform1ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1ivImmediate
>();
2411 const GLsizei kNumElements
= 2;
2412 const size_t kExpectedCmdSize
=
2413 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 1;
2415 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2416 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ivImmediate::kCmdId
),
2417 cmd
.header
.command
);
2418 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2419 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2420 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2421 CheckBytesWrittenMatchesExpectedSize(
2422 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2423 // TODO(gman): Check that data was inserted;
2426 TEST_F(GLES2FormatTest
, Uniform1ui
) {
2427 cmds::Uniform1ui
& cmd
= *GetBufferAs
<cmds::Uniform1ui
>();
2429 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLuint
>(12));
2430 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ui::kCmdId
),
2431 cmd
.header
.command
);
2432 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2433 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2434 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2435 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2438 TEST_F(GLES2FormatTest
, Uniform1uivImmediate
) {
2439 const int kSomeBaseValueToTestWith
= 51;
2440 static GLuint data
[] = {
2441 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2442 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2444 cmds::Uniform1uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1uivImmediate
>();
2445 const GLsizei kNumElements
= 2;
2446 const size_t kExpectedCmdSize
=
2447 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 1;
2449 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2450 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1uivImmediate::kCmdId
),
2451 cmd
.header
.command
);
2452 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2453 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2454 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2455 CheckBytesWrittenMatchesExpectedSize(
2456 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2457 // TODO(gman): Check that data was inserted;
2460 TEST_F(GLES2FormatTest
, Uniform2f
) {
2461 cmds::Uniform2f
& cmd
= *GetBufferAs
<cmds::Uniform2f
>();
2462 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2463 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13));
2464 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2f::kCmdId
), cmd
.header
.command
);
2465 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2466 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2467 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2468 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2469 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2472 TEST_F(GLES2FormatTest
, Uniform2fvImmediate
) {
2473 const int kSomeBaseValueToTestWith
= 51;
2474 static GLfloat data
[] = {
2475 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2476 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2477 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2478 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2480 cmds::Uniform2fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2fvImmediate
>();
2481 const GLsizei kNumElements
= 2;
2482 const size_t kExpectedCmdSize
=
2483 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 2;
2485 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2486 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2fvImmediate::kCmdId
),
2487 cmd
.header
.command
);
2488 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2489 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2490 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2491 CheckBytesWrittenMatchesExpectedSize(
2492 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2493 // TODO(gman): Check that data was inserted;
2496 TEST_F(GLES2FormatTest
, Uniform2i
) {
2497 cmds::Uniform2i
& cmd
= *GetBufferAs
<cmds::Uniform2i
>();
2498 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2499 static_cast<GLint
>(13));
2500 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2i::kCmdId
), cmd
.header
.command
);
2501 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2502 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2503 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2504 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2505 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2508 TEST_F(GLES2FormatTest
, Uniform2ivImmediate
) {
2509 const int kSomeBaseValueToTestWith
= 51;
2510 static GLint data
[] = {
2511 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2512 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2513 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2514 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2516 cmds::Uniform2ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2ivImmediate
>();
2517 const GLsizei kNumElements
= 2;
2518 const size_t kExpectedCmdSize
=
2519 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 2;
2521 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2522 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ivImmediate::kCmdId
),
2523 cmd
.header
.command
);
2524 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2525 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2526 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2527 CheckBytesWrittenMatchesExpectedSize(
2528 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2529 // TODO(gman): Check that data was inserted;
2532 TEST_F(GLES2FormatTest
, Uniform2ui
) {
2533 cmds::Uniform2ui
& cmd
= *GetBufferAs
<cmds::Uniform2ui
>();
2534 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2535 static_cast<GLuint
>(12), static_cast<GLuint
>(13));
2536 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ui::kCmdId
),
2537 cmd
.header
.command
);
2538 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2539 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2540 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2541 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
2542 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2545 TEST_F(GLES2FormatTest
, Uniform2uivImmediate
) {
2546 const int kSomeBaseValueToTestWith
= 51;
2547 static GLuint data
[] = {
2548 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2549 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2550 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
2551 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
2553 cmds::Uniform2uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2uivImmediate
>();
2554 const GLsizei kNumElements
= 2;
2555 const size_t kExpectedCmdSize
=
2556 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 2;
2558 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2559 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2uivImmediate::kCmdId
),
2560 cmd
.header
.command
);
2561 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2562 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2563 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2564 CheckBytesWrittenMatchesExpectedSize(
2565 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2566 // TODO(gman): Check that data was inserted;
2569 TEST_F(GLES2FormatTest
, Uniform3f
) {
2570 cmds::Uniform3f
& cmd
= *GetBufferAs
<cmds::Uniform3f
>();
2572 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLfloat
>(12),
2573 static_cast<GLfloat
>(13), static_cast<GLfloat
>(14));
2574 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3f::kCmdId
), cmd
.header
.command
);
2575 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2576 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2577 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2578 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2579 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2580 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2583 TEST_F(GLES2FormatTest
, Uniform3fvImmediate
) {
2584 const int kSomeBaseValueToTestWith
= 51;
2585 static GLfloat data
[] = {
2586 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2587 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2588 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2589 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2590 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2591 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2593 cmds::Uniform3fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3fvImmediate
>();
2594 const GLsizei kNumElements
= 2;
2595 const size_t kExpectedCmdSize
=
2596 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 3;
2598 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2599 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3fvImmediate::kCmdId
),
2600 cmd
.header
.command
);
2601 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2602 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2603 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2604 CheckBytesWrittenMatchesExpectedSize(
2605 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2606 // TODO(gman): Check that data was inserted;
2609 TEST_F(GLES2FormatTest
, Uniform3i
) {
2610 cmds::Uniform3i
& cmd
= *GetBufferAs
<cmds::Uniform3i
>();
2611 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2612 static_cast<GLint
>(13), static_cast<GLint
>(14));
2613 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3i::kCmdId
), cmd
.header
.command
);
2614 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2615 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2616 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2617 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2618 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2619 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2622 TEST_F(GLES2FormatTest
, Uniform3ivImmediate
) {
2623 const int kSomeBaseValueToTestWith
= 51;
2624 static GLint data
[] = {
2625 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2626 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2627 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2628 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2629 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2630 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2632 cmds::Uniform3ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3ivImmediate
>();
2633 const GLsizei kNumElements
= 2;
2634 const size_t kExpectedCmdSize
=
2635 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 3;
2637 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2638 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ivImmediate::kCmdId
),
2639 cmd
.header
.command
);
2640 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2641 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2642 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2643 CheckBytesWrittenMatchesExpectedSize(
2644 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2645 // TODO(gman): Check that data was inserted;
2648 TEST_F(GLES2FormatTest
, Uniform3ui
) {
2649 cmds::Uniform3ui
& cmd
= *GetBufferAs
<cmds::Uniform3ui
>();
2651 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLuint
>(12),
2652 static_cast<GLuint
>(13), static_cast<GLuint
>(14));
2653 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ui::kCmdId
),
2654 cmd
.header
.command
);
2655 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2656 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2657 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2658 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
2659 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.z
);
2660 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2663 TEST_F(GLES2FormatTest
, Uniform3uivImmediate
) {
2664 const int kSomeBaseValueToTestWith
= 51;
2665 static GLuint data
[] = {
2666 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2667 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2668 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
2669 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
2670 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 4),
2671 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 5),
2673 cmds::Uniform3uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3uivImmediate
>();
2674 const GLsizei kNumElements
= 2;
2675 const size_t kExpectedCmdSize
=
2676 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 3;
2678 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2679 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3uivImmediate::kCmdId
),
2680 cmd
.header
.command
);
2681 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2682 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2683 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2684 CheckBytesWrittenMatchesExpectedSize(
2685 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2686 // TODO(gman): Check that data was inserted;
2689 TEST_F(GLES2FormatTest
, Uniform4f
) {
2690 cmds::Uniform4f
& cmd
= *GetBufferAs
<cmds::Uniform4f
>();
2691 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2692 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13),
2693 static_cast<GLfloat
>(14), static_cast<GLfloat
>(15));
2694 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4f::kCmdId
), cmd
.header
.command
);
2695 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2696 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2697 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2698 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2699 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2700 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
2701 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2704 TEST_F(GLES2FormatTest
, Uniform4fvImmediate
) {
2705 const int kSomeBaseValueToTestWith
= 51;
2706 static GLfloat data
[] = {
2707 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2708 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2709 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2710 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2711 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2712 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2713 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2714 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2716 cmds::Uniform4fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4fvImmediate
>();
2717 const GLsizei kNumElements
= 2;
2718 const size_t kExpectedCmdSize
=
2719 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
2721 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2722 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4fvImmediate::kCmdId
),
2723 cmd
.header
.command
);
2724 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2725 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2726 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2727 CheckBytesWrittenMatchesExpectedSize(
2728 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2729 // TODO(gman): Check that data was inserted;
2732 TEST_F(GLES2FormatTest
, Uniform4i
) {
2733 cmds::Uniform4i
& cmd
= *GetBufferAs
<cmds::Uniform4i
>();
2734 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2735 static_cast<GLint
>(13), static_cast<GLint
>(14),
2736 static_cast<GLint
>(15));
2737 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4i::kCmdId
), cmd
.header
.command
);
2738 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2739 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2740 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2741 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2742 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2743 EXPECT_EQ(static_cast<GLint
>(15), cmd
.w
);
2744 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2747 TEST_F(GLES2FormatTest
, Uniform4ivImmediate
) {
2748 const int kSomeBaseValueToTestWith
= 51;
2749 static GLint data
[] = {
2750 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2751 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2752 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2753 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2754 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2755 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2756 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 6),
2757 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 7),
2759 cmds::Uniform4ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4ivImmediate
>();
2760 const GLsizei kNumElements
= 2;
2761 const size_t kExpectedCmdSize
=
2762 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 4;
2764 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2765 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ivImmediate::kCmdId
),
2766 cmd
.header
.command
);
2767 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2768 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2769 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2770 CheckBytesWrittenMatchesExpectedSize(
2771 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2772 // TODO(gman): Check that data was inserted;
2775 TEST_F(GLES2FormatTest
, Uniform4ui
) {
2776 cmds::Uniform4ui
& cmd
= *GetBufferAs
<cmds::Uniform4ui
>();
2777 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2778 static_cast<GLuint
>(12), static_cast<GLuint
>(13),
2779 static_cast<GLuint
>(14), static_cast<GLuint
>(15));
2780 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ui::kCmdId
),
2781 cmd
.header
.command
);
2782 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2783 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2784 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2785 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
2786 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.z
);
2787 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.w
);
2788 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2791 TEST_F(GLES2FormatTest
, Uniform4uivImmediate
) {
2792 const int kSomeBaseValueToTestWith
= 51;
2793 static GLuint data
[] = {
2794 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2795 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2796 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
2797 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
2798 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 4),
2799 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 5),
2800 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 6),
2801 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 7),
2803 cmds::Uniform4uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4uivImmediate
>();
2804 const GLsizei kNumElements
= 2;
2805 const size_t kExpectedCmdSize
=
2806 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 4;
2808 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2809 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4uivImmediate::kCmdId
),
2810 cmd
.header
.command
);
2811 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2812 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2813 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2814 CheckBytesWrittenMatchesExpectedSize(
2815 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2816 // TODO(gman): Check that data was inserted;
2819 TEST_F(GLES2FormatTest
, UniformBlockBinding
) {
2820 cmds::UniformBlockBinding
& cmd
= *GetBufferAs
<cmds::UniformBlockBinding
>();
2821 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
2822 static_cast<GLuint
>(12), static_cast<GLuint
>(13));
2823 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformBlockBinding::kCmdId
),
2824 cmd
.header
.command
);
2825 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2826 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2827 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
2828 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.binding
);
2829 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2832 TEST_F(GLES2FormatTest
, UniformMatrix2fvImmediate
) {
2833 const int kSomeBaseValueToTestWith
= 51;
2834 static GLfloat data
[] = {
2835 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2836 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2837 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2838 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2839 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2840 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2841 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2842 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2844 cmds::UniformMatrix2fvImmediate
& cmd
=
2845 *GetBufferAs
<cmds::UniformMatrix2fvImmediate
>();
2846 const GLsizei kNumElements
= 2;
2847 const size_t kExpectedCmdSize
=
2848 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
2850 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2851 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2fvImmediate::kCmdId
),
2852 cmd
.header
.command
);
2853 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2854 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2855 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2856 CheckBytesWrittenMatchesExpectedSize(
2857 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2858 // TODO(gman): Check that data was inserted;
2861 TEST_F(GLES2FormatTest
, UniformMatrix2x3fvImmediate
) {
2862 const int kSomeBaseValueToTestWith
= 51;
2863 static GLfloat data
[] = {
2864 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2865 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2866 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2867 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2868 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2869 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2870 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2871 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2872 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2873 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2874 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2875 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2877 cmds::UniformMatrix2x3fvImmediate
& cmd
=
2878 *GetBufferAs
<cmds::UniformMatrix2x3fvImmediate
>();
2879 const GLsizei kNumElements
= 2;
2880 const size_t kExpectedCmdSize
=
2881 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 6;
2883 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2884 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x3fvImmediate::kCmdId
),
2885 cmd
.header
.command
);
2886 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2887 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2888 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2889 CheckBytesWrittenMatchesExpectedSize(
2890 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2891 // TODO(gman): Check that data was inserted;
2894 TEST_F(GLES2FormatTest
, UniformMatrix2x4fvImmediate
) {
2895 const int kSomeBaseValueToTestWith
= 51;
2896 static GLfloat data
[] = {
2897 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2898 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2899 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2900 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2901 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2902 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2903 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2904 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2905 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2906 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2907 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2908 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2909 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
2910 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
2911 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
2912 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
2914 cmds::UniformMatrix2x4fvImmediate
& cmd
=
2915 *GetBufferAs
<cmds::UniformMatrix2x4fvImmediate
>();
2916 const GLsizei kNumElements
= 2;
2917 const size_t kExpectedCmdSize
=
2918 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 8;
2920 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2921 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x4fvImmediate::kCmdId
),
2922 cmd
.header
.command
);
2923 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2924 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2925 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2926 CheckBytesWrittenMatchesExpectedSize(
2927 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2928 // TODO(gman): Check that data was inserted;
2931 TEST_F(GLES2FormatTest
, UniformMatrix3fvImmediate
) {
2932 const int kSomeBaseValueToTestWith
= 51;
2933 static GLfloat data
[] = {
2934 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2935 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2936 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2937 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2938 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2939 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2940 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2941 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2942 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2943 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2944 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2945 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2946 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
2947 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
2948 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
2949 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
2950 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
2951 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
2953 cmds::UniformMatrix3fvImmediate
& cmd
=
2954 *GetBufferAs
<cmds::UniformMatrix3fvImmediate
>();
2955 const GLsizei kNumElements
= 2;
2956 const size_t kExpectedCmdSize
=
2957 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 9;
2959 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2960 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3fvImmediate::kCmdId
),
2961 cmd
.header
.command
);
2962 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2963 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2964 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2965 CheckBytesWrittenMatchesExpectedSize(
2966 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2967 // TODO(gman): Check that data was inserted;
2970 TEST_F(GLES2FormatTest
, UniformMatrix3x2fvImmediate
) {
2971 const int kSomeBaseValueToTestWith
= 51;
2972 static GLfloat data
[] = {
2973 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2974 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2975 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2976 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2977 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2978 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2979 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2980 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2981 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
2982 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
2983 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
2984 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
2986 cmds::UniformMatrix3x2fvImmediate
& cmd
=
2987 *GetBufferAs
<cmds::UniformMatrix3x2fvImmediate
>();
2988 const GLsizei kNumElements
= 2;
2989 const size_t kExpectedCmdSize
=
2990 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 6;
2992 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2993 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x2fvImmediate::kCmdId
),
2994 cmd
.header
.command
);
2995 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2996 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2997 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2998 CheckBytesWrittenMatchesExpectedSize(
2999 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3000 // TODO(gman): Check that data was inserted;
3003 TEST_F(GLES2FormatTest
, UniformMatrix3x4fvImmediate
) {
3004 const int kSomeBaseValueToTestWith
= 51;
3005 static GLfloat data
[] = {
3006 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3007 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3008 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3009 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3010 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3011 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3012 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3013 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3014 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3015 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3016 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3017 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3018 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3019 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3020 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3021 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3022 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3023 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3024 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
3025 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
3026 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
3027 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
3028 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
3029 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
3031 cmds::UniformMatrix3x4fvImmediate
& cmd
=
3032 *GetBufferAs
<cmds::UniformMatrix3x4fvImmediate
>();
3033 const GLsizei kNumElements
= 2;
3034 const size_t kExpectedCmdSize
=
3035 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 12;
3037 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3038 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x4fvImmediate::kCmdId
),
3039 cmd
.header
.command
);
3040 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3041 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3042 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3043 CheckBytesWrittenMatchesExpectedSize(
3044 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3045 // TODO(gman): Check that data was inserted;
3048 TEST_F(GLES2FormatTest
, UniformMatrix4fvImmediate
) {
3049 const int kSomeBaseValueToTestWith
= 51;
3050 static GLfloat data
[] = {
3051 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3052 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3053 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3054 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3055 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3056 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3057 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3058 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3059 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3060 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3061 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3062 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3063 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3064 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3065 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3066 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3067 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3068 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3069 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
3070 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
3071 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
3072 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
3073 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
3074 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
3075 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 24),
3076 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 25),
3077 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 26),
3078 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 27),
3079 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 28),
3080 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 29),
3081 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 30),
3082 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 31),
3084 cmds::UniformMatrix4fvImmediate
& cmd
=
3085 *GetBufferAs
<cmds::UniformMatrix4fvImmediate
>();
3086 const GLsizei kNumElements
= 2;
3087 const size_t kExpectedCmdSize
=
3088 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 16;
3090 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3091 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4fvImmediate::kCmdId
),
3092 cmd
.header
.command
);
3093 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3094 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3095 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3096 CheckBytesWrittenMatchesExpectedSize(
3097 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3098 // TODO(gman): Check that data was inserted;
3101 TEST_F(GLES2FormatTest
, UniformMatrix4x2fvImmediate
) {
3102 const int kSomeBaseValueToTestWith
= 51;
3103 static GLfloat data
[] = {
3104 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3105 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3106 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3107 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3108 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3109 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3110 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3111 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3112 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3113 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3114 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3115 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3116 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3117 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3118 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3119 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3121 cmds::UniformMatrix4x2fvImmediate
& cmd
=
3122 *GetBufferAs
<cmds::UniformMatrix4x2fvImmediate
>();
3123 const GLsizei kNumElements
= 2;
3124 const size_t kExpectedCmdSize
=
3125 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 8;
3127 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3128 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x2fvImmediate::kCmdId
),
3129 cmd
.header
.command
);
3130 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3131 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3132 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3133 CheckBytesWrittenMatchesExpectedSize(
3134 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3135 // TODO(gman): Check that data was inserted;
3138 TEST_F(GLES2FormatTest
, UniformMatrix4x3fvImmediate
) {
3139 const int kSomeBaseValueToTestWith
= 51;
3140 static GLfloat data
[] = {
3141 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3142 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3143 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3144 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3145 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3146 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3147 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3148 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3149 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3150 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3151 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3152 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3153 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3154 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3155 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3156 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3157 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3158 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3159 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
3160 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
3161 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
3162 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
3163 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
3164 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
3166 cmds::UniformMatrix4x3fvImmediate
& cmd
=
3167 *GetBufferAs
<cmds::UniformMatrix4x3fvImmediate
>();
3168 const GLsizei kNumElements
= 2;
3169 const size_t kExpectedCmdSize
=
3170 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 12;
3172 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3173 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x3fvImmediate::kCmdId
),
3174 cmd
.header
.command
);
3175 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3176 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3177 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3178 CheckBytesWrittenMatchesExpectedSize(
3179 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3180 // TODO(gman): Check that data was inserted;
3183 TEST_F(GLES2FormatTest
, UseProgram
) {
3184 cmds::UseProgram
& cmd
= *GetBufferAs
<cmds::UseProgram
>();
3185 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3186 EXPECT_EQ(static_cast<uint32_t>(cmds::UseProgram::kCmdId
),
3187 cmd
.header
.command
);
3188 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3189 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3190 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3193 TEST_F(GLES2FormatTest
, ValidateProgram
) {
3194 cmds::ValidateProgram
& cmd
= *GetBufferAs
<cmds::ValidateProgram
>();
3195 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3196 EXPECT_EQ(static_cast<uint32_t>(cmds::ValidateProgram::kCmdId
),
3197 cmd
.header
.command
);
3198 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3199 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3200 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3203 TEST_F(GLES2FormatTest
, VertexAttrib1f
) {
3204 cmds::VertexAttrib1f
& cmd
= *GetBufferAs
<cmds::VertexAttrib1f
>();
3206 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLfloat
>(12));
3207 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1f::kCmdId
),
3208 cmd
.header
.command
);
3209 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3210 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3211 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3212 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3215 TEST_F(GLES2FormatTest
, VertexAttrib1fvImmediate
) {
3216 const int kSomeBaseValueToTestWith
= 51;
3217 static GLfloat data
[] = {
3218 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3220 cmds::VertexAttrib1fvImmediate
& cmd
=
3221 *GetBufferAs
<cmds::VertexAttrib1fvImmediate
>();
3222 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3223 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1fvImmediate::kCmdId
),
3224 cmd
.header
.command
);
3225 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3226 cmd
.header
.size
* 4u);
3227 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3228 CheckBytesWrittenMatchesExpectedSize(
3229 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3230 // TODO(gman): Check that data was inserted;
3233 TEST_F(GLES2FormatTest
, VertexAttrib2f
) {
3234 cmds::VertexAttrib2f
& cmd
= *GetBufferAs
<cmds::VertexAttrib2f
>();
3235 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3236 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13));
3237 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2f::kCmdId
),
3238 cmd
.header
.command
);
3239 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3240 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3241 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3242 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3243 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3246 TEST_F(GLES2FormatTest
, VertexAttrib2fvImmediate
) {
3247 const int kSomeBaseValueToTestWith
= 51;
3248 static GLfloat data
[] = {
3249 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3250 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3252 cmds::VertexAttrib2fvImmediate
& cmd
=
3253 *GetBufferAs
<cmds::VertexAttrib2fvImmediate
>();
3254 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3255 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2fvImmediate::kCmdId
),
3256 cmd
.header
.command
);
3257 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3258 cmd
.header
.size
* 4u);
3259 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3260 CheckBytesWrittenMatchesExpectedSize(
3261 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3262 // TODO(gman): Check that data was inserted;
3265 TEST_F(GLES2FormatTest
, VertexAttrib3f
) {
3266 cmds::VertexAttrib3f
& cmd
= *GetBufferAs
<cmds::VertexAttrib3f
>();
3268 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLfloat
>(12),
3269 static_cast<GLfloat
>(13), static_cast<GLfloat
>(14));
3270 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3f::kCmdId
),
3271 cmd
.header
.command
);
3272 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3273 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3274 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3275 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3276 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
3277 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3280 TEST_F(GLES2FormatTest
, VertexAttrib3fvImmediate
) {
3281 const int kSomeBaseValueToTestWith
= 51;
3282 static GLfloat data
[] = {
3283 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3284 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3285 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3287 cmds::VertexAttrib3fvImmediate
& cmd
=
3288 *GetBufferAs
<cmds::VertexAttrib3fvImmediate
>();
3289 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3290 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3fvImmediate::kCmdId
),
3291 cmd
.header
.command
);
3292 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3293 cmd
.header
.size
* 4u);
3294 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3295 CheckBytesWrittenMatchesExpectedSize(
3296 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3297 // TODO(gman): Check that data was inserted;
3300 TEST_F(GLES2FormatTest
, VertexAttrib4f
) {
3301 cmds::VertexAttrib4f
& cmd
= *GetBufferAs
<cmds::VertexAttrib4f
>();
3302 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3303 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13),
3304 static_cast<GLfloat
>(14), static_cast<GLfloat
>(15));
3305 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4f::kCmdId
),
3306 cmd
.header
.command
);
3307 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3308 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3309 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3310 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3311 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
3312 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
3313 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3316 TEST_F(GLES2FormatTest
, VertexAttrib4fvImmediate
) {
3317 const int kSomeBaseValueToTestWith
= 51;
3318 static GLfloat data
[] = {
3319 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3320 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3321 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3322 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3324 cmds::VertexAttrib4fvImmediate
& cmd
=
3325 *GetBufferAs
<cmds::VertexAttrib4fvImmediate
>();
3326 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3327 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4fvImmediate::kCmdId
),
3328 cmd
.header
.command
);
3329 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3330 cmd
.header
.size
* 4u);
3331 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3332 CheckBytesWrittenMatchesExpectedSize(
3333 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3334 // TODO(gman): Check that data was inserted;
3337 TEST_F(GLES2FormatTest
, VertexAttribI4i
) {
3338 cmds::VertexAttribI4i
& cmd
= *GetBufferAs
<cmds::VertexAttribI4i
>();
3339 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3340 static_cast<GLint
>(12), static_cast<GLint
>(13),
3341 static_cast<GLint
>(14), static_cast<GLint
>(15));
3342 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4i::kCmdId
),
3343 cmd
.header
.command
);
3344 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3345 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3346 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
3347 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
3348 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
3349 EXPECT_EQ(static_cast<GLint
>(15), cmd
.w
);
3350 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3353 TEST_F(GLES2FormatTest
, VertexAttribI4ivImmediate
) {
3354 const int kSomeBaseValueToTestWith
= 51;
3355 static GLint data
[] = {
3356 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
3357 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
3358 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
3359 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
3361 cmds::VertexAttribI4ivImmediate
& cmd
=
3362 *GetBufferAs
<cmds::VertexAttribI4ivImmediate
>();
3363 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3364 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4ivImmediate::kCmdId
),
3365 cmd
.header
.command
);
3366 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3367 cmd
.header
.size
* 4u);
3368 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3369 CheckBytesWrittenMatchesExpectedSize(
3370 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3371 // TODO(gman): Check that data was inserted;
3374 TEST_F(GLES2FormatTest
, VertexAttribI4ui
) {
3375 cmds::VertexAttribI4ui
& cmd
= *GetBufferAs
<cmds::VertexAttribI4ui
>();
3376 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3377 static_cast<GLuint
>(12), static_cast<GLuint
>(13),
3378 static_cast<GLuint
>(14), static_cast<GLuint
>(15));
3379 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4ui::kCmdId
),
3380 cmd
.header
.command
);
3381 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3382 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3383 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
3384 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
3385 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.z
);
3386 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.w
);
3387 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3390 TEST_F(GLES2FormatTest
, VertexAttribI4uivImmediate
) {
3391 const int kSomeBaseValueToTestWith
= 51;
3392 static GLuint data
[] = {
3393 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
3394 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
3395 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
3396 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
3398 cmds::VertexAttribI4uivImmediate
& cmd
=
3399 *GetBufferAs
<cmds::VertexAttribI4uivImmediate
>();
3400 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3401 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4uivImmediate::kCmdId
),
3402 cmd
.header
.command
);
3403 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3404 cmd
.header
.size
* 4u);
3405 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3406 CheckBytesWrittenMatchesExpectedSize(
3407 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3408 // TODO(gman): Check that data was inserted;
3411 TEST_F(GLES2FormatTest
, VertexAttribIPointer
) {
3412 cmds::VertexAttribIPointer
& cmd
= *GetBufferAs
<cmds::VertexAttribIPointer
>();
3413 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3414 static_cast<GLint
>(12), static_cast<GLenum
>(13),
3415 static_cast<GLsizei
>(14), static_cast<GLuint
>(15));
3416 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribIPointer::kCmdId
),
3417 cmd
.header
.command
);
3418 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3419 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3420 EXPECT_EQ(static_cast<GLint
>(12), cmd
.size
);
3421 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3422 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.stride
);
3423 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.offset
);
3424 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3427 TEST_F(GLES2FormatTest
, VertexAttribPointer
) {
3428 cmds::VertexAttribPointer
& cmd
= *GetBufferAs
<cmds::VertexAttribPointer
>();
3430 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
3431 static_cast<GLenum
>(13), static_cast<GLboolean
>(14),
3432 static_cast<GLsizei
>(15), static_cast<GLuint
>(16));
3433 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribPointer::kCmdId
),
3434 cmd
.header
.command
);
3435 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3436 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3437 EXPECT_EQ(static_cast<GLint
>(12), cmd
.size
);
3438 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3439 EXPECT_EQ(static_cast<GLboolean
>(14), cmd
.normalized
);
3440 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.stride
);
3441 EXPECT_EQ(static_cast<GLuint
>(16), cmd
.offset
);
3442 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3445 TEST_F(GLES2FormatTest
, Viewport
) {
3446 cmds::Viewport
& cmd
= *GetBufferAs
<cmds::Viewport
>();
3447 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
3448 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
3449 EXPECT_EQ(static_cast<uint32_t>(cmds::Viewport::kCmdId
), cmd
.header
.command
);
3450 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3451 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
3452 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
3453 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
3454 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
3455 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3458 TEST_F(GLES2FormatTest
, WaitSync
) {
3459 cmds::WaitSync
& cmd
= *GetBufferAs
<cmds::WaitSync
>();
3461 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLbitfield
>(12),
3462 static_cast<GLuint
>(13), static_cast<GLuint
>(14));
3463 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSync::kCmdId
), cmd
.header
.command
);
3464 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3465 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
3466 EXPECT_EQ(static_cast<GLbitfield
>(12), cmd
.flags
);
3467 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.timeout_0
);
3468 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.timeout_1
);
3469 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3472 TEST_F(GLES2FormatTest
, BlitFramebufferCHROMIUM
) {
3473 cmds::BlitFramebufferCHROMIUM
& cmd
=
3474 *GetBufferAs
<cmds::BlitFramebufferCHROMIUM
>();
3475 void* next_cmd
= cmd
.Set(
3476 &cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
3477 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLint
>(15),
3478 static_cast<GLint
>(16), static_cast<GLint
>(17), static_cast<GLint
>(18),
3479 static_cast<GLbitfield
>(19), static_cast<GLenum
>(20));
3480 EXPECT_EQ(static_cast<uint32_t>(cmds::BlitFramebufferCHROMIUM::kCmdId
),
3481 cmd
.header
.command
);
3482 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3483 EXPECT_EQ(static_cast<GLint
>(11), cmd
.srcX0
);
3484 EXPECT_EQ(static_cast<GLint
>(12), cmd
.srcY0
);
3485 EXPECT_EQ(static_cast<GLint
>(13), cmd
.srcX1
);
3486 EXPECT_EQ(static_cast<GLint
>(14), cmd
.srcY1
);
3487 EXPECT_EQ(static_cast<GLint
>(15), cmd
.dstX0
);
3488 EXPECT_EQ(static_cast<GLint
>(16), cmd
.dstY0
);
3489 EXPECT_EQ(static_cast<GLint
>(17), cmd
.dstX1
);
3490 EXPECT_EQ(static_cast<GLint
>(18), cmd
.dstY1
);
3491 EXPECT_EQ(static_cast<GLbitfield
>(19), cmd
.mask
);
3492 EXPECT_EQ(static_cast<GLenum
>(20), cmd
.filter
);
3493 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3496 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleCHROMIUM
) {
3497 cmds::RenderbufferStorageMultisampleCHROMIUM
& cmd
=
3498 *GetBufferAs
<cmds::RenderbufferStorageMultisampleCHROMIUM
>();
3499 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3500 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
3501 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15));
3502 EXPECT_EQ(static_cast<uint32_t>(
3503 cmds::RenderbufferStorageMultisampleCHROMIUM::kCmdId
),
3504 cmd
.header
.command
);
3505 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3506 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3507 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
3508 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
3509 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3510 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3511 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3514 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleEXT
) {
3515 cmds::RenderbufferStorageMultisampleEXT
& cmd
=
3516 *GetBufferAs
<cmds::RenderbufferStorageMultisampleEXT
>();
3517 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3518 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
3519 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15));
3521 static_cast<uint32_t>(cmds::RenderbufferStorageMultisampleEXT::kCmdId
),
3522 cmd
.header
.command
);
3523 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3524 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3525 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
3526 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
3527 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3528 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3529 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3532 TEST_F(GLES2FormatTest
, FramebufferTexture2DMultisampleEXT
) {
3533 cmds::FramebufferTexture2DMultisampleEXT
& cmd
=
3534 *GetBufferAs
<cmds::FramebufferTexture2DMultisampleEXT
>();
3535 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3536 static_cast<GLenum
>(12), static_cast<GLenum
>(13),
3537 static_cast<GLuint
>(14), static_cast<GLsizei
>(15));
3539 static_cast<uint32_t>(cmds::FramebufferTexture2DMultisampleEXT::kCmdId
),
3540 cmd
.header
.command
);
3541 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3542 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3543 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
3544 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
3545 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
3546 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.samples
);
3547 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3550 TEST_F(GLES2FormatTest
, TexStorage2DEXT
) {
3551 cmds::TexStorage2DEXT
& cmd
= *GetBufferAs
<cmds::TexStorage2DEXT
>();
3552 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3553 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
3554 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15));
3555 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage2DEXT::kCmdId
),
3556 cmd
.header
.command
);
3557 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3558 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3559 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.levels
);
3560 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalFormat
);
3561 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3562 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3563 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3566 TEST_F(GLES2FormatTest
, GenQueriesEXTImmediate
) {
3567 static GLuint ids
[] = {
3570 cmds::GenQueriesEXTImmediate
& cmd
=
3571 *GetBufferAs
<cmds::GenQueriesEXTImmediate
>();
3572 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3573 EXPECT_EQ(static_cast<uint32_t>(cmds::GenQueriesEXTImmediate::kCmdId
),
3574 cmd
.header
.command
);
3575 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3576 cmd
.header
.size
* 4u);
3577 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3578 CheckBytesWrittenMatchesExpectedSize(
3580 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3581 // TODO(gman): Check that ids were inserted;
3584 TEST_F(GLES2FormatTest
, DeleteQueriesEXTImmediate
) {
3585 static GLuint ids
[] = {
3588 cmds::DeleteQueriesEXTImmediate
& cmd
=
3589 *GetBufferAs
<cmds::DeleteQueriesEXTImmediate
>();
3590 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3591 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteQueriesEXTImmediate::kCmdId
),
3592 cmd
.header
.command
);
3593 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3594 cmd
.header
.size
* 4u);
3595 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3596 CheckBytesWrittenMatchesExpectedSize(
3598 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3599 // TODO(gman): Check that ids were inserted;
3602 TEST_F(GLES2FormatTest
, BeginQueryEXT
) {
3603 cmds::BeginQueryEXT
& cmd
= *GetBufferAs
<cmds::BeginQueryEXT
>();
3605 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12),
3606 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
3607 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginQueryEXT::kCmdId
),
3608 cmd
.header
.command
);
3609 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3610 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3611 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.id
);
3612 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.sync_data_shm_id
);
3613 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.sync_data_shm_offset
);
3614 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3617 TEST_F(GLES2FormatTest
, BeginTransformFeedback
) {
3618 cmds::BeginTransformFeedback
& cmd
=
3619 *GetBufferAs
<cmds::BeginTransformFeedback
>();
3620 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
3621 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginTransformFeedback::kCmdId
),
3622 cmd
.header
.command
);
3623 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3624 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.primitivemode
);
3625 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3628 TEST_F(GLES2FormatTest
, EndQueryEXT
) {
3629 cmds::EndQueryEXT
& cmd
= *GetBufferAs
<cmds::EndQueryEXT
>();
3631 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
3632 EXPECT_EQ(static_cast<uint32_t>(cmds::EndQueryEXT::kCmdId
),
3633 cmd
.header
.command
);
3634 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3635 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3636 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.submit_count
);
3637 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3640 TEST_F(GLES2FormatTest
, EndTransformFeedback
) {
3641 cmds::EndTransformFeedback
& cmd
= *GetBufferAs
<cmds::EndTransformFeedback
>();
3642 void* next_cmd
= cmd
.Set(&cmd
);
3643 EXPECT_EQ(static_cast<uint32_t>(cmds::EndTransformFeedback::kCmdId
),
3644 cmd
.header
.command
);
3645 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3646 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3649 TEST_F(GLES2FormatTest
, InsertEventMarkerEXT
) {
3650 cmds::InsertEventMarkerEXT
& cmd
= *GetBufferAs
<cmds::InsertEventMarkerEXT
>();
3651 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3652 EXPECT_EQ(static_cast<uint32_t>(cmds::InsertEventMarkerEXT::kCmdId
),
3653 cmd
.header
.command
);
3654 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3655 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3656 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3659 TEST_F(GLES2FormatTest
, PushGroupMarkerEXT
) {
3660 cmds::PushGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PushGroupMarkerEXT
>();
3661 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3662 EXPECT_EQ(static_cast<uint32_t>(cmds::PushGroupMarkerEXT::kCmdId
),
3663 cmd
.header
.command
);
3664 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3665 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3666 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3669 TEST_F(GLES2FormatTest
, PopGroupMarkerEXT
) {
3670 cmds::PopGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PopGroupMarkerEXT
>();
3671 void* next_cmd
= cmd
.Set(&cmd
);
3672 EXPECT_EQ(static_cast<uint32_t>(cmds::PopGroupMarkerEXT::kCmdId
),
3673 cmd
.header
.command
);
3674 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3675 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3678 TEST_F(GLES2FormatTest
, GenVertexArraysOESImmediate
) {
3679 static GLuint ids
[] = {
3682 cmds::GenVertexArraysOESImmediate
& cmd
=
3683 *GetBufferAs
<cmds::GenVertexArraysOESImmediate
>();
3684 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3685 EXPECT_EQ(static_cast<uint32_t>(cmds::GenVertexArraysOESImmediate::kCmdId
),
3686 cmd
.header
.command
);
3687 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3688 cmd
.header
.size
* 4u);
3689 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3690 CheckBytesWrittenMatchesExpectedSize(
3692 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3693 // TODO(gman): Check that ids were inserted;
3696 TEST_F(GLES2FormatTest
, DeleteVertexArraysOESImmediate
) {
3697 static GLuint ids
[] = {
3700 cmds::DeleteVertexArraysOESImmediate
& cmd
=
3701 *GetBufferAs
<cmds::DeleteVertexArraysOESImmediate
>();
3702 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3703 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteVertexArraysOESImmediate::kCmdId
),
3704 cmd
.header
.command
);
3705 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3706 cmd
.header
.size
* 4u);
3707 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3708 CheckBytesWrittenMatchesExpectedSize(
3710 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3711 // TODO(gman): Check that ids were inserted;
3714 TEST_F(GLES2FormatTest
, IsVertexArrayOES
) {
3715 cmds::IsVertexArrayOES
& cmd
= *GetBufferAs
<cmds::IsVertexArrayOES
>();
3717 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
3718 static_cast<uint32_t>(13));
3719 EXPECT_EQ(static_cast<uint32_t>(cmds::IsVertexArrayOES::kCmdId
),
3720 cmd
.header
.command
);
3721 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3722 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
3723 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
3724 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
3725 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3728 TEST_F(GLES2FormatTest
, BindVertexArrayOES
) {
3729 cmds::BindVertexArrayOES
& cmd
= *GetBufferAs
<cmds::BindVertexArrayOES
>();
3730 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3731 EXPECT_EQ(static_cast<uint32_t>(cmds::BindVertexArrayOES::kCmdId
),
3732 cmd
.header
.command
);
3733 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3734 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
3735 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3738 TEST_F(GLES2FormatTest
, SwapBuffers
) {
3739 cmds::SwapBuffers
& cmd
= *GetBufferAs
<cmds::SwapBuffers
>();
3740 void* next_cmd
= cmd
.Set(&cmd
);
3741 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapBuffers::kCmdId
),
3742 cmd
.header
.command
);
3743 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3744 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3747 TEST_F(GLES2FormatTest
, GetMaxValueInBufferCHROMIUM
) {
3748 cmds::GetMaxValueInBufferCHROMIUM
& cmd
=
3749 *GetBufferAs
<cmds::GetMaxValueInBufferCHROMIUM
>();
3751 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLsizei
>(12),
3752 static_cast<GLenum
>(13), static_cast<GLuint
>(14),
3753 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
3754 EXPECT_EQ(static_cast<uint32_t>(cmds::GetMaxValueInBufferCHROMIUM::kCmdId
),
3755 cmd
.header
.command
);
3756 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3757 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer_id
);
3758 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
3759 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3760 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.offset
);
3761 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_id
);
3762 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.result_shm_offset
);
3763 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3766 TEST_F(GLES2FormatTest
, EnableFeatureCHROMIUM
) {
3767 cmds::EnableFeatureCHROMIUM
& cmd
=
3768 *GetBufferAs
<cmds::EnableFeatureCHROMIUM
>();
3770 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
3771 static_cast<uint32_t>(13));
3772 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableFeatureCHROMIUM::kCmdId
),
3773 cmd
.header
.command
);
3774 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3775 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3776 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
3777 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
3778 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3781 TEST_F(GLES2FormatTest
, MapBufferRange
) {
3782 cmds::MapBufferRange
& cmd
= *GetBufferAs
<cmds::MapBufferRange
>();
3784 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLintptr
>(12),
3785 static_cast<GLsizeiptr
>(13), static_cast<GLbitfield
>(14),
3786 static_cast<uint32_t>(15), static_cast<uint32_t>(16),
3787 static_cast<uint32_t>(17), static_cast<uint32_t>(18));
3788 EXPECT_EQ(static_cast<uint32_t>(cmds::MapBufferRange::kCmdId
),
3789 cmd
.header
.command
);
3790 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3791 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3792 EXPECT_EQ(static_cast<GLintptr
>(12), cmd
.offset
);
3793 EXPECT_EQ(static_cast<GLsizeiptr
>(13), cmd
.size
);
3794 EXPECT_EQ(static_cast<GLbitfield
>(14), cmd
.access
);
3795 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.data_shm_id
);
3796 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.data_shm_offset
);
3797 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.result_shm_id
);
3798 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.result_shm_offset
);
3799 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3802 TEST_F(GLES2FormatTest
, UnmapBuffer
) {
3803 cmds::UnmapBuffer
& cmd
= *GetBufferAs
<cmds::UnmapBuffer
>();
3804 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
3805 EXPECT_EQ(static_cast<uint32_t>(cmds::UnmapBuffer::kCmdId
),
3806 cmd
.header
.command
);
3807 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3808 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3809 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3812 TEST_F(GLES2FormatTest
, ResizeCHROMIUM
) {
3813 cmds::ResizeCHROMIUM
& cmd
= *GetBufferAs
<cmds::ResizeCHROMIUM
>();
3814 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3815 static_cast<GLuint
>(12), static_cast<GLfloat
>(13));
3816 EXPECT_EQ(static_cast<uint32_t>(cmds::ResizeCHROMIUM::kCmdId
),
3817 cmd
.header
.command
);
3818 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3819 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.width
);
3820 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.height
);
3821 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.scale_factor
);
3822 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3825 TEST_F(GLES2FormatTest
, GetRequestableExtensionsCHROMIUM
) {
3826 cmds::GetRequestableExtensionsCHROMIUM
& cmd
=
3827 *GetBufferAs
<cmds::GetRequestableExtensionsCHROMIUM
>();
3828 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
3830 static_cast<uint32_t>(cmds::GetRequestableExtensionsCHROMIUM::kCmdId
),
3831 cmd
.header
.command
);
3832 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3833 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.bucket_id
);
3834 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3837 TEST_F(GLES2FormatTest
, RequestExtensionCHROMIUM
) {
3838 cmds::RequestExtensionCHROMIUM
& cmd
=
3839 *GetBufferAs
<cmds::RequestExtensionCHROMIUM
>();
3840 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
3841 EXPECT_EQ(static_cast<uint32_t>(cmds::RequestExtensionCHROMIUM::kCmdId
),
3842 cmd
.header
.command
);
3843 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3844 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.bucket_id
);
3845 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3848 TEST_F(GLES2FormatTest
, GetProgramInfoCHROMIUM
) {
3849 cmds::GetProgramInfoCHROMIUM
& cmd
=
3850 *GetBufferAs
<cmds::GetProgramInfoCHROMIUM
>();
3852 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
3853 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoCHROMIUM::kCmdId
),
3854 cmd
.header
.command
);
3855 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3856 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3857 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
3858 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3861 TEST_F(GLES2FormatTest
, GetUniformBlocksCHROMIUM
) {
3862 cmds::GetUniformBlocksCHROMIUM
& cmd
=
3863 *GetBufferAs
<cmds::GetUniformBlocksCHROMIUM
>();
3865 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
3866 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlocksCHROMIUM::kCmdId
),
3867 cmd
.header
.command
);
3868 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3869 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3870 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
3871 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3874 TEST_F(GLES2FormatTest
, GetTransformFeedbackVaryingsCHROMIUM
) {
3875 cmds::GetTransformFeedbackVaryingsCHROMIUM
& cmd
=
3876 *GetBufferAs
<cmds::GetTransformFeedbackVaryingsCHROMIUM
>();
3878 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
3880 static_cast<uint32_t>(cmds::GetTransformFeedbackVaryingsCHROMIUM::kCmdId
),
3881 cmd
.header
.command
);
3882 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3883 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3884 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
3885 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3888 TEST_F(GLES2FormatTest
, GetUniformsES3CHROMIUM
) {
3889 cmds::GetUniformsES3CHROMIUM
& cmd
=
3890 *GetBufferAs
<cmds::GetUniformsES3CHROMIUM
>();
3892 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
3893 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformsES3CHROMIUM::kCmdId
),
3894 cmd
.header
.command
);
3895 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3896 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3897 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
3898 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3901 TEST_F(GLES2FormatTest
, GetTranslatedShaderSourceANGLE
) {
3902 cmds::GetTranslatedShaderSourceANGLE
& cmd
=
3903 *GetBufferAs
<cmds::GetTranslatedShaderSourceANGLE
>();
3905 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
3906 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTranslatedShaderSourceANGLE::kCmdId
),
3907 cmd
.header
.command
);
3908 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3909 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
3910 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
3911 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3914 TEST_F(GLES2FormatTest
, PostSubBufferCHROMIUM
) {
3915 cmds::PostSubBufferCHROMIUM
& cmd
=
3916 *GetBufferAs
<cmds::PostSubBufferCHROMIUM
>();
3917 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
3918 static_cast<GLint
>(13), static_cast<GLint
>(14));
3919 EXPECT_EQ(static_cast<uint32_t>(cmds::PostSubBufferCHROMIUM::kCmdId
),
3920 cmd
.header
.command
);
3921 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3922 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
3923 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
3924 EXPECT_EQ(static_cast<GLint
>(13), cmd
.width
);
3925 EXPECT_EQ(static_cast<GLint
>(14), cmd
.height
);
3926 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3929 TEST_F(GLES2FormatTest
, TexImageIOSurface2DCHROMIUM
) {
3930 cmds::TexImageIOSurface2DCHROMIUM
& cmd
=
3931 *GetBufferAs
<cmds::TexImageIOSurface2DCHROMIUM
>();
3932 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3933 static_cast<GLsizei
>(12), static_cast<GLsizei
>(13),
3934 static_cast<GLuint
>(14), static_cast<GLuint
>(15));
3935 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImageIOSurface2DCHROMIUM::kCmdId
),
3936 cmd
.header
.command
);
3937 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3938 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3939 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.width
);
3940 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.height
);
3941 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.ioSurfaceId
);
3942 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.plane
);
3943 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3946 TEST_F(GLES2FormatTest
, CopyTextureCHROMIUM
) {
3947 cmds::CopyTextureCHROMIUM
& cmd
= *GetBufferAs
<cmds::CopyTextureCHROMIUM
>();
3948 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3949 static_cast<GLenum
>(12), static_cast<GLenum
>(13),
3950 static_cast<GLint
>(14), static_cast<GLenum
>(15));
3951 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTextureCHROMIUM::kCmdId
),
3952 cmd
.header
.command
);
3953 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3954 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3955 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
3956 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
3957 EXPECT_EQ(static_cast<GLint
>(14), cmd
.internalformat
);
3958 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.dest_type
);
3959 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3962 TEST_F(GLES2FormatTest
, CopySubTextureCHROMIUM
) {
3963 cmds::CopySubTextureCHROMIUM
& cmd
=
3964 *GetBufferAs
<cmds::CopySubTextureCHROMIUM
>();
3965 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3966 static_cast<GLenum
>(12), static_cast<GLenum
>(13),
3967 static_cast<GLint
>(14), static_cast<GLint
>(15));
3968 EXPECT_EQ(static_cast<uint32_t>(cmds::CopySubTextureCHROMIUM::kCmdId
),
3969 cmd
.header
.command
);
3970 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3971 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3972 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
3973 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
3974 EXPECT_EQ(static_cast<GLint
>(14), cmd
.xoffset
);
3975 EXPECT_EQ(static_cast<GLint
>(15), cmd
.yoffset
);
3976 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3979 TEST_F(GLES2FormatTest
, DrawArraysInstancedANGLE
) {
3980 cmds::DrawArraysInstancedANGLE
& cmd
=
3981 *GetBufferAs
<cmds::DrawArraysInstancedANGLE
>();
3983 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
3984 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
3985 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArraysInstancedANGLE::kCmdId
),
3986 cmd
.header
.command
);
3987 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3988 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
3989 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
3990 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
3991 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.primcount
);
3992 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3995 TEST_F(GLES2FormatTest
, DrawElementsInstancedANGLE
) {
3996 cmds::DrawElementsInstancedANGLE
& cmd
=
3997 *GetBufferAs
<cmds::DrawElementsInstancedANGLE
>();
3998 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3999 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
4000 static_cast<GLuint
>(14), static_cast<GLsizei
>(15));
4001 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElementsInstancedANGLE::kCmdId
),
4002 cmd
.header
.command
);
4003 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4004 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
4005 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
4006 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
4007 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
4008 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.primcount
);
4009 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4012 TEST_F(GLES2FormatTest
, VertexAttribDivisorANGLE
) {
4013 cmds::VertexAttribDivisorANGLE
& cmd
=
4014 *GetBufferAs
<cmds::VertexAttribDivisorANGLE
>();
4016 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
4017 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribDivisorANGLE::kCmdId
),
4018 cmd
.header
.command
);
4019 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4020 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
4021 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.divisor
);
4022 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4025 // TODO(gman): Write test for GenMailboxCHROMIUM
4026 TEST_F(GLES2FormatTest
, ProduceTextureCHROMIUMImmediate
) {
4027 const int kSomeBaseValueToTestWith
= 51;
4028 static GLbyte data
[] = {
4029 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4030 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4031 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4032 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4033 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4034 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4035 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4036 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4037 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4038 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4039 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4040 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4041 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4042 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4043 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4044 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4045 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4046 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4047 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4048 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4049 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4050 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4051 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4052 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4053 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4054 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4055 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4056 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4057 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4058 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4059 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4060 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4061 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4062 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4063 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4064 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4065 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4066 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4067 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4068 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4069 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4070 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4071 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4072 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4073 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4074 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4075 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4076 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4077 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4078 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4079 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4080 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4081 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4082 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4083 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4084 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4085 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4086 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4087 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4088 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4089 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4090 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4091 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4092 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4094 cmds::ProduceTextureCHROMIUMImmediate
& cmd
=
4095 *GetBufferAs
<cmds::ProduceTextureCHROMIUMImmediate
>();
4096 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
4098 static_cast<uint32_t>(cmds::ProduceTextureCHROMIUMImmediate::kCmdId
),
4099 cmd
.header
.command
);
4100 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4101 cmd
.header
.size
* 4u);
4102 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4103 CheckBytesWrittenMatchesExpectedSize(
4104 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4105 // TODO(gman): Check that data was inserted;
4108 TEST_F(GLES2FormatTest
, ProduceTextureDirectCHROMIUMImmediate
) {
4109 const int kSomeBaseValueToTestWith
= 51;
4110 static GLbyte data
[] = {
4111 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4112 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4113 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4114 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4115 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4116 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4117 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4118 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4119 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4120 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4121 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4122 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4123 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4124 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4125 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4126 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4127 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4128 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4129 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4130 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4131 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4132 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4133 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4134 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4135 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4136 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4137 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4138 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4139 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4140 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4141 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4142 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4143 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4144 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4145 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4146 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4147 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4148 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4149 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4150 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4151 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4152 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4153 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4154 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4155 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4156 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4157 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4158 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4159 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4160 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4161 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4162 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4163 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4164 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4165 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4166 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4167 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4168 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4169 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4170 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4171 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4172 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4173 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4174 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4176 cmds::ProduceTextureDirectCHROMIUMImmediate
& cmd
=
4177 *GetBufferAs
<cmds::ProduceTextureDirectCHROMIUMImmediate
>();
4179 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
4180 EXPECT_EQ(static_cast<uint32_t>(
4181 cmds::ProduceTextureDirectCHROMIUMImmediate::kCmdId
),
4182 cmd
.header
.command
);
4183 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4184 cmd
.header
.size
* 4u);
4185 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
4186 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.target
);
4187 CheckBytesWrittenMatchesExpectedSize(
4188 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4189 // TODO(gman): Check that data was inserted;
4192 TEST_F(GLES2FormatTest
, ConsumeTextureCHROMIUMImmediate
) {
4193 const int kSomeBaseValueToTestWith
= 51;
4194 static GLbyte data
[] = {
4195 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4196 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4197 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4198 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4199 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4200 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4201 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4202 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4203 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4204 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4205 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4206 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4207 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4208 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4209 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4210 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4211 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4212 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4213 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4214 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4215 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4216 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4217 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4218 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4219 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4220 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4221 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4222 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4223 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4224 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4225 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4226 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4227 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4228 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4229 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4230 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4231 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4232 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4233 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4234 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4235 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4236 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4237 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4238 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4239 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4240 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4241 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4242 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4243 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4244 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4245 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4246 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4247 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4248 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4249 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4250 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4251 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4252 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4253 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4254 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4255 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4256 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4257 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4258 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4260 cmds::ConsumeTextureCHROMIUMImmediate
& cmd
=
4261 *GetBufferAs
<cmds::ConsumeTextureCHROMIUMImmediate
>();
4262 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
4264 static_cast<uint32_t>(cmds::ConsumeTextureCHROMIUMImmediate::kCmdId
),
4265 cmd
.header
.command
);
4266 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4267 cmd
.header
.size
* 4u);
4268 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4269 CheckBytesWrittenMatchesExpectedSize(
4270 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4271 // TODO(gman): Check that data was inserted;
4274 // TODO(gman): Write test for CreateAndConsumeTextureCHROMIUMImmediate
4275 TEST_F(GLES2FormatTest
, BindUniformLocationCHROMIUMBucket
) {
4276 cmds::BindUniformLocationCHROMIUMBucket
& cmd
=
4277 *GetBufferAs
<cmds::BindUniformLocationCHROMIUMBucket
>();
4278 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
4279 static_cast<GLint
>(12), static_cast<uint32_t>(13));
4281 static_cast<uint32_t>(cmds::BindUniformLocationCHROMIUMBucket::kCmdId
),
4282 cmd
.header
.command
);
4283 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4284 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4285 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
4286 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
4287 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4290 TEST_F(GLES2FormatTest
, GenValuebuffersCHROMIUMImmediate
) {
4291 static GLuint ids
[] = {
4294 cmds::GenValuebuffersCHROMIUMImmediate
& cmd
=
4295 *GetBufferAs
<cmds::GenValuebuffersCHROMIUMImmediate
>();
4296 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
4298 static_cast<uint32_t>(cmds::GenValuebuffersCHROMIUMImmediate::kCmdId
),
4299 cmd
.header
.command
);
4300 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
4301 cmd
.header
.size
* 4u);
4302 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
4303 CheckBytesWrittenMatchesExpectedSize(
4305 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
4306 // TODO(gman): Check that ids were inserted;
4309 TEST_F(GLES2FormatTest
, DeleteValuebuffersCHROMIUMImmediate
) {
4310 static GLuint ids
[] = {
4313 cmds::DeleteValuebuffersCHROMIUMImmediate
& cmd
=
4314 *GetBufferAs
<cmds::DeleteValuebuffersCHROMIUMImmediate
>();
4315 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
4317 static_cast<uint32_t>(cmds::DeleteValuebuffersCHROMIUMImmediate::kCmdId
),
4318 cmd
.header
.command
);
4319 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
4320 cmd
.header
.size
* 4u);
4321 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
4322 CheckBytesWrittenMatchesExpectedSize(
4324 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
4325 // TODO(gman): Check that ids were inserted;
4328 TEST_F(GLES2FormatTest
, IsValuebufferCHROMIUM
) {
4329 cmds::IsValuebufferCHROMIUM
& cmd
=
4330 *GetBufferAs
<cmds::IsValuebufferCHROMIUM
>();
4332 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
4333 static_cast<uint32_t>(13));
4334 EXPECT_EQ(static_cast<uint32_t>(cmds::IsValuebufferCHROMIUM::kCmdId
),
4335 cmd
.header
.command
);
4336 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4337 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.valuebuffer
);
4338 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
4339 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
4340 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4343 TEST_F(GLES2FormatTest
, BindValuebufferCHROMIUM
) {
4344 cmds::BindValuebufferCHROMIUM
& cmd
=
4345 *GetBufferAs
<cmds::BindValuebufferCHROMIUM
>();
4347 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
4348 EXPECT_EQ(static_cast<uint32_t>(cmds::BindValuebufferCHROMIUM::kCmdId
),
4349 cmd
.header
.command
);
4350 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4351 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4352 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.valuebuffer
);
4353 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4356 TEST_F(GLES2FormatTest
, SubscribeValueCHROMIUM
) {
4357 cmds::SubscribeValueCHROMIUM
& cmd
=
4358 *GetBufferAs
<cmds::SubscribeValueCHROMIUM
>();
4360 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
4361 EXPECT_EQ(static_cast<uint32_t>(cmds::SubscribeValueCHROMIUM::kCmdId
),
4362 cmd
.header
.command
);
4363 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4364 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4365 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.subscription
);
4366 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4369 TEST_F(GLES2FormatTest
, PopulateSubscribedValuesCHROMIUM
) {
4370 cmds::PopulateSubscribedValuesCHROMIUM
& cmd
=
4371 *GetBufferAs
<cmds::PopulateSubscribedValuesCHROMIUM
>();
4372 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
4374 static_cast<uint32_t>(cmds::PopulateSubscribedValuesCHROMIUM::kCmdId
),
4375 cmd
.header
.command
);
4376 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4377 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4378 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4381 TEST_F(GLES2FormatTest
, UniformValuebufferCHROMIUM
) {
4382 cmds::UniformValuebufferCHROMIUM
& cmd
=
4383 *GetBufferAs
<cmds::UniformValuebufferCHROMIUM
>();
4384 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
4385 static_cast<GLenum
>(12), static_cast<GLenum
>(13));
4386 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformValuebufferCHROMIUM::kCmdId
),
4387 cmd
.header
.command
);
4388 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4389 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
4390 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.target
);
4391 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.subscription
);
4392 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4395 TEST_F(GLES2FormatTest
, BindTexImage2DCHROMIUM
) {
4396 cmds::BindTexImage2DCHROMIUM
& cmd
=
4397 *GetBufferAs
<cmds::BindTexImage2DCHROMIUM
>();
4399 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
4400 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexImage2DCHROMIUM::kCmdId
),
4401 cmd
.header
.command
);
4402 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4403 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4404 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
4405 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4408 TEST_F(GLES2FormatTest
, ReleaseTexImage2DCHROMIUM
) {
4409 cmds::ReleaseTexImage2DCHROMIUM
& cmd
=
4410 *GetBufferAs
<cmds::ReleaseTexImage2DCHROMIUM
>();
4412 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
4413 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseTexImage2DCHROMIUM::kCmdId
),
4414 cmd
.header
.command
);
4415 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4416 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4417 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
4418 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4421 TEST_F(GLES2FormatTest
, TraceBeginCHROMIUM
) {
4422 cmds::TraceBeginCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceBeginCHROMIUM
>();
4424 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
4425 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceBeginCHROMIUM::kCmdId
),
4426 cmd
.header
.command
);
4427 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4428 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.category_bucket_id
);
4429 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.name_bucket_id
);
4430 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4433 TEST_F(GLES2FormatTest
, TraceEndCHROMIUM
) {
4434 cmds::TraceEndCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceEndCHROMIUM
>();
4435 void* next_cmd
= cmd
.Set(&cmd
);
4436 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceEndCHROMIUM::kCmdId
),
4437 cmd
.header
.command
);
4438 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4439 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4442 TEST_F(GLES2FormatTest
, AsyncTexSubImage2DCHROMIUM
) {
4443 cmds::AsyncTexSubImage2DCHROMIUM
& cmd
=
4444 *GetBufferAs
<cmds::AsyncTexSubImage2DCHROMIUM
>();
4445 void* next_cmd
= cmd
.Set(
4446 &cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
4447 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLsizei
>(15),
4448 static_cast<GLsizei
>(16), static_cast<GLenum
>(17),
4449 static_cast<GLenum
>(18), static_cast<uint32_t>(19),
4450 static_cast<uint32_t>(20), static_cast<uint32_t>(21),
4451 static_cast<uint32_t>(22), static_cast<uint32_t>(23));
4452 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexSubImage2DCHROMIUM::kCmdId
),
4453 cmd
.header
.command
);
4454 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4455 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4456 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
4457 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
4458 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
4459 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
4460 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
4461 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
4462 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
4463 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.data_shm_id
);
4464 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.data_shm_offset
);
4465 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.async_upload_token
);
4466 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.sync_data_shm_id
);
4467 EXPECT_EQ(static_cast<uint32_t>(23), cmd
.sync_data_shm_offset
);
4468 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4471 TEST_F(GLES2FormatTest
, AsyncTexImage2DCHROMIUM
) {
4472 cmds::AsyncTexImage2DCHROMIUM
& cmd
=
4473 *GetBufferAs
<cmds::AsyncTexImage2DCHROMIUM
>();
4475 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
4476 static_cast<GLint
>(13), static_cast<GLsizei
>(14),
4477 static_cast<GLsizei
>(15), static_cast<GLenum
>(16),
4478 static_cast<GLenum
>(17), static_cast<uint32_t>(18),
4479 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
4480 static_cast<uint32_t>(21), static_cast<uint32_t>(22));
4481 EXPECT_EQ(static_cast<uint32_t>(cmds::AsyncTexImage2DCHROMIUM::kCmdId
),
4482 cmd
.header
.command
);
4483 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4484 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4485 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
4486 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
4487 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
4488 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
4489 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.format
);
4490 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.type
);
4491 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_id
);
4492 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_offset
);
4493 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.async_upload_token
);
4494 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.sync_data_shm_id
);
4495 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.sync_data_shm_offset
);
4496 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4499 TEST_F(GLES2FormatTest
, WaitAsyncTexImage2DCHROMIUM
) {
4500 cmds::WaitAsyncTexImage2DCHROMIUM
& cmd
=
4501 *GetBufferAs
<cmds::WaitAsyncTexImage2DCHROMIUM
>();
4502 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
4503 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAsyncTexImage2DCHROMIUM::kCmdId
),
4504 cmd
.header
.command
);
4505 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4506 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4507 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4510 TEST_F(GLES2FormatTest
, WaitAllAsyncTexImage2DCHROMIUM
) {
4511 cmds::WaitAllAsyncTexImage2DCHROMIUM
& cmd
=
4512 *GetBufferAs
<cmds::WaitAllAsyncTexImage2DCHROMIUM
>();
4513 void* next_cmd
= cmd
.Set(&cmd
);
4514 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitAllAsyncTexImage2DCHROMIUM::kCmdId
),
4515 cmd
.header
.command
);
4516 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4517 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4520 TEST_F(GLES2FormatTest
, DiscardFramebufferEXTImmediate
) {
4521 const int kSomeBaseValueToTestWith
= 51;
4522 static GLenum data
[] = {
4523 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
4524 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
4526 cmds::DiscardFramebufferEXTImmediate
& cmd
=
4527 *GetBufferAs
<cmds::DiscardFramebufferEXTImmediate
>();
4528 const GLsizei kNumElements
= 2;
4529 const size_t kExpectedCmdSize
=
4530 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
4532 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
);
4533 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardFramebufferEXTImmediate::kCmdId
),
4534 cmd
.header
.command
);
4535 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
4536 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
4537 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
4538 CheckBytesWrittenMatchesExpectedSize(
4539 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4540 // TODO(gman): Check that data was inserted;
4543 TEST_F(GLES2FormatTest
, LoseContextCHROMIUM
) {
4544 cmds::LoseContextCHROMIUM
& cmd
= *GetBufferAs
<cmds::LoseContextCHROMIUM
>();
4546 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
4547 EXPECT_EQ(static_cast<uint32_t>(cmds::LoseContextCHROMIUM::kCmdId
),
4548 cmd
.header
.command
);
4549 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4550 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.current
);
4551 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.other
);
4552 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4555 // TODO(gman): Write test for InsertSyncPointCHROMIUM
4556 TEST_F(GLES2FormatTest
, WaitSyncPointCHROMIUM
) {
4557 cmds::WaitSyncPointCHROMIUM
& cmd
=
4558 *GetBufferAs
<cmds::WaitSyncPointCHROMIUM
>();
4559 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
4560 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSyncPointCHROMIUM::kCmdId
),
4561 cmd
.header
.command
);
4562 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4563 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync_point
);
4564 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4567 TEST_F(GLES2FormatTest
, DrawBuffersEXTImmediate
) {
4568 const int kSomeBaseValueToTestWith
= 51;
4569 static GLenum data
[] = {
4570 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
4572 cmds::DrawBuffersEXTImmediate
& cmd
=
4573 *GetBufferAs
<cmds::DrawBuffersEXTImmediate
>();
4574 const GLsizei kNumElements
= 1;
4575 const size_t kExpectedCmdSize
=
4576 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
4577 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(1), data
);
4578 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawBuffersEXTImmediate::kCmdId
),
4579 cmd
.header
.command
);
4580 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
4581 EXPECT_EQ(static_cast<GLsizei
>(1), cmd
.count
);
4582 CheckBytesWrittenMatchesExpectedSize(
4583 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4584 // TODO(gman): Check that data was inserted;
4587 TEST_F(GLES2FormatTest
, DiscardBackbufferCHROMIUM
) {
4588 cmds::DiscardBackbufferCHROMIUM
& cmd
=
4589 *GetBufferAs
<cmds::DiscardBackbufferCHROMIUM
>();
4590 void* next_cmd
= cmd
.Set(&cmd
);
4591 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardBackbufferCHROMIUM::kCmdId
),
4592 cmd
.header
.command
);
4593 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4594 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4597 TEST_F(GLES2FormatTest
, ScheduleOverlayPlaneCHROMIUM
) {
4598 cmds::ScheduleOverlayPlaneCHROMIUM
& cmd
=
4599 *GetBufferAs
<cmds::ScheduleOverlayPlaneCHROMIUM
>();
4600 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
4601 static_cast<GLenum
>(12), static_cast<GLuint
>(13),
4602 static_cast<GLint
>(14), static_cast<GLint
>(15),
4603 static_cast<GLint
>(16), static_cast<GLint
>(17),
4604 static_cast<GLfloat
>(18), static_cast<GLfloat
>(19),
4605 static_cast<GLfloat
>(20), static_cast<GLfloat
>(21));
4606 EXPECT_EQ(static_cast<uint32_t>(cmds::ScheduleOverlayPlaneCHROMIUM::kCmdId
),
4607 cmd
.header
.command
);
4608 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4609 EXPECT_EQ(static_cast<GLint
>(11), cmd
.plane_z_order
);
4610 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.plane_transform
);
4611 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.overlay_texture_id
);
4612 EXPECT_EQ(static_cast<GLint
>(14), cmd
.bounds_x
);
4613 EXPECT_EQ(static_cast<GLint
>(15), cmd
.bounds_y
);
4614 EXPECT_EQ(static_cast<GLint
>(16), cmd
.bounds_width
);
4615 EXPECT_EQ(static_cast<GLint
>(17), cmd
.bounds_height
);
4616 EXPECT_EQ(static_cast<GLfloat
>(18), cmd
.uv_x
);
4617 EXPECT_EQ(static_cast<GLfloat
>(19), cmd
.uv_y
);
4618 EXPECT_EQ(static_cast<GLfloat
>(20), cmd
.uv_width
);
4619 EXPECT_EQ(static_cast<GLfloat
>(21), cmd
.uv_height
);
4620 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4623 TEST_F(GLES2FormatTest
, SwapInterval
) {
4624 cmds::SwapInterval
& cmd
= *GetBufferAs
<cmds::SwapInterval
>();
4625 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11));
4626 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapInterval::kCmdId
),
4627 cmd
.header
.command
);
4628 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4629 EXPECT_EQ(static_cast<GLint
>(11), cmd
.interval
);
4630 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4633 TEST_F(GLES2FormatTest
, MatrixLoadfCHROMIUMImmediate
) {
4634 const int kSomeBaseValueToTestWith
= 51;
4635 static GLfloat data
[] = {
4636 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
4637 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
4638 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
4639 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
4640 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
4641 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
4642 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
4643 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
4644 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
4645 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
4646 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
4647 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
4648 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
4649 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
4650 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
4651 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
4653 cmds::MatrixLoadfCHROMIUMImmediate
& cmd
=
4654 *GetBufferAs
<cmds::MatrixLoadfCHROMIUMImmediate
>();
4655 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
4656 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadfCHROMIUMImmediate::kCmdId
),
4657 cmd
.header
.command
);
4658 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4659 cmd
.header
.size
* 4u);
4660 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.matrixMode
);
4661 CheckBytesWrittenMatchesExpectedSize(
4662 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4663 // TODO(gman): Check that data was inserted;
4666 TEST_F(GLES2FormatTest
, MatrixLoadIdentityCHROMIUM
) {
4667 cmds::MatrixLoadIdentityCHROMIUM
& cmd
=
4668 *GetBufferAs
<cmds::MatrixLoadIdentityCHROMIUM
>();
4669 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
4670 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadIdentityCHROMIUM::kCmdId
),
4671 cmd
.header
.command
);
4672 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4673 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.matrixMode
);
4674 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4677 TEST_F(GLES2FormatTest
, BlendBarrierKHR
) {
4678 cmds::BlendBarrierKHR
& cmd
= *GetBufferAs
<cmds::BlendBarrierKHR
>();
4679 void* next_cmd
= cmd
.Set(&cmd
);
4680 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendBarrierKHR::kCmdId
),
4681 cmd
.header
.command
);
4682 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4683 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4686 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_