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
, CompressedTexImage3DBucket
) {
527 cmds::CompressedTexImage3DBucket
& cmd
=
528 *GetBufferAs
<cmds::CompressedTexImage3DBucket
>();
529 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
530 static_cast<GLint
>(12), static_cast<GLenum
>(13),
531 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15),
532 static_cast<GLsizei
>(16), static_cast<GLuint
>(17));
533 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage3DBucket::kCmdId
),
535 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
536 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
537 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
538 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
539 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
540 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
541 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.depth
);
542 EXPECT_EQ(static_cast<GLuint
>(17), cmd
.bucket_id
);
543 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
546 TEST_F(GLES2FormatTest
, CompressedTexImage3D
) {
547 cmds::CompressedTexImage3D
& cmd
= *GetBufferAs
<cmds::CompressedTexImage3D
>();
549 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
550 static_cast<GLenum
>(13), static_cast<GLsizei
>(14),
551 static_cast<GLsizei
>(15), static_cast<GLsizei
>(16),
552 static_cast<GLsizei
>(17), static_cast<uint32_t>(18),
553 static_cast<uint32_t>(19));
554 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage3D::kCmdId
),
556 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
557 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
558 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
559 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
560 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
561 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
562 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.depth
);
563 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.imageSize
);
564 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.data_shm_id
);
565 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.data_shm_offset
);
566 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
569 TEST_F(GLES2FormatTest
, CompressedTexSubImage3DBucket
) {
570 cmds::CompressedTexSubImage3DBucket
& cmd
=
571 *GetBufferAs
<cmds::CompressedTexSubImage3DBucket
>();
573 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
574 static_cast<GLint
>(13), static_cast<GLint
>(14),
575 static_cast<GLint
>(15), static_cast<GLsizei
>(16),
576 static_cast<GLsizei
>(17), static_cast<GLsizei
>(18),
577 static_cast<GLenum
>(19), static_cast<GLuint
>(20));
578 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage3DBucket::kCmdId
),
580 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
581 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
582 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
583 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
584 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
585 EXPECT_EQ(static_cast<GLint
>(15), cmd
.zoffset
);
586 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
587 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
588 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.depth
);
589 EXPECT_EQ(static_cast<GLenum
>(19), cmd
.format
);
590 EXPECT_EQ(static_cast<GLuint
>(20), cmd
.bucket_id
);
591 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
594 TEST_F(GLES2FormatTest
, CompressedTexSubImage3D
) {
595 cmds::CompressedTexSubImage3D
& cmd
=
596 *GetBufferAs
<cmds::CompressedTexSubImage3D
>();
598 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
599 static_cast<GLint
>(13), static_cast<GLint
>(14),
600 static_cast<GLint
>(15), static_cast<GLsizei
>(16),
601 static_cast<GLsizei
>(17), static_cast<GLsizei
>(18),
602 static_cast<GLenum
>(19), static_cast<GLsizei
>(20),
603 static_cast<uint32_t>(21), static_cast<uint32_t>(22));
604 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage3D::kCmdId
),
606 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
607 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
608 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
609 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
610 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
611 EXPECT_EQ(static_cast<GLint
>(15), cmd
.zoffset
);
612 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
613 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
614 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.depth
);
615 EXPECT_EQ(static_cast<GLenum
>(19), cmd
.format
);
616 EXPECT_EQ(static_cast<GLsizei
>(20), cmd
.imageSize
);
617 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.data_shm_id
);
618 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.data_shm_offset
);
619 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
622 TEST_F(GLES2FormatTest
, CopyBufferSubData
) {
623 cmds::CopyBufferSubData
& cmd
= *GetBufferAs
<cmds::CopyBufferSubData
>();
625 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
626 static_cast<GLintptr
>(13), static_cast<GLintptr
>(14),
627 static_cast<GLsizeiptr
>(15));
628 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyBufferSubData::kCmdId
),
630 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
631 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.readtarget
);
632 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.writetarget
);
633 EXPECT_EQ(static_cast<GLintptr
>(13), cmd
.readoffset
);
634 EXPECT_EQ(static_cast<GLintptr
>(14), cmd
.writeoffset
);
635 EXPECT_EQ(static_cast<GLsizeiptr
>(15), cmd
.size
);
636 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
639 TEST_F(GLES2FormatTest
, CopyTexImage2D
) {
640 cmds::CopyTexImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexImage2D
>();
641 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
642 static_cast<GLint
>(12), static_cast<GLenum
>(13),
643 static_cast<GLint
>(14), static_cast<GLint
>(15),
644 static_cast<GLsizei
>(16), static_cast<GLsizei
>(17));
645 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexImage2D::kCmdId
),
647 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
648 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
649 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
650 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
651 EXPECT_EQ(static_cast<GLint
>(14), cmd
.x
);
652 EXPECT_EQ(static_cast<GLint
>(15), cmd
.y
);
653 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
654 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
655 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
658 TEST_F(GLES2FormatTest
, CopyTexSubImage2D
) {
659 cmds::CopyTexSubImage2D
& cmd
= *GetBufferAs
<cmds::CopyTexSubImage2D
>();
661 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
662 static_cast<GLint
>(13), static_cast<GLint
>(14),
663 static_cast<GLint
>(15), static_cast<GLint
>(16),
664 static_cast<GLsizei
>(17), static_cast<GLsizei
>(18));
665 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage2D::kCmdId
),
667 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
668 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
669 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
670 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
671 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
672 EXPECT_EQ(static_cast<GLint
>(15), cmd
.x
);
673 EXPECT_EQ(static_cast<GLint
>(16), cmd
.y
);
674 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.width
);
675 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.height
);
676 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
679 TEST_F(GLES2FormatTest
, CopyTexSubImage3D
) {
680 cmds::CopyTexSubImage3D
& cmd
= *GetBufferAs
<cmds::CopyTexSubImage3D
>();
681 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
682 static_cast<GLint
>(12), static_cast<GLint
>(13),
683 static_cast<GLint
>(14), static_cast<GLint
>(15),
684 static_cast<GLint
>(16), static_cast<GLint
>(17),
685 static_cast<GLsizei
>(18), static_cast<GLsizei
>(19));
686 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage3D::kCmdId
),
688 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
689 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
690 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
691 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
692 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
693 EXPECT_EQ(static_cast<GLint
>(15), cmd
.zoffset
);
694 EXPECT_EQ(static_cast<GLint
>(16), cmd
.x
);
695 EXPECT_EQ(static_cast<GLint
>(17), cmd
.y
);
696 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.width
);
697 EXPECT_EQ(static_cast<GLsizei
>(19), cmd
.height
);
698 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
701 TEST_F(GLES2FormatTest
, CreateProgram
) {
702 cmds::CreateProgram
& cmd
= *GetBufferAs
<cmds::CreateProgram
>();
703 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
704 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateProgram::kCmdId
),
706 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
707 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.client_id
);
708 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
711 TEST_F(GLES2FormatTest
, CreateShader
) {
712 cmds::CreateShader
& cmd
= *GetBufferAs
<cmds::CreateShader
>();
714 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12));
715 EXPECT_EQ(static_cast<uint32_t>(cmds::CreateShader::kCmdId
),
717 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
718 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.type
);
719 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.client_id
);
720 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
723 TEST_F(GLES2FormatTest
, CullFace
) {
724 cmds::CullFace
& cmd
= *GetBufferAs
<cmds::CullFace
>();
725 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
726 EXPECT_EQ(static_cast<uint32_t>(cmds::CullFace::kCmdId
), cmd
.header
.command
);
727 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
728 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
729 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
732 TEST_F(GLES2FormatTest
, DeleteBuffersImmediate
) {
733 static GLuint ids
[] = {
736 cmds::DeleteBuffersImmediate
& cmd
=
737 *GetBufferAs
<cmds::DeleteBuffersImmediate
>();
738 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
739 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteBuffersImmediate::kCmdId
),
741 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
742 cmd
.header
.size
* 4u);
743 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
744 CheckBytesWrittenMatchesExpectedSize(
746 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
747 // TODO(gman): Check that ids were inserted;
750 TEST_F(GLES2FormatTest
, DeleteFramebuffersImmediate
) {
751 static GLuint ids
[] = {
754 cmds::DeleteFramebuffersImmediate
& cmd
=
755 *GetBufferAs
<cmds::DeleteFramebuffersImmediate
>();
756 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
757 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteFramebuffersImmediate::kCmdId
),
759 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
760 cmd
.header
.size
* 4u);
761 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
762 CheckBytesWrittenMatchesExpectedSize(
764 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
765 // TODO(gman): Check that ids were inserted;
768 TEST_F(GLES2FormatTest
, DeleteProgram
) {
769 cmds::DeleteProgram
& cmd
= *GetBufferAs
<cmds::DeleteProgram
>();
770 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
771 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteProgram::kCmdId
),
773 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
774 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
775 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
778 TEST_F(GLES2FormatTest
, DeleteRenderbuffersImmediate
) {
779 static GLuint ids
[] = {
782 cmds::DeleteRenderbuffersImmediate
& cmd
=
783 *GetBufferAs
<cmds::DeleteRenderbuffersImmediate
>();
784 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
785 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteRenderbuffersImmediate::kCmdId
),
787 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
788 cmd
.header
.size
* 4u);
789 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
790 CheckBytesWrittenMatchesExpectedSize(
792 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
793 // TODO(gman): Check that ids were inserted;
796 TEST_F(GLES2FormatTest
, DeleteSamplersImmediate
) {
797 static GLuint ids
[] = {
800 cmds::DeleteSamplersImmediate
& cmd
=
801 *GetBufferAs
<cmds::DeleteSamplersImmediate
>();
802 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
803 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSamplersImmediate::kCmdId
),
805 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
806 cmd
.header
.size
* 4u);
807 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
808 CheckBytesWrittenMatchesExpectedSize(
810 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
811 // TODO(gman): Check that ids were inserted;
814 TEST_F(GLES2FormatTest
, DeleteSync
) {
815 cmds::DeleteSync
& cmd
= *GetBufferAs
<cmds::DeleteSync
>();
816 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
817 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSync::kCmdId
),
819 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
820 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
821 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
824 TEST_F(GLES2FormatTest
, DeleteShader
) {
825 cmds::DeleteShader
& cmd
= *GetBufferAs
<cmds::DeleteShader
>();
826 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
827 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteShader::kCmdId
),
829 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
830 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
831 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
834 TEST_F(GLES2FormatTest
, DeleteTexturesImmediate
) {
835 static GLuint ids
[] = {
838 cmds::DeleteTexturesImmediate
& cmd
=
839 *GetBufferAs
<cmds::DeleteTexturesImmediate
>();
840 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
841 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteTexturesImmediate::kCmdId
),
843 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
844 cmd
.header
.size
* 4u);
845 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
846 CheckBytesWrittenMatchesExpectedSize(
848 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
849 // TODO(gman): Check that ids were inserted;
852 TEST_F(GLES2FormatTest
, DeleteTransformFeedbacksImmediate
) {
853 static GLuint ids
[] = {
856 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
857 *GetBufferAs
<cmds::DeleteTransformFeedbacksImmediate
>();
858 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
860 static_cast<uint32_t>(cmds::DeleteTransformFeedbacksImmediate::kCmdId
),
862 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
863 cmd
.header
.size
* 4u);
864 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
865 CheckBytesWrittenMatchesExpectedSize(
867 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
868 // TODO(gman): Check that ids were inserted;
871 TEST_F(GLES2FormatTest
, DepthFunc
) {
872 cmds::DepthFunc
& cmd
= *GetBufferAs
<cmds::DepthFunc
>();
873 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
874 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthFunc::kCmdId
), cmd
.header
.command
);
875 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
876 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
877 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
880 TEST_F(GLES2FormatTest
, DepthMask
) {
881 cmds::DepthMask
& cmd
= *GetBufferAs
<cmds::DepthMask
>();
882 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLboolean
>(11));
883 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthMask::kCmdId
), cmd
.header
.command
);
884 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
885 EXPECT_EQ(static_cast<GLboolean
>(11), cmd
.flag
);
886 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
889 TEST_F(GLES2FormatTest
, DepthRangef
) {
890 cmds::DepthRangef
& cmd
= *GetBufferAs
<cmds::DepthRangef
>();
892 cmd
.Set(&cmd
, static_cast<GLclampf
>(11), static_cast<GLclampf
>(12));
893 EXPECT_EQ(static_cast<uint32_t>(cmds::DepthRangef::kCmdId
),
895 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
896 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.zNear
);
897 EXPECT_EQ(static_cast<GLclampf
>(12), cmd
.zFar
);
898 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
901 TEST_F(GLES2FormatTest
, DetachShader
) {
902 cmds::DetachShader
& cmd
= *GetBufferAs
<cmds::DetachShader
>();
904 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
905 EXPECT_EQ(static_cast<uint32_t>(cmds::DetachShader::kCmdId
),
907 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
908 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
909 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.shader
);
910 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
913 TEST_F(GLES2FormatTest
, Disable
) {
914 cmds::Disable
& cmd
= *GetBufferAs
<cmds::Disable
>();
915 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
916 EXPECT_EQ(static_cast<uint32_t>(cmds::Disable::kCmdId
), cmd
.header
.command
);
917 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
918 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
919 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
922 TEST_F(GLES2FormatTest
, DisableVertexAttribArray
) {
923 cmds::DisableVertexAttribArray
& cmd
=
924 *GetBufferAs
<cmds::DisableVertexAttribArray
>();
925 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
926 EXPECT_EQ(static_cast<uint32_t>(cmds::DisableVertexAttribArray::kCmdId
),
928 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
929 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
930 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
933 TEST_F(GLES2FormatTest
, DrawArrays
) {
934 cmds::DrawArrays
& cmd
= *GetBufferAs
<cmds::DrawArrays
>();
935 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
936 static_cast<GLint
>(12), static_cast<GLsizei
>(13));
937 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArrays::kCmdId
),
939 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
940 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
941 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
942 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
943 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
946 TEST_F(GLES2FormatTest
, DrawElements
) {
947 cmds::DrawElements
& cmd
= *GetBufferAs
<cmds::DrawElements
>();
949 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLsizei
>(12),
950 static_cast<GLenum
>(13), static_cast<GLuint
>(14));
951 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElements::kCmdId
),
953 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
954 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
955 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
956 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
957 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
958 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
961 TEST_F(GLES2FormatTest
, Enable
) {
962 cmds::Enable
& cmd
= *GetBufferAs
<cmds::Enable
>();
963 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
964 EXPECT_EQ(static_cast<uint32_t>(cmds::Enable::kCmdId
), cmd
.header
.command
);
965 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
966 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
967 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
970 TEST_F(GLES2FormatTest
, EnableVertexAttribArray
) {
971 cmds::EnableVertexAttribArray
& cmd
=
972 *GetBufferAs
<cmds::EnableVertexAttribArray
>();
973 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
974 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableVertexAttribArray::kCmdId
),
976 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
977 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
978 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
981 TEST_F(GLES2FormatTest
, FenceSync
) {
982 cmds::FenceSync
& cmd
= *GetBufferAs
<cmds::FenceSync
>();
983 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
984 EXPECT_EQ(static_cast<uint32_t>(cmds::FenceSync::kCmdId
), cmd
.header
.command
);
985 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
986 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.client_id
);
987 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
990 TEST_F(GLES2FormatTest
, Finish
) {
991 cmds::Finish
& cmd
= *GetBufferAs
<cmds::Finish
>();
992 void* next_cmd
= cmd
.Set(&cmd
);
993 EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId
), cmd
.header
.command
);
994 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
995 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
998 TEST_F(GLES2FormatTest
, Flush
) {
999 cmds::Flush
& cmd
= *GetBufferAs
<cmds::Flush
>();
1000 void* next_cmd
= cmd
.Set(&cmd
);
1001 EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId
), cmd
.header
.command
);
1002 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1003 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1006 TEST_F(GLES2FormatTest
, FramebufferRenderbuffer
) {
1007 cmds::FramebufferRenderbuffer
& cmd
=
1008 *GetBufferAs
<cmds::FramebufferRenderbuffer
>();
1010 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1011 static_cast<GLenum
>(13), static_cast<GLuint
>(14));
1012 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferRenderbuffer::kCmdId
),
1013 cmd
.header
.command
);
1014 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1015 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1016 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
1017 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.renderbuffertarget
);
1018 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.renderbuffer
);
1019 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1022 TEST_F(GLES2FormatTest
, FramebufferTexture2D
) {
1023 cmds::FramebufferTexture2D
& cmd
= *GetBufferAs
<cmds::FramebufferTexture2D
>();
1025 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1026 static_cast<GLenum
>(13), static_cast<GLuint
>(14));
1027 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTexture2D::kCmdId
),
1028 cmd
.header
.command
);
1029 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1030 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1031 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
1032 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
1033 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
1034 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1037 TEST_F(GLES2FormatTest
, FramebufferTextureLayer
) {
1038 cmds::FramebufferTextureLayer
& cmd
=
1039 *GetBufferAs
<cmds::FramebufferTextureLayer
>();
1040 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
1041 static_cast<GLenum
>(12), static_cast<GLuint
>(13),
1042 static_cast<GLint
>(14), static_cast<GLint
>(15));
1043 EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTextureLayer::kCmdId
),
1044 cmd
.header
.command
);
1045 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1046 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1047 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
1048 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.texture
);
1049 EXPECT_EQ(static_cast<GLint
>(14), cmd
.level
);
1050 EXPECT_EQ(static_cast<GLint
>(15), cmd
.layer
);
1051 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1054 TEST_F(GLES2FormatTest
, FrontFace
) {
1055 cmds::FrontFace
& cmd
= *GetBufferAs
<cmds::FrontFace
>();
1056 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
1057 EXPECT_EQ(static_cast<uint32_t>(cmds::FrontFace::kCmdId
), cmd
.header
.command
);
1058 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1059 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
1060 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1063 TEST_F(GLES2FormatTest
, GenBuffersImmediate
) {
1064 static GLuint ids
[] = {
1067 cmds::GenBuffersImmediate
& cmd
= *GetBufferAs
<cmds::GenBuffersImmediate
>();
1068 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1069 EXPECT_EQ(static_cast<uint32_t>(cmds::GenBuffersImmediate::kCmdId
),
1070 cmd
.header
.command
);
1071 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1072 cmd
.header
.size
* 4u);
1073 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1074 CheckBytesWrittenMatchesExpectedSize(
1076 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1077 // TODO(gman): Check that ids were inserted;
1080 TEST_F(GLES2FormatTest
, GenerateMipmap
) {
1081 cmds::GenerateMipmap
& cmd
= *GetBufferAs
<cmds::GenerateMipmap
>();
1082 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
1083 EXPECT_EQ(static_cast<uint32_t>(cmds::GenerateMipmap::kCmdId
),
1084 cmd
.header
.command
);
1085 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1086 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1087 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1090 TEST_F(GLES2FormatTest
, GenFramebuffersImmediate
) {
1091 static GLuint ids
[] = {
1094 cmds::GenFramebuffersImmediate
& cmd
=
1095 *GetBufferAs
<cmds::GenFramebuffersImmediate
>();
1096 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1097 EXPECT_EQ(static_cast<uint32_t>(cmds::GenFramebuffersImmediate::kCmdId
),
1098 cmd
.header
.command
);
1099 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1100 cmd
.header
.size
* 4u);
1101 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1102 CheckBytesWrittenMatchesExpectedSize(
1104 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1105 // TODO(gman): Check that ids were inserted;
1108 TEST_F(GLES2FormatTest
, GenRenderbuffersImmediate
) {
1109 static GLuint ids
[] = {
1112 cmds::GenRenderbuffersImmediate
& cmd
=
1113 *GetBufferAs
<cmds::GenRenderbuffersImmediate
>();
1114 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1115 EXPECT_EQ(static_cast<uint32_t>(cmds::GenRenderbuffersImmediate::kCmdId
),
1116 cmd
.header
.command
);
1117 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1118 cmd
.header
.size
* 4u);
1119 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1120 CheckBytesWrittenMatchesExpectedSize(
1122 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1123 // TODO(gman): Check that ids were inserted;
1126 TEST_F(GLES2FormatTest
, GenSamplersImmediate
) {
1127 static GLuint ids
[] = {
1130 cmds::GenSamplersImmediate
& cmd
= *GetBufferAs
<cmds::GenSamplersImmediate
>();
1131 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1132 EXPECT_EQ(static_cast<uint32_t>(cmds::GenSamplersImmediate::kCmdId
),
1133 cmd
.header
.command
);
1134 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1135 cmd
.header
.size
* 4u);
1136 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1137 CheckBytesWrittenMatchesExpectedSize(
1139 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1140 // TODO(gman): Check that ids were inserted;
1143 TEST_F(GLES2FormatTest
, GenTexturesImmediate
) {
1144 static GLuint ids
[] = {
1147 cmds::GenTexturesImmediate
& cmd
= *GetBufferAs
<cmds::GenTexturesImmediate
>();
1148 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1149 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTexturesImmediate::kCmdId
),
1150 cmd
.header
.command
);
1151 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1152 cmd
.header
.size
* 4u);
1153 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1154 CheckBytesWrittenMatchesExpectedSize(
1156 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1157 // TODO(gman): Check that ids were inserted;
1160 TEST_F(GLES2FormatTest
, GenTransformFeedbacksImmediate
) {
1161 static GLuint ids
[] = {
1164 cmds::GenTransformFeedbacksImmediate
& cmd
=
1165 *GetBufferAs
<cmds::GenTransformFeedbacksImmediate
>();
1166 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
1167 EXPECT_EQ(static_cast<uint32_t>(cmds::GenTransformFeedbacksImmediate::kCmdId
),
1168 cmd
.header
.command
);
1169 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
1170 cmd
.header
.size
* 4u);
1171 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
1172 CheckBytesWrittenMatchesExpectedSize(
1174 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
1175 // TODO(gman): Check that ids were inserted;
1178 TEST_F(GLES2FormatTest
, GetActiveAttrib
) {
1179 cmds::GetActiveAttrib
& cmd
= *GetBufferAs
<cmds::GetActiveAttrib
>();
1181 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1182 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1183 static_cast<uint32_t>(15));
1184 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveAttrib::kCmdId
),
1185 cmd
.header
.command
);
1186 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1187 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1188 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1189 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1190 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1191 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1192 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1195 TEST_F(GLES2FormatTest
, GetActiveUniform
) {
1196 cmds::GetActiveUniform
& cmd
= *GetBufferAs
<cmds::GetActiveUniform
>();
1198 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1199 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1200 static_cast<uint32_t>(15));
1201 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniform::kCmdId
),
1202 cmd
.header
.command
);
1203 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1204 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1205 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1206 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1207 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1208 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1209 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1212 TEST_F(GLES2FormatTest
, GetActiveUniformBlockiv
) {
1213 cmds::GetActiveUniformBlockiv
& cmd
=
1214 *GetBufferAs
<cmds::GetActiveUniformBlockiv
>();
1216 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1217 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1218 static_cast<uint32_t>(15));
1219 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockiv::kCmdId
),
1220 cmd
.header
.command
);
1221 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1222 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1223 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1224 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1225 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1226 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1227 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1230 TEST_F(GLES2FormatTest
, GetActiveUniformBlockName
) {
1231 cmds::GetActiveUniformBlockName
& cmd
=
1232 *GetBufferAs
<cmds::GetActiveUniformBlockName
>();
1234 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1235 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1236 static_cast<uint32_t>(15));
1237 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockName::kCmdId
),
1238 cmd
.header
.command
);
1239 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1240 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1241 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1242 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1243 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1244 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1245 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1248 TEST_F(GLES2FormatTest
, GetActiveUniformsiv
) {
1249 cmds::GetActiveUniformsiv
& cmd
= *GetBufferAs
<cmds::GetActiveUniformsiv
>();
1251 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1252 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1253 static_cast<uint32_t>(15));
1254 EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformsiv::kCmdId
),
1255 cmd
.header
.command
);
1256 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1257 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1258 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.indices_bucket_id
);
1259 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1260 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1261 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1262 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1265 TEST_F(GLES2FormatTest
, GetAttachedShaders
) {
1266 cmds::GetAttachedShaders
& cmd
= *GetBufferAs
<cmds::GetAttachedShaders
>();
1268 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1269 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1270 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttachedShaders::kCmdId
),
1271 cmd
.header
.command
);
1272 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1273 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1274 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1275 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1276 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_size
);
1277 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1280 TEST_F(GLES2FormatTest
, GetAttribLocation
) {
1281 cmds::GetAttribLocation
& cmd
= *GetBufferAs
<cmds::GetAttribLocation
>();
1283 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1284 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1285 EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttribLocation::kCmdId
),
1286 cmd
.header
.command
);
1287 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1288 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1289 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1290 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1291 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1292 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1295 TEST_F(GLES2FormatTest
, GetBooleanv
) {
1296 cmds::GetBooleanv
& cmd
= *GetBufferAs
<cmds::GetBooleanv
>();
1298 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1299 static_cast<uint32_t>(13));
1300 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBooleanv::kCmdId
),
1301 cmd
.header
.command
);
1302 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1303 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1304 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1305 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1306 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1309 TEST_F(GLES2FormatTest
, GetBufferParameteri64v
) {
1310 cmds::GetBufferParameteri64v
& cmd
=
1311 *GetBufferAs
<cmds::GetBufferParameteri64v
>();
1313 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1314 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1315 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteri64v::kCmdId
),
1316 cmd
.header
.command
);
1317 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1318 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1319 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1320 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1321 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1322 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1325 TEST_F(GLES2FormatTest
, GetBufferParameteriv
) {
1326 cmds::GetBufferParameteriv
& cmd
= *GetBufferAs
<cmds::GetBufferParameteriv
>();
1328 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1329 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1330 EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteriv::kCmdId
),
1331 cmd
.header
.command
);
1332 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1333 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1334 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1335 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1336 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1337 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1340 TEST_F(GLES2FormatTest
, GetError
) {
1341 cmds::GetError
& cmd
= *GetBufferAs
<cmds::GetError
>();
1343 cmd
.Set(&cmd
, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
1344 EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId
), cmd
.header
.command
);
1345 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1346 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.result_shm_id
);
1347 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_offset
);
1348 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1351 TEST_F(GLES2FormatTest
, GetFloatv
) {
1352 cmds::GetFloatv
& cmd
= *GetBufferAs
<cmds::GetFloatv
>();
1354 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1355 static_cast<uint32_t>(13));
1356 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFloatv::kCmdId
), cmd
.header
.command
);
1357 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1358 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1359 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1360 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1361 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1364 TEST_F(GLES2FormatTest
, GetFragDataLocation
) {
1365 cmds::GetFragDataLocation
& cmd
= *GetBufferAs
<cmds::GetFragDataLocation
>();
1367 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1368 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1369 EXPECT_EQ(static_cast<uint32_t>(cmds::GetFragDataLocation::kCmdId
),
1370 cmd
.header
.command
);
1371 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1372 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1373 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1374 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1375 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1376 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1379 TEST_F(GLES2FormatTest
, GetFramebufferAttachmentParameteriv
) {
1380 cmds::GetFramebufferAttachmentParameteriv
& cmd
=
1381 *GetBufferAs
<cmds::GetFramebufferAttachmentParameteriv
>();
1383 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1384 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1385 static_cast<uint32_t>(15));
1387 static_cast<uint32_t>(cmds::GetFramebufferAttachmentParameteriv::kCmdId
),
1388 cmd
.header
.command
);
1389 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1390 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1391 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
1392 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1393 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1394 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1395 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1398 TEST_F(GLES2FormatTest
, GetInteger64v
) {
1399 cmds::GetInteger64v
& cmd
= *GetBufferAs
<cmds::GetInteger64v
>();
1401 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1402 static_cast<uint32_t>(13));
1403 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInteger64v::kCmdId
),
1404 cmd
.header
.command
);
1405 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1406 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1407 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1408 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1409 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1412 TEST_F(GLES2FormatTest
, GetIntegeri_v
) {
1413 cmds::GetIntegeri_v
& cmd
= *GetBufferAs
<cmds::GetIntegeri_v
>();
1415 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12),
1416 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1417 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegeri_v::kCmdId
),
1418 cmd
.header
.command
);
1419 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1420 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1421 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1422 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.data_shm_id
);
1423 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.data_shm_offset
);
1424 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1427 TEST_F(GLES2FormatTest
, GetInteger64i_v
) {
1428 cmds::GetInteger64i_v
& cmd
= *GetBufferAs
<cmds::GetInteger64i_v
>();
1430 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12),
1431 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1432 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInteger64i_v::kCmdId
),
1433 cmd
.header
.command
);
1434 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1435 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1436 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1437 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.data_shm_id
);
1438 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.data_shm_offset
);
1439 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1442 TEST_F(GLES2FormatTest
, GetIntegerv
) {
1443 cmds::GetIntegerv
& cmd
= *GetBufferAs
<cmds::GetIntegerv
>();
1445 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1446 static_cast<uint32_t>(13));
1447 EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegerv::kCmdId
),
1448 cmd
.header
.command
);
1449 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1450 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
1451 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.params_shm_id
);
1452 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_offset
);
1453 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1456 TEST_F(GLES2FormatTest
, GetInternalformativ
) {
1457 cmds::GetInternalformativ
& cmd
= *GetBufferAs
<cmds::GetInternalformativ
>();
1459 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1460 static_cast<GLenum
>(13), static_cast<uint32_t>(14),
1461 static_cast<uint32_t>(15));
1462 EXPECT_EQ(static_cast<uint32_t>(cmds::GetInternalformativ::kCmdId
),
1463 cmd
.header
.command
);
1464 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1465 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1466 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.format
);
1467 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.pname
);
1468 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_id
);
1469 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.params_shm_offset
);
1470 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1473 TEST_F(GLES2FormatTest
, GetProgramiv
) {
1474 cmds::GetProgramiv
& cmd
= *GetBufferAs
<cmds::GetProgramiv
>();
1476 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1477 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1478 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramiv::kCmdId
),
1479 cmd
.header
.command
);
1480 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1481 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
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
, GetProgramInfoLog
) {
1489 cmds::GetProgramInfoLog
& cmd
= *GetBufferAs
<cmds::GetProgramInfoLog
>();
1491 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1492 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoLog::kCmdId
),
1493 cmd
.header
.command
);
1494 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1495 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1496 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1497 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1500 TEST_F(GLES2FormatTest
, GetRenderbufferParameteriv
) {
1501 cmds::GetRenderbufferParameteriv
& cmd
=
1502 *GetBufferAs
<cmds::GetRenderbufferParameteriv
>();
1504 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1505 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1506 EXPECT_EQ(static_cast<uint32_t>(cmds::GetRenderbufferParameteriv::kCmdId
),
1507 cmd
.header
.command
);
1508 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1509 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1510 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1511 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1512 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1513 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1516 TEST_F(GLES2FormatTest
, GetSamplerParameterfv
) {
1517 cmds::GetSamplerParameterfv
& cmd
=
1518 *GetBufferAs
<cmds::GetSamplerParameterfv
>();
1520 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1521 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1522 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameterfv::kCmdId
),
1523 cmd
.header
.command
);
1524 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1525 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1526 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1527 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1528 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1529 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1532 TEST_F(GLES2FormatTest
, GetSamplerParameteriv
) {
1533 cmds::GetSamplerParameteriv
& cmd
=
1534 *GetBufferAs
<cmds::GetSamplerParameteriv
>();
1536 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1537 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1538 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameteriv::kCmdId
),
1539 cmd
.header
.command
);
1540 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1541 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1542 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1543 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1544 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1545 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1548 TEST_F(GLES2FormatTest
, GetShaderiv
) {
1549 cmds::GetShaderiv
& cmd
= *GetBufferAs
<cmds::GetShaderiv
>();
1551 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1552 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1553 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderiv::kCmdId
),
1554 cmd
.header
.command
);
1555 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1556 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1557 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1558 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1559 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1560 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1563 TEST_F(GLES2FormatTest
, GetShaderInfoLog
) {
1564 cmds::GetShaderInfoLog
& cmd
= *GetBufferAs
<cmds::GetShaderInfoLog
>();
1566 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1567 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderInfoLog::kCmdId
),
1568 cmd
.header
.command
);
1569 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1570 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1571 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1572 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1575 TEST_F(GLES2FormatTest
, GetShaderPrecisionFormat
) {
1576 cmds::GetShaderPrecisionFormat
& cmd
=
1577 *GetBufferAs
<cmds::GetShaderPrecisionFormat
>();
1579 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1580 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1581 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderPrecisionFormat::kCmdId
),
1582 cmd
.header
.command
);
1583 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1584 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.shadertype
);
1585 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.precisiontype
);
1586 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_id
);
1587 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_offset
);
1588 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1591 TEST_F(GLES2FormatTest
, GetShaderSource
) {
1592 cmds::GetShaderSource
& cmd
= *GetBufferAs
<cmds::GetShaderSource
>();
1594 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
1595 EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderSource::kCmdId
),
1596 cmd
.header
.command
);
1597 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1598 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1599 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1600 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1603 TEST_F(GLES2FormatTest
, GetString
) {
1604 cmds::GetString
& cmd
= *GetBufferAs
<cmds::GetString
>();
1606 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12));
1607 EXPECT_EQ(static_cast<uint32_t>(cmds::GetString::kCmdId
), cmd
.header
.command
);
1608 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1609 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.name
);
1610 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
1611 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1614 TEST_F(GLES2FormatTest
, GetSynciv
) {
1615 cmds::GetSynciv
& cmd
= *GetBufferAs
<cmds::GetSynciv
>();
1617 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1618 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1619 EXPECT_EQ(static_cast<uint32_t>(cmds::GetSynciv::kCmdId
), cmd
.header
.command
);
1620 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1621 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
1622 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1623 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.values_shm_id
);
1624 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.values_shm_offset
);
1625 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1628 TEST_F(GLES2FormatTest
, GetTexParameterfv
) {
1629 cmds::GetTexParameterfv
& cmd
= *GetBufferAs
<cmds::GetTexParameterfv
>();
1631 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1632 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1633 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameterfv::kCmdId
),
1634 cmd
.header
.command
);
1635 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1636 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1637 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1638 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1639 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1640 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1643 TEST_F(GLES2FormatTest
, GetTexParameteriv
) {
1644 cmds::GetTexParameteriv
& cmd
= *GetBufferAs
<cmds::GetTexParameteriv
>();
1646 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
1647 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1648 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameteriv::kCmdId
),
1649 cmd
.header
.command
);
1650 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1651 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1652 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1653 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1654 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1655 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1658 TEST_F(GLES2FormatTest
, GetTransformFeedbackVarying
) {
1659 cmds::GetTransformFeedbackVarying
& cmd
=
1660 *GetBufferAs
<cmds::GetTransformFeedbackVarying
>();
1662 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12),
1663 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
1664 static_cast<uint32_t>(15));
1665 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTransformFeedbackVarying::kCmdId
),
1666 cmd
.header
.command
);
1667 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1668 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1669 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
1670 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
1671 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.result_shm_id
);
1672 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_offset
);
1673 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1676 TEST_F(GLES2FormatTest
, GetUniformBlockIndex
) {
1677 cmds::GetUniformBlockIndex
& cmd
= *GetBufferAs
<cmds::GetUniformBlockIndex
>();
1679 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1680 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1681 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlockIndex::kCmdId
),
1682 cmd
.header
.command
);
1683 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1684 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1685 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1686 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.index_shm_id
);
1687 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.index_shm_offset
);
1688 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1691 TEST_F(GLES2FormatTest
, GetUniformfv
) {
1692 cmds::GetUniformfv
& cmd
= *GetBufferAs
<cmds::GetUniformfv
>();
1694 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
1695 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1696 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformfv::kCmdId
),
1697 cmd
.header
.command
);
1698 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1699 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1700 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1701 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1702 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1703 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1706 TEST_F(GLES2FormatTest
, GetUniformiv
) {
1707 cmds::GetUniformiv
& cmd
= *GetBufferAs
<cmds::GetUniformiv
>();
1709 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
1710 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1711 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformiv::kCmdId
),
1712 cmd
.header
.command
);
1713 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1714 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1715 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1716 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1717 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1718 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1721 TEST_F(GLES2FormatTest
, GetUniformuiv
) {
1722 cmds::GetUniformuiv
& cmd
= *GetBufferAs
<cmds::GetUniformuiv
>();
1724 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
1725 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1726 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformuiv::kCmdId
),
1727 cmd
.header
.command
);
1728 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1729 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1730 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
1731 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1732 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1733 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1736 TEST_F(GLES2FormatTest
, GetUniformIndices
) {
1737 cmds::GetUniformIndices
& cmd
= *GetBufferAs
<cmds::GetUniformIndices
>();
1739 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1740 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1741 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformIndices::kCmdId
),
1742 cmd
.header
.command
);
1743 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1744 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1745 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.names_bucket_id
);
1746 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.indices_shm_id
);
1747 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.indices_shm_offset
);
1748 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1751 TEST_F(GLES2FormatTest
, GetUniformLocation
) {
1752 cmds::GetUniformLocation
& cmd
= *GetBufferAs
<cmds::GetUniformLocation
>();
1754 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1755 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1756 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformLocation::kCmdId
),
1757 cmd
.header
.command
);
1758 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1759 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1760 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.name_bucket_id
);
1761 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.location_shm_id
);
1762 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.location_shm_offset
);
1763 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1766 TEST_F(GLES2FormatTest
, GetVertexAttribfv
) {
1767 cmds::GetVertexAttribfv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribfv
>();
1769 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1770 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1771 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribfv::kCmdId
),
1772 cmd
.header
.command
);
1773 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1774 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1775 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1776 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1777 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1778 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1781 TEST_F(GLES2FormatTest
, GetVertexAttribiv
) {
1782 cmds::GetVertexAttribiv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribiv
>();
1784 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1785 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1786 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribiv::kCmdId
),
1787 cmd
.header
.command
);
1788 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1789 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1790 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1791 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1792 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1793 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1796 TEST_F(GLES2FormatTest
, GetVertexAttribIiv
) {
1797 cmds::GetVertexAttribIiv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribIiv
>();
1799 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1800 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1801 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIiv::kCmdId
),
1802 cmd
.header
.command
);
1803 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1804 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1805 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1806 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1807 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1808 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1811 TEST_F(GLES2FormatTest
, GetVertexAttribIuiv
) {
1812 cmds::GetVertexAttribIuiv
& cmd
= *GetBufferAs
<cmds::GetVertexAttribIuiv
>();
1814 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1815 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1816 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIuiv::kCmdId
),
1817 cmd
.header
.command
);
1818 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1819 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1820 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1821 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.params_shm_id
);
1822 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.params_shm_offset
);
1823 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1826 TEST_F(GLES2FormatTest
, GetVertexAttribPointerv
) {
1827 cmds::GetVertexAttribPointerv
& cmd
=
1828 *GetBufferAs
<cmds::GetVertexAttribPointerv
>();
1830 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
1831 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
1832 EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribPointerv::kCmdId
),
1833 cmd
.header
.command
);
1834 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1835 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
1836 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
1837 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.pointer_shm_id
);
1838 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.pointer_shm_offset
);
1839 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1842 TEST_F(GLES2FormatTest
, Hint
) {
1843 cmds::Hint
& cmd
= *GetBufferAs
<cmds::Hint
>();
1845 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
1846 EXPECT_EQ(static_cast<uint32_t>(cmds::Hint::kCmdId
), cmd
.header
.command
);
1847 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1848 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
1849 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.mode
);
1850 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1853 TEST_F(GLES2FormatTest
, InvalidateFramebufferImmediate
) {
1854 const int kSomeBaseValueToTestWith
= 51;
1855 static GLenum data
[] = {
1856 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
1857 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
1859 cmds::InvalidateFramebufferImmediate
& cmd
=
1860 *GetBufferAs
<cmds::InvalidateFramebufferImmediate
>();
1861 const GLsizei kNumElements
= 2;
1862 const size_t kExpectedCmdSize
=
1863 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
1865 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
);
1866 EXPECT_EQ(static_cast<uint32_t>(cmds::InvalidateFramebufferImmediate::kCmdId
),
1867 cmd
.header
.command
);
1868 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1869 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
1870 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1871 CheckBytesWrittenMatchesExpectedSize(
1872 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1873 // TODO(gman): Check that data was inserted;
1876 TEST_F(GLES2FormatTest
, InvalidateSubFramebufferImmediate
) {
1877 const int kSomeBaseValueToTestWith
= 51;
1878 static GLenum data
[] = {
1879 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
1880 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
1882 cmds::InvalidateSubFramebufferImmediate
& cmd
=
1883 *GetBufferAs
<cmds::InvalidateSubFramebufferImmediate
>();
1884 const GLsizei kNumElements
= 2;
1885 const size_t kExpectedCmdSize
=
1886 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
1888 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
,
1889 static_cast<GLint
>(4), static_cast<GLint
>(5),
1890 static_cast<GLsizei
>(6), static_cast<GLsizei
>(7));
1892 static_cast<uint32_t>(cmds::InvalidateSubFramebufferImmediate::kCmdId
),
1893 cmd
.header
.command
);
1894 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
1895 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
1896 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
1897 EXPECT_EQ(static_cast<GLint
>(4), cmd
.x
);
1898 EXPECT_EQ(static_cast<GLint
>(5), cmd
.y
);
1899 EXPECT_EQ(static_cast<GLsizei
>(6), cmd
.width
);
1900 EXPECT_EQ(static_cast<GLsizei
>(7), cmd
.height
);
1901 CheckBytesWrittenMatchesExpectedSize(
1902 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
1903 // TODO(gman): Check that data was inserted;
1906 TEST_F(GLES2FormatTest
, IsBuffer
) {
1907 cmds::IsBuffer
& cmd
= *GetBufferAs
<cmds::IsBuffer
>();
1909 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1910 static_cast<uint32_t>(13));
1911 EXPECT_EQ(static_cast<uint32_t>(cmds::IsBuffer::kCmdId
), cmd
.header
.command
);
1912 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1913 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer
);
1914 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1915 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1916 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1919 TEST_F(GLES2FormatTest
, IsEnabled
) {
1920 cmds::IsEnabled
& cmd
= *GetBufferAs
<cmds::IsEnabled
>();
1922 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<uint32_t>(12),
1923 static_cast<uint32_t>(13));
1924 EXPECT_EQ(static_cast<uint32_t>(cmds::IsEnabled::kCmdId
), cmd
.header
.command
);
1925 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1926 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.cap
);
1927 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1928 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1929 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1932 TEST_F(GLES2FormatTest
, IsFramebuffer
) {
1933 cmds::IsFramebuffer
& cmd
= *GetBufferAs
<cmds::IsFramebuffer
>();
1935 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1936 static_cast<uint32_t>(13));
1937 EXPECT_EQ(static_cast<uint32_t>(cmds::IsFramebuffer::kCmdId
),
1938 cmd
.header
.command
);
1939 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1940 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.framebuffer
);
1941 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1942 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1943 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1946 TEST_F(GLES2FormatTest
, IsProgram
) {
1947 cmds::IsProgram
& cmd
= *GetBufferAs
<cmds::IsProgram
>();
1949 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1950 static_cast<uint32_t>(13));
1951 EXPECT_EQ(static_cast<uint32_t>(cmds::IsProgram::kCmdId
), cmd
.header
.command
);
1952 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1953 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
1954 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1955 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1956 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1959 TEST_F(GLES2FormatTest
, IsRenderbuffer
) {
1960 cmds::IsRenderbuffer
& cmd
= *GetBufferAs
<cmds::IsRenderbuffer
>();
1962 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1963 static_cast<uint32_t>(13));
1964 EXPECT_EQ(static_cast<uint32_t>(cmds::IsRenderbuffer::kCmdId
),
1965 cmd
.header
.command
);
1966 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1967 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.renderbuffer
);
1968 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1969 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1970 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1973 TEST_F(GLES2FormatTest
, IsSampler
) {
1974 cmds::IsSampler
& cmd
= *GetBufferAs
<cmds::IsSampler
>();
1976 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1977 static_cast<uint32_t>(13));
1978 EXPECT_EQ(static_cast<uint32_t>(cmds::IsSampler::kCmdId
), cmd
.header
.command
);
1979 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1980 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
1981 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1982 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1983 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1986 TEST_F(GLES2FormatTest
, IsShader
) {
1987 cmds::IsShader
& cmd
= *GetBufferAs
<cmds::IsShader
>();
1989 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
1990 static_cast<uint32_t>(13));
1991 EXPECT_EQ(static_cast<uint32_t>(cmds::IsShader::kCmdId
), cmd
.header
.command
);
1992 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
1993 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
1994 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
1995 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
1996 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
1999 TEST_F(GLES2FormatTest
, IsSync
) {
2000 cmds::IsSync
& cmd
= *GetBufferAs
<cmds::IsSync
>();
2002 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
2003 static_cast<uint32_t>(13));
2004 EXPECT_EQ(static_cast<uint32_t>(cmds::IsSync::kCmdId
), cmd
.header
.command
);
2005 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2006 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
2007 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
2008 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
2009 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2012 TEST_F(GLES2FormatTest
, IsTexture
) {
2013 cmds::IsTexture
& cmd
= *GetBufferAs
<cmds::IsTexture
>();
2015 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
2016 static_cast<uint32_t>(13));
2017 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTexture::kCmdId
), cmd
.header
.command
);
2018 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2019 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
2020 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
2021 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
2022 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2025 TEST_F(GLES2FormatTest
, IsTransformFeedback
) {
2026 cmds::IsTransformFeedback
& cmd
= *GetBufferAs
<cmds::IsTransformFeedback
>();
2028 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
2029 static_cast<uint32_t>(13));
2030 EXPECT_EQ(static_cast<uint32_t>(cmds::IsTransformFeedback::kCmdId
),
2031 cmd
.header
.command
);
2032 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2033 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.transformfeedback
);
2034 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
2035 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
2036 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2039 TEST_F(GLES2FormatTest
, LineWidth
) {
2040 cmds::LineWidth
& cmd
= *GetBufferAs
<cmds::LineWidth
>();
2041 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLfloat
>(11));
2042 EXPECT_EQ(static_cast<uint32_t>(cmds::LineWidth::kCmdId
), cmd
.header
.command
);
2043 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2044 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.width
);
2045 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2048 TEST_F(GLES2FormatTest
, LinkProgram
) {
2049 cmds::LinkProgram
& cmd
= *GetBufferAs
<cmds::LinkProgram
>();
2050 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2051 EXPECT_EQ(static_cast<uint32_t>(cmds::LinkProgram::kCmdId
),
2052 cmd
.header
.command
);
2053 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2054 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2055 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2058 TEST_F(GLES2FormatTest
, PauseTransformFeedback
) {
2059 cmds::PauseTransformFeedback
& cmd
=
2060 *GetBufferAs
<cmds::PauseTransformFeedback
>();
2061 void* next_cmd
= cmd
.Set(&cmd
);
2062 EXPECT_EQ(static_cast<uint32_t>(cmds::PauseTransformFeedback::kCmdId
),
2063 cmd
.header
.command
);
2064 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2065 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2068 TEST_F(GLES2FormatTest
, PixelStorei
) {
2069 cmds::PixelStorei
& cmd
= *GetBufferAs
<cmds::PixelStorei
>();
2071 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
2072 EXPECT_EQ(static_cast<uint32_t>(cmds::PixelStorei::kCmdId
),
2073 cmd
.header
.command
);
2074 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2075 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.pname
);
2076 EXPECT_EQ(static_cast<GLint
>(12), cmd
.param
);
2077 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2080 TEST_F(GLES2FormatTest
, PolygonOffset
) {
2081 cmds::PolygonOffset
& cmd
= *GetBufferAs
<cmds::PolygonOffset
>();
2083 cmd
.Set(&cmd
, static_cast<GLfloat
>(11), static_cast<GLfloat
>(12));
2084 EXPECT_EQ(static_cast<uint32_t>(cmds::PolygonOffset::kCmdId
),
2085 cmd
.header
.command
);
2086 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2087 EXPECT_EQ(static_cast<GLfloat
>(11), cmd
.factor
);
2088 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.units
);
2089 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2092 TEST_F(GLES2FormatTest
, ReadBuffer
) {
2093 cmds::ReadBuffer
& cmd
= *GetBufferAs
<cmds::ReadBuffer
>();
2094 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
2095 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadBuffer::kCmdId
),
2096 cmd
.header
.command
);
2097 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2098 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.src
);
2099 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2102 TEST_F(GLES2FormatTest
, ReadPixels
) {
2103 cmds::ReadPixels
& cmd
= *GetBufferAs
<cmds::ReadPixels
>();
2104 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2105 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14),
2106 static_cast<GLenum
>(15), static_cast<GLenum
>(16),
2107 static_cast<uint32_t>(17), static_cast<uint32_t>(18),
2108 static_cast<uint32_t>(19), static_cast<uint32_t>(20),
2109 static_cast<GLboolean
>(21));
2110 EXPECT_EQ(static_cast<uint32_t>(cmds::ReadPixels::kCmdId
),
2111 cmd
.header
.command
);
2112 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2113 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
2114 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
2115 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
2116 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
2117 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.format
);
2118 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.type
);
2119 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.pixels_shm_id
);
2120 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_offset
);
2121 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.result_shm_id
);
2122 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.result_shm_offset
);
2123 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.async
);
2124 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2127 TEST_F(GLES2FormatTest
, ReleaseShaderCompiler
) {
2128 cmds::ReleaseShaderCompiler
& cmd
=
2129 *GetBufferAs
<cmds::ReleaseShaderCompiler
>();
2130 void* next_cmd
= cmd
.Set(&cmd
);
2131 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseShaderCompiler::kCmdId
),
2132 cmd
.header
.command
);
2133 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2134 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2137 TEST_F(GLES2FormatTest
, RenderbufferStorage
) {
2138 cmds::RenderbufferStorage
& cmd
= *GetBufferAs
<cmds::RenderbufferStorage
>();
2140 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
2141 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
2142 EXPECT_EQ(static_cast<uint32_t>(cmds::RenderbufferStorage::kCmdId
),
2143 cmd
.header
.command
);
2144 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2145 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2146 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.internalformat
);
2147 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
2148 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
2149 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2152 TEST_F(GLES2FormatTest
, ResumeTransformFeedback
) {
2153 cmds::ResumeTransformFeedback
& cmd
=
2154 *GetBufferAs
<cmds::ResumeTransformFeedback
>();
2155 void* next_cmd
= cmd
.Set(&cmd
);
2156 EXPECT_EQ(static_cast<uint32_t>(cmds::ResumeTransformFeedback::kCmdId
),
2157 cmd
.header
.command
);
2158 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2159 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2162 TEST_F(GLES2FormatTest
, SampleCoverage
) {
2163 cmds::SampleCoverage
& cmd
= *GetBufferAs
<cmds::SampleCoverage
>();
2165 cmd
.Set(&cmd
, static_cast<GLclampf
>(11), static_cast<GLboolean
>(12));
2166 EXPECT_EQ(static_cast<uint32_t>(cmds::SampleCoverage::kCmdId
),
2167 cmd
.header
.command
);
2168 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2169 EXPECT_EQ(static_cast<GLclampf
>(11), cmd
.value
);
2170 EXPECT_EQ(static_cast<GLboolean
>(12), cmd
.invert
);
2171 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2174 TEST_F(GLES2FormatTest
, SamplerParameterf
) {
2175 cmds::SamplerParameterf
& cmd
= *GetBufferAs
<cmds::SamplerParameterf
>();
2176 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
2177 static_cast<GLenum
>(12), static_cast<GLfloat
>(13));
2178 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterf::kCmdId
),
2179 cmd
.header
.command
);
2180 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2181 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2182 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2183 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.param
);
2184 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2187 TEST_F(GLES2FormatTest
, SamplerParameterfvImmediate
) {
2188 const int kSomeBaseValueToTestWith
= 51;
2189 static GLfloat data
[] = {
2190 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2192 cmds::SamplerParameterfvImmediate
& cmd
=
2193 *GetBufferAs
<cmds::SamplerParameterfvImmediate
>();
2195 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
2196 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterfvImmediate::kCmdId
),
2197 cmd
.header
.command
);
2198 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2199 cmd
.header
.size
* 4u);
2200 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2201 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2202 CheckBytesWrittenMatchesExpectedSize(
2203 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2204 // TODO(gman): Check that data was inserted;
2207 TEST_F(GLES2FormatTest
, SamplerParameteri
) {
2208 cmds::SamplerParameteri
& cmd
= *GetBufferAs
<cmds::SamplerParameteri
>();
2209 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
2210 static_cast<GLenum
>(12), static_cast<GLint
>(13));
2211 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameteri::kCmdId
),
2212 cmd
.header
.command
);
2213 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2214 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2215 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2216 EXPECT_EQ(static_cast<GLint
>(13), cmd
.param
);
2217 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2220 TEST_F(GLES2FormatTest
, SamplerParameterivImmediate
) {
2221 const int kSomeBaseValueToTestWith
= 51;
2222 static GLint data
[] = {
2223 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2225 cmds::SamplerParameterivImmediate
& cmd
=
2226 *GetBufferAs
<cmds::SamplerParameterivImmediate
>();
2228 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
2229 EXPECT_EQ(static_cast<uint32_t>(cmds::SamplerParameterivImmediate::kCmdId
),
2230 cmd
.header
.command
);
2231 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2232 cmd
.header
.size
* 4u);
2233 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sampler
);
2234 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2235 CheckBytesWrittenMatchesExpectedSize(
2236 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2237 // TODO(gman): Check that data was inserted;
2240 TEST_F(GLES2FormatTest
, Scissor
) {
2241 cmds::Scissor
& cmd
= *GetBufferAs
<cmds::Scissor
>();
2242 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2243 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
2244 EXPECT_EQ(static_cast<uint32_t>(cmds::Scissor::kCmdId
), cmd
.header
.command
);
2245 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2246 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
2247 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
2248 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
2249 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
2250 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2253 TEST_F(GLES2FormatTest
, ShaderBinary
) {
2254 cmds::ShaderBinary
& cmd
= *GetBufferAs
<cmds::ShaderBinary
>();
2255 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(11),
2256 static_cast<uint32_t>(12), static_cast<uint32_t>(13),
2257 static_cast<GLenum
>(14), static_cast<uint32_t>(15),
2258 static_cast<uint32_t>(16), static_cast<GLsizei
>(17));
2259 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderBinary::kCmdId
),
2260 cmd
.header
.command
);
2261 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2262 EXPECT_EQ(static_cast<GLsizei
>(11), cmd
.n
);
2263 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.shaders_shm_id
);
2264 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.shaders_shm_offset
);
2265 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.binaryformat
);
2266 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.binary_shm_id
);
2267 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.binary_shm_offset
);
2268 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.length
);
2269 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2272 TEST_F(GLES2FormatTest
, ShaderSourceBucket
) {
2273 cmds::ShaderSourceBucket
& cmd
= *GetBufferAs
<cmds::ShaderSourceBucket
>();
2275 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
2276 EXPECT_EQ(static_cast<uint32_t>(cmds::ShaderSourceBucket::kCmdId
),
2277 cmd
.header
.command
);
2278 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2279 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
2280 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.str_bucket_id
);
2281 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2284 TEST_F(GLES2FormatTest
, StencilFunc
) {
2285 cmds::StencilFunc
& cmd
= *GetBufferAs
<cmds::StencilFunc
>();
2286 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2287 static_cast<GLint
>(12), static_cast<GLuint
>(13));
2288 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFunc::kCmdId
),
2289 cmd
.header
.command
);
2290 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2291 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
2292 EXPECT_EQ(static_cast<GLint
>(12), cmd
.ref
);
2293 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
2294 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2297 TEST_F(GLES2FormatTest
, StencilFuncSeparate
) {
2298 cmds::StencilFuncSeparate
& cmd
= *GetBufferAs
<cmds::StencilFuncSeparate
>();
2300 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
2301 static_cast<GLint
>(13), static_cast<GLuint
>(14));
2302 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFuncSeparate::kCmdId
),
2303 cmd
.header
.command
);
2304 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2305 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2306 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.func
);
2307 EXPECT_EQ(static_cast<GLint
>(13), cmd
.ref
);
2308 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.mask
);
2309 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2312 TEST_F(GLES2FormatTest
, StencilMask
) {
2313 cmds::StencilMask
& cmd
= *GetBufferAs
<cmds::StencilMask
>();
2314 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
2315 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMask::kCmdId
),
2316 cmd
.header
.command
);
2317 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2318 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.mask
);
2319 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2322 TEST_F(GLES2FormatTest
, StencilMaskSeparate
) {
2323 cmds::StencilMaskSeparate
& cmd
= *GetBufferAs
<cmds::StencilMaskSeparate
>();
2325 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
2326 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilMaskSeparate::kCmdId
),
2327 cmd
.header
.command
);
2328 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2329 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2330 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.mask
);
2331 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2334 TEST_F(GLES2FormatTest
, StencilOp
) {
2335 cmds::StencilOp
& cmd
= *GetBufferAs
<cmds::StencilOp
>();
2336 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2337 static_cast<GLenum
>(12), static_cast<GLenum
>(13));
2338 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOp::kCmdId
), cmd
.header
.command
);
2339 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2340 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.fail
);
2341 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.zfail
);
2342 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zpass
);
2343 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2346 TEST_F(GLES2FormatTest
, StencilOpSeparate
) {
2347 cmds::StencilOpSeparate
& cmd
= *GetBufferAs
<cmds::StencilOpSeparate
>();
2349 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
2350 static_cast<GLenum
>(13), static_cast<GLenum
>(14));
2351 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilOpSeparate::kCmdId
),
2352 cmd
.header
.command
);
2353 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2354 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.face
);
2355 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.fail
);
2356 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.zfail
);
2357 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.zpass
);
2358 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2361 TEST_F(GLES2FormatTest
, TexImage2D
) {
2362 cmds::TexImage2D
& cmd
= *GetBufferAs
<cmds::TexImage2D
>();
2364 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2365 static_cast<GLint
>(13), static_cast<GLsizei
>(14),
2366 static_cast<GLsizei
>(15), static_cast<GLenum
>(16),
2367 static_cast<GLenum
>(17), static_cast<uint32_t>(18),
2368 static_cast<uint32_t>(19));
2369 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage2D::kCmdId
),
2370 cmd
.header
.command
);
2371 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2372 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2373 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2374 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
2375 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2376 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2377 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.format
);
2378 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.type
);
2379 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.pixels_shm_id
);
2380 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_offset
);
2381 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2384 TEST_F(GLES2FormatTest
, TexImage3D
) {
2385 cmds::TexImage3D
& cmd
= *GetBufferAs
<cmds::TexImage3D
>();
2387 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2388 static_cast<GLint
>(13), static_cast<GLsizei
>(14),
2389 static_cast<GLsizei
>(15), static_cast<GLsizei
>(16),
2390 static_cast<GLenum
>(17), static_cast<GLenum
>(18),
2391 static_cast<uint32_t>(19), static_cast<uint32_t>(20));
2392 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImage3D::kCmdId
),
2393 cmd
.header
.command
);
2394 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2395 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2396 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2397 EXPECT_EQ(static_cast<GLint
>(13), cmd
.internalformat
);
2398 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2399 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2400 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.depth
);
2401 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
2402 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
2403 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_id
);
2404 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.pixels_shm_offset
);
2405 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2408 TEST_F(GLES2FormatTest
, TexParameterf
) {
2409 cmds::TexParameterf
& cmd
= *GetBufferAs
<cmds::TexParameterf
>();
2410 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2411 static_cast<GLenum
>(12), static_cast<GLfloat
>(13));
2412 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterf::kCmdId
),
2413 cmd
.header
.command
);
2414 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2415 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2416 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2417 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.param
);
2418 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2421 TEST_F(GLES2FormatTest
, TexParameterfvImmediate
) {
2422 const int kSomeBaseValueToTestWith
= 51;
2423 static GLfloat data
[] = {
2424 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2426 cmds::TexParameterfvImmediate
& cmd
=
2427 *GetBufferAs
<cmds::TexParameterfvImmediate
>();
2429 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12), data
);
2430 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterfvImmediate::kCmdId
),
2431 cmd
.header
.command
);
2432 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2433 cmd
.header
.size
* 4u);
2434 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2435 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2436 CheckBytesWrittenMatchesExpectedSize(
2437 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2438 // TODO(gman): Check that data was inserted;
2441 TEST_F(GLES2FormatTest
, TexParameteri
) {
2442 cmds::TexParameteri
& cmd
= *GetBufferAs
<cmds::TexParameteri
>();
2443 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
2444 static_cast<GLenum
>(12), static_cast<GLint
>(13));
2445 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameteri::kCmdId
),
2446 cmd
.header
.command
);
2447 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2448 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2449 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2450 EXPECT_EQ(static_cast<GLint
>(13), cmd
.param
);
2451 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2454 TEST_F(GLES2FormatTest
, TexParameterivImmediate
) {
2455 const int kSomeBaseValueToTestWith
= 51;
2456 static GLint data
[] = {
2457 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2459 cmds::TexParameterivImmediate
& cmd
=
2460 *GetBufferAs
<cmds::TexParameterivImmediate
>();
2462 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12), data
);
2463 EXPECT_EQ(static_cast<uint32_t>(cmds::TexParameterivImmediate::kCmdId
),
2464 cmd
.header
.command
);
2465 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
2466 cmd
.header
.size
* 4u);
2467 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2468 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
2469 CheckBytesWrittenMatchesExpectedSize(
2470 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2471 // TODO(gman): Check that data was inserted;
2474 TEST_F(GLES2FormatTest
, TexStorage3D
) {
2475 cmds::TexStorage3D
& cmd
= *GetBufferAs
<cmds::TexStorage3D
>();
2477 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLsizei
>(12),
2478 static_cast<GLenum
>(13), static_cast<GLsizei
>(14),
2479 static_cast<GLsizei
>(15), static_cast<GLsizei
>(16));
2480 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage3D::kCmdId
),
2481 cmd
.header
.command
);
2482 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2483 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2484 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.levels
);
2485 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalFormat
);
2486 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
2487 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
2488 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.depth
);
2489 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2492 TEST_F(GLES2FormatTest
, TexSubImage2D
) {
2493 cmds::TexSubImage2D
& cmd
= *GetBufferAs
<cmds::TexSubImage2D
>();
2494 void* next_cmd
= cmd
.Set(
2495 &cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2496 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLsizei
>(15),
2497 static_cast<GLsizei
>(16), static_cast<GLenum
>(17),
2498 static_cast<GLenum
>(18), static_cast<uint32_t>(19),
2499 static_cast<uint32_t>(20), static_cast<GLboolean
>(21));
2500 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage2D::kCmdId
),
2501 cmd
.header
.command
);
2502 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2503 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2504 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2505 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
2506 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
2507 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.width
);
2508 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.height
);
2509 EXPECT_EQ(static_cast<GLenum
>(17), cmd
.format
);
2510 EXPECT_EQ(static_cast<GLenum
>(18), cmd
.type
);
2511 EXPECT_EQ(static_cast<uint32_t>(19), cmd
.pixels_shm_id
);
2512 EXPECT_EQ(static_cast<uint32_t>(20), cmd
.pixels_shm_offset
);
2513 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.internal
);
2514 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2517 TEST_F(GLES2FormatTest
, TexSubImage3D
) {
2518 cmds::TexSubImage3D
& cmd
= *GetBufferAs
<cmds::TexSubImage3D
>();
2519 void* next_cmd
= cmd
.Set(
2520 &cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
2521 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLint
>(15),
2522 static_cast<GLsizei
>(16), static_cast<GLsizei
>(17),
2523 static_cast<GLsizei
>(18), static_cast<GLenum
>(19),
2524 static_cast<GLenum
>(20), static_cast<uint32_t>(21),
2525 static_cast<uint32_t>(22), static_cast<GLboolean
>(23));
2526 EXPECT_EQ(static_cast<uint32_t>(cmds::TexSubImage3D::kCmdId
),
2527 cmd
.header
.command
);
2528 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2529 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
2530 EXPECT_EQ(static_cast<GLint
>(12), cmd
.level
);
2531 EXPECT_EQ(static_cast<GLint
>(13), cmd
.xoffset
);
2532 EXPECT_EQ(static_cast<GLint
>(14), cmd
.yoffset
);
2533 EXPECT_EQ(static_cast<GLint
>(15), cmd
.zoffset
);
2534 EXPECT_EQ(static_cast<GLsizei
>(16), cmd
.width
);
2535 EXPECT_EQ(static_cast<GLsizei
>(17), cmd
.height
);
2536 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.depth
);
2537 EXPECT_EQ(static_cast<GLenum
>(19), cmd
.format
);
2538 EXPECT_EQ(static_cast<GLenum
>(20), cmd
.type
);
2539 EXPECT_EQ(static_cast<uint32_t>(21), cmd
.pixels_shm_id
);
2540 EXPECT_EQ(static_cast<uint32_t>(22), cmd
.pixels_shm_offset
);
2541 EXPECT_EQ(static_cast<GLboolean
>(23), cmd
.internal
);
2542 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2545 TEST_F(GLES2FormatTest
, TransformFeedbackVaryingsBucket
) {
2546 cmds::TransformFeedbackVaryingsBucket
& cmd
=
2547 *GetBufferAs
<cmds::TransformFeedbackVaryingsBucket
>();
2548 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
2549 static_cast<uint32_t>(12), static_cast<GLenum
>(13));
2551 static_cast<uint32_t>(cmds::TransformFeedbackVaryingsBucket::kCmdId
),
2552 cmd
.header
.command
);
2553 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2554 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
2555 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.varyings_bucket_id
);
2556 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.buffermode
);
2557 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2560 TEST_F(GLES2FormatTest
, Uniform1f
) {
2561 cmds::Uniform1f
& cmd
= *GetBufferAs
<cmds::Uniform1f
>();
2563 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLfloat
>(12));
2564 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1f::kCmdId
), cmd
.header
.command
);
2565 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2566 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2567 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2568 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2571 TEST_F(GLES2FormatTest
, Uniform1fvImmediate
) {
2572 const int kSomeBaseValueToTestWith
= 51;
2573 static GLfloat data
[] = {
2574 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2575 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2577 cmds::Uniform1fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1fvImmediate
>();
2578 const GLsizei kNumElements
= 2;
2579 const size_t kExpectedCmdSize
=
2580 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 1;
2582 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2583 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1fvImmediate::kCmdId
),
2584 cmd
.header
.command
);
2585 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2586 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2587 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2588 CheckBytesWrittenMatchesExpectedSize(
2589 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2590 // TODO(gman): Check that data was inserted;
2593 TEST_F(GLES2FormatTest
, Uniform1i
) {
2594 cmds::Uniform1i
& cmd
= *GetBufferAs
<cmds::Uniform1i
>();
2596 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12));
2597 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1i::kCmdId
), cmd
.header
.command
);
2598 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2599 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2600 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2601 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2604 TEST_F(GLES2FormatTest
, Uniform1ivImmediate
) {
2605 const int kSomeBaseValueToTestWith
= 51;
2606 static GLint data
[] = {
2607 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2608 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2610 cmds::Uniform1ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1ivImmediate
>();
2611 const GLsizei kNumElements
= 2;
2612 const size_t kExpectedCmdSize
=
2613 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 1;
2615 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2616 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ivImmediate::kCmdId
),
2617 cmd
.header
.command
);
2618 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2619 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2620 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2621 CheckBytesWrittenMatchesExpectedSize(
2622 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2623 // TODO(gman): Check that data was inserted;
2626 TEST_F(GLES2FormatTest
, Uniform1ui
) {
2627 cmds::Uniform1ui
& cmd
= *GetBufferAs
<cmds::Uniform1ui
>();
2629 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLuint
>(12));
2630 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1ui::kCmdId
),
2631 cmd
.header
.command
);
2632 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2633 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2634 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2635 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2638 TEST_F(GLES2FormatTest
, Uniform1uivImmediate
) {
2639 const int kSomeBaseValueToTestWith
= 51;
2640 static GLuint data
[] = {
2641 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2642 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2644 cmds::Uniform1uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform1uivImmediate
>();
2645 const GLsizei kNumElements
= 2;
2646 const size_t kExpectedCmdSize
=
2647 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 1;
2649 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2650 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform1uivImmediate::kCmdId
),
2651 cmd
.header
.command
);
2652 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2653 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2654 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2655 CheckBytesWrittenMatchesExpectedSize(
2656 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2657 // TODO(gman): Check that data was inserted;
2660 TEST_F(GLES2FormatTest
, Uniform2f
) {
2661 cmds::Uniform2f
& cmd
= *GetBufferAs
<cmds::Uniform2f
>();
2662 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2663 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13));
2664 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2f::kCmdId
), cmd
.header
.command
);
2665 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2666 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2667 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2668 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2669 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2672 TEST_F(GLES2FormatTest
, Uniform2fvImmediate
) {
2673 const int kSomeBaseValueToTestWith
= 51;
2674 static GLfloat data
[] = {
2675 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2676 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2677 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2678 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2680 cmds::Uniform2fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2fvImmediate
>();
2681 const GLsizei kNumElements
= 2;
2682 const size_t kExpectedCmdSize
=
2683 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 2;
2685 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2686 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2fvImmediate::kCmdId
),
2687 cmd
.header
.command
);
2688 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2689 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2690 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2691 CheckBytesWrittenMatchesExpectedSize(
2692 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2693 // TODO(gman): Check that data was inserted;
2696 TEST_F(GLES2FormatTest
, Uniform2i
) {
2697 cmds::Uniform2i
& cmd
= *GetBufferAs
<cmds::Uniform2i
>();
2698 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2699 static_cast<GLint
>(13));
2700 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2i::kCmdId
), cmd
.header
.command
);
2701 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2702 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2703 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2704 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2705 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2708 TEST_F(GLES2FormatTest
, Uniform2ivImmediate
) {
2709 const int kSomeBaseValueToTestWith
= 51;
2710 static GLint data
[] = {
2711 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2712 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2713 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2714 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2716 cmds::Uniform2ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2ivImmediate
>();
2717 const GLsizei kNumElements
= 2;
2718 const size_t kExpectedCmdSize
=
2719 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 2;
2721 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2722 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ivImmediate::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
, Uniform2ui
) {
2733 cmds::Uniform2ui
& cmd
= *GetBufferAs
<cmds::Uniform2ui
>();
2734 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2735 static_cast<GLuint
>(12), static_cast<GLuint
>(13));
2736 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2ui::kCmdId
),
2737 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<GLuint
>(12), cmd
.x
);
2741 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
2742 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2745 TEST_F(GLES2FormatTest
, Uniform2uivImmediate
) {
2746 const int kSomeBaseValueToTestWith
= 51;
2747 static GLuint data
[] = {
2748 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2749 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2750 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
2751 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
2753 cmds::Uniform2uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform2uivImmediate
>();
2754 const GLsizei kNumElements
= 2;
2755 const size_t kExpectedCmdSize
=
2756 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 2;
2758 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2759 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform2uivImmediate::kCmdId
),
2760 cmd
.header
.command
);
2761 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2762 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2763 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2764 CheckBytesWrittenMatchesExpectedSize(
2765 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2766 // TODO(gman): Check that data was inserted;
2769 TEST_F(GLES2FormatTest
, Uniform3f
) {
2770 cmds::Uniform3f
& cmd
= *GetBufferAs
<cmds::Uniform3f
>();
2772 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLfloat
>(12),
2773 static_cast<GLfloat
>(13), static_cast<GLfloat
>(14));
2774 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3f::kCmdId
), cmd
.header
.command
);
2775 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2776 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2777 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2778 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2779 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2780 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2783 TEST_F(GLES2FormatTest
, Uniform3fvImmediate
) {
2784 const int kSomeBaseValueToTestWith
= 51;
2785 static GLfloat data
[] = {
2786 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2787 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2788 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2789 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2790 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2791 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2793 cmds::Uniform3fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3fvImmediate
>();
2794 const GLsizei kNumElements
= 2;
2795 const size_t kExpectedCmdSize
=
2796 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 3;
2798 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2799 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3fvImmediate::kCmdId
),
2800 cmd
.header
.command
);
2801 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2802 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2803 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2804 CheckBytesWrittenMatchesExpectedSize(
2805 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2806 // TODO(gman): Check that data was inserted;
2809 TEST_F(GLES2FormatTest
, Uniform3i
) {
2810 cmds::Uniform3i
& cmd
= *GetBufferAs
<cmds::Uniform3i
>();
2811 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2812 static_cast<GLint
>(13), static_cast<GLint
>(14));
2813 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3i::kCmdId
), cmd
.header
.command
);
2814 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2815 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2816 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2817 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2818 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2819 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2822 TEST_F(GLES2FormatTest
, Uniform3ivImmediate
) {
2823 const int kSomeBaseValueToTestWith
= 51;
2824 static GLint data
[] = {
2825 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2826 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2827 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2828 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2829 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2830 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2832 cmds::Uniform3ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3ivImmediate
>();
2833 const GLsizei kNumElements
= 2;
2834 const size_t kExpectedCmdSize
=
2835 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 3;
2837 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2838 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ivImmediate::kCmdId
),
2839 cmd
.header
.command
);
2840 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2841 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2842 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2843 CheckBytesWrittenMatchesExpectedSize(
2844 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2845 // TODO(gman): Check that data was inserted;
2848 TEST_F(GLES2FormatTest
, Uniform3ui
) {
2849 cmds::Uniform3ui
& cmd
= *GetBufferAs
<cmds::Uniform3ui
>();
2851 cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLuint
>(12),
2852 static_cast<GLuint
>(13), static_cast<GLuint
>(14));
2853 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3ui::kCmdId
),
2854 cmd
.header
.command
);
2855 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2856 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2857 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2858 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
2859 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.z
);
2860 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2863 TEST_F(GLES2FormatTest
, Uniform3uivImmediate
) {
2864 const int kSomeBaseValueToTestWith
= 51;
2865 static GLuint data
[] = {
2866 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2867 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2868 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
2869 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
2870 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 4),
2871 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 5),
2873 cmds::Uniform3uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform3uivImmediate
>();
2874 const GLsizei kNumElements
= 2;
2875 const size_t kExpectedCmdSize
=
2876 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 3;
2878 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2879 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform3uivImmediate::kCmdId
),
2880 cmd
.header
.command
);
2881 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2882 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2883 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2884 CheckBytesWrittenMatchesExpectedSize(
2885 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2886 // TODO(gman): Check that data was inserted;
2889 TEST_F(GLES2FormatTest
, Uniform4f
) {
2890 cmds::Uniform4f
& cmd
= *GetBufferAs
<cmds::Uniform4f
>();
2891 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2892 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13),
2893 static_cast<GLfloat
>(14), static_cast<GLfloat
>(15));
2894 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4f::kCmdId
), cmd
.header
.command
);
2895 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2896 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2897 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
2898 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
2899 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
2900 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
2901 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2904 TEST_F(GLES2FormatTest
, Uniform4fvImmediate
) {
2905 const int kSomeBaseValueToTestWith
= 51;
2906 static GLfloat data
[] = {
2907 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
2908 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
2909 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
2910 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
2911 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
2912 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
2913 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
2914 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
2916 cmds::Uniform4fvImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4fvImmediate
>();
2917 const GLsizei kNumElements
= 2;
2918 const size_t kExpectedCmdSize
=
2919 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
2921 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2922 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4fvImmediate::kCmdId
),
2923 cmd
.header
.command
);
2924 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2925 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2926 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2927 CheckBytesWrittenMatchesExpectedSize(
2928 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2929 // TODO(gman): Check that data was inserted;
2932 TEST_F(GLES2FormatTest
, Uniform4i
) {
2933 cmds::Uniform4i
& cmd
= *GetBufferAs
<cmds::Uniform4i
>();
2934 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
2935 static_cast<GLint
>(13), static_cast<GLint
>(14),
2936 static_cast<GLint
>(15));
2937 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4i::kCmdId
), cmd
.header
.command
);
2938 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2939 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2940 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
2941 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
2942 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
2943 EXPECT_EQ(static_cast<GLint
>(15), cmd
.w
);
2944 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2947 TEST_F(GLES2FormatTest
, Uniform4ivImmediate
) {
2948 const int kSomeBaseValueToTestWith
= 51;
2949 static GLint data
[] = {
2950 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
2951 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
2952 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
2953 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
2954 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 4),
2955 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 5),
2956 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 6),
2957 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 7),
2959 cmds::Uniform4ivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4ivImmediate
>();
2960 const GLsizei kNumElements
= 2;
2961 const size_t kExpectedCmdSize
=
2962 sizeof(cmd
) + kNumElements
* sizeof(GLint
) * 4;
2964 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
2965 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ivImmediate::kCmdId
),
2966 cmd
.header
.command
);
2967 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
2968 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
2969 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
2970 CheckBytesWrittenMatchesExpectedSize(
2971 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
2972 // TODO(gman): Check that data was inserted;
2975 TEST_F(GLES2FormatTest
, Uniform4ui
) {
2976 cmds::Uniform4ui
& cmd
= *GetBufferAs
<cmds::Uniform4ui
>();
2977 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
2978 static_cast<GLuint
>(12), static_cast<GLuint
>(13),
2979 static_cast<GLuint
>(14), static_cast<GLuint
>(15));
2980 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4ui::kCmdId
),
2981 cmd
.header
.command
);
2982 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
2983 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
2984 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
2985 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
2986 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.z
);
2987 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.w
);
2988 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
2991 TEST_F(GLES2FormatTest
, Uniform4uivImmediate
) {
2992 const int kSomeBaseValueToTestWith
= 51;
2993 static GLuint data
[] = {
2994 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
2995 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
2996 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
2997 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
2998 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 4),
2999 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 5),
3000 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 6),
3001 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 7),
3003 cmds::Uniform4uivImmediate
& cmd
= *GetBufferAs
<cmds::Uniform4uivImmediate
>();
3004 const GLsizei kNumElements
= 2;
3005 const size_t kExpectedCmdSize
=
3006 sizeof(cmd
) + kNumElements
* sizeof(GLuint
) * 4;
3008 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3009 EXPECT_EQ(static_cast<uint32_t>(cmds::Uniform4uivImmediate::kCmdId
),
3010 cmd
.header
.command
);
3011 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3012 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3013 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3014 CheckBytesWrittenMatchesExpectedSize(
3015 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3016 // TODO(gman): Check that data was inserted;
3019 TEST_F(GLES2FormatTest
, UniformBlockBinding
) {
3020 cmds::UniformBlockBinding
& cmd
= *GetBufferAs
<cmds::UniformBlockBinding
>();
3021 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3022 static_cast<GLuint
>(12), static_cast<GLuint
>(13));
3023 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformBlockBinding::kCmdId
),
3024 cmd
.header
.command
);
3025 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3026 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3027 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.index
);
3028 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.binding
);
3029 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3032 TEST_F(GLES2FormatTest
, UniformMatrix2fvImmediate
) {
3033 const int kSomeBaseValueToTestWith
= 51;
3034 static GLfloat data
[] = {
3035 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3036 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3037 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3038 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3039 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3040 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3041 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3042 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3044 cmds::UniformMatrix2fvImmediate
& cmd
=
3045 *GetBufferAs
<cmds::UniformMatrix2fvImmediate
>();
3046 const GLsizei kNumElements
= 2;
3047 const size_t kExpectedCmdSize
=
3048 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 4;
3050 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3051 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2fvImmediate::kCmdId
),
3052 cmd
.header
.command
);
3053 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3054 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3055 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3056 CheckBytesWrittenMatchesExpectedSize(
3057 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3058 // TODO(gman): Check that data was inserted;
3061 TEST_F(GLES2FormatTest
, UniformMatrix2x3fvImmediate
) {
3062 const int kSomeBaseValueToTestWith
= 51;
3063 static GLfloat data
[] = {
3064 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3065 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3066 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3067 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3068 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3069 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3070 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3071 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3072 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3073 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3074 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3075 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3077 cmds::UniformMatrix2x3fvImmediate
& cmd
=
3078 *GetBufferAs
<cmds::UniformMatrix2x3fvImmediate
>();
3079 const GLsizei kNumElements
= 2;
3080 const size_t kExpectedCmdSize
=
3081 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 6;
3083 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3084 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x3fvImmediate::kCmdId
),
3085 cmd
.header
.command
);
3086 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3087 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3088 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3089 CheckBytesWrittenMatchesExpectedSize(
3090 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3091 // TODO(gman): Check that data was inserted;
3094 TEST_F(GLES2FormatTest
, UniformMatrix2x4fvImmediate
) {
3095 const int kSomeBaseValueToTestWith
= 51;
3096 static GLfloat data
[] = {
3097 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3098 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3099 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3100 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3101 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3102 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3103 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3104 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3105 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3106 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3107 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3108 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3109 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3110 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3111 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3112 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3114 cmds::UniformMatrix2x4fvImmediate
& cmd
=
3115 *GetBufferAs
<cmds::UniformMatrix2x4fvImmediate
>();
3116 const GLsizei kNumElements
= 2;
3117 const size_t kExpectedCmdSize
=
3118 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 8;
3120 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3121 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x4fvImmediate::kCmdId
),
3122 cmd
.header
.command
);
3123 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3124 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3125 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3126 CheckBytesWrittenMatchesExpectedSize(
3127 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3128 // TODO(gman): Check that data was inserted;
3131 TEST_F(GLES2FormatTest
, UniformMatrix3fvImmediate
) {
3132 const int kSomeBaseValueToTestWith
= 51;
3133 static GLfloat data
[] = {
3134 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3135 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3136 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3137 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3138 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3139 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3140 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3141 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3142 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3143 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3144 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3145 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3146 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3147 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3148 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3149 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3150 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3151 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3153 cmds::UniformMatrix3fvImmediate
& cmd
=
3154 *GetBufferAs
<cmds::UniformMatrix3fvImmediate
>();
3155 const GLsizei kNumElements
= 2;
3156 const size_t kExpectedCmdSize
=
3157 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 9;
3159 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3160 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3fvImmediate::kCmdId
),
3161 cmd
.header
.command
);
3162 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3163 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3164 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3165 CheckBytesWrittenMatchesExpectedSize(
3166 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3167 // TODO(gman): Check that data was inserted;
3170 TEST_F(GLES2FormatTest
, UniformMatrix3x2fvImmediate
) {
3171 const int kSomeBaseValueToTestWith
= 51;
3172 static GLfloat data
[] = {
3173 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3174 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3175 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3176 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3177 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3178 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3179 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3180 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3181 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3182 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3183 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3184 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3186 cmds::UniformMatrix3x2fvImmediate
& cmd
=
3187 *GetBufferAs
<cmds::UniformMatrix3x2fvImmediate
>();
3188 const GLsizei kNumElements
= 2;
3189 const size_t kExpectedCmdSize
=
3190 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 6;
3192 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3193 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x2fvImmediate::kCmdId
),
3194 cmd
.header
.command
);
3195 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3196 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3197 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3198 CheckBytesWrittenMatchesExpectedSize(
3199 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3200 // TODO(gman): Check that data was inserted;
3203 TEST_F(GLES2FormatTest
, UniformMatrix3x4fvImmediate
) {
3204 const int kSomeBaseValueToTestWith
= 51;
3205 static GLfloat data
[] = {
3206 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3207 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3208 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3209 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3210 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3211 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3212 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3213 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3214 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3215 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3216 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3217 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3218 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3219 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3220 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3221 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3222 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3223 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3224 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
3225 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
3226 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
3227 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
3228 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
3229 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
3231 cmds::UniformMatrix3x4fvImmediate
& cmd
=
3232 *GetBufferAs
<cmds::UniformMatrix3x4fvImmediate
>();
3233 const GLsizei kNumElements
= 2;
3234 const size_t kExpectedCmdSize
=
3235 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 12;
3237 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3238 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x4fvImmediate::kCmdId
),
3239 cmd
.header
.command
);
3240 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3241 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3242 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3243 CheckBytesWrittenMatchesExpectedSize(
3244 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3245 // TODO(gman): Check that data was inserted;
3248 TEST_F(GLES2FormatTest
, UniformMatrix4fvImmediate
) {
3249 const int kSomeBaseValueToTestWith
= 51;
3250 static GLfloat data
[] = {
3251 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3252 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3253 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3254 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3255 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3256 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3257 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3258 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3259 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3260 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3261 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3262 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3263 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3264 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3265 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3266 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3267 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3268 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3269 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
3270 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
3271 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
3272 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
3273 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
3274 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
3275 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 24),
3276 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 25),
3277 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 26),
3278 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 27),
3279 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 28),
3280 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 29),
3281 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 30),
3282 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 31),
3284 cmds::UniformMatrix4fvImmediate
& cmd
=
3285 *GetBufferAs
<cmds::UniformMatrix4fvImmediate
>();
3286 const GLsizei kNumElements
= 2;
3287 const size_t kExpectedCmdSize
=
3288 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 16;
3290 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3291 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4fvImmediate::kCmdId
),
3292 cmd
.header
.command
);
3293 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3294 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3295 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3296 CheckBytesWrittenMatchesExpectedSize(
3297 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3298 // TODO(gman): Check that data was inserted;
3301 TEST_F(GLES2FormatTest
, UniformMatrix4x2fvImmediate
) {
3302 const int kSomeBaseValueToTestWith
= 51;
3303 static GLfloat data
[] = {
3304 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3305 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3306 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3307 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3308 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3309 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3310 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3311 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3312 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3313 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3314 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3315 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3316 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3317 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3318 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3319 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3321 cmds::UniformMatrix4x2fvImmediate
& cmd
=
3322 *GetBufferAs
<cmds::UniformMatrix4x2fvImmediate
>();
3323 const GLsizei kNumElements
= 2;
3324 const size_t kExpectedCmdSize
=
3325 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 8;
3327 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3328 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x2fvImmediate::kCmdId
),
3329 cmd
.header
.command
);
3330 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3331 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3332 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3333 CheckBytesWrittenMatchesExpectedSize(
3334 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3335 // TODO(gman): Check that data was inserted;
3338 TEST_F(GLES2FormatTest
, UniformMatrix4x3fvImmediate
) {
3339 const int kSomeBaseValueToTestWith
= 51;
3340 static GLfloat data
[] = {
3341 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3342 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3343 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3344 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3345 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
3346 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
3347 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
3348 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
3349 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
3350 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
3351 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
3352 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
3353 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
3354 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
3355 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
3356 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
3357 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 16),
3358 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 17),
3359 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 18),
3360 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 19),
3361 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 20),
3362 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 21),
3363 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 22),
3364 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 23),
3366 cmds::UniformMatrix4x3fvImmediate
& cmd
=
3367 *GetBufferAs
<cmds::UniformMatrix4x3fvImmediate
>();
3368 const GLsizei kNumElements
= 2;
3369 const size_t kExpectedCmdSize
=
3370 sizeof(cmd
) + kNumElements
* sizeof(GLfloat
) * 12;
3372 cmd
.Set(&cmd
, static_cast<GLint
>(1), static_cast<GLsizei
>(2), data
);
3373 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x3fvImmediate::kCmdId
),
3374 cmd
.header
.command
);
3375 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
3376 EXPECT_EQ(static_cast<GLint
>(1), cmd
.location
);
3377 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
3378 CheckBytesWrittenMatchesExpectedSize(
3379 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3380 // TODO(gman): Check that data was inserted;
3383 TEST_F(GLES2FormatTest
, UseProgram
) {
3384 cmds::UseProgram
& cmd
= *GetBufferAs
<cmds::UseProgram
>();
3385 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3386 EXPECT_EQ(static_cast<uint32_t>(cmds::UseProgram::kCmdId
),
3387 cmd
.header
.command
);
3388 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3389 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3390 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3393 TEST_F(GLES2FormatTest
, ValidateProgram
) {
3394 cmds::ValidateProgram
& cmd
= *GetBufferAs
<cmds::ValidateProgram
>();
3395 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3396 EXPECT_EQ(static_cast<uint32_t>(cmds::ValidateProgram::kCmdId
),
3397 cmd
.header
.command
);
3398 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3399 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
3400 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3403 TEST_F(GLES2FormatTest
, VertexAttrib1f
) {
3404 cmds::VertexAttrib1f
& cmd
= *GetBufferAs
<cmds::VertexAttrib1f
>();
3406 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLfloat
>(12));
3407 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1f::kCmdId
),
3408 cmd
.header
.command
);
3409 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3410 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3411 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3412 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3415 TEST_F(GLES2FormatTest
, VertexAttrib1fvImmediate
) {
3416 const int kSomeBaseValueToTestWith
= 51;
3417 static GLfloat data
[] = {
3418 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3420 cmds::VertexAttrib1fvImmediate
& cmd
=
3421 *GetBufferAs
<cmds::VertexAttrib1fvImmediate
>();
3422 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3423 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib1fvImmediate::kCmdId
),
3424 cmd
.header
.command
);
3425 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3426 cmd
.header
.size
* 4u);
3427 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3428 CheckBytesWrittenMatchesExpectedSize(
3429 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3430 // TODO(gman): Check that data was inserted;
3433 TEST_F(GLES2FormatTest
, VertexAttrib2f
) {
3434 cmds::VertexAttrib2f
& cmd
= *GetBufferAs
<cmds::VertexAttrib2f
>();
3435 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3436 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13));
3437 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2f::kCmdId
),
3438 cmd
.header
.command
);
3439 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3440 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3441 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3442 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3443 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3446 TEST_F(GLES2FormatTest
, VertexAttrib2fvImmediate
) {
3447 const int kSomeBaseValueToTestWith
= 51;
3448 static GLfloat data
[] = {
3449 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3450 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3452 cmds::VertexAttrib2fvImmediate
& cmd
=
3453 *GetBufferAs
<cmds::VertexAttrib2fvImmediate
>();
3454 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3455 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib2fvImmediate::kCmdId
),
3456 cmd
.header
.command
);
3457 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3458 cmd
.header
.size
* 4u);
3459 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3460 CheckBytesWrittenMatchesExpectedSize(
3461 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3462 // TODO(gman): Check that data was inserted;
3465 TEST_F(GLES2FormatTest
, VertexAttrib3f
) {
3466 cmds::VertexAttrib3f
& cmd
= *GetBufferAs
<cmds::VertexAttrib3f
>();
3468 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLfloat
>(12),
3469 static_cast<GLfloat
>(13), static_cast<GLfloat
>(14));
3470 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3f::kCmdId
),
3471 cmd
.header
.command
);
3472 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3473 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3474 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3475 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3476 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
3477 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3480 TEST_F(GLES2FormatTest
, VertexAttrib3fvImmediate
) {
3481 const int kSomeBaseValueToTestWith
= 51;
3482 static GLfloat data
[] = {
3483 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3484 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3485 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3487 cmds::VertexAttrib3fvImmediate
& cmd
=
3488 *GetBufferAs
<cmds::VertexAttrib3fvImmediate
>();
3489 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3490 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib3fvImmediate::kCmdId
),
3491 cmd
.header
.command
);
3492 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3493 cmd
.header
.size
* 4u);
3494 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3495 CheckBytesWrittenMatchesExpectedSize(
3496 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3497 // TODO(gman): Check that data was inserted;
3500 TEST_F(GLES2FormatTest
, VertexAttrib4f
) {
3501 cmds::VertexAttrib4f
& cmd
= *GetBufferAs
<cmds::VertexAttrib4f
>();
3502 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3503 static_cast<GLfloat
>(12), static_cast<GLfloat
>(13),
3504 static_cast<GLfloat
>(14), static_cast<GLfloat
>(15));
3505 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4f::kCmdId
),
3506 cmd
.header
.command
);
3507 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3508 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3509 EXPECT_EQ(static_cast<GLfloat
>(12), cmd
.x
);
3510 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.y
);
3511 EXPECT_EQ(static_cast<GLfloat
>(14), cmd
.z
);
3512 EXPECT_EQ(static_cast<GLfloat
>(15), cmd
.w
);
3513 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3516 TEST_F(GLES2FormatTest
, VertexAttrib4fvImmediate
) {
3517 const int kSomeBaseValueToTestWith
= 51;
3518 static GLfloat data
[] = {
3519 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
3520 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
3521 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
3522 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
3524 cmds::VertexAttrib4fvImmediate
& cmd
=
3525 *GetBufferAs
<cmds::VertexAttrib4fvImmediate
>();
3526 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3527 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttrib4fvImmediate::kCmdId
),
3528 cmd
.header
.command
);
3529 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3530 cmd
.header
.size
* 4u);
3531 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3532 CheckBytesWrittenMatchesExpectedSize(
3533 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3534 // TODO(gman): Check that data was inserted;
3537 TEST_F(GLES2FormatTest
, VertexAttribI4i
) {
3538 cmds::VertexAttribI4i
& cmd
= *GetBufferAs
<cmds::VertexAttribI4i
>();
3539 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3540 static_cast<GLint
>(12), static_cast<GLint
>(13),
3541 static_cast<GLint
>(14), static_cast<GLint
>(15));
3542 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4i::kCmdId
),
3543 cmd
.header
.command
);
3544 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3545 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3546 EXPECT_EQ(static_cast<GLint
>(12), cmd
.x
);
3547 EXPECT_EQ(static_cast<GLint
>(13), cmd
.y
);
3548 EXPECT_EQ(static_cast<GLint
>(14), cmd
.z
);
3549 EXPECT_EQ(static_cast<GLint
>(15), cmd
.w
);
3550 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3553 TEST_F(GLES2FormatTest
, VertexAttribI4ivImmediate
) {
3554 const int kSomeBaseValueToTestWith
= 51;
3555 static GLint data
[] = {
3556 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 0),
3557 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 1),
3558 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 2),
3559 static_cast<GLint
>(kSomeBaseValueToTestWith
+ 3),
3561 cmds::VertexAttribI4ivImmediate
& cmd
=
3562 *GetBufferAs
<cmds::VertexAttribI4ivImmediate
>();
3563 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3564 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4ivImmediate::kCmdId
),
3565 cmd
.header
.command
);
3566 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3567 cmd
.header
.size
* 4u);
3568 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3569 CheckBytesWrittenMatchesExpectedSize(
3570 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3571 // TODO(gman): Check that data was inserted;
3574 TEST_F(GLES2FormatTest
, VertexAttribI4ui
) {
3575 cmds::VertexAttribI4ui
& cmd
= *GetBufferAs
<cmds::VertexAttribI4ui
>();
3576 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3577 static_cast<GLuint
>(12), static_cast<GLuint
>(13),
3578 static_cast<GLuint
>(14), static_cast<GLuint
>(15));
3579 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4ui::kCmdId
),
3580 cmd
.header
.command
);
3581 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3582 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3583 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.x
);
3584 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.y
);
3585 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.z
);
3586 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.w
);
3587 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3590 TEST_F(GLES2FormatTest
, VertexAttribI4uivImmediate
) {
3591 const int kSomeBaseValueToTestWith
= 51;
3592 static GLuint data
[] = {
3593 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 0),
3594 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 1),
3595 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 2),
3596 static_cast<GLuint
>(kSomeBaseValueToTestWith
+ 3),
3598 cmds::VertexAttribI4uivImmediate
& cmd
=
3599 *GetBufferAs
<cmds::VertexAttribI4uivImmediate
>();
3600 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11), data
);
3601 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribI4uivImmediate::kCmdId
),
3602 cmd
.header
.command
);
3603 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
3604 cmd
.header
.size
* 4u);
3605 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3606 CheckBytesWrittenMatchesExpectedSize(
3607 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
3608 // TODO(gman): Check that data was inserted;
3611 TEST_F(GLES2FormatTest
, VertexAttribIPointer
) {
3612 cmds::VertexAttribIPointer
& cmd
= *GetBufferAs
<cmds::VertexAttribIPointer
>();
3613 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3614 static_cast<GLint
>(12), static_cast<GLenum
>(13),
3615 static_cast<GLsizei
>(14), static_cast<GLuint
>(15));
3616 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribIPointer::kCmdId
),
3617 cmd
.header
.command
);
3618 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3619 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3620 EXPECT_EQ(static_cast<GLint
>(12), cmd
.size
);
3621 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3622 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.stride
);
3623 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.offset
);
3624 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3627 TEST_F(GLES2FormatTest
, VertexAttribPointer
) {
3628 cmds::VertexAttribPointer
& cmd
= *GetBufferAs
<cmds::VertexAttribPointer
>();
3630 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
3631 static_cast<GLenum
>(13), static_cast<GLboolean
>(14),
3632 static_cast<GLsizei
>(15), static_cast<GLuint
>(16));
3633 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribPointer::kCmdId
),
3634 cmd
.header
.command
);
3635 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3636 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.indx
);
3637 EXPECT_EQ(static_cast<GLint
>(12), cmd
.size
);
3638 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3639 EXPECT_EQ(static_cast<GLboolean
>(14), cmd
.normalized
);
3640 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.stride
);
3641 EXPECT_EQ(static_cast<GLuint
>(16), cmd
.offset
);
3642 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3645 TEST_F(GLES2FormatTest
, Viewport
) {
3646 cmds::Viewport
& cmd
= *GetBufferAs
<cmds::Viewport
>();
3647 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
3648 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
3649 EXPECT_EQ(static_cast<uint32_t>(cmds::Viewport::kCmdId
), cmd
.header
.command
);
3650 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3651 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
3652 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
3653 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.width
);
3654 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.height
);
3655 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3658 TEST_F(GLES2FormatTest
, WaitSync
) {
3659 cmds::WaitSync
& cmd
= *GetBufferAs
<cmds::WaitSync
>();
3661 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLbitfield
>(12),
3662 static_cast<GLuint
>(13), static_cast<GLuint
>(14));
3663 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSync::kCmdId
), cmd
.header
.command
);
3664 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3665 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync
);
3666 EXPECT_EQ(static_cast<GLbitfield
>(12), cmd
.flags
);
3667 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.timeout_0
);
3668 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.timeout_1
);
3669 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3672 TEST_F(GLES2FormatTest
, BlitFramebufferCHROMIUM
) {
3673 cmds::BlitFramebufferCHROMIUM
& cmd
=
3674 *GetBufferAs
<cmds::BlitFramebufferCHROMIUM
>();
3675 void* next_cmd
= cmd
.Set(
3676 &cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
3677 static_cast<GLint
>(13), static_cast<GLint
>(14), static_cast<GLint
>(15),
3678 static_cast<GLint
>(16), static_cast<GLint
>(17), static_cast<GLint
>(18),
3679 static_cast<GLbitfield
>(19), static_cast<GLenum
>(20));
3680 EXPECT_EQ(static_cast<uint32_t>(cmds::BlitFramebufferCHROMIUM::kCmdId
),
3681 cmd
.header
.command
);
3682 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3683 EXPECT_EQ(static_cast<GLint
>(11), cmd
.srcX0
);
3684 EXPECT_EQ(static_cast<GLint
>(12), cmd
.srcY0
);
3685 EXPECT_EQ(static_cast<GLint
>(13), cmd
.srcX1
);
3686 EXPECT_EQ(static_cast<GLint
>(14), cmd
.srcY1
);
3687 EXPECT_EQ(static_cast<GLint
>(15), cmd
.dstX0
);
3688 EXPECT_EQ(static_cast<GLint
>(16), cmd
.dstY0
);
3689 EXPECT_EQ(static_cast<GLint
>(17), cmd
.dstX1
);
3690 EXPECT_EQ(static_cast<GLint
>(18), cmd
.dstY1
);
3691 EXPECT_EQ(static_cast<GLbitfield
>(19), cmd
.mask
);
3692 EXPECT_EQ(static_cast<GLenum
>(20), cmd
.filter
);
3693 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3696 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleCHROMIUM
) {
3697 cmds::RenderbufferStorageMultisampleCHROMIUM
& cmd
=
3698 *GetBufferAs
<cmds::RenderbufferStorageMultisampleCHROMIUM
>();
3699 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3700 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
3701 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15));
3702 EXPECT_EQ(static_cast<uint32_t>(
3703 cmds::RenderbufferStorageMultisampleCHROMIUM::kCmdId
),
3704 cmd
.header
.command
);
3705 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3706 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3707 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
3708 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
3709 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3710 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3711 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3714 TEST_F(GLES2FormatTest
, RenderbufferStorageMultisampleEXT
) {
3715 cmds::RenderbufferStorageMultisampleEXT
& cmd
=
3716 *GetBufferAs
<cmds::RenderbufferStorageMultisampleEXT
>();
3717 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3718 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
3719 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15));
3721 static_cast<uint32_t>(cmds::RenderbufferStorageMultisampleEXT::kCmdId
),
3722 cmd
.header
.command
);
3723 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3724 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3725 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.samples
);
3726 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalformat
);
3727 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3728 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3729 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3732 TEST_F(GLES2FormatTest
, FramebufferTexture2DMultisampleEXT
) {
3733 cmds::FramebufferTexture2DMultisampleEXT
& cmd
=
3734 *GetBufferAs
<cmds::FramebufferTexture2DMultisampleEXT
>();
3735 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3736 static_cast<GLenum
>(12), static_cast<GLenum
>(13),
3737 static_cast<GLuint
>(14), static_cast<GLsizei
>(15));
3739 static_cast<uint32_t>(cmds::FramebufferTexture2DMultisampleEXT::kCmdId
),
3740 cmd
.header
.command
);
3741 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3742 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3743 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.attachment
);
3744 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.textarget
);
3745 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.texture
);
3746 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.samples
);
3747 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3750 TEST_F(GLES2FormatTest
, TexStorage2DEXT
) {
3751 cmds::TexStorage2DEXT
& cmd
= *GetBufferAs
<cmds::TexStorage2DEXT
>();
3752 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
3753 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
3754 static_cast<GLsizei
>(14), static_cast<GLsizei
>(15));
3755 EXPECT_EQ(static_cast<uint32_t>(cmds::TexStorage2DEXT::kCmdId
),
3756 cmd
.header
.command
);
3757 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3758 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3759 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.levels
);
3760 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.internalFormat
);
3761 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.width
);
3762 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.height
);
3763 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3766 TEST_F(GLES2FormatTest
, GenQueriesEXTImmediate
) {
3767 static GLuint ids
[] = {
3770 cmds::GenQueriesEXTImmediate
& cmd
=
3771 *GetBufferAs
<cmds::GenQueriesEXTImmediate
>();
3772 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3773 EXPECT_EQ(static_cast<uint32_t>(cmds::GenQueriesEXTImmediate::kCmdId
),
3774 cmd
.header
.command
);
3775 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3776 cmd
.header
.size
* 4u);
3777 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3778 CheckBytesWrittenMatchesExpectedSize(
3780 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3781 // TODO(gman): Check that ids were inserted;
3784 TEST_F(GLES2FormatTest
, DeleteQueriesEXTImmediate
) {
3785 static GLuint ids
[] = {
3788 cmds::DeleteQueriesEXTImmediate
& cmd
=
3789 *GetBufferAs
<cmds::DeleteQueriesEXTImmediate
>();
3790 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3791 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteQueriesEXTImmediate::kCmdId
),
3792 cmd
.header
.command
);
3793 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3794 cmd
.header
.size
* 4u);
3795 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3796 CheckBytesWrittenMatchesExpectedSize(
3798 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3799 // TODO(gman): Check that ids were inserted;
3802 TEST_F(GLES2FormatTest
, QueryCounterEXT
) {
3803 cmds::QueryCounterEXT
& cmd
= *GetBufferAs
<cmds::QueryCounterEXT
>();
3804 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
3805 static_cast<GLenum
>(12), static_cast<uint32_t>(13),
3806 static_cast<uint32_t>(14), static_cast<GLuint
>(15));
3807 EXPECT_EQ(static_cast<uint32_t>(cmds::QueryCounterEXT::kCmdId
),
3808 cmd
.header
.command
);
3809 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3810 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.id
);
3811 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.target
);
3812 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.sync_data_shm_id
);
3813 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.sync_data_shm_offset
);
3814 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.submit_count
);
3815 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3818 TEST_F(GLES2FormatTest
, BeginQueryEXT
) {
3819 cmds::BeginQueryEXT
& cmd
= *GetBufferAs
<cmds::BeginQueryEXT
>();
3821 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12),
3822 static_cast<uint32_t>(13), static_cast<uint32_t>(14));
3823 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginQueryEXT::kCmdId
),
3824 cmd
.header
.command
);
3825 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3826 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3827 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.id
);
3828 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.sync_data_shm_id
);
3829 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.sync_data_shm_offset
);
3830 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3833 TEST_F(GLES2FormatTest
, BeginTransformFeedback
) {
3834 cmds::BeginTransformFeedback
& cmd
=
3835 *GetBufferAs
<cmds::BeginTransformFeedback
>();
3836 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
3837 EXPECT_EQ(static_cast<uint32_t>(cmds::BeginTransformFeedback::kCmdId
),
3838 cmd
.header
.command
);
3839 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3840 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.primitivemode
);
3841 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3844 TEST_F(GLES2FormatTest
, EndQueryEXT
) {
3845 cmds::EndQueryEXT
& cmd
= *GetBufferAs
<cmds::EndQueryEXT
>();
3847 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
3848 EXPECT_EQ(static_cast<uint32_t>(cmds::EndQueryEXT::kCmdId
),
3849 cmd
.header
.command
);
3850 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3851 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
3852 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.submit_count
);
3853 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3856 TEST_F(GLES2FormatTest
, EndTransformFeedback
) {
3857 cmds::EndTransformFeedback
& cmd
= *GetBufferAs
<cmds::EndTransformFeedback
>();
3858 void* next_cmd
= cmd
.Set(&cmd
);
3859 EXPECT_EQ(static_cast<uint32_t>(cmds::EndTransformFeedback::kCmdId
),
3860 cmd
.header
.command
);
3861 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3862 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3865 TEST_F(GLES2FormatTest
, SetDisjointValueSyncCHROMIUM
) {
3866 cmds::SetDisjointValueSyncCHROMIUM
& cmd
=
3867 *GetBufferAs
<cmds::SetDisjointValueSyncCHROMIUM
>();
3869 cmd
.Set(&cmd
, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
3870 EXPECT_EQ(static_cast<uint32_t>(cmds::SetDisjointValueSyncCHROMIUM::kCmdId
),
3871 cmd
.header
.command
);
3872 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3873 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.sync_data_shm_id
);
3874 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.sync_data_shm_offset
);
3875 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3878 TEST_F(GLES2FormatTest
, InsertEventMarkerEXT
) {
3879 cmds::InsertEventMarkerEXT
& cmd
= *GetBufferAs
<cmds::InsertEventMarkerEXT
>();
3880 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3881 EXPECT_EQ(static_cast<uint32_t>(cmds::InsertEventMarkerEXT::kCmdId
),
3882 cmd
.header
.command
);
3883 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3884 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3885 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3888 TEST_F(GLES2FormatTest
, PushGroupMarkerEXT
) {
3889 cmds::PushGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PushGroupMarkerEXT
>();
3890 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3891 EXPECT_EQ(static_cast<uint32_t>(cmds::PushGroupMarkerEXT::kCmdId
),
3892 cmd
.header
.command
);
3893 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3894 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
3895 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3898 TEST_F(GLES2FormatTest
, PopGroupMarkerEXT
) {
3899 cmds::PopGroupMarkerEXT
& cmd
= *GetBufferAs
<cmds::PopGroupMarkerEXT
>();
3900 void* next_cmd
= cmd
.Set(&cmd
);
3901 EXPECT_EQ(static_cast<uint32_t>(cmds::PopGroupMarkerEXT::kCmdId
),
3902 cmd
.header
.command
);
3903 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3904 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3907 TEST_F(GLES2FormatTest
, GenVertexArraysOESImmediate
) {
3908 static GLuint ids
[] = {
3911 cmds::GenVertexArraysOESImmediate
& cmd
=
3912 *GetBufferAs
<cmds::GenVertexArraysOESImmediate
>();
3913 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3914 EXPECT_EQ(static_cast<uint32_t>(cmds::GenVertexArraysOESImmediate::kCmdId
),
3915 cmd
.header
.command
);
3916 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3917 cmd
.header
.size
* 4u);
3918 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3919 CheckBytesWrittenMatchesExpectedSize(
3921 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3922 // TODO(gman): Check that ids were inserted;
3925 TEST_F(GLES2FormatTest
, DeleteVertexArraysOESImmediate
) {
3926 static GLuint ids
[] = {
3929 cmds::DeleteVertexArraysOESImmediate
& cmd
=
3930 *GetBufferAs
<cmds::DeleteVertexArraysOESImmediate
>();
3931 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
3932 EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteVertexArraysOESImmediate::kCmdId
),
3933 cmd
.header
.command
);
3934 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
3935 cmd
.header
.size
* 4u);
3936 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
3937 CheckBytesWrittenMatchesExpectedSize(
3939 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
3940 // TODO(gman): Check that ids were inserted;
3943 TEST_F(GLES2FormatTest
, IsVertexArrayOES
) {
3944 cmds::IsVertexArrayOES
& cmd
= *GetBufferAs
<cmds::IsVertexArrayOES
>();
3946 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
3947 static_cast<uint32_t>(13));
3948 EXPECT_EQ(static_cast<uint32_t>(cmds::IsVertexArrayOES::kCmdId
),
3949 cmd
.header
.command
);
3950 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3951 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
3952 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
3953 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
3954 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3957 TEST_F(GLES2FormatTest
, BindVertexArrayOES
) {
3958 cmds::BindVertexArrayOES
& cmd
= *GetBufferAs
<cmds::BindVertexArrayOES
>();
3959 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
3960 EXPECT_EQ(static_cast<uint32_t>(cmds::BindVertexArrayOES::kCmdId
),
3961 cmd
.header
.command
);
3962 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3963 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.array
);
3964 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3967 TEST_F(GLES2FormatTest
, SwapBuffers
) {
3968 cmds::SwapBuffers
& cmd
= *GetBufferAs
<cmds::SwapBuffers
>();
3969 void* next_cmd
= cmd
.Set(&cmd
);
3970 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapBuffers::kCmdId
),
3971 cmd
.header
.command
);
3972 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3973 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3976 TEST_F(GLES2FormatTest
, GetMaxValueInBufferCHROMIUM
) {
3977 cmds::GetMaxValueInBufferCHROMIUM
& cmd
=
3978 *GetBufferAs
<cmds::GetMaxValueInBufferCHROMIUM
>();
3980 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLsizei
>(12),
3981 static_cast<GLenum
>(13), static_cast<GLuint
>(14),
3982 static_cast<uint32_t>(15), static_cast<uint32_t>(16));
3983 EXPECT_EQ(static_cast<uint32_t>(cmds::GetMaxValueInBufferCHROMIUM::kCmdId
),
3984 cmd
.header
.command
);
3985 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
3986 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.buffer_id
);
3987 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
3988 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
3989 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.offset
);
3990 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.result_shm_id
);
3991 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.result_shm_offset
);
3992 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
3995 TEST_F(GLES2FormatTest
, EnableFeatureCHROMIUM
) {
3996 cmds::EnableFeatureCHROMIUM
& cmd
=
3997 *GetBufferAs
<cmds::EnableFeatureCHROMIUM
>();
3999 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
4000 static_cast<uint32_t>(13));
4001 EXPECT_EQ(static_cast<uint32_t>(cmds::EnableFeatureCHROMIUM::kCmdId
),
4002 cmd
.header
.command
);
4003 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4004 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.bucket_id
);
4005 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
4006 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
4007 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4010 TEST_F(GLES2FormatTest
, MapBufferRange
) {
4011 cmds::MapBufferRange
& cmd
= *GetBufferAs
<cmds::MapBufferRange
>();
4013 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLintptr
>(12),
4014 static_cast<GLsizeiptr
>(13), static_cast<GLbitfield
>(14),
4015 static_cast<uint32_t>(15), static_cast<uint32_t>(16),
4016 static_cast<uint32_t>(17), static_cast<uint32_t>(18));
4017 EXPECT_EQ(static_cast<uint32_t>(cmds::MapBufferRange::kCmdId
),
4018 cmd
.header
.command
);
4019 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4020 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4021 EXPECT_EQ(static_cast<GLintptr
>(12), cmd
.offset
);
4022 EXPECT_EQ(static_cast<GLsizeiptr
>(13), cmd
.size
);
4023 EXPECT_EQ(static_cast<GLbitfield
>(14), cmd
.access
);
4024 EXPECT_EQ(static_cast<uint32_t>(15), cmd
.data_shm_id
);
4025 EXPECT_EQ(static_cast<uint32_t>(16), cmd
.data_shm_offset
);
4026 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.result_shm_id
);
4027 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.result_shm_offset
);
4028 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4031 TEST_F(GLES2FormatTest
, UnmapBuffer
) {
4032 cmds::UnmapBuffer
& cmd
= *GetBufferAs
<cmds::UnmapBuffer
>();
4033 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
4034 EXPECT_EQ(static_cast<uint32_t>(cmds::UnmapBuffer::kCmdId
),
4035 cmd
.header
.command
);
4036 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4037 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4038 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4041 TEST_F(GLES2FormatTest
, ResizeCHROMIUM
) {
4042 cmds::ResizeCHROMIUM
& cmd
= *GetBufferAs
<cmds::ResizeCHROMIUM
>();
4043 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
4044 static_cast<GLuint
>(12), static_cast<GLfloat
>(13));
4045 EXPECT_EQ(static_cast<uint32_t>(cmds::ResizeCHROMIUM::kCmdId
),
4046 cmd
.header
.command
);
4047 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4048 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.width
);
4049 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.height
);
4050 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.scale_factor
);
4051 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4054 TEST_F(GLES2FormatTest
, GetRequestableExtensionsCHROMIUM
) {
4055 cmds::GetRequestableExtensionsCHROMIUM
& cmd
=
4056 *GetBufferAs
<cmds::GetRequestableExtensionsCHROMIUM
>();
4057 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
4059 static_cast<uint32_t>(cmds::GetRequestableExtensionsCHROMIUM::kCmdId
),
4060 cmd
.header
.command
);
4061 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4062 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.bucket_id
);
4063 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4066 TEST_F(GLES2FormatTest
, RequestExtensionCHROMIUM
) {
4067 cmds::RequestExtensionCHROMIUM
& cmd
=
4068 *GetBufferAs
<cmds::RequestExtensionCHROMIUM
>();
4069 void* next_cmd
= cmd
.Set(&cmd
, static_cast<uint32_t>(11));
4070 EXPECT_EQ(static_cast<uint32_t>(cmds::RequestExtensionCHROMIUM::kCmdId
),
4071 cmd
.header
.command
);
4072 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4073 EXPECT_EQ(static_cast<uint32_t>(11), cmd
.bucket_id
);
4074 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4077 TEST_F(GLES2FormatTest
, GetProgramInfoCHROMIUM
) {
4078 cmds::GetProgramInfoCHROMIUM
& cmd
=
4079 *GetBufferAs
<cmds::GetProgramInfoCHROMIUM
>();
4081 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
4082 EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoCHROMIUM::kCmdId
),
4083 cmd
.header
.command
);
4084 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4085 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4086 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
4087 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4090 TEST_F(GLES2FormatTest
, GetUniformBlocksCHROMIUM
) {
4091 cmds::GetUniformBlocksCHROMIUM
& cmd
=
4092 *GetBufferAs
<cmds::GetUniformBlocksCHROMIUM
>();
4094 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
4095 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlocksCHROMIUM::kCmdId
),
4096 cmd
.header
.command
);
4097 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4098 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4099 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
4100 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4103 TEST_F(GLES2FormatTest
, GetTransformFeedbackVaryingsCHROMIUM
) {
4104 cmds::GetTransformFeedbackVaryingsCHROMIUM
& cmd
=
4105 *GetBufferAs
<cmds::GetTransformFeedbackVaryingsCHROMIUM
>();
4107 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
4109 static_cast<uint32_t>(cmds::GetTransformFeedbackVaryingsCHROMIUM::kCmdId
),
4110 cmd
.header
.command
);
4111 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4112 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4113 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
4114 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4117 TEST_F(GLES2FormatTest
, GetUniformsES3CHROMIUM
) {
4118 cmds::GetUniformsES3CHROMIUM
& cmd
=
4119 *GetBufferAs
<cmds::GetUniformsES3CHROMIUM
>();
4121 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
4122 EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformsES3CHROMIUM::kCmdId
),
4123 cmd
.header
.command
);
4124 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4125 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4126 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
4127 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4130 TEST_F(GLES2FormatTest
, GetTranslatedShaderSourceANGLE
) {
4131 cmds::GetTranslatedShaderSourceANGLE
& cmd
=
4132 *GetBufferAs
<cmds::GetTranslatedShaderSourceANGLE
>();
4134 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12));
4135 EXPECT_EQ(static_cast<uint32_t>(cmds::GetTranslatedShaderSourceANGLE::kCmdId
),
4136 cmd
.header
.command
);
4137 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4138 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.shader
);
4139 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.bucket_id
);
4140 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4143 TEST_F(GLES2FormatTest
, PostSubBufferCHROMIUM
) {
4144 cmds::PostSubBufferCHROMIUM
& cmd
=
4145 *GetBufferAs
<cmds::PostSubBufferCHROMIUM
>();
4146 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11), static_cast<GLint
>(12),
4147 static_cast<GLint
>(13), static_cast<GLint
>(14));
4148 EXPECT_EQ(static_cast<uint32_t>(cmds::PostSubBufferCHROMIUM::kCmdId
),
4149 cmd
.header
.command
);
4150 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4151 EXPECT_EQ(static_cast<GLint
>(11), cmd
.x
);
4152 EXPECT_EQ(static_cast<GLint
>(12), cmd
.y
);
4153 EXPECT_EQ(static_cast<GLint
>(13), cmd
.width
);
4154 EXPECT_EQ(static_cast<GLint
>(14), cmd
.height
);
4155 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4158 TEST_F(GLES2FormatTest
, TexImageIOSurface2DCHROMIUM
) {
4159 cmds::TexImageIOSurface2DCHROMIUM
& cmd
=
4160 *GetBufferAs
<cmds::TexImageIOSurface2DCHROMIUM
>();
4161 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
4162 static_cast<GLsizei
>(12), static_cast<GLsizei
>(13),
4163 static_cast<GLuint
>(14), static_cast<GLuint
>(15));
4164 EXPECT_EQ(static_cast<uint32_t>(cmds::TexImageIOSurface2DCHROMIUM::kCmdId
),
4165 cmd
.header
.command
);
4166 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4167 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4168 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.width
);
4169 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.height
);
4170 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.ioSurfaceId
);
4171 EXPECT_EQ(static_cast<GLuint
>(15), cmd
.plane
);
4172 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4175 TEST_F(GLES2FormatTest
, CopyTextureCHROMIUM
) {
4176 cmds::CopyTextureCHROMIUM
& cmd
= *GetBufferAs
<cmds::CopyTextureCHROMIUM
>();
4178 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
4179 static_cast<GLenum
>(13), static_cast<GLint
>(14),
4180 static_cast<GLenum
>(15), static_cast<GLboolean
>(16),
4181 static_cast<GLboolean
>(17), static_cast<GLboolean
>(18));
4182 EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTextureCHROMIUM::kCmdId
),
4183 cmd
.header
.command
);
4184 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4185 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4186 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
4187 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
4188 EXPECT_EQ(static_cast<GLint
>(14), cmd
.internalformat
);
4189 EXPECT_EQ(static_cast<GLenum
>(15), cmd
.dest_type
);
4190 EXPECT_EQ(static_cast<GLboolean
>(16), cmd
.unpack_flip_y
);
4191 EXPECT_EQ(static_cast<GLboolean
>(17), cmd
.unpack_premultiply_alpha
);
4192 EXPECT_EQ(static_cast<GLboolean
>(18), cmd
.unpack_unmultiply_alpha
);
4193 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4196 TEST_F(GLES2FormatTest
, CopySubTextureCHROMIUM
) {
4197 cmds::CopySubTextureCHROMIUM
& cmd
=
4198 *GetBufferAs
<cmds::CopySubTextureCHROMIUM
>();
4199 void* next_cmd
= cmd
.Set(
4200 &cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12),
4201 static_cast<GLenum
>(13), static_cast<GLint
>(14), static_cast<GLint
>(15),
4202 static_cast<GLint
>(16), static_cast<GLint
>(17), static_cast<GLsizei
>(18),
4203 static_cast<GLsizei
>(19), static_cast<GLboolean
>(20),
4204 static_cast<GLboolean
>(21), static_cast<GLboolean
>(22));
4205 EXPECT_EQ(static_cast<uint32_t>(cmds::CopySubTextureCHROMIUM::kCmdId
),
4206 cmd
.header
.command
);
4207 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4208 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4209 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
4210 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
4211 EXPECT_EQ(static_cast<GLint
>(14), cmd
.xoffset
);
4212 EXPECT_EQ(static_cast<GLint
>(15), cmd
.yoffset
);
4213 EXPECT_EQ(static_cast<GLint
>(16), cmd
.x
);
4214 EXPECT_EQ(static_cast<GLint
>(17), cmd
.y
);
4215 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.width
);
4216 EXPECT_EQ(static_cast<GLsizei
>(19), cmd
.height
);
4217 EXPECT_EQ(static_cast<GLboolean
>(20), cmd
.unpack_flip_y
);
4218 EXPECT_EQ(static_cast<GLboolean
>(21), cmd
.unpack_premultiply_alpha
);
4219 EXPECT_EQ(static_cast<GLboolean
>(22), cmd
.unpack_unmultiply_alpha
);
4220 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4223 TEST_F(GLES2FormatTest
, CompressedCopyTextureCHROMIUM
) {
4224 cmds::CompressedCopyTextureCHROMIUM
& cmd
=
4225 *GetBufferAs
<cmds::CompressedCopyTextureCHROMIUM
>();
4226 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
4227 static_cast<GLenum
>(12), static_cast<GLenum
>(13));
4228 EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedCopyTextureCHROMIUM::kCmdId
),
4229 cmd
.header
.command
);
4230 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4231 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4232 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
4233 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
4234 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4237 TEST_F(GLES2FormatTest
, CompressedCopySubTextureCHROMIUM
) {
4238 cmds::CompressedCopySubTextureCHROMIUM
& cmd
=
4239 *GetBufferAs
<cmds::CompressedCopySubTextureCHROMIUM
>();
4240 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
4241 static_cast<GLenum
>(12), static_cast<GLenum
>(13),
4242 static_cast<GLint
>(14), static_cast<GLint
>(15),
4243 static_cast<GLint
>(16), static_cast<GLint
>(17),
4244 static_cast<GLsizei
>(18), static_cast<GLsizei
>(19));
4246 static_cast<uint32_t>(cmds::CompressedCopySubTextureCHROMIUM::kCmdId
),
4247 cmd
.header
.command
);
4248 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4249 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4250 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.source_id
);
4251 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.dest_id
);
4252 EXPECT_EQ(static_cast<GLint
>(14), cmd
.xoffset
);
4253 EXPECT_EQ(static_cast<GLint
>(15), cmd
.yoffset
);
4254 EXPECT_EQ(static_cast<GLint
>(16), cmd
.x
);
4255 EXPECT_EQ(static_cast<GLint
>(17), cmd
.y
);
4256 EXPECT_EQ(static_cast<GLsizei
>(18), cmd
.width
);
4257 EXPECT_EQ(static_cast<GLsizei
>(19), cmd
.height
);
4258 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4261 TEST_F(GLES2FormatTest
, DrawArraysInstancedANGLE
) {
4262 cmds::DrawArraysInstancedANGLE
& cmd
=
4263 *GetBufferAs
<cmds::DrawArraysInstancedANGLE
>();
4265 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12),
4266 static_cast<GLsizei
>(13), static_cast<GLsizei
>(14));
4267 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArraysInstancedANGLE::kCmdId
),
4268 cmd
.header
.command
);
4269 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4270 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
4271 EXPECT_EQ(static_cast<GLint
>(12), cmd
.first
);
4272 EXPECT_EQ(static_cast<GLsizei
>(13), cmd
.count
);
4273 EXPECT_EQ(static_cast<GLsizei
>(14), cmd
.primcount
);
4274 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4277 TEST_F(GLES2FormatTest
, DrawElementsInstancedANGLE
) {
4278 cmds::DrawElementsInstancedANGLE
& cmd
=
4279 *GetBufferAs
<cmds::DrawElementsInstancedANGLE
>();
4280 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
4281 static_cast<GLsizei
>(12), static_cast<GLenum
>(13),
4282 static_cast<GLuint
>(14), static_cast<GLsizei
>(15));
4283 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElementsInstancedANGLE::kCmdId
),
4284 cmd
.header
.command
);
4285 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4286 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.mode
);
4287 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.count
);
4288 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.type
);
4289 EXPECT_EQ(static_cast<GLuint
>(14), cmd
.index_offset
);
4290 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.primcount
);
4291 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4294 TEST_F(GLES2FormatTest
, VertexAttribDivisorANGLE
) {
4295 cmds::VertexAttribDivisorANGLE
& cmd
=
4296 *GetBufferAs
<cmds::VertexAttribDivisorANGLE
>();
4298 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
4299 EXPECT_EQ(static_cast<uint32_t>(cmds::VertexAttribDivisorANGLE::kCmdId
),
4300 cmd
.header
.command
);
4301 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4302 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.index
);
4303 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.divisor
);
4304 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4307 // TODO(gman): Write test for GenMailboxCHROMIUM
4308 TEST_F(GLES2FormatTest
, ProduceTextureCHROMIUMImmediate
) {
4309 const int kSomeBaseValueToTestWith
= 51;
4310 static GLbyte data
[] = {
4311 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4312 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4313 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4314 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4315 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4316 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4317 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4318 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4319 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4320 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4321 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4322 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4323 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4324 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4325 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4326 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4327 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4328 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4329 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4330 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4331 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4332 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4333 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4334 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4335 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4336 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4337 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4338 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4339 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4340 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4341 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4342 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4343 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4344 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4345 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4346 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4347 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4348 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4349 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4350 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4351 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4352 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4353 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4354 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4355 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4356 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4357 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4358 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4359 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4360 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4361 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4362 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4363 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4364 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4365 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4366 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4367 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4368 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4369 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4370 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4371 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4372 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4373 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4374 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4376 cmds::ProduceTextureCHROMIUMImmediate
& cmd
=
4377 *GetBufferAs
<cmds::ProduceTextureCHROMIUMImmediate
>();
4378 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
4380 static_cast<uint32_t>(cmds::ProduceTextureCHROMIUMImmediate::kCmdId
),
4381 cmd
.header
.command
);
4382 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4383 cmd
.header
.size
* 4u);
4384 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4385 CheckBytesWrittenMatchesExpectedSize(
4386 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4387 // TODO(gman): Check that data was inserted;
4390 TEST_F(GLES2FormatTest
, ProduceTextureDirectCHROMIUMImmediate
) {
4391 const int kSomeBaseValueToTestWith
= 51;
4392 static GLbyte data
[] = {
4393 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4394 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4395 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4396 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4397 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4398 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4399 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4400 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4401 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4402 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4403 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4404 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4405 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4406 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4407 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4408 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4409 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4410 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4411 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4412 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4413 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4414 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4415 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4416 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4417 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4418 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4419 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4420 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4421 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4422 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4423 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4424 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4425 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4426 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4427 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4428 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4429 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4430 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4431 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4432 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4433 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4434 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4435 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4436 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4437 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4438 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4439 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4440 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4441 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4442 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4443 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4444 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4445 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4446 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4447 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4448 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4449 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4450 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4451 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4452 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4453 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4454 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4455 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4456 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4458 cmds::ProduceTextureDirectCHROMIUMImmediate
& cmd
=
4459 *GetBufferAs
<cmds::ProduceTextureDirectCHROMIUMImmediate
>();
4461 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12), data
);
4462 EXPECT_EQ(static_cast<uint32_t>(
4463 cmds::ProduceTextureDirectCHROMIUMImmediate::kCmdId
),
4464 cmd
.header
.command
);
4465 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4466 cmd
.header
.size
* 4u);
4467 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.texture
);
4468 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.target
);
4469 CheckBytesWrittenMatchesExpectedSize(
4470 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4471 // TODO(gman): Check that data was inserted;
4474 TEST_F(GLES2FormatTest
, ConsumeTextureCHROMIUMImmediate
) {
4475 const int kSomeBaseValueToTestWith
= 51;
4476 static GLbyte data
[] = {
4477 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 0),
4478 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 1),
4479 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 2),
4480 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 3),
4481 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 4),
4482 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 5),
4483 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 6),
4484 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 7),
4485 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 8),
4486 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 9),
4487 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 10),
4488 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 11),
4489 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 12),
4490 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 13),
4491 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 14),
4492 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 15),
4493 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 16),
4494 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 17),
4495 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 18),
4496 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 19),
4497 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 20),
4498 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 21),
4499 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 22),
4500 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 23),
4501 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 24),
4502 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 25),
4503 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 26),
4504 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 27),
4505 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 28),
4506 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 29),
4507 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 30),
4508 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 31),
4509 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 32),
4510 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 33),
4511 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 34),
4512 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 35),
4513 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 36),
4514 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 37),
4515 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 38),
4516 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 39),
4517 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 40),
4518 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 41),
4519 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 42),
4520 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 43),
4521 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 44),
4522 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 45),
4523 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 46),
4524 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 47),
4525 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 48),
4526 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 49),
4527 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 50),
4528 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 51),
4529 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 52),
4530 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 53),
4531 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 54),
4532 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 55),
4533 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 56),
4534 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 57),
4535 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 58),
4536 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 59),
4537 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 60),
4538 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 61),
4539 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 62),
4540 static_cast<GLbyte
>(kSomeBaseValueToTestWith
+ 63),
4542 cmds::ConsumeTextureCHROMIUMImmediate
& cmd
=
4543 *GetBufferAs
<cmds::ConsumeTextureCHROMIUMImmediate
>();
4544 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
4546 static_cast<uint32_t>(cmds::ConsumeTextureCHROMIUMImmediate::kCmdId
),
4547 cmd
.header
.command
);
4548 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4549 cmd
.header
.size
* 4u);
4550 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4551 CheckBytesWrittenMatchesExpectedSize(
4552 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4553 // TODO(gman): Check that data was inserted;
4556 // TODO(gman): Write test for CreateAndConsumeTextureCHROMIUMImmediate
4557 TEST_F(GLES2FormatTest
, BindUniformLocationCHROMIUMBucket
) {
4558 cmds::BindUniformLocationCHROMIUMBucket
& cmd
=
4559 *GetBufferAs
<cmds::BindUniformLocationCHROMIUMBucket
>();
4560 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
4561 static_cast<GLint
>(12), static_cast<uint32_t>(13));
4563 static_cast<uint32_t>(cmds::BindUniformLocationCHROMIUMBucket::kCmdId
),
4564 cmd
.header
.command
);
4565 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4566 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.program
);
4567 EXPECT_EQ(static_cast<GLint
>(12), cmd
.location
);
4568 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.name_bucket_id
);
4569 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4572 TEST_F(GLES2FormatTest
, GenValuebuffersCHROMIUMImmediate
) {
4573 static GLuint ids
[] = {
4576 cmds::GenValuebuffersCHROMIUMImmediate
& cmd
=
4577 *GetBufferAs
<cmds::GenValuebuffersCHROMIUMImmediate
>();
4578 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
4580 static_cast<uint32_t>(cmds::GenValuebuffersCHROMIUMImmediate::kCmdId
),
4581 cmd
.header
.command
);
4582 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
4583 cmd
.header
.size
* 4u);
4584 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
4585 CheckBytesWrittenMatchesExpectedSize(
4587 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
4588 // TODO(gman): Check that ids were inserted;
4591 TEST_F(GLES2FormatTest
, DeleteValuebuffersCHROMIUMImmediate
) {
4592 static GLuint ids
[] = {
4595 cmds::DeleteValuebuffersCHROMIUMImmediate
& cmd
=
4596 *GetBufferAs
<cmds::DeleteValuebuffersCHROMIUMImmediate
>();
4597 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(arraysize(ids
)), ids
);
4599 static_cast<uint32_t>(cmds::DeleteValuebuffersCHROMIUMImmediate::kCmdId
),
4600 cmd
.header
.command
);
4601 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(cmd
.n
* 4u),
4602 cmd
.header
.size
* 4u);
4603 EXPECT_EQ(static_cast<GLsizei
>(arraysize(ids
)), cmd
.n
);
4604 CheckBytesWrittenMatchesExpectedSize(
4606 sizeof(cmd
) + RoundSizeToMultipleOfEntries(arraysize(ids
) * 4u));
4607 // TODO(gman): Check that ids were inserted;
4610 TEST_F(GLES2FormatTest
, IsValuebufferCHROMIUM
) {
4611 cmds::IsValuebufferCHROMIUM
& cmd
=
4612 *GetBufferAs
<cmds::IsValuebufferCHROMIUM
>();
4614 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
4615 static_cast<uint32_t>(13));
4616 EXPECT_EQ(static_cast<uint32_t>(cmds::IsValuebufferCHROMIUM::kCmdId
),
4617 cmd
.header
.command
);
4618 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4619 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.valuebuffer
);
4620 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
4621 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
4622 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4625 TEST_F(GLES2FormatTest
, BindValuebufferCHROMIUM
) {
4626 cmds::BindValuebufferCHROMIUM
& cmd
=
4627 *GetBufferAs
<cmds::BindValuebufferCHROMIUM
>();
4629 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLuint
>(12));
4630 EXPECT_EQ(static_cast<uint32_t>(cmds::BindValuebufferCHROMIUM::kCmdId
),
4631 cmd
.header
.command
);
4632 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4633 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4634 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.valuebuffer
);
4635 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4638 TEST_F(GLES2FormatTest
, SubscribeValueCHROMIUM
) {
4639 cmds::SubscribeValueCHROMIUM
& cmd
=
4640 *GetBufferAs
<cmds::SubscribeValueCHROMIUM
>();
4642 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
4643 EXPECT_EQ(static_cast<uint32_t>(cmds::SubscribeValueCHROMIUM::kCmdId
),
4644 cmd
.header
.command
);
4645 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4646 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4647 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.subscription
);
4648 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4651 TEST_F(GLES2FormatTest
, PopulateSubscribedValuesCHROMIUM
) {
4652 cmds::PopulateSubscribedValuesCHROMIUM
& cmd
=
4653 *GetBufferAs
<cmds::PopulateSubscribedValuesCHROMIUM
>();
4654 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
4656 static_cast<uint32_t>(cmds::PopulateSubscribedValuesCHROMIUM::kCmdId
),
4657 cmd
.header
.command
);
4658 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4659 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4660 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4663 TEST_F(GLES2FormatTest
, UniformValuebufferCHROMIUM
) {
4664 cmds::UniformValuebufferCHROMIUM
& cmd
=
4665 *GetBufferAs
<cmds::UniformValuebufferCHROMIUM
>();
4666 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
4667 static_cast<GLenum
>(12), static_cast<GLenum
>(13));
4668 EXPECT_EQ(static_cast<uint32_t>(cmds::UniformValuebufferCHROMIUM::kCmdId
),
4669 cmd
.header
.command
);
4670 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4671 EXPECT_EQ(static_cast<GLint
>(11), cmd
.location
);
4672 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.target
);
4673 EXPECT_EQ(static_cast<GLenum
>(13), cmd
.subscription
);
4674 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4677 TEST_F(GLES2FormatTest
, BindTexImage2DCHROMIUM
) {
4678 cmds::BindTexImage2DCHROMIUM
& cmd
=
4679 *GetBufferAs
<cmds::BindTexImage2DCHROMIUM
>();
4681 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
4682 EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexImage2DCHROMIUM::kCmdId
),
4683 cmd
.header
.command
);
4684 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4685 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4686 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
4687 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4690 TEST_F(GLES2FormatTest
, ReleaseTexImage2DCHROMIUM
) {
4691 cmds::ReleaseTexImage2DCHROMIUM
& cmd
=
4692 *GetBufferAs
<cmds::ReleaseTexImage2DCHROMIUM
>();
4694 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLint
>(12));
4695 EXPECT_EQ(static_cast<uint32_t>(cmds::ReleaseTexImage2DCHROMIUM::kCmdId
),
4696 cmd
.header
.command
);
4697 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4698 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.target
);
4699 EXPECT_EQ(static_cast<GLint
>(12), cmd
.imageId
);
4700 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4703 TEST_F(GLES2FormatTest
, TraceBeginCHROMIUM
) {
4704 cmds::TraceBeginCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceBeginCHROMIUM
>();
4706 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLuint
>(12));
4707 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceBeginCHROMIUM::kCmdId
),
4708 cmd
.header
.command
);
4709 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4710 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.category_bucket_id
);
4711 EXPECT_EQ(static_cast<GLuint
>(12), cmd
.name_bucket_id
);
4712 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4715 TEST_F(GLES2FormatTest
, TraceEndCHROMIUM
) {
4716 cmds::TraceEndCHROMIUM
& cmd
= *GetBufferAs
<cmds::TraceEndCHROMIUM
>();
4717 void* next_cmd
= cmd
.Set(&cmd
);
4718 EXPECT_EQ(static_cast<uint32_t>(cmds::TraceEndCHROMIUM::kCmdId
),
4719 cmd
.header
.command
);
4720 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4721 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4724 TEST_F(GLES2FormatTest
, DiscardFramebufferEXTImmediate
) {
4725 const int kSomeBaseValueToTestWith
= 51;
4726 static GLenum data
[] = {
4727 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
4728 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 1),
4730 cmds::DiscardFramebufferEXTImmediate
& cmd
=
4731 *GetBufferAs
<cmds::DiscardFramebufferEXTImmediate
>();
4732 const GLsizei kNumElements
= 2;
4733 const size_t kExpectedCmdSize
=
4734 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
4736 cmd
.Set(&cmd
, static_cast<GLenum
>(1), static_cast<GLsizei
>(2), data
);
4737 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardFramebufferEXTImmediate::kCmdId
),
4738 cmd
.header
.command
);
4739 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
4740 EXPECT_EQ(static_cast<GLenum
>(1), cmd
.target
);
4741 EXPECT_EQ(static_cast<GLsizei
>(2), cmd
.count
);
4742 CheckBytesWrittenMatchesExpectedSize(
4743 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4744 // TODO(gman): Check that data was inserted;
4747 TEST_F(GLES2FormatTest
, LoseContextCHROMIUM
) {
4748 cmds::LoseContextCHROMIUM
& cmd
= *GetBufferAs
<cmds::LoseContextCHROMIUM
>();
4750 cmd
.Set(&cmd
, static_cast<GLenum
>(11), static_cast<GLenum
>(12));
4751 EXPECT_EQ(static_cast<uint32_t>(cmds::LoseContextCHROMIUM::kCmdId
),
4752 cmd
.header
.command
);
4753 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4754 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.current
);
4755 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.other
);
4756 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4759 // TODO(gman): Write test for InsertSyncPointCHROMIUM
4760 TEST_F(GLES2FormatTest
, WaitSyncPointCHROMIUM
) {
4761 cmds::WaitSyncPointCHROMIUM
& cmd
=
4762 *GetBufferAs
<cmds::WaitSyncPointCHROMIUM
>();
4763 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11));
4764 EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSyncPointCHROMIUM::kCmdId
),
4765 cmd
.header
.command
);
4766 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4767 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.sync_point
);
4768 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4771 TEST_F(GLES2FormatTest
, DrawBuffersEXTImmediate
) {
4772 const int kSomeBaseValueToTestWith
= 51;
4773 static GLenum data
[] = {
4774 static_cast<GLenum
>(kSomeBaseValueToTestWith
+ 0),
4776 cmds::DrawBuffersEXTImmediate
& cmd
=
4777 *GetBufferAs
<cmds::DrawBuffersEXTImmediate
>();
4778 const GLsizei kNumElements
= 1;
4779 const size_t kExpectedCmdSize
=
4780 sizeof(cmd
) + kNumElements
* sizeof(GLenum
) * 1;
4781 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLsizei
>(1), data
);
4782 EXPECT_EQ(static_cast<uint32_t>(cmds::DrawBuffersEXTImmediate::kCmdId
),
4783 cmd
.header
.command
);
4784 EXPECT_EQ(kExpectedCmdSize
, cmd
.header
.size
* 4u);
4785 EXPECT_EQ(static_cast<GLsizei
>(1), cmd
.count
);
4786 CheckBytesWrittenMatchesExpectedSize(
4787 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4788 // TODO(gman): Check that data was inserted;
4791 TEST_F(GLES2FormatTest
, DiscardBackbufferCHROMIUM
) {
4792 cmds::DiscardBackbufferCHROMIUM
& cmd
=
4793 *GetBufferAs
<cmds::DiscardBackbufferCHROMIUM
>();
4794 void* next_cmd
= cmd
.Set(&cmd
);
4795 EXPECT_EQ(static_cast<uint32_t>(cmds::DiscardBackbufferCHROMIUM::kCmdId
),
4796 cmd
.header
.command
);
4797 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4798 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4801 TEST_F(GLES2FormatTest
, ScheduleOverlayPlaneCHROMIUM
) {
4802 cmds::ScheduleOverlayPlaneCHROMIUM
& cmd
=
4803 *GetBufferAs
<cmds::ScheduleOverlayPlaneCHROMIUM
>();
4804 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11),
4805 static_cast<GLenum
>(12), static_cast<GLuint
>(13),
4806 static_cast<GLint
>(14), static_cast<GLint
>(15),
4807 static_cast<GLint
>(16), static_cast<GLint
>(17),
4808 static_cast<GLfloat
>(18), static_cast<GLfloat
>(19),
4809 static_cast<GLfloat
>(20), static_cast<GLfloat
>(21));
4810 EXPECT_EQ(static_cast<uint32_t>(cmds::ScheduleOverlayPlaneCHROMIUM::kCmdId
),
4811 cmd
.header
.command
);
4812 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4813 EXPECT_EQ(static_cast<GLint
>(11), cmd
.plane_z_order
);
4814 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.plane_transform
);
4815 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.overlay_texture_id
);
4816 EXPECT_EQ(static_cast<GLint
>(14), cmd
.bounds_x
);
4817 EXPECT_EQ(static_cast<GLint
>(15), cmd
.bounds_y
);
4818 EXPECT_EQ(static_cast<GLint
>(16), cmd
.bounds_width
);
4819 EXPECT_EQ(static_cast<GLint
>(17), cmd
.bounds_height
);
4820 EXPECT_EQ(static_cast<GLfloat
>(18), cmd
.uv_x
);
4821 EXPECT_EQ(static_cast<GLfloat
>(19), cmd
.uv_y
);
4822 EXPECT_EQ(static_cast<GLfloat
>(20), cmd
.uv_width
);
4823 EXPECT_EQ(static_cast<GLfloat
>(21), cmd
.uv_height
);
4824 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4827 TEST_F(GLES2FormatTest
, SwapInterval
) {
4828 cmds::SwapInterval
& cmd
= *GetBufferAs
<cmds::SwapInterval
>();
4829 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLint
>(11));
4830 EXPECT_EQ(static_cast<uint32_t>(cmds::SwapInterval::kCmdId
),
4831 cmd
.header
.command
);
4832 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4833 EXPECT_EQ(static_cast<GLint
>(11), cmd
.interval
);
4834 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4837 TEST_F(GLES2FormatTest
, FlushDriverCachesCHROMIUM
) {
4838 cmds::FlushDriverCachesCHROMIUM
& cmd
=
4839 *GetBufferAs
<cmds::FlushDriverCachesCHROMIUM
>();
4840 void* next_cmd
= cmd
.Set(&cmd
);
4841 EXPECT_EQ(static_cast<uint32_t>(cmds::FlushDriverCachesCHROMIUM::kCmdId
),
4842 cmd
.header
.command
);
4843 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4844 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4847 TEST_F(GLES2FormatTest
, MatrixLoadfCHROMIUMImmediate
) {
4848 const int kSomeBaseValueToTestWith
= 51;
4849 static GLfloat data
[] = {
4850 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 0),
4851 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 1),
4852 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 2),
4853 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 3),
4854 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 4),
4855 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 5),
4856 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 6),
4857 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 7),
4858 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 8),
4859 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 9),
4860 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 10),
4861 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 11),
4862 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 12),
4863 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 13),
4864 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 14),
4865 static_cast<GLfloat
>(kSomeBaseValueToTestWith
+ 15),
4867 cmds::MatrixLoadfCHROMIUMImmediate
& cmd
=
4868 *GetBufferAs
<cmds::MatrixLoadfCHROMIUMImmediate
>();
4869 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11), data
);
4870 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadfCHROMIUMImmediate::kCmdId
),
4871 cmd
.header
.command
);
4872 EXPECT_EQ(sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)),
4873 cmd
.header
.size
* 4u);
4874 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.matrixMode
);
4875 CheckBytesWrittenMatchesExpectedSize(
4876 next_cmd
, sizeof(cmd
) + RoundSizeToMultipleOfEntries(sizeof(data
)));
4877 // TODO(gman): Check that data was inserted;
4880 TEST_F(GLES2FormatTest
, MatrixLoadIdentityCHROMIUM
) {
4881 cmds::MatrixLoadIdentityCHROMIUM
& cmd
=
4882 *GetBufferAs
<cmds::MatrixLoadIdentityCHROMIUM
>();
4883 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11));
4884 EXPECT_EQ(static_cast<uint32_t>(cmds::MatrixLoadIdentityCHROMIUM::kCmdId
),
4885 cmd
.header
.command
);
4886 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4887 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.matrixMode
);
4888 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4891 TEST_F(GLES2FormatTest
, GenPathsCHROMIUM
) {
4892 cmds::GenPathsCHROMIUM
& cmd
= *GetBufferAs
<cmds::GenPathsCHROMIUM
>();
4894 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLsizei
>(12));
4895 EXPECT_EQ(static_cast<uint32_t>(cmds::GenPathsCHROMIUM::kCmdId
),
4896 cmd
.header
.command
);
4897 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4898 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.first_client_id
);
4899 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.range
);
4900 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4903 TEST_F(GLES2FormatTest
, DeletePathsCHROMIUM
) {
4904 cmds::DeletePathsCHROMIUM
& cmd
= *GetBufferAs
<cmds::DeletePathsCHROMIUM
>();
4906 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLsizei
>(12));
4907 EXPECT_EQ(static_cast<uint32_t>(cmds::DeletePathsCHROMIUM::kCmdId
),
4908 cmd
.header
.command
);
4909 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4910 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.first_client_id
);
4911 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.range
);
4912 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4915 TEST_F(GLES2FormatTest
, IsPathCHROMIUM
) {
4916 cmds::IsPathCHROMIUM
& cmd
= *GetBufferAs
<cmds::IsPathCHROMIUM
>();
4918 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<uint32_t>(12),
4919 static_cast<uint32_t>(13));
4920 EXPECT_EQ(static_cast<uint32_t>(cmds::IsPathCHROMIUM::kCmdId
),
4921 cmd
.header
.command
);
4922 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4923 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
4924 EXPECT_EQ(static_cast<uint32_t>(12), cmd
.result_shm_id
);
4925 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.result_shm_offset
);
4926 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4929 TEST_F(GLES2FormatTest
, PathCommandsCHROMIUM
) {
4930 cmds::PathCommandsCHROMIUM
& cmd
= *GetBufferAs
<cmds::PathCommandsCHROMIUM
>();
4932 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLsizei
>(12),
4933 static_cast<uint32_t>(13), static_cast<uint32_t>(14),
4934 static_cast<GLsizei
>(15), static_cast<GLenum
>(16),
4935 static_cast<uint32_t>(17), static_cast<uint32_t>(18));
4936 EXPECT_EQ(static_cast<uint32_t>(cmds::PathCommandsCHROMIUM::kCmdId
),
4937 cmd
.header
.command
);
4938 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4939 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
4940 EXPECT_EQ(static_cast<GLsizei
>(12), cmd
.numCommands
);
4941 EXPECT_EQ(static_cast<uint32_t>(13), cmd
.commands_shm_id
);
4942 EXPECT_EQ(static_cast<uint32_t>(14), cmd
.commands_shm_offset
);
4943 EXPECT_EQ(static_cast<GLsizei
>(15), cmd
.numCoords
);
4944 EXPECT_EQ(static_cast<GLenum
>(16), cmd
.coordType
);
4945 EXPECT_EQ(static_cast<uint32_t>(17), cmd
.coords_shm_id
);
4946 EXPECT_EQ(static_cast<uint32_t>(18), cmd
.coords_shm_offset
);
4947 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4950 TEST_F(GLES2FormatTest
, PathParameterfCHROMIUM
) {
4951 cmds::PathParameterfCHROMIUM
& cmd
=
4952 *GetBufferAs
<cmds::PathParameterfCHROMIUM
>();
4953 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
4954 static_cast<GLenum
>(12), static_cast<GLfloat
>(13));
4955 EXPECT_EQ(static_cast<uint32_t>(cmds::PathParameterfCHROMIUM::kCmdId
),
4956 cmd
.header
.command
);
4957 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4958 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
4959 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
4960 EXPECT_EQ(static_cast<GLfloat
>(13), cmd
.value
);
4961 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4964 TEST_F(GLES2FormatTest
, PathParameteriCHROMIUM
) {
4965 cmds::PathParameteriCHROMIUM
& cmd
=
4966 *GetBufferAs
<cmds::PathParameteriCHROMIUM
>();
4967 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
4968 static_cast<GLenum
>(12), static_cast<GLint
>(13));
4969 EXPECT_EQ(static_cast<uint32_t>(cmds::PathParameteriCHROMIUM::kCmdId
),
4970 cmd
.header
.command
);
4971 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4972 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
4973 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.pname
);
4974 EXPECT_EQ(static_cast<GLint
>(13), cmd
.value
);
4975 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4978 TEST_F(GLES2FormatTest
, PathStencilFuncCHROMIUM
) {
4979 cmds::PathStencilFuncCHROMIUM
& cmd
=
4980 *GetBufferAs
<cmds::PathStencilFuncCHROMIUM
>();
4981 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLenum
>(11),
4982 static_cast<GLint
>(12), static_cast<GLuint
>(13));
4983 EXPECT_EQ(static_cast<uint32_t>(cmds::PathStencilFuncCHROMIUM::kCmdId
),
4984 cmd
.header
.command
);
4985 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
4986 EXPECT_EQ(static_cast<GLenum
>(11), cmd
.func
);
4987 EXPECT_EQ(static_cast<GLint
>(12), cmd
.ref
);
4988 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
4989 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
4992 TEST_F(GLES2FormatTest
, StencilFillPathCHROMIUM
) {
4993 cmds::StencilFillPathCHROMIUM
& cmd
=
4994 *GetBufferAs
<cmds::StencilFillPathCHROMIUM
>();
4995 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
4996 static_cast<GLenum
>(12), static_cast<GLuint
>(13));
4997 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilFillPathCHROMIUM::kCmdId
),
4998 cmd
.header
.command
);
4999 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5000 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
5001 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.fillMode
);
5002 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
5003 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5006 TEST_F(GLES2FormatTest
, StencilStrokePathCHROMIUM
) {
5007 cmds::StencilStrokePathCHROMIUM
& cmd
=
5008 *GetBufferAs
<cmds::StencilStrokePathCHROMIUM
>();
5009 void* next_cmd
= cmd
.Set(&cmd
, static_cast<GLuint
>(11),
5010 static_cast<GLint
>(12), static_cast<GLuint
>(13));
5011 EXPECT_EQ(static_cast<uint32_t>(cmds::StencilStrokePathCHROMIUM::kCmdId
),
5012 cmd
.header
.command
);
5013 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5014 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
5015 EXPECT_EQ(static_cast<GLint
>(12), cmd
.reference
);
5016 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
5017 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5020 TEST_F(GLES2FormatTest
, CoverFillPathCHROMIUM
) {
5021 cmds::CoverFillPathCHROMIUM
& cmd
=
5022 *GetBufferAs
<cmds::CoverFillPathCHROMIUM
>();
5024 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12));
5025 EXPECT_EQ(static_cast<uint32_t>(cmds::CoverFillPathCHROMIUM::kCmdId
),
5026 cmd
.header
.command
);
5027 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5028 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
5029 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.coverMode
);
5030 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5033 TEST_F(GLES2FormatTest
, CoverStrokePathCHROMIUM
) {
5034 cmds::CoverStrokePathCHROMIUM
& cmd
=
5035 *GetBufferAs
<cmds::CoverStrokePathCHROMIUM
>();
5037 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12));
5038 EXPECT_EQ(static_cast<uint32_t>(cmds::CoverStrokePathCHROMIUM::kCmdId
),
5039 cmd
.header
.command
);
5040 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5041 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
5042 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.coverMode
);
5043 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5046 TEST_F(GLES2FormatTest
, StencilThenCoverFillPathCHROMIUM
) {
5047 cmds::StencilThenCoverFillPathCHROMIUM
& cmd
=
5048 *GetBufferAs
<cmds::StencilThenCoverFillPathCHROMIUM
>();
5050 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLenum
>(12),
5051 static_cast<GLuint
>(13), static_cast<GLenum
>(14));
5053 static_cast<uint32_t>(cmds::StencilThenCoverFillPathCHROMIUM::kCmdId
),
5054 cmd
.header
.command
);
5055 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5056 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
5057 EXPECT_EQ(static_cast<GLenum
>(12), cmd
.fillMode
);
5058 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
5059 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.coverMode
);
5060 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5063 TEST_F(GLES2FormatTest
, StencilThenCoverStrokePathCHROMIUM
) {
5064 cmds::StencilThenCoverStrokePathCHROMIUM
& cmd
=
5065 *GetBufferAs
<cmds::StencilThenCoverStrokePathCHROMIUM
>();
5067 cmd
.Set(&cmd
, static_cast<GLuint
>(11), static_cast<GLint
>(12),
5068 static_cast<GLuint
>(13), static_cast<GLenum
>(14));
5070 static_cast<uint32_t>(cmds::StencilThenCoverStrokePathCHROMIUM::kCmdId
),
5071 cmd
.header
.command
);
5072 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5073 EXPECT_EQ(static_cast<GLuint
>(11), cmd
.path
);
5074 EXPECT_EQ(static_cast<GLint
>(12), cmd
.reference
);
5075 EXPECT_EQ(static_cast<GLuint
>(13), cmd
.mask
);
5076 EXPECT_EQ(static_cast<GLenum
>(14), cmd
.coverMode
);
5077 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5080 TEST_F(GLES2FormatTest
, BlendBarrierKHR
) {
5081 cmds::BlendBarrierKHR
& cmd
= *GetBufferAs
<cmds::BlendBarrierKHR
>();
5082 void* next_cmd
= cmd
.Set(&cmd
);
5083 EXPECT_EQ(static_cast<uint32_t>(cmds::BlendBarrierKHR::kCmdId
),
5084 cmd
.header
.command
);
5085 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5086 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5089 TEST_F(GLES2FormatTest
, ApplyScreenSpaceAntialiasingCHROMIUM
) {
5090 cmds::ApplyScreenSpaceAntialiasingCHROMIUM
& cmd
=
5091 *GetBufferAs
<cmds::ApplyScreenSpaceAntialiasingCHROMIUM
>();
5092 void* next_cmd
= cmd
.Set(&cmd
);
5094 static_cast<uint32_t>(cmds::ApplyScreenSpaceAntialiasingCHROMIUM::kCmdId
),
5095 cmd
.header
.command
);
5096 EXPECT_EQ(sizeof(cmd
), cmd
.header
.size
* 4u);
5097 CheckBytesWrittenMatchesExpectedSize(next_cmd
, sizeof(cmd
));
5100 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_