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 // It is included by gles2_cmd_decoder_unittest_2.cc
12 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_
13 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_
15 // TODO(gman): GetString
17 TEST_P(GLES2DecoderTest2
, GetSyncivValidArgs
) {
18 EXPECT_CALL(*gl_
, GetError())
19 .WillOnce(Return(GL_NO_ERROR
))
20 .WillOnce(Return(GL_NO_ERROR
))
21 .RetiresOnSaturation();
22 SpecializedSetup
<cmds::GetSynciv
, 0>(true);
23 typedef cmds::GetSynciv::Result Result
;
24 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
26 *gl_
, GetSynciv(reinterpret_cast<GLsync
>(kServiceSyncId
), GL_SYNC_STATUS
,
27 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
29 nullptr, result
->GetData()));
32 cmd
.Init(client_sync_id_
, GL_SYNC_STATUS
, shared_memory_id_
,
33 shared_memory_offset_
);
34 decoder_
->set_unsafe_es3_apis_enabled(true);
35 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
36 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_SYNC_STATUS
),
37 result
->GetNumResults());
38 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
39 decoder_
->set_unsafe_es3_apis_enabled(false);
40 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
43 TEST_P(GLES2DecoderTest2
, GetTexParameterfvValidArgs
) {
44 EXPECT_CALL(*gl_
, GetError())
45 .WillOnce(Return(GL_NO_ERROR
))
46 .WillOnce(Return(GL_NO_ERROR
))
47 .RetiresOnSaturation();
48 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(true);
49 typedef cmds::GetTexParameterfv::Result Result
;
50 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
51 EXPECT_CALL(*gl_
, GetTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
54 cmds::GetTexParameterfv cmd
;
55 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
56 shared_memory_offset_
);
57 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
59 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
60 result
->GetNumResults());
61 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
64 TEST_P(GLES2DecoderTest2
, GetTexParameterfvInvalidArgs0_0
) {
65 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
66 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
67 cmds::GetTexParameterfv::Result
* result
=
68 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
70 cmds::GetTexParameterfv cmd
;
71 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
72 shared_memory_offset_
);
73 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
74 EXPECT_EQ(0u, result
->size
);
75 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
78 TEST_P(GLES2DecoderTest2
, GetTexParameterfvInvalidArgs1_0
) {
79 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
80 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
81 cmds::GetTexParameterfv::Result
* result
=
82 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
84 cmds::GetTexParameterfv cmd
;
85 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, shared_memory_id_
,
86 shared_memory_offset_
);
87 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
88 EXPECT_EQ(0u, result
->size
);
89 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
92 TEST_P(GLES2DecoderTest2
, GetTexParameterfvInvalidArgs2_0
) {
93 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
94 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
95 cmds::GetTexParameterfv::Result
* result
=
96 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
98 cmds::GetTexParameterfv cmd
;
99 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
100 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
101 EXPECT_EQ(0u, result
->size
);
104 TEST_P(GLES2DecoderTest2
, GetTexParameterfvInvalidArgs2_1
) {
105 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
106 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
107 cmds::GetTexParameterfv::Result
* result
=
108 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
110 cmds::GetTexParameterfv cmd
;
111 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
112 kInvalidSharedMemoryOffset
);
113 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
114 EXPECT_EQ(0u, result
->size
);
117 TEST_P(GLES2DecoderTest2
, GetTexParameterivValidArgs
) {
118 EXPECT_CALL(*gl_
, GetError())
119 .WillOnce(Return(GL_NO_ERROR
))
120 .WillOnce(Return(GL_NO_ERROR
))
121 .RetiresOnSaturation();
122 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(true);
123 typedef cmds::GetTexParameteriv::Result Result
;
124 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
125 EXPECT_CALL(*gl_
, GetTexParameteriv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
128 cmds::GetTexParameteriv cmd
;
129 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
130 shared_memory_offset_
);
131 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
133 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
134 result
->GetNumResults());
135 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
138 TEST_P(GLES2DecoderTest2
, GetTexParameterivInvalidArgs0_0
) {
139 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
140 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
141 cmds::GetTexParameteriv::Result
* result
=
142 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
144 cmds::GetTexParameteriv cmd
;
145 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
146 shared_memory_offset_
);
147 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
148 EXPECT_EQ(0u, result
->size
);
149 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
152 TEST_P(GLES2DecoderTest2
, GetTexParameterivInvalidArgs1_0
) {
153 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
154 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
155 cmds::GetTexParameteriv::Result
* result
=
156 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
158 cmds::GetTexParameteriv cmd
;
159 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, shared_memory_id_
,
160 shared_memory_offset_
);
161 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
162 EXPECT_EQ(0u, result
->size
);
163 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
166 TEST_P(GLES2DecoderTest2
, GetTexParameterivInvalidArgs2_0
) {
167 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
168 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
169 cmds::GetTexParameteriv::Result
* result
=
170 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
172 cmds::GetTexParameteriv cmd
;
173 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
174 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
175 EXPECT_EQ(0u, result
->size
);
178 TEST_P(GLES2DecoderTest2
, GetTexParameterivInvalidArgs2_1
) {
179 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
180 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
181 cmds::GetTexParameteriv::Result
* result
=
182 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
184 cmds::GetTexParameteriv cmd
;
185 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
186 kInvalidSharedMemoryOffset
);
187 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
188 EXPECT_EQ(0u, result
->size
);
190 // TODO(gman): GetTransformFeedbackVarying
192 // TODO(gman): GetUniformBlockIndex
194 // TODO(gman): GetUniformfv
196 // TODO(gman): GetUniformiv
198 // TODO(gman): GetUniformIndices
200 // TODO(gman): GetUniformLocation
202 TEST_P(GLES2DecoderTest2
, GetVertexAttribfvValidArgs
) {
203 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(true);
204 typedef cmds::GetVertexAttribfv::Result Result
;
205 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
207 cmds::GetVertexAttribfv cmd
;
208 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
209 shared_memory_offset_
);
210 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
211 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
212 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
),
213 result
->GetNumResults());
214 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
217 TEST_P(GLES2DecoderTest2
, GetVertexAttribfvInvalidArgs2_0
) {
218 EXPECT_CALL(*gl_
, GetVertexAttribfv(_
, _
, _
)).Times(0);
219 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(false);
220 cmds::GetVertexAttribfv::Result
* result
=
221 static_cast<cmds::GetVertexAttribfv::Result
*>(shared_memory_address_
);
223 cmds::GetVertexAttribfv cmd
;
224 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, kInvalidSharedMemoryId
, 0);
225 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
226 EXPECT_EQ(0u, result
->size
);
229 TEST_P(GLES2DecoderTest2
, GetVertexAttribfvInvalidArgs2_1
) {
230 EXPECT_CALL(*gl_
, GetVertexAttribfv(_
, _
, _
)).Times(0);
231 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(false);
232 cmds::GetVertexAttribfv::Result
* result
=
233 static_cast<cmds::GetVertexAttribfv::Result
*>(shared_memory_address_
);
235 cmds::GetVertexAttribfv cmd
;
236 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
237 kInvalidSharedMemoryOffset
);
238 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
239 EXPECT_EQ(0u, result
->size
);
242 TEST_P(GLES2DecoderTest2
, GetVertexAttribivValidArgs
) {
243 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(true);
244 typedef cmds::GetVertexAttribiv::Result Result
;
245 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
247 cmds::GetVertexAttribiv cmd
;
248 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
249 shared_memory_offset_
);
250 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
251 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
252 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
),
253 result
->GetNumResults());
254 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
257 TEST_P(GLES2DecoderTest2
, GetVertexAttribivInvalidArgs2_0
) {
258 EXPECT_CALL(*gl_
, GetVertexAttribiv(_
, _
, _
)).Times(0);
259 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(false);
260 cmds::GetVertexAttribiv::Result
* result
=
261 static_cast<cmds::GetVertexAttribiv::Result
*>(shared_memory_address_
);
263 cmds::GetVertexAttribiv cmd
;
264 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, kInvalidSharedMemoryId
, 0);
265 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
266 EXPECT_EQ(0u, result
->size
);
269 TEST_P(GLES2DecoderTest2
, GetVertexAttribivInvalidArgs2_1
) {
270 EXPECT_CALL(*gl_
, GetVertexAttribiv(_
, _
, _
)).Times(0);
271 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(false);
272 cmds::GetVertexAttribiv::Result
* result
=
273 static_cast<cmds::GetVertexAttribiv::Result
*>(shared_memory_address_
);
275 cmds::GetVertexAttribiv cmd
;
276 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
277 kInvalidSharedMemoryOffset
);
278 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
279 EXPECT_EQ(0u, result
->size
);
281 // TODO(gman): GetVertexAttribPointerv
283 TEST_P(GLES2DecoderTest2
, HintValidArgs
) {
284 EXPECT_CALL(*gl_
, Hint(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
));
285 SpecializedSetup
<cmds::Hint
, 0>(true);
287 cmd
.Init(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
);
288 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
289 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
292 TEST_P(GLES2DecoderTest2
, HintInvalidArgs0_0
) {
293 EXPECT_CALL(*gl_
, Hint(_
, _
)).Times(0);
294 SpecializedSetup
<cmds::Hint
, 0>(false);
296 cmd
.Init(GL_PERSPECTIVE_CORRECTION_HINT
, GL_FASTEST
);
297 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
298 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
300 // TODO(gman): InvalidateFramebufferImmediate
301 // TODO(gman): InvalidateSubFramebufferImmediate
303 TEST_P(GLES2DecoderTest2
, IsBufferValidArgs
) {
304 SpecializedSetup
<cmds::IsBuffer
, 0>(true);
306 cmd
.Init(client_buffer_id_
, shared_memory_id_
, shared_memory_offset_
);
307 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
308 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
311 TEST_P(GLES2DecoderTest2
, IsBufferInvalidArgsBadSharedMemoryId
) {
312 SpecializedSetup
<cmds::IsBuffer
, 0>(false);
314 cmd
.Init(client_buffer_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
315 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
316 cmd
.Init(client_buffer_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
317 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
320 TEST_P(GLES2DecoderTest2
, IsEnabledValidArgs
) {
321 SpecializedSetup
<cmds::IsEnabled
, 0>(true);
323 cmd
.Init(GL_BLEND
, shared_memory_id_
, shared_memory_offset_
);
324 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
325 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
328 TEST_P(GLES2DecoderTest2
, IsEnabledInvalidArgs0_0
) {
329 EXPECT_CALL(*gl_
, IsEnabled(_
)).Times(0);
330 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
332 cmd
.Init(GL_CLIP_PLANE0
, shared_memory_id_
, shared_memory_offset_
);
333 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
334 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
337 TEST_P(GLES2DecoderTest2
, IsEnabledInvalidArgs0_1
) {
338 EXPECT_CALL(*gl_
, IsEnabled(_
)).Times(0);
339 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
341 cmd
.Init(GL_POINT_SPRITE
, shared_memory_id_
, shared_memory_offset_
);
342 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
343 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
346 TEST_P(GLES2DecoderTest2
, IsEnabledInvalidArgsBadSharedMemoryId
) {
347 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
349 cmd
.Init(GL_BLEND
, kInvalidSharedMemoryId
, shared_memory_offset_
);
350 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
351 cmd
.Init(GL_BLEND
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
352 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
355 TEST_P(GLES2DecoderTest2
, IsFramebufferValidArgs
) {
356 SpecializedSetup
<cmds::IsFramebuffer
, 0>(true);
357 cmds::IsFramebuffer cmd
;
358 cmd
.Init(client_framebuffer_id_
, shared_memory_id_
, shared_memory_offset_
);
359 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
360 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
363 TEST_P(GLES2DecoderTest2
, IsFramebufferInvalidArgsBadSharedMemoryId
) {
364 SpecializedSetup
<cmds::IsFramebuffer
, 0>(false);
365 cmds::IsFramebuffer cmd
;
366 cmd
.Init(client_framebuffer_id_
, kInvalidSharedMemoryId
,
367 shared_memory_offset_
);
368 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
369 cmd
.Init(client_framebuffer_id_
, shared_memory_id_
,
370 kInvalidSharedMemoryOffset
);
371 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
374 TEST_P(GLES2DecoderTest2
, IsProgramValidArgs
) {
375 SpecializedSetup
<cmds::IsProgram
, 0>(true);
377 cmd
.Init(client_program_id_
, shared_memory_id_
, shared_memory_offset_
);
378 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
379 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
382 TEST_P(GLES2DecoderTest2
, IsProgramInvalidArgsBadSharedMemoryId
) {
383 SpecializedSetup
<cmds::IsProgram
, 0>(false);
385 cmd
.Init(client_program_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
386 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
387 cmd
.Init(client_program_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
388 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
391 TEST_P(GLES2DecoderTest2
, IsRenderbufferValidArgs
) {
392 SpecializedSetup
<cmds::IsRenderbuffer
, 0>(true);
393 cmds::IsRenderbuffer cmd
;
394 cmd
.Init(client_renderbuffer_id_
, shared_memory_id_
, shared_memory_offset_
);
395 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
396 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
399 TEST_P(GLES2DecoderTest2
, IsRenderbufferInvalidArgsBadSharedMemoryId
) {
400 SpecializedSetup
<cmds::IsRenderbuffer
, 0>(false);
401 cmds::IsRenderbuffer cmd
;
402 cmd
.Init(client_renderbuffer_id_
, kInvalidSharedMemoryId
,
403 shared_memory_offset_
);
404 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
405 cmd
.Init(client_renderbuffer_id_
, shared_memory_id_
,
406 kInvalidSharedMemoryOffset
);
407 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
410 TEST_P(GLES2DecoderTest2
, IsSamplerValidArgs
) {
411 SpecializedSetup
<cmds::IsSampler
, 0>(true);
413 cmd
.Init(client_sampler_id_
, shared_memory_id_
, shared_memory_offset_
);
414 decoder_
->set_unsafe_es3_apis_enabled(true);
415 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
416 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
417 decoder_
->set_unsafe_es3_apis_enabled(false);
418 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
421 TEST_P(GLES2DecoderTest2
, IsSamplerInvalidArgsBadSharedMemoryId
) {
422 SpecializedSetup
<cmds::IsSampler
, 0>(false);
423 decoder_
->set_unsafe_es3_apis_enabled(true);
425 cmd
.Init(client_sampler_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
426 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
427 cmd
.Init(client_sampler_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
428 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
429 decoder_
->set_unsafe_es3_apis_enabled(true);
432 TEST_P(GLES2DecoderTest2
, IsShaderValidArgs
) {
433 SpecializedSetup
<cmds::IsShader
, 0>(true);
435 cmd
.Init(client_shader_id_
, shared_memory_id_
, shared_memory_offset_
);
436 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
437 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
440 TEST_P(GLES2DecoderTest2
, IsShaderInvalidArgsBadSharedMemoryId
) {
441 SpecializedSetup
<cmds::IsShader
, 0>(false);
443 cmd
.Init(client_shader_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
444 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
445 cmd
.Init(client_shader_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
446 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
449 TEST_P(GLES2DecoderTest2
, IsSyncValidArgs
) {
450 SpecializedSetup
<cmds::IsSync
, 0>(true);
452 cmd
.Init(client_sync_id_
, shared_memory_id_
, shared_memory_offset_
);
453 decoder_
->set_unsafe_es3_apis_enabled(true);
454 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
455 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
456 decoder_
->set_unsafe_es3_apis_enabled(false);
457 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
460 TEST_P(GLES2DecoderTest2
, IsSyncInvalidArgsBadSharedMemoryId
) {
461 SpecializedSetup
<cmds::IsSync
, 0>(false);
462 decoder_
->set_unsafe_es3_apis_enabled(true);
464 cmd
.Init(client_sync_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
465 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
466 cmd
.Init(client_sync_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
467 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
468 decoder_
->set_unsafe_es3_apis_enabled(true);
471 TEST_P(GLES2DecoderTest2
, IsTextureValidArgs
) {
472 SpecializedSetup
<cmds::IsTexture
, 0>(true);
474 cmd
.Init(client_texture_id_
, shared_memory_id_
, shared_memory_offset_
);
475 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
476 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
479 TEST_P(GLES2DecoderTest2
, IsTextureInvalidArgsBadSharedMemoryId
) {
480 SpecializedSetup
<cmds::IsTexture
, 0>(false);
482 cmd
.Init(client_texture_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
483 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
484 cmd
.Init(client_texture_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
485 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
488 TEST_P(GLES2DecoderTest2
, IsTransformFeedbackValidArgs
) {
489 SpecializedSetup
<cmds::IsTransformFeedback
, 0>(true);
490 cmds::IsTransformFeedback cmd
;
491 cmd
.Init(client_transformfeedback_id_
, shared_memory_id_
,
492 shared_memory_offset_
);
493 decoder_
->set_unsafe_es3_apis_enabled(true);
494 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
495 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
496 decoder_
->set_unsafe_es3_apis_enabled(false);
497 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
500 TEST_P(GLES2DecoderTest2
, IsTransformFeedbackInvalidArgsBadSharedMemoryId
) {
501 SpecializedSetup
<cmds::IsTransformFeedback
, 0>(false);
502 decoder_
->set_unsafe_es3_apis_enabled(true);
503 cmds::IsTransformFeedback cmd
;
504 cmd
.Init(client_transformfeedback_id_
, kInvalidSharedMemoryId
,
505 shared_memory_offset_
);
506 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
507 cmd
.Init(client_transformfeedback_id_
, shared_memory_id_
,
508 kInvalidSharedMemoryOffset
);
509 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
510 decoder_
->set_unsafe_es3_apis_enabled(true);
513 TEST_P(GLES2DecoderTest2
, LineWidthValidArgs
) {
514 EXPECT_CALL(*gl_
, LineWidth(0.5f
));
515 SpecializedSetup
<cmds::LineWidth
, 0>(true);
518 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
519 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
522 TEST_P(GLES2DecoderTest2
, LineWidthInvalidValue0_0
) {
523 SpecializedSetup
<cmds::LineWidth
, 0>(false);
526 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
527 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
530 TEST_P(GLES2DecoderTest2
, LineWidthNaNValue0
) {
531 SpecializedSetup
<cmds::LineWidth
, 0>(false);
534 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
535 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
538 TEST_P(GLES2DecoderTest2
, LinkProgramValidArgs
) {
539 EXPECT_CALL(*gl_
, LinkProgram(kServiceProgramId
));
540 SpecializedSetup
<cmds::LinkProgram
, 0>(true);
541 cmds::LinkProgram cmd
;
542 cmd
.Init(client_program_id_
);
543 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
544 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
547 TEST_P(GLES2DecoderTest2
, PauseTransformFeedbackValidArgs
) {
548 EXPECT_CALL(*gl_
, PauseTransformFeedback());
549 SpecializedSetup
<cmds::PauseTransformFeedback
, 0>(true);
550 cmds::PauseTransformFeedback cmd
;
552 decoder_
->set_unsafe_es3_apis_enabled(true);
553 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
554 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
555 decoder_
->set_unsafe_es3_apis_enabled(false);
556 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
558 // TODO(gman): PixelStorei
560 TEST_P(GLES2DecoderTest2
, PolygonOffsetValidArgs
) {
561 EXPECT_CALL(*gl_
, PolygonOffset(1, 2));
562 SpecializedSetup
<cmds::PolygonOffset
, 0>(true);
563 cmds::PolygonOffset cmd
;
565 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
566 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
569 TEST_P(GLES2DecoderTest2
, ReadBufferValidArgs
) {
570 EXPECT_CALL(*gl_
, ReadBuffer(1));
571 SpecializedSetup
<cmds::ReadBuffer
, 0>(true);
572 cmds::ReadBuffer cmd
;
574 decoder_
->set_unsafe_es3_apis_enabled(true);
575 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
576 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
577 decoder_
->set_unsafe_es3_apis_enabled(false);
578 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
580 // TODO(gman): ReadPixels
582 // TODO(gman): ReleaseShaderCompiler
584 TEST_P(GLES2DecoderTest2
, RenderbufferStorageValidArgs
) {
585 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(true);
586 cmds::RenderbufferStorage cmd
;
587 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, 3, 4);
588 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
589 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
592 TEST_P(GLES2DecoderTest2
, RenderbufferStorageInvalidArgs0_0
) {
593 EXPECT_CALL(*gl_
, RenderbufferStorageEXT(_
, _
, _
, _
)).Times(0);
594 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(false);
595 cmds::RenderbufferStorage cmd
;
596 cmd
.Init(GL_FRAMEBUFFER
, GL_RGBA4
, 3, 4);
597 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
598 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
601 TEST_P(GLES2DecoderTest2
, RenderbufferStorageInvalidArgs2_0
) {
602 EXPECT_CALL(*gl_
, RenderbufferStorageEXT(_
, _
, _
, _
)).Times(0);
603 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(false);
604 cmds::RenderbufferStorage cmd
;
605 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, -1, 4);
606 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
607 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
610 TEST_P(GLES2DecoderTest2
, RenderbufferStorageInvalidArgs3_0
) {
611 EXPECT_CALL(*gl_
, RenderbufferStorageEXT(_
, _
, _
, _
)).Times(0);
612 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(false);
613 cmds::RenderbufferStorage cmd
;
614 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, 3, -1);
615 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
616 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
619 TEST_P(GLES2DecoderTest2
, ResumeTransformFeedbackValidArgs
) {
620 EXPECT_CALL(*gl_
, ResumeTransformFeedback());
621 SpecializedSetup
<cmds::ResumeTransformFeedback
, 0>(true);
622 cmds::ResumeTransformFeedback cmd
;
624 decoder_
->set_unsafe_es3_apis_enabled(true);
625 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
626 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
627 decoder_
->set_unsafe_es3_apis_enabled(false);
628 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
631 TEST_P(GLES2DecoderTest2
, SampleCoverageValidArgs
) {
632 EXPECT_CALL(*gl_
, SampleCoverage(1, true));
633 SpecializedSetup
<cmds::SampleCoverage
, 0>(true);
634 cmds::SampleCoverage cmd
;
636 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
637 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
640 TEST_P(GLES2DecoderTest2
, SamplerParameterfValidArgs
) {
641 EXPECT_CALL(*gl_
, SamplerParameterf(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
643 SpecializedSetup
<cmds::SamplerParameterf
, 0>(true);
644 cmds::SamplerParameterf cmd
;
645 cmd
.Init(client_sampler_id_
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
646 decoder_
->set_unsafe_es3_apis_enabled(true);
647 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
648 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
649 decoder_
->set_unsafe_es3_apis_enabled(false);
650 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
653 TEST_P(GLES2DecoderTest2
, SamplerParameterfvImmediateValidArgs
) {
654 cmds::SamplerParameterfvImmediate
& cmd
=
655 *GetImmediateAs
<cmds::SamplerParameterfvImmediate
>();
656 SpecializedSetup
<cmds::SamplerParameterfvImmediate
, 0>(true);
660 cmd
.Init(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
661 EXPECT_CALL(*gl_
, SamplerParameterf(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
662 *reinterpret_cast<GLfloat
*>(
663 ImmediateDataAddress(&cmd
))));
664 decoder_
->set_unsafe_es3_apis_enabled(true);
665 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
666 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
667 decoder_
->set_unsafe_es3_apis_enabled(false);
668 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
671 TEST_P(GLES2DecoderTest2
, SamplerParameteriValidArgs
) {
672 EXPECT_CALL(*gl_
, SamplerParameteri(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
674 SpecializedSetup
<cmds::SamplerParameteri
, 0>(true);
675 cmds::SamplerParameteri cmd
;
676 cmd
.Init(client_sampler_id_
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
677 decoder_
->set_unsafe_es3_apis_enabled(true);
678 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
679 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
680 decoder_
->set_unsafe_es3_apis_enabled(false);
681 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
684 TEST_P(GLES2DecoderTest2
, SamplerParameterivImmediateValidArgs
) {
685 cmds::SamplerParameterivImmediate
& cmd
=
686 *GetImmediateAs
<cmds::SamplerParameterivImmediate
>();
687 SpecializedSetup
<cmds::SamplerParameterivImmediate
, 0>(true);
691 cmd
.Init(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
692 EXPECT_CALL(*gl_
, SamplerParameteri(
693 kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
694 *reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
695 decoder_
->set_unsafe_es3_apis_enabled(true);
696 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
697 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
698 decoder_
->set_unsafe_es3_apis_enabled(false);
699 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
702 TEST_P(GLES2DecoderTest2
, ScissorValidArgs
) {
703 EXPECT_CALL(*gl_
, Scissor(1, 2, 3, 4));
704 SpecializedSetup
<cmds::Scissor
, 0>(true);
706 cmd
.Init(1, 2, 3, 4);
707 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
708 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
711 TEST_P(GLES2DecoderTest2
, ScissorInvalidArgs2_0
) {
712 EXPECT_CALL(*gl_
, Scissor(_
, _
, _
, _
)).Times(0);
713 SpecializedSetup
<cmds::Scissor
, 0>(false);
715 cmd
.Init(1, 2, -1, 4);
716 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
717 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
720 TEST_P(GLES2DecoderTest2
, ScissorInvalidArgs3_0
) {
721 EXPECT_CALL(*gl_
, Scissor(_
, _
, _
, _
)).Times(0);
722 SpecializedSetup
<cmds::Scissor
, 0>(false);
724 cmd
.Init(1, 2, 3, -1);
725 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
726 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
728 // TODO(gman): ShaderBinary
730 TEST_P(GLES2DecoderTest2
, ShaderSourceBucketValidArgs
) {
731 const uint32 kBucketId
= 123;
732 const char kSource0
[] = "hello";
733 const char* kSource
[] = {kSource0
};
734 const char kValidStrEnd
= 0;
735 SetBucketAsCStrings(kBucketId
, 1, kSource
, 1, kValidStrEnd
);
736 cmds::ShaderSourceBucket cmd
;
737 cmd
.Init(client_shader_id_
, kBucketId
);
738 decoder_
->set_unsafe_es3_apis_enabled(true);
739 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
742 TEST_P(GLES2DecoderTest2
, ShaderSourceBucketInvalidArgs
) {
743 const uint32 kBucketId
= 123;
744 const char kSource0
[] = "hello";
745 const char* kSource
[] = {kSource0
};
746 const char kValidStrEnd
= 0;
747 decoder_
->set_unsafe_es3_apis_enabled(true);
748 cmds::ShaderSourceBucket cmd
;
750 cmd
.Init(client_shader_id_
, kBucketId
);
751 EXPECT_NE(error::kNoError
, ExecuteCmd(cmd
));
752 // Test invalid client.
753 SetBucketAsCStrings(kBucketId
, 1, kSource
, 1, kValidStrEnd
);
754 cmd
.Init(kInvalidClientId
, kBucketId
);
755 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
756 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
759 TEST_P(GLES2DecoderTest2
, ShaderSourceBucketInvalidHeader
) {
760 const uint32 kBucketId
= 123;
761 const char kSource0
[] = "hello";
762 const char* kSource
[] = {kSource0
};
763 const char kValidStrEnd
= 0;
764 const GLsizei kCount
= static_cast<GLsizei
>(arraysize(kSource
));
765 const GLsizei kTests
[] = {
766 kCount
+ 1, 0, std::numeric_limits
<GLsizei
>::max(), -1,
768 decoder_
->set_unsafe_es3_apis_enabled(true);
769 for (size_t ii
= 0; ii
< arraysize(kTests
); ++ii
) {
770 SetBucketAsCStrings(kBucketId
, 1, kSource
, kTests
[ii
], kValidStrEnd
);
771 cmds::ShaderSourceBucket cmd
;
772 cmd
.Init(client_shader_id_
, kBucketId
);
773 EXPECT_EQ(error::kInvalidArguments
, ExecuteCmd(cmd
));
777 TEST_P(GLES2DecoderTest2
, ShaderSourceBucketInvalidStringEnding
) {
778 const uint32 kBucketId
= 123;
779 const char kSource0
[] = "hello";
780 const char* kSource
[] = {kSource0
};
781 const char kInvalidStrEnd
= '*';
782 SetBucketAsCStrings(kBucketId
, 1, kSource
, 1, kInvalidStrEnd
);
783 cmds::ShaderSourceBucket cmd
;
784 cmd
.Init(client_shader_id_
, kBucketId
);
785 decoder_
->set_unsafe_es3_apis_enabled(true);
786 EXPECT_EQ(error::kInvalidArguments
, ExecuteCmd(cmd
));
789 TEST_P(GLES2DecoderTest2
, StencilFuncValidArgs
) {
790 EXPECT_CALL(*gl_
, StencilFunc(GL_NEVER
, 2, 3));
791 SpecializedSetup
<cmds::StencilFunc
, 0>(true);
792 cmds::StencilFunc cmd
;
793 cmd
.Init(GL_NEVER
, 2, 3);
794 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
795 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
798 TEST_P(GLES2DecoderTest2
, StencilFuncSeparateValidArgs
) {
799 EXPECT_CALL(*gl_
, StencilFuncSeparate(GL_FRONT
, GL_NEVER
, 3, 4));
800 SpecializedSetup
<cmds::StencilFuncSeparate
, 0>(true);
801 cmds::StencilFuncSeparate cmd
;
802 cmd
.Init(GL_FRONT
, GL_NEVER
, 3, 4);
803 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
804 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
807 TEST_P(GLES2DecoderTest2
, StencilMaskValidArgs
) {
808 SpecializedSetup
<cmds::StencilMask
, 0>(true);
809 cmds::StencilMask cmd
;
811 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
812 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
815 TEST_P(GLES2DecoderTest2
, StencilMaskSeparateValidArgs
) {
816 SpecializedSetup
<cmds::StencilMaskSeparate
, 0>(true);
817 cmds::StencilMaskSeparate cmd
;
818 cmd
.Init(GL_FRONT
, 2);
819 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
820 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
823 TEST_P(GLES2DecoderTest2
, StencilOpValidArgs
) {
824 EXPECT_CALL(*gl_
, StencilOp(GL_KEEP
, GL_INCR
, GL_KEEP
));
825 SpecializedSetup
<cmds::StencilOp
, 0>(true);
827 cmd
.Init(GL_KEEP
, GL_INCR
, GL_KEEP
);
828 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
829 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
832 TEST_P(GLES2DecoderTest2
, StencilOpSeparateValidArgs
) {
833 EXPECT_CALL(*gl_
, StencilOpSeparate(GL_FRONT
, GL_INCR
, GL_KEEP
, GL_KEEP
));
834 SpecializedSetup
<cmds::StencilOpSeparate
, 0>(true);
835 cmds::StencilOpSeparate cmd
;
836 cmd
.Init(GL_FRONT
, GL_INCR
, GL_KEEP
, GL_KEEP
);
837 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
838 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
840 // TODO(gman): TexImage2D
842 // TODO(gman): TexImage3D
844 TEST_P(GLES2DecoderTest2
, TexParameterfValidArgs
) {
846 TexParameterf(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
));
847 SpecializedSetup
<cmds::TexParameterf
, 0>(true);
848 cmds::TexParameterf cmd
;
849 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
850 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
851 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
854 TEST_P(GLES2DecoderTest2
, TexParameterfInvalidArgs0_0
) {
855 EXPECT_CALL(*gl_
, TexParameterf(_
, _
, _
)).Times(0);
856 SpecializedSetup
<cmds::TexParameterf
, 0>(false);
857 cmds::TexParameterf cmd
;
858 cmd
.Init(GL_TEXTURE_1D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
859 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
860 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
863 TEST_P(GLES2DecoderTest2
, TexParameterfInvalidArgs0_1
) {
864 EXPECT_CALL(*gl_
, TexParameterf(_
, _
, _
)).Times(0);
865 SpecializedSetup
<cmds::TexParameterf
, 0>(false);
866 cmds::TexParameterf cmd
;
867 cmd
.Init(GL_TEXTURE_3D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
868 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
869 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
872 TEST_P(GLES2DecoderTest2
, TexParameterfInvalidArgs1_0
) {
873 EXPECT_CALL(*gl_
, TexParameterf(_
, _
, _
)).Times(0);
874 SpecializedSetup
<cmds::TexParameterf
, 0>(false);
875 cmds::TexParameterf cmd
;
876 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, GL_NEAREST
);
877 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
878 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
881 TEST_P(GLES2DecoderTest2
, TexParameterfvImmediateValidArgs
) {
882 cmds::TexParameterfvImmediate
& cmd
=
883 *GetImmediateAs
<cmds::TexParameterfvImmediate
>();
884 SpecializedSetup
<cmds::TexParameterfvImmediate
, 0>(true);
888 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
891 TexParameterf(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
892 *reinterpret_cast<GLfloat
*>(ImmediateDataAddress(&cmd
))));
893 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
894 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
897 TEST_P(GLES2DecoderTest2
, TexParameterfvImmediateInvalidArgs0_0
) {
898 cmds::TexParameterfvImmediate
& cmd
=
899 *GetImmediateAs
<cmds::TexParameterfvImmediate
>();
900 EXPECT_CALL(*gl_
, TexParameterf(_
, _
, _
)).Times(0);
902 SpecializedSetup
<cmds::TexParameterfvImmediate
, 0>(false);
906 cmd
.Init(GL_TEXTURE_1D
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
907 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
909 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
912 TEST_P(GLES2DecoderTest2
, TexParameterfvImmediateInvalidArgs0_1
) {
913 cmds::TexParameterfvImmediate
& cmd
=
914 *GetImmediateAs
<cmds::TexParameterfvImmediate
>();
915 EXPECT_CALL(*gl_
, TexParameterf(_
, _
, _
)).Times(0);
917 SpecializedSetup
<cmds::TexParameterfvImmediate
, 0>(false);
921 cmd
.Init(GL_TEXTURE_3D
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
922 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
924 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
927 TEST_P(GLES2DecoderTest2
, TexParameterfvImmediateInvalidArgs1_0
) {
928 cmds::TexParameterfvImmediate
& cmd
=
929 *GetImmediateAs
<cmds::TexParameterfvImmediate
>();
930 EXPECT_CALL(*gl_
, TexParameterf(_
, _
, _
)).Times(0);
932 SpecializedSetup
<cmds::TexParameterfvImmediate
, 0>(false);
936 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, &temp
[0]);
937 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
939 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
942 TEST_P(GLES2DecoderTest2
, TexParameteriValidArgs
) {
944 TexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
));
945 SpecializedSetup
<cmds::TexParameteri
, 0>(true);
946 cmds::TexParameteri cmd
;
947 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
948 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
949 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
952 TEST_P(GLES2DecoderTest2
, TexParameteriInvalidArgs0_0
) {
953 EXPECT_CALL(*gl_
, TexParameteri(_
, _
, _
)).Times(0);
954 SpecializedSetup
<cmds::TexParameteri
, 0>(false);
955 cmds::TexParameteri cmd
;
956 cmd
.Init(GL_TEXTURE_1D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
957 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
958 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
961 TEST_P(GLES2DecoderTest2
, TexParameteriInvalidArgs0_1
) {
962 EXPECT_CALL(*gl_
, TexParameteri(_
, _
, _
)).Times(0);
963 SpecializedSetup
<cmds::TexParameteri
, 0>(false);
964 cmds::TexParameteri cmd
;
965 cmd
.Init(GL_TEXTURE_3D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
966 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
967 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
970 TEST_P(GLES2DecoderTest2
, TexParameteriInvalidArgs1_0
) {
971 EXPECT_CALL(*gl_
, TexParameteri(_
, _
, _
)).Times(0);
972 SpecializedSetup
<cmds::TexParameteri
, 0>(false);
973 cmds::TexParameteri cmd
;
974 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, GL_NEAREST
);
975 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
976 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
979 TEST_P(GLES2DecoderTest2
, TexParameterivImmediateValidArgs
) {
980 cmds::TexParameterivImmediate
& cmd
=
981 *GetImmediateAs
<cmds::TexParameterivImmediate
>();
982 SpecializedSetup
<cmds::TexParameterivImmediate
, 0>(true);
986 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
987 EXPECT_CALL(*gl_
, TexParameteri(
988 GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
989 *reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
990 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
991 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
994 TEST_P(GLES2DecoderTest2
, TexParameterivImmediateInvalidArgs0_0
) {
995 cmds::TexParameterivImmediate
& cmd
=
996 *GetImmediateAs
<cmds::TexParameterivImmediate
>();
997 EXPECT_CALL(*gl_
, TexParameteri(_
, _
, _
)).Times(0);
999 SpecializedSetup
<cmds::TexParameterivImmediate
, 0>(false);
1003 cmd
.Init(GL_TEXTURE_1D
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
1004 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1006 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1009 TEST_P(GLES2DecoderTest2
, TexParameterivImmediateInvalidArgs0_1
) {
1010 cmds::TexParameterivImmediate
& cmd
=
1011 *GetImmediateAs
<cmds::TexParameterivImmediate
>();
1012 EXPECT_CALL(*gl_
, TexParameteri(_
, _
, _
)).Times(0);
1014 SpecializedSetup
<cmds::TexParameterivImmediate
, 0>(false);
1018 cmd
.Init(GL_TEXTURE_3D
, GL_TEXTURE_MAG_FILTER
, &temp
[0]);
1019 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1021 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1024 TEST_P(GLES2DecoderTest2
, TexParameterivImmediateInvalidArgs1_0
) {
1025 cmds::TexParameterivImmediate
& cmd
=
1026 *GetImmediateAs
<cmds::TexParameterivImmediate
>();
1027 EXPECT_CALL(*gl_
, TexParameteri(_
, _
, _
)).Times(0);
1029 SpecializedSetup
<cmds::TexParameterivImmediate
, 0>(false);
1033 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, &temp
[0]);
1034 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1036 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1039 TEST_P(GLES2DecoderTest2
, TexStorage3DValidArgs
) {
1040 EXPECT_CALL(*gl_
, TexStorage3D(GL_TEXTURE_3D
, 2, GL_RGB565
, 4, 5, 6));
1041 SpecializedSetup
<cmds::TexStorage3D
, 0>(true);
1042 cmds::TexStorage3D cmd
;
1043 cmd
.Init(GL_TEXTURE_3D
, 2, GL_RGB565
, 4, 5, 6);
1044 decoder_
->set_unsafe_es3_apis_enabled(true);
1045 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1046 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1047 decoder_
->set_unsafe_es3_apis_enabled(false);
1048 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1050 // TODO(gman): TexSubImage2D
1052 // TODO(gman): TexSubImage3D
1054 TEST_P(GLES2DecoderTest2
, TransformFeedbackVaryingsBucketValidArgs
) {
1055 EXPECT_CALL(*gl_
, TransformFeedbackVaryings(kServiceProgramId
, 1, _
,
1056 GL_INTERLEAVED_ATTRIBS
));
1057 const uint32 kBucketId
= 123;
1058 const char kSource0
[] = "hello";
1059 const char* kSource
[] = {kSource0
};
1060 const char kValidStrEnd
= 0;
1061 SetBucketAsCStrings(kBucketId
, 1, kSource
, 1, kValidStrEnd
);
1062 cmds::TransformFeedbackVaryingsBucket cmd
;
1063 cmd
.Init(client_program_id_
, kBucketId
, GL_INTERLEAVED_ATTRIBS
);
1064 decoder_
->set_unsafe_es3_apis_enabled(true);
1065 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1066 decoder_
->set_unsafe_es3_apis_enabled(false);
1067 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1070 TEST_P(GLES2DecoderTest2
, TransformFeedbackVaryingsBucketInvalidArgs
) {
1071 const uint32 kBucketId
= 123;
1072 const char kSource0
[] = "hello";
1073 const char* kSource
[] = {kSource0
};
1074 const char kValidStrEnd
= 0;
1075 decoder_
->set_unsafe_es3_apis_enabled(true);
1076 cmds::TransformFeedbackVaryingsBucket cmd
;
1078 cmd
.Init(client_program_id_
, kBucketId
, GL_INTERLEAVED_ATTRIBS
);
1079 EXPECT_NE(error::kNoError
, ExecuteCmd(cmd
));
1080 // Test invalid client.
1081 SetBucketAsCStrings(kBucketId
, 1, kSource
, 1, kValidStrEnd
);
1082 cmd
.Init(kInvalidClientId
, kBucketId
, GL_INTERLEAVED_ATTRIBS
);
1083 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1084 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1087 TEST_P(GLES2DecoderTest2
, TransformFeedbackVaryingsBucketInvalidHeader
) {
1088 const uint32 kBucketId
= 123;
1089 const char kSource0
[] = "hello";
1090 const char* kSource
[] = {kSource0
};
1091 const char kValidStrEnd
= 0;
1092 const GLsizei kCount
= static_cast<GLsizei
>(arraysize(kSource
));
1093 const GLsizei kTests
[] = {
1094 kCount
+ 1, 0, std::numeric_limits
<GLsizei
>::max(), -1,
1096 decoder_
->set_unsafe_es3_apis_enabled(true);
1097 for (size_t ii
= 0; ii
< arraysize(kTests
); ++ii
) {
1098 SetBucketAsCStrings(kBucketId
, 1, kSource
, kTests
[ii
], kValidStrEnd
);
1099 cmds::TransformFeedbackVaryingsBucket cmd
;
1100 cmd
.Init(client_program_id_
, kBucketId
, GL_INTERLEAVED_ATTRIBS
);
1101 EXPECT_EQ(error::kInvalidArguments
, ExecuteCmd(cmd
));
1105 TEST_P(GLES2DecoderTest2
, TransformFeedbackVaryingsBucketInvalidStringEnding
) {
1106 const uint32 kBucketId
= 123;
1107 const char kSource0
[] = "hello";
1108 const char* kSource
[] = {kSource0
};
1109 const char kInvalidStrEnd
= '*';
1110 SetBucketAsCStrings(kBucketId
, 1, kSource
, 1, kInvalidStrEnd
);
1111 cmds::TransformFeedbackVaryingsBucket cmd
;
1112 cmd
.Init(client_program_id_
, kBucketId
, GL_INTERLEAVED_ATTRIBS
);
1113 decoder_
->set_unsafe_es3_apis_enabled(true);
1114 EXPECT_EQ(error::kInvalidArguments
, ExecuteCmd(cmd
));
1117 TEST_P(GLES2DecoderTest2
, Uniform1fValidArgs
) {
1118 EXPECT_CALL(*gl_
, Uniform1fv(1, 1, _
));
1119 SpecializedSetup
<cmds::Uniform1f
, 0>(true);
1120 cmds::Uniform1f cmd
;
1122 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1123 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1126 TEST_P(GLES2DecoderTest2
, Uniform1fvImmediateValidArgs
) {
1127 cmds::Uniform1fvImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform1fvImmediate
>();
1130 Uniform1fv(1, 2, reinterpret_cast<GLfloat
*>(ImmediateDataAddress(&cmd
))));
1131 SpecializedSetup
<cmds::Uniform1fvImmediate
, 0>(true);
1132 GLfloat temp
[1 * 2] = {
1135 cmd
.Init(1, 2, &temp
[0]);
1136 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1137 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1139 // TODO(gman): Uniform1i
1140 // TODO(gman): Uniform1ivImmediate
1142 TEST_P(GLES2DecoderTest2
, Uniform1uiValidArgs
) {
1143 EXPECT_CALL(*gl_
, Uniform1uiv(1, 1, _
));
1144 SpecializedSetup
<cmds::Uniform1ui
, 0>(true);
1145 cmds::Uniform1ui cmd
;
1147 decoder_
->set_unsafe_es3_apis_enabled(true);
1148 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1149 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1150 decoder_
->set_unsafe_es3_apis_enabled(false);
1151 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1154 TEST_P(GLES2DecoderTest2
, Uniform1uivImmediateValidArgs
) {
1155 cmds::Uniform1uivImmediate
& cmd
=
1156 *GetImmediateAs
<cmds::Uniform1uivImmediate
>();
1159 Uniform1uiv(1, 2, reinterpret_cast<GLuint
*>(ImmediateDataAddress(&cmd
))));
1160 SpecializedSetup
<cmds::Uniform1uivImmediate
, 0>(true);
1161 GLuint temp
[1 * 2] = {
1164 cmd
.Init(1, 2, &temp
[0]);
1165 decoder_
->set_unsafe_es3_apis_enabled(true);
1166 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1167 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1168 decoder_
->set_unsafe_es3_apis_enabled(false);
1169 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1172 TEST_P(GLES2DecoderTest2
, Uniform2fValidArgs
) {
1173 EXPECT_CALL(*gl_
, Uniform2fv(1, 1, _
));
1174 SpecializedSetup
<cmds::Uniform2f
, 0>(true);
1175 cmds::Uniform2f cmd
;
1177 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1178 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1181 TEST_P(GLES2DecoderTest2
, Uniform2fvImmediateValidArgs
) {
1182 cmds::Uniform2fvImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform2fvImmediate
>();
1185 Uniform2fv(1, 2, reinterpret_cast<GLfloat
*>(ImmediateDataAddress(&cmd
))));
1186 SpecializedSetup
<cmds::Uniform2fvImmediate
, 0>(true);
1187 GLfloat temp
[2 * 2] = {
1190 cmd
.Init(1, 2, &temp
[0]);
1191 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1192 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1195 TEST_P(GLES2DecoderTest2
, Uniform2iValidArgs
) {
1196 EXPECT_CALL(*gl_
, Uniform2iv(1, 1, _
));
1197 SpecializedSetup
<cmds::Uniform2i
, 0>(true);
1198 cmds::Uniform2i cmd
;
1200 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1201 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1204 TEST_P(GLES2DecoderTest2
, Uniform2ivImmediateValidArgs
) {
1205 cmds::Uniform2ivImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform2ivImmediate
>();
1208 Uniform2iv(1, 2, reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
1209 SpecializedSetup
<cmds::Uniform2ivImmediate
, 0>(true);
1210 GLint temp
[2 * 2] = {
1213 cmd
.Init(1, 2, &temp
[0]);
1214 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1215 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1218 TEST_P(GLES2DecoderTest2
, Uniform2uiValidArgs
) {
1219 EXPECT_CALL(*gl_
, Uniform2uiv(1, 1, _
));
1220 SpecializedSetup
<cmds::Uniform2ui
, 0>(true);
1221 cmds::Uniform2ui cmd
;
1223 decoder_
->set_unsafe_es3_apis_enabled(true);
1224 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1225 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1226 decoder_
->set_unsafe_es3_apis_enabled(false);
1227 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1230 TEST_P(GLES2DecoderTest2
, Uniform2uivImmediateValidArgs
) {
1231 cmds::Uniform2uivImmediate
& cmd
=
1232 *GetImmediateAs
<cmds::Uniform2uivImmediate
>();
1235 Uniform2uiv(1, 2, reinterpret_cast<GLuint
*>(ImmediateDataAddress(&cmd
))));
1236 SpecializedSetup
<cmds::Uniform2uivImmediate
, 0>(true);
1237 GLuint temp
[2 * 2] = {
1240 cmd
.Init(1, 2, &temp
[0]);
1241 decoder_
->set_unsafe_es3_apis_enabled(true);
1242 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1243 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1244 decoder_
->set_unsafe_es3_apis_enabled(false);
1245 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1248 TEST_P(GLES2DecoderTest2
, Uniform3fValidArgs
) {
1249 EXPECT_CALL(*gl_
, Uniform3fv(1, 1, _
));
1250 SpecializedSetup
<cmds::Uniform3f
, 0>(true);
1251 cmds::Uniform3f cmd
;
1252 cmd
.Init(1, 2, 3, 4);
1253 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1254 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1257 TEST_P(GLES2DecoderTest2
, Uniform3fvImmediateValidArgs
) {
1258 cmds::Uniform3fvImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform3fvImmediate
>();
1261 Uniform3fv(1, 2, reinterpret_cast<GLfloat
*>(ImmediateDataAddress(&cmd
))));
1262 SpecializedSetup
<cmds::Uniform3fvImmediate
, 0>(true);
1263 GLfloat temp
[3 * 2] = {
1266 cmd
.Init(1, 2, &temp
[0]);
1267 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1268 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1271 TEST_P(GLES2DecoderTest2
, Uniform3iValidArgs
) {
1272 EXPECT_CALL(*gl_
, Uniform3iv(1, 1, _
));
1273 SpecializedSetup
<cmds::Uniform3i
, 0>(true);
1274 cmds::Uniform3i cmd
;
1275 cmd
.Init(1, 2, 3, 4);
1276 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1277 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1280 TEST_P(GLES2DecoderTest2
, Uniform3ivImmediateValidArgs
) {
1281 cmds::Uniform3ivImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform3ivImmediate
>();
1284 Uniform3iv(1, 2, reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
1285 SpecializedSetup
<cmds::Uniform3ivImmediate
, 0>(true);
1286 GLint temp
[3 * 2] = {
1289 cmd
.Init(1, 2, &temp
[0]);
1290 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1291 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1294 TEST_P(GLES2DecoderTest2
, Uniform3uiValidArgs
) {
1295 EXPECT_CALL(*gl_
, Uniform3uiv(1, 1, _
));
1296 SpecializedSetup
<cmds::Uniform3ui
, 0>(true);
1297 cmds::Uniform3ui cmd
;
1298 cmd
.Init(1, 2, 3, 4);
1299 decoder_
->set_unsafe_es3_apis_enabled(true);
1300 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1301 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1302 decoder_
->set_unsafe_es3_apis_enabled(false);
1303 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1306 TEST_P(GLES2DecoderTest2
, Uniform3uivImmediateValidArgs
) {
1307 cmds::Uniform3uivImmediate
& cmd
=
1308 *GetImmediateAs
<cmds::Uniform3uivImmediate
>();
1311 Uniform3uiv(1, 2, reinterpret_cast<GLuint
*>(ImmediateDataAddress(&cmd
))));
1312 SpecializedSetup
<cmds::Uniform3uivImmediate
, 0>(true);
1313 GLuint temp
[3 * 2] = {
1316 cmd
.Init(1, 2, &temp
[0]);
1317 decoder_
->set_unsafe_es3_apis_enabled(true);
1318 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1319 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1320 decoder_
->set_unsafe_es3_apis_enabled(false);
1321 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1324 TEST_P(GLES2DecoderTest2
, Uniform4fValidArgs
) {
1325 EXPECT_CALL(*gl_
, Uniform4fv(1, 1, _
));
1326 SpecializedSetup
<cmds::Uniform4f
, 0>(true);
1327 cmds::Uniform4f cmd
;
1328 cmd
.Init(1, 2, 3, 4, 5);
1329 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1330 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1333 TEST_P(GLES2DecoderTest2
, Uniform4fvImmediateValidArgs
) {
1334 cmds::Uniform4fvImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform4fvImmediate
>();
1337 Uniform4fv(1, 2, reinterpret_cast<GLfloat
*>(ImmediateDataAddress(&cmd
))));
1338 SpecializedSetup
<cmds::Uniform4fvImmediate
, 0>(true);
1339 GLfloat temp
[4 * 2] = {
1342 cmd
.Init(1, 2, &temp
[0]);
1343 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1344 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1347 TEST_P(GLES2DecoderTest2
, Uniform4iValidArgs
) {
1348 EXPECT_CALL(*gl_
, Uniform4iv(1, 1, _
));
1349 SpecializedSetup
<cmds::Uniform4i
, 0>(true);
1350 cmds::Uniform4i cmd
;
1351 cmd
.Init(1, 2, 3, 4, 5);
1352 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1353 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1356 TEST_P(GLES2DecoderTest2
, Uniform4ivImmediateValidArgs
) {
1357 cmds::Uniform4ivImmediate
& cmd
= *GetImmediateAs
<cmds::Uniform4ivImmediate
>();
1360 Uniform4iv(1, 2, reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
1361 SpecializedSetup
<cmds::Uniform4ivImmediate
, 0>(true);
1362 GLint temp
[4 * 2] = {
1365 cmd
.Init(1, 2, &temp
[0]);
1366 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1367 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1370 TEST_P(GLES2DecoderTest2
, Uniform4uiValidArgs
) {
1371 EXPECT_CALL(*gl_
, Uniform4uiv(1, 1, _
));
1372 SpecializedSetup
<cmds::Uniform4ui
, 0>(true);
1373 cmds::Uniform4ui cmd
;
1374 cmd
.Init(1, 2, 3, 4, 5);
1375 decoder_
->set_unsafe_es3_apis_enabled(true);
1376 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1377 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1378 decoder_
->set_unsafe_es3_apis_enabled(false);
1379 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1382 TEST_P(GLES2DecoderTest2
, Uniform4uivImmediateValidArgs
) {
1383 cmds::Uniform4uivImmediate
& cmd
=
1384 *GetImmediateAs
<cmds::Uniform4uivImmediate
>();
1387 Uniform4uiv(1, 2, reinterpret_cast<GLuint
*>(ImmediateDataAddress(&cmd
))));
1388 SpecializedSetup
<cmds::Uniform4uivImmediate
, 0>(true);
1389 GLuint temp
[4 * 2] = {
1392 cmd
.Init(1, 2, &temp
[0]);
1393 decoder_
->set_unsafe_es3_apis_enabled(true);
1394 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1395 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1396 decoder_
->set_unsafe_es3_apis_enabled(false);
1397 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1399 // TODO(gman): UniformBlockBinding
1401 TEST_P(GLES2DecoderTest2
, UniformMatrix2fvImmediateValidArgs
) {
1402 cmds::UniformMatrix2fvImmediate
& cmd
=
1403 *GetImmediateAs
<cmds::UniformMatrix2fvImmediate
>();
1405 UniformMatrix2fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1406 ImmediateDataAddress(&cmd
))));
1407 SpecializedSetup
<cmds::UniformMatrix2fvImmediate
, 0>(true);
1408 GLfloat temp
[4 * 2] = {
1411 cmd
.Init(1, 2, &temp
[0]);
1412 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1413 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1416 TEST_P(GLES2DecoderTest2
, UniformMatrix2x3fvImmediateValidArgs
) {
1417 cmds::UniformMatrix2x3fvImmediate
& cmd
=
1418 *GetImmediateAs
<cmds::UniformMatrix2x3fvImmediate
>();
1420 UniformMatrix2x3fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1421 ImmediateDataAddress(&cmd
))));
1422 SpecializedSetup
<cmds::UniformMatrix2x3fvImmediate
, 0>(true);
1423 GLfloat temp
[6 * 2] = {
1426 cmd
.Init(1, 2, &temp
[0]);
1427 decoder_
->set_unsafe_es3_apis_enabled(true);
1428 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1429 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1430 decoder_
->set_unsafe_es3_apis_enabled(false);
1431 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1434 TEST_P(GLES2DecoderTest2
, UniformMatrix2x4fvImmediateValidArgs
) {
1435 cmds::UniformMatrix2x4fvImmediate
& cmd
=
1436 *GetImmediateAs
<cmds::UniformMatrix2x4fvImmediate
>();
1438 UniformMatrix2x4fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1439 ImmediateDataAddress(&cmd
))));
1440 SpecializedSetup
<cmds::UniformMatrix2x4fvImmediate
, 0>(true);
1441 GLfloat temp
[8 * 2] = {
1444 cmd
.Init(1, 2, &temp
[0]);
1445 decoder_
->set_unsafe_es3_apis_enabled(true);
1446 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1447 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1448 decoder_
->set_unsafe_es3_apis_enabled(false);
1449 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1452 TEST_P(GLES2DecoderTest2
, UniformMatrix3fvImmediateValidArgs
) {
1453 cmds::UniformMatrix3fvImmediate
& cmd
=
1454 *GetImmediateAs
<cmds::UniformMatrix3fvImmediate
>();
1456 UniformMatrix3fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1457 ImmediateDataAddress(&cmd
))));
1458 SpecializedSetup
<cmds::UniformMatrix3fvImmediate
, 0>(true);
1459 GLfloat temp
[9 * 2] = {
1462 cmd
.Init(1, 2, &temp
[0]);
1463 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1464 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1467 TEST_P(GLES2DecoderTest2
, UniformMatrix3x2fvImmediateValidArgs
) {
1468 cmds::UniformMatrix3x2fvImmediate
& cmd
=
1469 *GetImmediateAs
<cmds::UniformMatrix3x2fvImmediate
>();
1471 UniformMatrix3x2fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1472 ImmediateDataAddress(&cmd
))));
1473 SpecializedSetup
<cmds::UniformMatrix3x2fvImmediate
, 0>(true);
1474 GLfloat temp
[6 * 2] = {
1477 cmd
.Init(1, 2, &temp
[0]);
1478 decoder_
->set_unsafe_es3_apis_enabled(true);
1479 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1480 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1481 decoder_
->set_unsafe_es3_apis_enabled(false);
1482 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1485 TEST_P(GLES2DecoderTest2
, UniformMatrix3x4fvImmediateValidArgs
) {
1486 cmds::UniformMatrix3x4fvImmediate
& cmd
=
1487 *GetImmediateAs
<cmds::UniformMatrix3x4fvImmediate
>();
1489 UniformMatrix3x4fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1490 ImmediateDataAddress(&cmd
))));
1491 SpecializedSetup
<cmds::UniformMatrix3x4fvImmediate
, 0>(true);
1492 GLfloat temp
[12 * 2] = {
1495 cmd
.Init(1, 2, &temp
[0]);
1496 decoder_
->set_unsafe_es3_apis_enabled(true);
1497 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1498 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1499 decoder_
->set_unsafe_es3_apis_enabled(false);
1500 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1503 TEST_P(GLES2DecoderTest2
, UniformMatrix4fvImmediateValidArgs
) {
1504 cmds::UniformMatrix4fvImmediate
& cmd
=
1505 *GetImmediateAs
<cmds::UniformMatrix4fvImmediate
>();
1507 UniformMatrix4fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1508 ImmediateDataAddress(&cmd
))));
1509 SpecializedSetup
<cmds::UniformMatrix4fvImmediate
, 0>(true);
1510 GLfloat temp
[16 * 2] = {
1513 cmd
.Init(1, 2, &temp
[0]);
1514 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1515 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1518 TEST_P(GLES2DecoderTest2
, UniformMatrix4x2fvImmediateValidArgs
) {
1519 cmds::UniformMatrix4x2fvImmediate
& cmd
=
1520 *GetImmediateAs
<cmds::UniformMatrix4x2fvImmediate
>();
1522 UniformMatrix4x2fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1523 ImmediateDataAddress(&cmd
))));
1524 SpecializedSetup
<cmds::UniformMatrix4x2fvImmediate
, 0>(true);
1525 GLfloat temp
[8 * 2] = {
1528 cmd
.Init(1, 2, &temp
[0]);
1529 decoder_
->set_unsafe_es3_apis_enabled(true);
1530 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1531 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1532 decoder_
->set_unsafe_es3_apis_enabled(false);
1533 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1536 TEST_P(GLES2DecoderTest2
, UniformMatrix4x3fvImmediateValidArgs
) {
1537 cmds::UniformMatrix4x3fvImmediate
& cmd
=
1538 *GetImmediateAs
<cmds::UniformMatrix4x3fvImmediate
>();
1540 UniformMatrix4x3fv(1, 2, false, reinterpret_cast<GLfloat
*>(
1541 ImmediateDataAddress(&cmd
))));
1542 SpecializedSetup
<cmds::UniformMatrix4x3fvImmediate
, 0>(true);
1543 GLfloat temp
[12 * 2] = {
1546 cmd
.Init(1, 2, &temp
[0]);
1547 decoder_
->set_unsafe_es3_apis_enabled(true);
1548 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1549 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1550 decoder_
->set_unsafe_es3_apis_enabled(false);
1551 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1554 TEST_P(GLES2DecoderTest2
, UseProgramValidArgs
) {
1555 EXPECT_CALL(*gl_
, UseProgram(kServiceProgramId
));
1556 SpecializedSetup
<cmds::UseProgram
, 0>(true);
1557 cmds::UseProgram cmd
;
1558 cmd
.Init(client_program_id_
);
1559 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1560 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1563 TEST_P(GLES2DecoderTest2
, UseProgramInvalidArgs0_0
) {
1564 EXPECT_CALL(*gl_
, UseProgram(_
)).Times(0);
1565 SpecializedSetup
<cmds::UseProgram
, 0>(false);
1566 cmds::UseProgram cmd
;
1567 cmd
.Init(kInvalidClientId
);
1568 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1569 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1572 TEST_P(GLES2DecoderTest2
, ValidateProgramValidArgs
) {
1573 EXPECT_CALL(*gl_
, ValidateProgram(kServiceProgramId
));
1574 SpecializedSetup
<cmds::ValidateProgram
, 0>(true);
1575 cmds::ValidateProgram cmd
;
1576 cmd
.Init(client_program_id_
);
1577 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1578 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1581 TEST_P(GLES2DecoderTest2
, VertexAttrib1fValidArgs
) {
1582 EXPECT_CALL(*gl_
, VertexAttrib1f(1, 2));
1583 SpecializedSetup
<cmds::VertexAttrib1f
, 0>(true);
1584 cmds::VertexAttrib1f cmd
;
1586 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1587 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1590 TEST_P(GLES2DecoderTest2
, VertexAttrib1fvImmediateValidArgs
) {
1591 cmds::VertexAttrib1fvImmediate
& cmd
=
1592 *GetImmediateAs
<cmds::VertexAttrib1fvImmediate
>();
1593 SpecializedSetup
<cmds::VertexAttrib1fvImmediate
, 0>(true);
1597 cmd
.Init(1, &temp
[0]);
1598 EXPECT_CALL(*gl_
, VertexAttrib1fv(1, reinterpret_cast<GLfloat
*>(
1599 ImmediateDataAddress(&cmd
))));
1600 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
1601 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1603 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_