Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_2_autogen.h
blobd21613b46ba45d9bd582e9679b4c78d09c4500ce
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // 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 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivValidArgs) {
16 EXPECT_CALL(*gl_, GetError())
17 .WillOnce(Return(GL_NO_ERROR))
18 .WillOnce(Return(GL_NO_ERROR))
19 .RetiresOnSaturation();
20 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(true);
21 typedef cmds::GetRenderbufferParameteriv::Result Result;
22 Result* result = static_cast<Result*>(shared_memory_address_);
23 EXPECT_CALL(
24 *gl_, GetRenderbufferParameterivEXT(
25 GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, result->GetData()));
26 result->size = 0;
27 cmds::GetRenderbufferParameteriv cmd;
28 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
29 shared_memory_offset_);
30 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
31 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
32 GL_RENDERBUFFER_RED_SIZE),
33 result->GetNumResults());
34 EXPECT_EQ(GL_NO_ERROR, GetGLError());
37 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs0_0) {
38 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
39 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
40 cmds::GetRenderbufferParameteriv::Result* result =
41 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
42 shared_memory_address_);
43 result->size = 0;
44 cmds::GetRenderbufferParameteriv cmd;
45 cmd.Init(GL_FRAMEBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
46 shared_memory_offset_);
47 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
48 EXPECT_EQ(0u, result->size);
49 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
52 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs2_0) {
53 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
54 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
55 cmds::GetRenderbufferParameteriv::Result* result =
56 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
57 shared_memory_address_);
58 result->size = 0;
59 cmds::GetRenderbufferParameteriv cmd;
60 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, kInvalidSharedMemoryId,
61 0);
62 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
63 EXPECT_EQ(0u, result->size);
66 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs2_1) {
67 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
68 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
69 cmds::GetRenderbufferParameteriv::Result* result =
70 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
71 shared_memory_address_);
72 result->size = 0;
73 cmds::GetRenderbufferParameteriv cmd;
74 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
75 kInvalidSharedMemoryOffset);
76 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
77 EXPECT_EQ(0u, result->size);
80 TEST_P(GLES2DecoderTest2, GetSamplerParameterfvValidArgs) {
81 EXPECT_CALL(*gl_, GetError())
82 .WillOnce(Return(GL_NO_ERROR))
83 .WillOnce(Return(GL_NO_ERROR))
84 .RetiresOnSaturation();
85 SpecializedSetup<cmds::GetSamplerParameterfv, 0>(true);
86 typedef cmds::GetSamplerParameterfv::Result Result;
87 Result* result = static_cast<Result*>(shared_memory_address_);
88 EXPECT_CALL(*gl_,
89 GetSamplerParameterfv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
90 result->GetData()));
91 result->size = 0;
92 cmds::GetSamplerParameterfv cmd;
93 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
94 shared_memory_offset_);
95 decoder_->set_unsafe_es3_apis_enabled(true);
96 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
97 EXPECT_EQ(
98 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
99 result->GetNumResults());
100 EXPECT_EQ(GL_NO_ERROR, GetGLError());
101 decoder_->set_unsafe_es3_apis_enabled(false);
102 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
105 TEST_P(GLES2DecoderTest2, GetSamplerParameterivValidArgs) {
106 EXPECT_CALL(*gl_, GetError())
107 .WillOnce(Return(GL_NO_ERROR))
108 .WillOnce(Return(GL_NO_ERROR))
109 .RetiresOnSaturation();
110 SpecializedSetup<cmds::GetSamplerParameteriv, 0>(true);
111 typedef cmds::GetSamplerParameteriv::Result Result;
112 Result* result = static_cast<Result*>(shared_memory_address_);
113 EXPECT_CALL(*gl_,
114 GetSamplerParameteriv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
115 result->GetData()));
116 result->size = 0;
117 cmds::GetSamplerParameteriv cmd;
118 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
119 shared_memory_offset_);
120 decoder_->set_unsafe_es3_apis_enabled(true);
121 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
122 EXPECT_EQ(
123 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
124 result->GetNumResults());
125 EXPECT_EQ(GL_NO_ERROR, GetGLError());
126 decoder_->set_unsafe_es3_apis_enabled(false);
127 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
130 TEST_P(GLES2DecoderTest2, GetShaderivValidArgs) {
131 EXPECT_CALL(*gl_, GetError())
132 .WillOnce(Return(GL_NO_ERROR))
133 .WillOnce(Return(GL_NO_ERROR))
134 .RetiresOnSaturation();
135 SpecializedSetup<cmds::GetShaderiv, 0>(true);
136 typedef cmds::GetShaderiv::Result Result;
137 Result* result = static_cast<Result*>(shared_memory_address_);
138 EXPECT_CALL(*gl_,
139 GetShaderiv(kServiceShaderId, GL_SHADER_TYPE, result->GetData()));
140 result->size = 0;
141 cmds::GetShaderiv cmd;
142 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
143 shared_memory_offset_);
144 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
145 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE),
146 result->GetNumResults());
147 EXPECT_EQ(GL_NO_ERROR, GetGLError());
150 TEST_P(GLES2DecoderTest2, GetShaderivInvalidArgs2_0) {
151 EXPECT_CALL(*gl_, GetShaderiv(_, _, _)).Times(0);
152 SpecializedSetup<cmds::GetShaderiv, 0>(false);
153 cmds::GetShaderiv::Result* result =
154 static_cast<cmds::GetShaderiv::Result*>(shared_memory_address_);
155 result->size = 0;
156 cmds::GetShaderiv cmd;
157 cmd.Init(client_shader_id_, GL_SHADER_TYPE, kInvalidSharedMemoryId, 0);
158 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
159 EXPECT_EQ(0u, result->size);
162 TEST_P(GLES2DecoderTest2, GetShaderivInvalidArgs2_1) {
163 EXPECT_CALL(*gl_, GetShaderiv(_, _, _)).Times(0);
164 SpecializedSetup<cmds::GetShaderiv, 0>(false);
165 cmds::GetShaderiv::Result* result =
166 static_cast<cmds::GetShaderiv::Result*>(shared_memory_address_);
167 result->size = 0;
168 cmds::GetShaderiv cmd;
169 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
170 kInvalidSharedMemoryOffset);
171 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
172 EXPECT_EQ(0u, result->size);
174 // TODO(gman): GetShaderInfoLog
175 // TODO(gman): GetShaderPrecisionFormat
177 // TODO(gman): GetShaderSource
178 // TODO(gman): GetString
180 TEST_P(GLES2DecoderTest2, GetSyncivValidArgs) {
181 EXPECT_CALL(*gl_, GetError())
182 .WillOnce(Return(GL_NO_ERROR))
183 .WillOnce(Return(GL_NO_ERROR))
184 .RetiresOnSaturation();
185 SpecializedSetup<cmds::GetSynciv, 0>(true);
186 typedef cmds::GetSynciv::Result Result;
187 Result* result = static_cast<Result*>(shared_memory_address_);
188 EXPECT_CALL(
189 *gl_, GetSynciv(reinterpret_cast<GLsync>(kServiceSyncId), GL_SYNC_STATUS,
190 decoder_->GetGLES2Util()->GLGetNumValuesReturned(
191 GL_SYNC_STATUS),
192 nullptr, result->GetData()));
193 result->size = 0;
194 cmds::GetSynciv cmd;
195 cmd.Init(client_sync_id_, GL_SYNC_STATUS, shared_memory_id_,
196 shared_memory_offset_);
197 decoder_->set_unsafe_es3_apis_enabled(true);
198 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
199 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SYNC_STATUS),
200 result->GetNumResults());
201 EXPECT_EQ(GL_NO_ERROR, GetGLError());
202 decoder_->set_unsafe_es3_apis_enabled(false);
203 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
206 TEST_P(GLES2DecoderTest2, GetTexParameterfvValidArgs) {
207 EXPECT_CALL(*gl_, GetError())
208 .WillOnce(Return(GL_NO_ERROR))
209 .WillOnce(Return(GL_NO_ERROR))
210 .RetiresOnSaturation();
211 SpecializedSetup<cmds::GetTexParameterfv, 0>(true);
212 typedef cmds::GetTexParameterfv::Result Result;
213 Result* result = static_cast<Result*>(shared_memory_address_);
214 EXPECT_CALL(*gl_, GetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
215 result->GetData()));
216 result->size = 0;
217 cmds::GetTexParameterfv cmd;
218 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
219 shared_memory_offset_);
220 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
221 EXPECT_EQ(
222 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
223 result->GetNumResults());
224 EXPECT_EQ(GL_NO_ERROR, GetGLError());
227 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs0_0) {
228 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
229 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
230 cmds::GetTexParameterfv::Result* result =
231 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
232 result->size = 0;
233 cmds::GetTexParameterfv cmd;
234 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
235 shared_memory_offset_);
236 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
237 EXPECT_EQ(0u, result->size);
238 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
241 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs1_0) {
242 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
243 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
244 cmds::GetTexParameterfv::Result* result =
245 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
246 result->size = 0;
247 cmds::GetTexParameterfv cmd;
248 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, shared_memory_id_,
249 shared_memory_offset_);
250 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
251 EXPECT_EQ(0u, result->size);
252 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
255 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs2_0) {
256 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
257 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
258 cmds::GetTexParameterfv::Result* result =
259 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
260 result->size = 0;
261 cmds::GetTexParameterfv cmd;
262 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, kInvalidSharedMemoryId, 0);
263 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
264 EXPECT_EQ(0u, result->size);
267 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs2_1) {
268 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
269 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
270 cmds::GetTexParameterfv::Result* result =
271 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
272 result->size = 0;
273 cmds::GetTexParameterfv cmd;
274 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
275 kInvalidSharedMemoryOffset);
276 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
277 EXPECT_EQ(0u, result->size);
280 TEST_P(GLES2DecoderTest2, GetTexParameterivValidArgs) {
281 EXPECT_CALL(*gl_, GetError())
282 .WillOnce(Return(GL_NO_ERROR))
283 .WillOnce(Return(GL_NO_ERROR))
284 .RetiresOnSaturation();
285 SpecializedSetup<cmds::GetTexParameteriv, 0>(true);
286 typedef cmds::GetTexParameteriv::Result Result;
287 Result* result = static_cast<Result*>(shared_memory_address_);
288 EXPECT_CALL(*gl_, GetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
289 result->GetData()));
290 result->size = 0;
291 cmds::GetTexParameteriv cmd;
292 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
293 shared_memory_offset_);
294 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
295 EXPECT_EQ(
296 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
297 result->GetNumResults());
298 EXPECT_EQ(GL_NO_ERROR, GetGLError());
301 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs0_0) {
302 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
303 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
304 cmds::GetTexParameteriv::Result* result =
305 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
306 result->size = 0;
307 cmds::GetTexParameteriv cmd;
308 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
309 shared_memory_offset_);
310 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
311 EXPECT_EQ(0u, result->size);
312 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
315 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs1_0) {
316 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
317 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
318 cmds::GetTexParameteriv::Result* result =
319 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
320 result->size = 0;
321 cmds::GetTexParameteriv cmd;
322 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, shared_memory_id_,
323 shared_memory_offset_);
324 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
325 EXPECT_EQ(0u, result->size);
326 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
329 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs2_0) {
330 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
331 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
332 cmds::GetTexParameteriv::Result* result =
333 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
334 result->size = 0;
335 cmds::GetTexParameteriv cmd;
336 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, kInvalidSharedMemoryId, 0);
337 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
338 EXPECT_EQ(0u, result->size);
341 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs2_1) {
342 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
343 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
344 cmds::GetTexParameteriv::Result* result =
345 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
346 result->size = 0;
347 cmds::GetTexParameteriv cmd;
348 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
349 kInvalidSharedMemoryOffset);
350 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
351 EXPECT_EQ(0u, result->size);
353 // TODO(gman): GetTransformFeedbackVarying
355 // TODO(gman): GetUniformBlockIndex
357 // TODO(gman): GetUniformfv
359 // TODO(gman): GetUniformiv
361 // TODO(gman): GetUniformuiv
363 // TODO(gman): GetUniformIndices
365 // TODO(gman): GetUniformLocation
367 TEST_P(GLES2DecoderTest2, GetVertexAttribfvValidArgs) {
368 SpecializedSetup<cmds::GetVertexAttribfv, 0>(true);
369 typedef cmds::GetVertexAttribfv::Result Result;
370 Result* result = static_cast<Result*>(shared_memory_address_);
371 result->size = 0;
372 cmds::GetVertexAttribfv cmd;
373 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
374 shared_memory_offset_);
375 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
376 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
377 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
378 result->GetNumResults());
379 EXPECT_EQ(GL_NO_ERROR, GetGLError());
382 TEST_P(GLES2DecoderTest2, GetVertexAttribfvInvalidArgs2_0) {
383 EXPECT_CALL(*gl_, GetVertexAttribfv(_, _, _)).Times(0);
384 SpecializedSetup<cmds::GetVertexAttribfv, 0>(false);
385 cmds::GetVertexAttribfv::Result* result =
386 static_cast<cmds::GetVertexAttribfv::Result*>(shared_memory_address_);
387 result->size = 0;
388 cmds::GetVertexAttribfv cmd;
389 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, kInvalidSharedMemoryId, 0);
390 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
391 EXPECT_EQ(0u, result->size);
394 TEST_P(GLES2DecoderTest2, GetVertexAttribfvInvalidArgs2_1) {
395 EXPECT_CALL(*gl_, GetVertexAttribfv(_, _, _)).Times(0);
396 SpecializedSetup<cmds::GetVertexAttribfv, 0>(false);
397 cmds::GetVertexAttribfv::Result* result =
398 static_cast<cmds::GetVertexAttribfv::Result*>(shared_memory_address_);
399 result->size = 0;
400 cmds::GetVertexAttribfv cmd;
401 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
402 kInvalidSharedMemoryOffset);
403 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
404 EXPECT_EQ(0u, result->size);
407 TEST_P(GLES2DecoderTest2, GetVertexAttribivValidArgs) {
408 SpecializedSetup<cmds::GetVertexAttribiv, 0>(true);
409 typedef cmds::GetVertexAttribiv::Result Result;
410 Result* result = static_cast<Result*>(shared_memory_address_);
411 result->size = 0;
412 cmds::GetVertexAttribiv cmd;
413 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
414 shared_memory_offset_);
415 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
416 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
417 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
418 result->GetNumResults());
419 EXPECT_EQ(GL_NO_ERROR, GetGLError());
422 TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_0) {
423 EXPECT_CALL(*gl_, GetVertexAttribiv(_, _, _)).Times(0);
424 SpecializedSetup<cmds::GetVertexAttribiv, 0>(false);
425 cmds::GetVertexAttribiv::Result* result =
426 static_cast<cmds::GetVertexAttribiv::Result*>(shared_memory_address_);
427 result->size = 0;
428 cmds::GetVertexAttribiv cmd;
429 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, kInvalidSharedMemoryId, 0);
430 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
431 EXPECT_EQ(0u, result->size);
434 TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_1) {
435 EXPECT_CALL(*gl_, GetVertexAttribiv(_, _, _)).Times(0);
436 SpecializedSetup<cmds::GetVertexAttribiv, 0>(false);
437 cmds::GetVertexAttribiv::Result* result =
438 static_cast<cmds::GetVertexAttribiv::Result*>(shared_memory_address_);
439 result->size = 0;
440 cmds::GetVertexAttribiv cmd;
441 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
442 kInvalidSharedMemoryOffset);
443 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
444 EXPECT_EQ(0u, result->size);
447 TEST_P(GLES2DecoderTest2, GetVertexAttribIivValidArgs) {
448 SpecializedSetup<cmds::GetVertexAttribIiv, 0>(true);
449 typedef cmds::GetVertexAttribIiv::Result Result;
450 Result* result = static_cast<Result*>(shared_memory_address_);
451 result->size = 0;
452 cmds::GetVertexAttribIiv cmd;
453 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
454 shared_memory_offset_);
455 decoder_->set_unsafe_es3_apis_enabled(true);
456 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
457 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
458 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
459 result->GetNumResults());
460 EXPECT_EQ(GL_NO_ERROR, GetGLError());
461 decoder_->set_unsafe_es3_apis_enabled(false);
462 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
465 TEST_P(GLES2DecoderTest2, GetVertexAttribIuivValidArgs) {
466 SpecializedSetup<cmds::GetVertexAttribIuiv, 0>(true);
467 typedef cmds::GetVertexAttribIuiv::Result Result;
468 Result* result = static_cast<Result*>(shared_memory_address_);
469 result->size = 0;
470 cmds::GetVertexAttribIuiv cmd;
471 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
472 shared_memory_offset_);
473 decoder_->set_unsafe_es3_apis_enabled(true);
474 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
475 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
476 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
477 result->GetNumResults());
478 EXPECT_EQ(GL_NO_ERROR, GetGLError());
479 decoder_->set_unsafe_es3_apis_enabled(false);
480 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
482 // TODO(gman): GetVertexAttribPointerv
484 TEST_P(GLES2DecoderTest2, HintValidArgs) {
485 EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST));
486 SpecializedSetup<cmds::Hint, 0>(true);
487 cmds::Hint cmd;
488 cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
489 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
490 EXPECT_EQ(GL_NO_ERROR, GetGLError());
493 TEST_P(GLES2DecoderTest2, HintInvalidArgs0_0) {
494 EXPECT_CALL(*gl_, Hint(_, _)).Times(0);
495 SpecializedSetup<cmds::Hint, 0>(false);
496 cmds::Hint cmd;
497 cmd.Init(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
498 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
499 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
501 // TODO(gman): InvalidateFramebufferImmediate
502 // TODO(gman): InvalidateSubFramebufferImmediate
504 TEST_P(GLES2DecoderTest2, IsBufferValidArgs) {
505 SpecializedSetup<cmds::IsBuffer, 0>(true);
506 cmds::IsBuffer cmd;
507 cmd.Init(client_buffer_id_, shared_memory_id_, shared_memory_offset_);
508 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
509 EXPECT_EQ(GL_NO_ERROR, GetGLError());
512 TEST_P(GLES2DecoderTest2, IsBufferInvalidArgsBadSharedMemoryId) {
513 SpecializedSetup<cmds::IsBuffer, 0>(false);
514 cmds::IsBuffer cmd;
515 cmd.Init(client_buffer_id_, kInvalidSharedMemoryId, shared_memory_offset_);
516 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
517 cmd.Init(client_buffer_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
518 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
521 TEST_P(GLES2DecoderTest2, IsEnabledValidArgs) {
522 SpecializedSetup<cmds::IsEnabled, 0>(true);
523 cmds::IsEnabled cmd;
524 cmd.Init(GL_BLEND, shared_memory_id_, shared_memory_offset_);
525 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
526 EXPECT_EQ(GL_NO_ERROR, GetGLError());
529 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgs0_0) {
530 EXPECT_CALL(*gl_, IsEnabled(_)).Times(0);
531 SpecializedSetup<cmds::IsEnabled, 0>(false);
532 cmds::IsEnabled cmd;
533 cmd.Init(GL_CLIP_PLANE0, shared_memory_id_, shared_memory_offset_);
534 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
535 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
538 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgs0_1) {
539 EXPECT_CALL(*gl_, IsEnabled(_)).Times(0);
540 SpecializedSetup<cmds::IsEnabled, 0>(false);
541 cmds::IsEnabled cmd;
542 cmd.Init(GL_POINT_SPRITE, shared_memory_id_, shared_memory_offset_);
543 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
544 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
547 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgsBadSharedMemoryId) {
548 SpecializedSetup<cmds::IsEnabled, 0>(false);
549 cmds::IsEnabled cmd;
550 cmd.Init(GL_BLEND, kInvalidSharedMemoryId, shared_memory_offset_);
551 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
552 cmd.Init(GL_BLEND, shared_memory_id_, kInvalidSharedMemoryOffset);
553 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
556 TEST_P(GLES2DecoderTest2, IsFramebufferValidArgs) {
557 SpecializedSetup<cmds::IsFramebuffer, 0>(true);
558 cmds::IsFramebuffer cmd;
559 cmd.Init(client_framebuffer_id_, shared_memory_id_, shared_memory_offset_);
560 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
561 EXPECT_EQ(GL_NO_ERROR, GetGLError());
564 TEST_P(GLES2DecoderTest2, IsFramebufferInvalidArgsBadSharedMemoryId) {
565 SpecializedSetup<cmds::IsFramebuffer, 0>(false);
566 cmds::IsFramebuffer cmd;
567 cmd.Init(client_framebuffer_id_, kInvalidSharedMemoryId,
568 shared_memory_offset_);
569 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
570 cmd.Init(client_framebuffer_id_, shared_memory_id_,
571 kInvalidSharedMemoryOffset);
572 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
575 TEST_P(GLES2DecoderTest2, IsProgramValidArgs) {
576 SpecializedSetup<cmds::IsProgram, 0>(true);
577 cmds::IsProgram cmd;
578 cmd.Init(client_program_id_, shared_memory_id_, shared_memory_offset_);
579 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
580 EXPECT_EQ(GL_NO_ERROR, GetGLError());
583 TEST_P(GLES2DecoderTest2, IsProgramInvalidArgsBadSharedMemoryId) {
584 SpecializedSetup<cmds::IsProgram, 0>(false);
585 cmds::IsProgram cmd;
586 cmd.Init(client_program_id_, kInvalidSharedMemoryId, shared_memory_offset_);
587 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
588 cmd.Init(client_program_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
589 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
592 TEST_P(GLES2DecoderTest2, IsRenderbufferValidArgs) {
593 SpecializedSetup<cmds::IsRenderbuffer, 0>(true);
594 cmds::IsRenderbuffer cmd;
595 cmd.Init(client_renderbuffer_id_, shared_memory_id_, shared_memory_offset_);
596 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
597 EXPECT_EQ(GL_NO_ERROR, GetGLError());
600 TEST_P(GLES2DecoderTest2, IsRenderbufferInvalidArgsBadSharedMemoryId) {
601 SpecializedSetup<cmds::IsRenderbuffer, 0>(false);
602 cmds::IsRenderbuffer cmd;
603 cmd.Init(client_renderbuffer_id_, kInvalidSharedMemoryId,
604 shared_memory_offset_);
605 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
606 cmd.Init(client_renderbuffer_id_, shared_memory_id_,
607 kInvalidSharedMemoryOffset);
608 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
611 TEST_P(GLES2DecoderTest2, IsSamplerValidArgs) {
612 SpecializedSetup<cmds::IsSampler, 0>(true);
613 cmds::IsSampler cmd;
614 cmd.Init(client_sampler_id_, shared_memory_id_, shared_memory_offset_);
615 decoder_->set_unsafe_es3_apis_enabled(true);
616 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
617 EXPECT_EQ(GL_NO_ERROR, GetGLError());
618 decoder_->set_unsafe_es3_apis_enabled(false);
619 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
622 TEST_P(GLES2DecoderTest2, IsSamplerInvalidArgsBadSharedMemoryId) {
623 SpecializedSetup<cmds::IsSampler, 0>(false);
624 decoder_->set_unsafe_es3_apis_enabled(true);
625 cmds::IsSampler cmd;
626 cmd.Init(client_sampler_id_, kInvalidSharedMemoryId, shared_memory_offset_);
627 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
628 cmd.Init(client_sampler_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
629 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
630 decoder_->set_unsafe_es3_apis_enabled(true);
633 TEST_P(GLES2DecoderTest2, IsShaderValidArgs) {
634 SpecializedSetup<cmds::IsShader, 0>(true);
635 cmds::IsShader cmd;
636 cmd.Init(client_shader_id_, shared_memory_id_, shared_memory_offset_);
637 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
638 EXPECT_EQ(GL_NO_ERROR, GetGLError());
641 TEST_P(GLES2DecoderTest2, IsShaderInvalidArgsBadSharedMemoryId) {
642 SpecializedSetup<cmds::IsShader, 0>(false);
643 cmds::IsShader cmd;
644 cmd.Init(client_shader_id_, kInvalidSharedMemoryId, shared_memory_offset_);
645 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
646 cmd.Init(client_shader_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
647 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
650 TEST_P(GLES2DecoderTest2, IsSyncValidArgs) {
651 SpecializedSetup<cmds::IsSync, 0>(true);
652 cmds::IsSync cmd;
653 cmd.Init(client_sync_id_, shared_memory_id_, shared_memory_offset_);
654 decoder_->set_unsafe_es3_apis_enabled(true);
655 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
656 EXPECT_EQ(GL_NO_ERROR, GetGLError());
657 decoder_->set_unsafe_es3_apis_enabled(false);
658 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
661 TEST_P(GLES2DecoderTest2, IsSyncInvalidArgsBadSharedMemoryId) {
662 SpecializedSetup<cmds::IsSync, 0>(false);
663 decoder_->set_unsafe_es3_apis_enabled(true);
664 cmds::IsSync cmd;
665 cmd.Init(client_sync_id_, kInvalidSharedMemoryId, shared_memory_offset_);
666 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
667 cmd.Init(client_sync_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
668 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
669 decoder_->set_unsafe_es3_apis_enabled(true);
672 TEST_P(GLES2DecoderTest2, IsTextureValidArgs) {
673 SpecializedSetup<cmds::IsTexture, 0>(true);
674 cmds::IsTexture cmd;
675 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
676 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
677 EXPECT_EQ(GL_NO_ERROR, GetGLError());
680 TEST_P(GLES2DecoderTest2, IsTextureInvalidArgsBadSharedMemoryId) {
681 SpecializedSetup<cmds::IsTexture, 0>(false);
682 cmds::IsTexture cmd;
683 cmd.Init(client_texture_id_, kInvalidSharedMemoryId, shared_memory_offset_);
684 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
685 cmd.Init(client_texture_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
686 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
689 TEST_P(GLES2DecoderTest2, IsTransformFeedbackValidArgs) {
690 SpecializedSetup<cmds::IsTransformFeedback, 0>(true);
691 cmds::IsTransformFeedback cmd;
692 cmd.Init(client_transformfeedback_id_, shared_memory_id_,
693 shared_memory_offset_);
694 decoder_->set_unsafe_es3_apis_enabled(true);
695 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
696 EXPECT_EQ(GL_NO_ERROR, GetGLError());
697 decoder_->set_unsafe_es3_apis_enabled(false);
698 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
701 TEST_P(GLES2DecoderTest2, IsTransformFeedbackInvalidArgsBadSharedMemoryId) {
702 SpecializedSetup<cmds::IsTransformFeedback, 0>(false);
703 decoder_->set_unsafe_es3_apis_enabled(true);
704 cmds::IsTransformFeedback cmd;
705 cmd.Init(client_transformfeedback_id_, kInvalidSharedMemoryId,
706 shared_memory_offset_);
707 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
708 cmd.Init(client_transformfeedback_id_, shared_memory_id_,
709 kInvalidSharedMemoryOffset);
710 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
711 decoder_->set_unsafe_es3_apis_enabled(true);
714 TEST_P(GLES2DecoderTest2, LineWidthValidArgs) {
715 EXPECT_CALL(*gl_, LineWidth(0.5f));
716 SpecializedSetup<cmds::LineWidth, 0>(true);
717 cmds::LineWidth cmd;
718 cmd.Init(0.5f);
719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
720 EXPECT_EQ(GL_NO_ERROR, GetGLError());
723 TEST_P(GLES2DecoderTest2, LineWidthInvalidValue0_0) {
724 SpecializedSetup<cmds::LineWidth, 0>(false);
725 cmds::LineWidth cmd;
726 cmd.Init(0.0f);
727 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
728 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
731 TEST_P(GLES2DecoderTest2, LineWidthNaNValue0) {
732 SpecializedSetup<cmds::LineWidth, 0>(false);
733 cmds::LineWidth cmd;
734 cmd.Init(nanf(""));
735 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
736 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
739 TEST_P(GLES2DecoderTest2, LinkProgramValidArgs) {
740 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId));
741 SpecializedSetup<cmds::LinkProgram, 0>(true);
742 cmds::LinkProgram cmd;
743 cmd.Init(client_program_id_);
744 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
745 EXPECT_EQ(GL_NO_ERROR, GetGLError());
748 TEST_P(GLES2DecoderTest2, PauseTransformFeedbackValidArgs) {
749 EXPECT_CALL(*gl_, PauseTransformFeedback());
750 SpecializedSetup<cmds::PauseTransformFeedback, 0>(true);
751 cmds::PauseTransformFeedback cmd;
752 cmd.Init();
753 decoder_->set_unsafe_es3_apis_enabled(true);
754 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
755 EXPECT_EQ(GL_NO_ERROR, GetGLError());
756 decoder_->set_unsafe_es3_apis_enabled(false);
757 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
759 // TODO(gman): PixelStorei
761 TEST_P(GLES2DecoderTest2, PolygonOffsetValidArgs) {
762 EXPECT_CALL(*gl_, PolygonOffset(1, 2));
763 SpecializedSetup<cmds::PolygonOffset, 0>(true);
764 cmds::PolygonOffset cmd;
765 cmd.Init(1, 2);
766 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
767 EXPECT_EQ(GL_NO_ERROR, GetGLError());
770 TEST_P(GLES2DecoderTest2, ReadBufferValidArgs) {
771 EXPECT_CALL(*gl_, ReadBuffer(1));
772 SpecializedSetup<cmds::ReadBuffer, 0>(true);
773 cmds::ReadBuffer cmd;
774 cmd.Init(1);
775 decoder_->set_unsafe_es3_apis_enabled(true);
776 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
777 EXPECT_EQ(GL_NO_ERROR, GetGLError());
778 decoder_->set_unsafe_es3_apis_enabled(false);
779 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
781 // TODO(gman): ReadPixels
783 // TODO(gman): ReleaseShaderCompiler
785 TEST_P(GLES2DecoderTest2, RenderbufferStorageValidArgs) {
786 SpecializedSetup<cmds::RenderbufferStorage, 0>(true);
787 cmds::RenderbufferStorage cmd;
788 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
789 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
790 EXPECT_EQ(GL_NO_ERROR, GetGLError());
793 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs0_0) {
794 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
795 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
796 cmds::RenderbufferStorage cmd;
797 cmd.Init(GL_FRAMEBUFFER, GL_RGBA4, 3, 4);
798 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
799 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
802 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs2_0) {
803 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
804 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
805 cmds::RenderbufferStorage cmd;
806 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, -1, 4);
807 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
808 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
811 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs3_0) {
812 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
813 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
814 cmds::RenderbufferStorage cmd;
815 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, -1);
816 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
817 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
820 TEST_P(GLES2DecoderTest2, ResumeTransformFeedbackValidArgs) {
821 EXPECT_CALL(*gl_, ResumeTransformFeedback());
822 SpecializedSetup<cmds::ResumeTransformFeedback, 0>(true);
823 cmds::ResumeTransformFeedback cmd;
824 cmd.Init();
825 decoder_->set_unsafe_es3_apis_enabled(true);
826 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
827 EXPECT_EQ(GL_NO_ERROR, GetGLError());
828 decoder_->set_unsafe_es3_apis_enabled(false);
829 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
832 TEST_P(GLES2DecoderTest2, SampleCoverageValidArgs) {
833 EXPECT_CALL(*gl_, SampleCoverage(1, true));
834 SpecializedSetup<cmds::SampleCoverage, 0>(true);
835 cmds::SampleCoverage cmd;
836 cmd.Init(1, true);
837 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
838 EXPECT_EQ(GL_NO_ERROR, GetGLError());
841 TEST_P(GLES2DecoderTest2, SamplerParameterfValidArgs) {
842 EXPECT_CALL(*gl_, SamplerParameterf(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
843 GL_NEAREST));
844 SpecializedSetup<cmds::SamplerParameterf, 0>(true);
845 cmds::SamplerParameterf cmd;
846 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
847 decoder_->set_unsafe_es3_apis_enabled(true);
848 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
849 EXPECT_EQ(GL_NO_ERROR, GetGLError());
850 decoder_->set_unsafe_es3_apis_enabled(false);
851 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
854 TEST_P(GLES2DecoderTest2, SamplerParameterfvImmediateValidArgs) {
855 cmds::SamplerParameterfvImmediate& cmd =
856 *GetImmediateAs<cmds::SamplerParameterfvImmediate>();
857 SpecializedSetup<cmds::SamplerParameterfvImmediate, 0>(true);
858 GLfloat temp[1] = {
859 GL_NEAREST,
861 cmd.Init(kServiceSamplerId, GL_TEXTURE_MAG_FILTER, &temp[0]);
862 EXPECT_CALL(*gl_, SamplerParameterf(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
863 *reinterpret_cast<GLfloat*>(
864 ImmediateDataAddress(&cmd))));
865 decoder_->set_unsafe_es3_apis_enabled(true);
866 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
867 EXPECT_EQ(GL_NO_ERROR, GetGLError());
868 decoder_->set_unsafe_es3_apis_enabled(false);
869 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
872 TEST_P(GLES2DecoderTest2, SamplerParameteriValidArgs) {
873 EXPECT_CALL(*gl_, SamplerParameteri(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
874 GL_NEAREST));
875 SpecializedSetup<cmds::SamplerParameteri, 0>(true);
876 cmds::SamplerParameteri cmd;
877 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
878 decoder_->set_unsafe_es3_apis_enabled(true);
879 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
880 EXPECT_EQ(GL_NO_ERROR, GetGLError());
881 decoder_->set_unsafe_es3_apis_enabled(false);
882 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
885 TEST_P(GLES2DecoderTest2, SamplerParameterivImmediateValidArgs) {
886 cmds::SamplerParameterivImmediate& cmd =
887 *GetImmediateAs<cmds::SamplerParameterivImmediate>();
888 SpecializedSetup<cmds::SamplerParameterivImmediate, 0>(true);
889 GLint temp[1] = {
890 GL_NEAREST,
892 cmd.Init(kServiceSamplerId, GL_TEXTURE_MAG_FILTER, &temp[0]);
893 EXPECT_CALL(*gl_, SamplerParameteri(
894 kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
895 *reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
896 decoder_->set_unsafe_es3_apis_enabled(true);
897 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
898 EXPECT_EQ(GL_NO_ERROR, GetGLError());
899 decoder_->set_unsafe_es3_apis_enabled(false);
900 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
903 TEST_P(GLES2DecoderTest2, ScissorValidArgs) {
904 EXPECT_CALL(*gl_, Scissor(1, 2, 3, 4));
905 SpecializedSetup<cmds::Scissor, 0>(true);
906 cmds::Scissor cmd;
907 cmd.Init(1, 2, 3, 4);
908 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
909 EXPECT_EQ(GL_NO_ERROR, GetGLError());
912 TEST_P(GLES2DecoderTest2, ScissorInvalidArgs2_0) {
913 EXPECT_CALL(*gl_, Scissor(_, _, _, _)).Times(0);
914 SpecializedSetup<cmds::Scissor, 0>(false);
915 cmds::Scissor cmd;
916 cmd.Init(1, 2, -1, 4);
917 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
918 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
921 TEST_P(GLES2DecoderTest2, ScissorInvalidArgs3_0) {
922 EXPECT_CALL(*gl_, Scissor(_, _, _, _)).Times(0);
923 SpecializedSetup<cmds::Scissor, 0>(false);
924 cmds::Scissor cmd;
925 cmd.Init(1, 2, 3, -1);
926 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
927 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
929 // TODO(gman): ShaderBinary
931 TEST_P(GLES2DecoderTest2, ShaderSourceBucketValidArgs) {
932 const uint32 kBucketId = 123;
933 const char kSource0[] = "hello";
934 const char* kSource[] = {kSource0};
935 const char kValidStrEnd = 0;
936 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
937 cmds::ShaderSourceBucket cmd;
938 cmd.Init(client_shader_id_, kBucketId);
939 decoder_->set_unsafe_es3_apis_enabled(true);
940 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
943 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidArgs) {
944 const uint32 kBucketId = 123;
945 const char kSource0[] = "hello";
946 const char* kSource[] = {kSource0};
947 const char kValidStrEnd = 0;
948 decoder_->set_unsafe_es3_apis_enabled(true);
949 cmds::ShaderSourceBucket cmd;
950 // Test no bucket.
951 cmd.Init(client_shader_id_, kBucketId);
952 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
953 // Test invalid client.
954 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
955 cmd.Init(kInvalidClientId, kBucketId);
956 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
957 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
960 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidHeader) {
961 const uint32 kBucketId = 123;
962 const char kSource0[] = "hello";
963 const char* kSource[] = {kSource0};
964 const char kValidStrEnd = 0;
965 const GLsizei kCount = static_cast<GLsizei>(arraysize(kSource));
966 const GLsizei kTests[] = {
967 kCount + 1, 0, std::numeric_limits<GLsizei>::max(), -1,
969 decoder_->set_unsafe_es3_apis_enabled(true);
970 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
971 SetBucketAsCStrings(kBucketId, 1, kSource, kTests[ii], kValidStrEnd);
972 cmds::ShaderSourceBucket cmd;
973 cmd.Init(client_shader_id_, kBucketId);
974 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
978 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidStringEnding) {
979 const uint32 kBucketId = 123;
980 const char kSource0[] = "hello";
981 const char* kSource[] = {kSource0};
982 const char kInvalidStrEnd = '*';
983 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kInvalidStrEnd);
984 cmds::ShaderSourceBucket cmd;
985 cmd.Init(client_shader_id_, kBucketId);
986 decoder_->set_unsafe_es3_apis_enabled(true);
987 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
990 TEST_P(GLES2DecoderTest2, StencilFuncValidArgs) {
991 EXPECT_CALL(*gl_, StencilFunc(GL_NEVER, 2, 3));
992 SpecializedSetup<cmds::StencilFunc, 0>(true);
993 cmds::StencilFunc cmd;
994 cmd.Init(GL_NEVER, 2, 3);
995 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
996 EXPECT_EQ(GL_NO_ERROR, GetGLError());
999 TEST_P(GLES2DecoderTest2, StencilFuncSeparateValidArgs) {
1000 EXPECT_CALL(*gl_, StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4));
1001 SpecializedSetup<cmds::StencilFuncSeparate, 0>(true);
1002 cmds::StencilFuncSeparate cmd;
1003 cmd.Init(GL_FRONT, GL_NEVER, 3, 4);
1004 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1005 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1008 TEST_P(GLES2DecoderTest2, StencilMaskValidArgs) {
1009 SpecializedSetup<cmds::StencilMask, 0>(true);
1010 cmds::StencilMask cmd;
1011 cmd.Init(1);
1012 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1013 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1016 TEST_P(GLES2DecoderTest2, StencilMaskSeparateValidArgs) {
1017 SpecializedSetup<cmds::StencilMaskSeparate, 0>(true);
1018 cmds::StencilMaskSeparate cmd;
1019 cmd.Init(GL_FRONT, 2);
1020 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1021 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1024 TEST_P(GLES2DecoderTest2, StencilOpValidArgs) {
1025 EXPECT_CALL(*gl_, StencilOp(GL_KEEP, GL_INCR, GL_KEEP));
1026 SpecializedSetup<cmds::StencilOp, 0>(true);
1027 cmds::StencilOp cmd;
1028 cmd.Init(GL_KEEP, GL_INCR, GL_KEEP);
1029 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1030 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1033 TEST_P(GLES2DecoderTest2, StencilOpSeparateValidArgs) {
1034 EXPECT_CALL(*gl_, StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP));
1035 SpecializedSetup<cmds::StencilOpSeparate, 0>(true);
1036 cmds::StencilOpSeparate cmd;
1037 cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1038 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1039 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1041 // TODO(gman): TexImage2D
1043 // TODO(gman): TexImage3D
1045 TEST_P(GLES2DecoderTest2, TexParameterfValidArgs) {
1046 EXPECT_CALL(*gl_,
1047 TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
1048 SpecializedSetup<cmds::TexParameterf, 0>(true);
1049 cmds::TexParameterf cmd;
1050 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1051 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1052 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1055 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs0_0) {
1056 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1057 SpecializedSetup<cmds::TexParameterf, 0>(false);
1058 cmds::TexParameterf cmd;
1059 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1060 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1061 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1064 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs0_1) {
1065 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1066 SpecializedSetup<cmds::TexParameterf, 0>(false);
1067 cmds::TexParameterf cmd;
1068 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1069 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1070 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1073 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs1_0) {
1074 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1075 SpecializedSetup<cmds::TexParameterf, 0>(false);
1076 cmds::TexParameterf cmd;
1077 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_NEAREST);
1078 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1079 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1082 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateValidArgs) {
1083 cmds::TexParameterfvImmediate& cmd =
1084 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1085 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(true);
1086 GLfloat temp[1] = {
1087 GL_NEAREST,
1089 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1090 EXPECT_CALL(
1091 *gl_,
1092 TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1093 *reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1094 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1095 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1098 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs0_0) {
1099 cmds::TexParameterfvImmediate& cmd =
1100 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1101 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1103 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1104 GLfloat temp[1] = {
1105 GL_NEAREST,
1107 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1108 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1110 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1113 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs0_1) {
1114 cmds::TexParameterfvImmediate& cmd =
1115 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1116 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1118 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1119 GLfloat temp[1] = {
1120 GL_NEAREST,
1122 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1123 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1125 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1128 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs1_0) {
1129 cmds::TexParameterfvImmediate& cmd =
1130 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1131 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1133 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1134 GLfloat temp[1] = {
1135 GL_NEAREST,
1137 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, &temp[0]);
1138 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1140 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1143 TEST_P(GLES2DecoderTest2, TexParameteriValidArgs) {
1144 EXPECT_CALL(*gl_,
1145 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
1146 SpecializedSetup<cmds::TexParameteri, 0>(true);
1147 cmds::TexParameteri cmd;
1148 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1149 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1150 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1153 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs0_0) {
1154 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1155 SpecializedSetup<cmds::TexParameteri, 0>(false);
1156 cmds::TexParameteri cmd;
1157 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1158 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1159 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1162 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs0_1) {
1163 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1164 SpecializedSetup<cmds::TexParameteri, 0>(false);
1165 cmds::TexParameteri cmd;
1166 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1167 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1168 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1171 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs1_0) {
1172 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1173 SpecializedSetup<cmds::TexParameteri, 0>(false);
1174 cmds::TexParameteri cmd;
1175 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_NEAREST);
1176 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1177 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1180 TEST_P(GLES2DecoderTest2, TexParameterivImmediateValidArgs) {
1181 cmds::TexParameterivImmediate& cmd =
1182 *GetImmediateAs<cmds::TexParameterivImmediate>();
1183 SpecializedSetup<cmds::TexParameterivImmediate, 0>(true);
1184 GLint temp[1] = {
1185 GL_NEAREST,
1187 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1188 EXPECT_CALL(*gl_, TexParameteri(
1189 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1190 *reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1191 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1192 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1195 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs0_0) {
1196 cmds::TexParameterivImmediate& cmd =
1197 *GetImmediateAs<cmds::TexParameterivImmediate>();
1198 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1200 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1201 GLint temp[1] = {
1202 GL_NEAREST,
1204 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1205 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1207 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1210 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs0_1) {
1211 cmds::TexParameterivImmediate& cmd =
1212 *GetImmediateAs<cmds::TexParameterivImmediate>();
1213 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1215 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1216 GLint temp[1] = {
1217 GL_NEAREST,
1219 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1220 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1222 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1225 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs1_0) {
1226 cmds::TexParameterivImmediate& cmd =
1227 *GetImmediateAs<cmds::TexParameterivImmediate>();
1228 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1230 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1231 GLint temp[1] = {
1232 GL_NEAREST,
1234 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, &temp[0]);
1235 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1237 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1240 TEST_P(GLES2DecoderTest2, TexStorage3DValidArgs) {
1241 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6));
1242 SpecializedSetup<cmds::TexStorage3D, 0>(true);
1243 cmds::TexStorage3D cmd;
1244 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6);
1245 decoder_->set_unsafe_es3_apis_enabled(true);
1246 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1247 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1248 decoder_->set_unsafe_es3_apis_enabled(false);
1249 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1251 // TODO(gman): TexSubImage2D
1253 // TODO(gman): TexSubImage3D
1255 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketValidArgs) {
1256 EXPECT_CALL(*gl_, TransformFeedbackVaryings(kServiceProgramId, 1, _,
1257 GL_INTERLEAVED_ATTRIBS));
1258 const uint32 kBucketId = 123;
1259 const char kSource0[] = "hello";
1260 const char* kSource[] = {kSource0};
1261 const char kValidStrEnd = 0;
1262 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
1263 cmds::TransformFeedbackVaryingsBucket cmd;
1264 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1265 decoder_->set_unsafe_es3_apis_enabled(true);
1266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1267 decoder_->set_unsafe_es3_apis_enabled(false);
1268 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1271 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidArgs) {
1272 const uint32 kBucketId = 123;
1273 const char kSource0[] = "hello";
1274 const char* kSource[] = {kSource0};
1275 const char kValidStrEnd = 0;
1276 decoder_->set_unsafe_es3_apis_enabled(true);
1277 cmds::TransformFeedbackVaryingsBucket cmd;
1278 // Test no bucket.
1279 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1280 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
1281 // Test invalid client.
1282 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
1283 cmd.Init(kInvalidClientId, kBucketId, GL_INTERLEAVED_ATTRIBS);
1284 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1285 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1288 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidHeader) {
1289 const uint32 kBucketId = 123;
1290 const char kSource0[] = "hello";
1291 const char* kSource[] = {kSource0};
1292 const char kValidStrEnd = 0;
1293 const GLsizei kCount = static_cast<GLsizei>(arraysize(kSource));
1294 const GLsizei kTests[] = {
1295 kCount + 1, 0, std::numeric_limits<GLsizei>::max(), -1,
1297 decoder_->set_unsafe_es3_apis_enabled(true);
1298 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
1299 SetBucketAsCStrings(kBucketId, 1, kSource, kTests[ii], kValidStrEnd);
1300 cmds::TransformFeedbackVaryingsBucket cmd;
1301 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1302 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1306 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidStringEnding) {
1307 const uint32 kBucketId = 123;
1308 const char kSource0[] = "hello";
1309 const char* kSource[] = {kSource0};
1310 const char kInvalidStrEnd = '*';
1311 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kInvalidStrEnd);
1312 cmds::TransformFeedbackVaryingsBucket cmd;
1313 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1314 decoder_->set_unsafe_es3_apis_enabled(true);
1315 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1318 TEST_P(GLES2DecoderTest2, Uniform1fValidArgs) {
1319 EXPECT_CALL(*gl_, Uniform1fv(1, 1, _));
1320 SpecializedSetup<cmds::Uniform1f, 0>(true);
1321 cmds::Uniform1f cmd;
1322 cmd.Init(1, 2);
1323 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1324 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1327 TEST_P(GLES2DecoderTest2, Uniform1fvImmediateValidArgs) {
1328 cmds::Uniform1fvImmediate& cmd = *GetImmediateAs<cmds::Uniform1fvImmediate>();
1329 EXPECT_CALL(
1330 *gl_,
1331 Uniform1fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1332 SpecializedSetup<cmds::Uniform1fvImmediate, 0>(true);
1333 GLfloat temp[1 * 2] = {
1336 cmd.Init(1, 2, &temp[0]);
1337 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1338 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1340 // TODO(gman): Uniform1i
1341 // TODO(gman): Uniform1ivImmediate
1343 TEST_P(GLES2DecoderTest2, Uniform1uiValidArgs) {
1344 EXPECT_CALL(*gl_, Uniform1uiv(1, 1, _));
1345 SpecializedSetup<cmds::Uniform1ui, 0>(true);
1346 cmds::Uniform1ui cmd;
1347 cmd.Init(1, 2);
1348 decoder_->set_unsafe_es3_apis_enabled(true);
1349 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1350 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1351 decoder_->set_unsafe_es3_apis_enabled(false);
1352 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1355 TEST_P(GLES2DecoderTest2, Uniform1uivImmediateValidArgs) {
1356 cmds::Uniform1uivImmediate& cmd =
1357 *GetImmediateAs<cmds::Uniform1uivImmediate>();
1358 EXPECT_CALL(
1359 *gl_,
1360 Uniform1uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1361 SpecializedSetup<cmds::Uniform1uivImmediate, 0>(true);
1362 GLuint temp[1 * 2] = {
1365 cmd.Init(1, 2, &temp[0]);
1366 decoder_->set_unsafe_es3_apis_enabled(true);
1367 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1368 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1369 decoder_->set_unsafe_es3_apis_enabled(false);
1370 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1373 TEST_P(GLES2DecoderTest2, Uniform2fValidArgs) {
1374 EXPECT_CALL(*gl_, Uniform2fv(1, 1, _));
1375 SpecializedSetup<cmds::Uniform2f, 0>(true);
1376 cmds::Uniform2f cmd;
1377 cmd.Init(1, 2, 3);
1378 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1379 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1382 TEST_P(GLES2DecoderTest2, Uniform2fvImmediateValidArgs) {
1383 cmds::Uniform2fvImmediate& cmd = *GetImmediateAs<cmds::Uniform2fvImmediate>();
1384 EXPECT_CALL(
1385 *gl_,
1386 Uniform2fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1387 SpecializedSetup<cmds::Uniform2fvImmediate, 0>(true);
1388 GLfloat temp[2 * 2] = {
1391 cmd.Init(1, 2, &temp[0]);
1392 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1393 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1396 TEST_P(GLES2DecoderTest2, Uniform2iValidArgs) {
1397 EXPECT_CALL(*gl_, Uniform2iv(1, 1, _));
1398 SpecializedSetup<cmds::Uniform2i, 0>(true);
1399 cmds::Uniform2i cmd;
1400 cmd.Init(1, 2, 3);
1401 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1402 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1405 TEST_P(GLES2DecoderTest2, Uniform2ivImmediateValidArgs) {
1406 cmds::Uniform2ivImmediate& cmd = *GetImmediateAs<cmds::Uniform2ivImmediate>();
1407 EXPECT_CALL(
1408 *gl_,
1409 Uniform2iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1410 SpecializedSetup<cmds::Uniform2ivImmediate, 0>(true);
1411 GLint temp[2 * 2] = {
1414 cmd.Init(1, 2, &temp[0]);
1415 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1416 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1419 TEST_P(GLES2DecoderTest2, Uniform2uiValidArgs) {
1420 EXPECT_CALL(*gl_, Uniform2uiv(1, 1, _));
1421 SpecializedSetup<cmds::Uniform2ui, 0>(true);
1422 cmds::Uniform2ui cmd;
1423 cmd.Init(1, 2, 3);
1424 decoder_->set_unsafe_es3_apis_enabled(true);
1425 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1426 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1427 decoder_->set_unsafe_es3_apis_enabled(false);
1428 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1431 TEST_P(GLES2DecoderTest2, Uniform2uivImmediateValidArgs) {
1432 cmds::Uniform2uivImmediate& cmd =
1433 *GetImmediateAs<cmds::Uniform2uivImmediate>();
1434 EXPECT_CALL(
1435 *gl_,
1436 Uniform2uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1437 SpecializedSetup<cmds::Uniform2uivImmediate, 0>(true);
1438 GLuint temp[2 * 2] = {
1441 cmd.Init(1, 2, &temp[0]);
1442 decoder_->set_unsafe_es3_apis_enabled(true);
1443 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1444 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1445 decoder_->set_unsafe_es3_apis_enabled(false);
1446 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1449 TEST_P(GLES2DecoderTest2, Uniform3fValidArgs) {
1450 EXPECT_CALL(*gl_, Uniform3fv(1, 1, _));
1451 SpecializedSetup<cmds::Uniform3f, 0>(true);
1452 cmds::Uniform3f cmd;
1453 cmd.Init(1, 2, 3, 4);
1454 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1455 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1458 TEST_P(GLES2DecoderTest2, Uniform3fvImmediateValidArgs) {
1459 cmds::Uniform3fvImmediate& cmd = *GetImmediateAs<cmds::Uniform3fvImmediate>();
1460 EXPECT_CALL(
1461 *gl_,
1462 Uniform3fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1463 SpecializedSetup<cmds::Uniform3fvImmediate, 0>(true);
1464 GLfloat temp[3 * 2] = {
1467 cmd.Init(1, 2, &temp[0]);
1468 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1469 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1472 TEST_P(GLES2DecoderTest2, Uniform3iValidArgs) {
1473 EXPECT_CALL(*gl_, Uniform3iv(1, 1, _));
1474 SpecializedSetup<cmds::Uniform3i, 0>(true);
1475 cmds::Uniform3i cmd;
1476 cmd.Init(1, 2, 3, 4);
1477 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1478 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1481 TEST_P(GLES2DecoderTest2, Uniform3ivImmediateValidArgs) {
1482 cmds::Uniform3ivImmediate& cmd = *GetImmediateAs<cmds::Uniform3ivImmediate>();
1483 EXPECT_CALL(
1484 *gl_,
1485 Uniform3iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1486 SpecializedSetup<cmds::Uniform3ivImmediate, 0>(true);
1487 GLint temp[3 * 2] = {
1490 cmd.Init(1, 2, &temp[0]);
1491 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1492 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1495 TEST_P(GLES2DecoderTest2, Uniform3uiValidArgs) {
1496 EXPECT_CALL(*gl_, Uniform3uiv(1, 1, _));
1497 SpecializedSetup<cmds::Uniform3ui, 0>(true);
1498 cmds::Uniform3ui cmd;
1499 cmd.Init(1, 2, 3, 4);
1500 decoder_->set_unsafe_es3_apis_enabled(true);
1501 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1502 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1503 decoder_->set_unsafe_es3_apis_enabled(false);
1504 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1507 TEST_P(GLES2DecoderTest2, Uniform3uivImmediateValidArgs) {
1508 cmds::Uniform3uivImmediate& cmd =
1509 *GetImmediateAs<cmds::Uniform3uivImmediate>();
1510 EXPECT_CALL(
1511 *gl_,
1512 Uniform3uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1513 SpecializedSetup<cmds::Uniform3uivImmediate, 0>(true);
1514 GLuint temp[3 * 2] = {
1517 cmd.Init(1, 2, &temp[0]);
1518 decoder_->set_unsafe_es3_apis_enabled(true);
1519 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1520 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1521 decoder_->set_unsafe_es3_apis_enabled(false);
1522 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1525 TEST_P(GLES2DecoderTest2, Uniform4fValidArgs) {
1526 EXPECT_CALL(*gl_, Uniform4fv(1, 1, _));
1527 SpecializedSetup<cmds::Uniform4f, 0>(true);
1528 cmds::Uniform4f cmd;
1529 cmd.Init(1, 2, 3, 4, 5);
1530 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1531 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1534 TEST_P(GLES2DecoderTest2, Uniform4fvImmediateValidArgs) {
1535 cmds::Uniform4fvImmediate& cmd = *GetImmediateAs<cmds::Uniform4fvImmediate>();
1536 EXPECT_CALL(
1537 *gl_,
1538 Uniform4fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1539 SpecializedSetup<cmds::Uniform4fvImmediate, 0>(true);
1540 GLfloat temp[4 * 2] = {
1543 cmd.Init(1, 2, &temp[0]);
1544 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1545 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1548 TEST_P(GLES2DecoderTest2, Uniform4iValidArgs) {
1549 EXPECT_CALL(*gl_, Uniform4iv(1, 1, _));
1550 SpecializedSetup<cmds::Uniform4i, 0>(true);
1551 cmds::Uniform4i cmd;
1552 cmd.Init(1, 2, 3, 4, 5);
1553 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1554 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1557 TEST_P(GLES2DecoderTest2, Uniform4ivImmediateValidArgs) {
1558 cmds::Uniform4ivImmediate& cmd = *GetImmediateAs<cmds::Uniform4ivImmediate>();
1559 EXPECT_CALL(
1560 *gl_,
1561 Uniform4iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1562 SpecializedSetup<cmds::Uniform4ivImmediate, 0>(true);
1563 GLint temp[4 * 2] = {
1566 cmd.Init(1, 2, &temp[0]);
1567 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1568 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1571 TEST_P(GLES2DecoderTest2, Uniform4uiValidArgs) {
1572 EXPECT_CALL(*gl_, Uniform4uiv(1, 1, _));
1573 SpecializedSetup<cmds::Uniform4ui, 0>(true);
1574 cmds::Uniform4ui cmd;
1575 cmd.Init(1, 2, 3, 4, 5);
1576 decoder_->set_unsafe_es3_apis_enabled(true);
1577 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1578 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1579 decoder_->set_unsafe_es3_apis_enabled(false);
1580 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1583 TEST_P(GLES2DecoderTest2, Uniform4uivImmediateValidArgs) {
1584 cmds::Uniform4uivImmediate& cmd =
1585 *GetImmediateAs<cmds::Uniform4uivImmediate>();
1586 EXPECT_CALL(
1587 *gl_,
1588 Uniform4uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1589 SpecializedSetup<cmds::Uniform4uivImmediate, 0>(true);
1590 GLuint temp[4 * 2] = {
1593 cmd.Init(1, 2, &temp[0]);
1594 decoder_->set_unsafe_es3_apis_enabled(true);
1595 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1596 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1597 decoder_->set_unsafe_es3_apis_enabled(false);
1598 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1600 // TODO(gman): UniformBlockBinding
1602 TEST_P(GLES2DecoderTest2, UniformMatrix2fvImmediateValidArgs) {
1603 cmds::UniformMatrix2fvImmediate& cmd =
1604 *GetImmediateAs<cmds::UniformMatrix2fvImmediate>();
1605 EXPECT_CALL(*gl_,
1606 UniformMatrix2fv(1, 2, false, reinterpret_cast<GLfloat*>(
1607 ImmediateDataAddress(&cmd))));
1608 SpecializedSetup<cmds::UniformMatrix2fvImmediate, 0>(true);
1609 GLfloat temp[4 * 2] = {
1612 cmd.Init(1, 2, &temp[0]);
1613 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1614 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1617 TEST_P(GLES2DecoderTest2, UniformMatrix2x3fvImmediateValidArgs) {
1618 cmds::UniformMatrix2x3fvImmediate& cmd =
1619 *GetImmediateAs<cmds::UniformMatrix2x3fvImmediate>();
1620 EXPECT_CALL(*gl_,
1621 UniformMatrix2x3fv(1, 2, false, reinterpret_cast<GLfloat*>(
1622 ImmediateDataAddress(&cmd))));
1623 SpecializedSetup<cmds::UniformMatrix2x3fvImmediate, 0>(true);
1624 GLfloat temp[6 * 2] = {
1627 cmd.Init(1, 2, &temp[0]);
1628 decoder_->set_unsafe_es3_apis_enabled(true);
1629 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1630 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1631 decoder_->set_unsafe_es3_apis_enabled(false);
1632 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1635 TEST_P(GLES2DecoderTest2, UniformMatrix2x4fvImmediateValidArgs) {
1636 cmds::UniformMatrix2x4fvImmediate& cmd =
1637 *GetImmediateAs<cmds::UniformMatrix2x4fvImmediate>();
1638 EXPECT_CALL(*gl_,
1639 UniformMatrix2x4fv(1, 2, false, reinterpret_cast<GLfloat*>(
1640 ImmediateDataAddress(&cmd))));
1641 SpecializedSetup<cmds::UniformMatrix2x4fvImmediate, 0>(true);
1642 GLfloat temp[8 * 2] = {
1645 cmd.Init(1, 2, &temp[0]);
1646 decoder_->set_unsafe_es3_apis_enabled(true);
1647 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1648 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1649 decoder_->set_unsafe_es3_apis_enabled(false);
1650 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1652 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_