Fix crash in SpeechRecognizerImpl introduced in AudioParams refactor.
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_2_autogen.h
blob40d9dab2aa92da9eecb53b2ce11a9063eb5bd682
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, GetProgramInfoLogValidArgs) {
16 const char* kInfo = "hello";
17 const uint32_t kBucketId = 123;
18 SpecializedSetup<cmds::GetProgramInfoLog, 0>(true);
20 cmds::GetProgramInfoLog cmd;
21 cmd.Init(client_program_id_, kBucketId);
22 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
23 CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
24 ASSERT_TRUE(bucket != NULL);
25 EXPECT_EQ(strlen(kInfo) + 1, bucket->size());
26 EXPECT_EQ(0,
27 memcmp(bucket->GetData(0, bucket->size()), kInfo, bucket->size()));
28 EXPECT_EQ(GL_NO_ERROR, GetGLError());
31 TEST_P(GLES2DecoderTest2, GetProgramInfoLogInvalidArgs) {
32 const uint32_t kBucketId = 123;
33 cmds::GetProgramInfoLog cmd;
34 cmd.Init(kInvalidClientId, kBucketId);
35 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
36 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
39 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivValidArgs) {
40 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
41 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(true);
42 typedef cmds::GetRenderbufferParameteriv::Result Result;
43 Result* result = static_cast<Result*>(shared_memory_address_);
44 EXPECT_CALL(
45 *gl_, GetRenderbufferParameterivEXT(
46 GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, result->GetData()));
47 result->size = 0;
48 cmds::GetRenderbufferParameteriv cmd;
49 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
50 shared_memory_offset_);
51 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
52 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
53 GL_RENDERBUFFER_RED_SIZE),
54 result->GetNumResults());
55 EXPECT_EQ(GL_NO_ERROR, GetGLError());
58 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs0_0) {
59 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
60 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
61 cmds::GetRenderbufferParameteriv::Result* result =
62 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
63 shared_memory_address_);
64 result->size = 0;
65 cmds::GetRenderbufferParameteriv cmd;
66 cmd.Init(GL_FRAMEBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
67 shared_memory_offset_);
68 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
69 EXPECT_EQ(0u, result->size);
70 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
73 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs2_0) {
74 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
75 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
76 cmds::GetRenderbufferParameteriv::Result* result =
77 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
78 shared_memory_address_);
79 result->size = 0;
80 cmds::GetRenderbufferParameteriv cmd;
81 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, kInvalidSharedMemoryId,
82 0);
83 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
84 EXPECT_EQ(0u, result->size);
87 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs2_1) {
88 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
89 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
90 cmds::GetRenderbufferParameteriv::Result* result =
91 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
92 shared_memory_address_);
93 result->size = 0;
94 cmds::GetRenderbufferParameteriv cmd;
95 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
96 kInvalidSharedMemoryOffset);
97 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
98 EXPECT_EQ(0u, result->size);
101 TEST_P(GLES2DecoderTest2, GetSamplerParameterfvValidArgs) {
102 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
103 SpecializedSetup<cmds::GetSamplerParameterfv, 0>(true);
104 typedef cmds::GetSamplerParameterfv::Result Result;
105 Result* result = static_cast<Result*>(shared_memory_address_);
106 EXPECT_CALL(*gl_,
107 GetSamplerParameterfv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
108 result->GetData()));
109 result->size = 0;
110 cmds::GetSamplerParameterfv cmd;
111 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
112 shared_memory_offset_);
113 decoder_->set_unsafe_es3_apis_enabled(true);
114 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
115 EXPECT_EQ(
116 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
117 result->GetNumResults());
118 EXPECT_EQ(GL_NO_ERROR, GetGLError());
119 decoder_->set_unsafe_es3_apis_enabled(false);
120 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
123 TEST_P(GLES2DecoderTest2, GetSamplerParameterivValidArgs) {
124 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
125 SpecializedSetup<cmds::GetSamplerParameteriv, 0>(true);
126 typedef cmds::GetSamplerParameteriv::Result Result;
127 Result* result = static_cast<Result*>(shared_memory_address_);
128 EXPECT_CALL(*gl_,
129 GetSamplerParameteriv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
130 result->GetData()));
131 result->size = 0;
132 cmds::GetSamplerParameteriv cmd;
133 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
134 shared_memory_offset_);
135 decoder_->set_unsafe_es3_apis_enabled(true);
136 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
137 EXPECT_EQ(
138 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
139 result->GetNumResults());
140 EXPECT_EQ(GL_NO_ERROR, GetGLError());
141 decoder_->set_unsafe_es3_apis_enabled(false);
142 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
145 TEST_P(GLES2DecoderTest2, GetShaderivValidArgs) {
146 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
147 SpecializedSetup<cmds::GetShaderiv, 0>(true);
148 typedef cmds::GetShaderiv::Result Result;
149 Result* result = static_cast<Result*>(shared_memory_address_);
150 EXPECT_CALL(*gl_,
151 GetShaderiv(kServiceShaderId, GL_SHADER_TYPE, result->GetData()));
152 result->size = 0;
153 cmds::GetShaderiv cmd;
154 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
155 shared_memory_offset_);
156 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
157 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE),
158 result->GetNumResults());
159 EXPECT_EQ(GL_NO_ERROR, GetGLError());
162 TEST_P(GLES2DecoderTest2, GetShaderivInvalidArgs2_0) {
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, kInvalidSharedMemoryId, 0);
170 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
171 EXPECT_EQ(0u, result->size);
174 TEST_P(GLES2DecoderTest2, GetShaderivInvalidArgs2_1) {
175 EXPECT_CALL(*gl_, GetShaderiv(_, _, _)).Times(0);
176 SpecializedSetup<cmds::GetShaderiv, 0>(false);
177 cmds::GetShaderiv::Result* result =
178 static_cast<cmds::GetShaderiv::Result*>(shared_memory_address_);
179 result->size = 0;
180 cmds::GetShaderiv cmd;
181 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
182 kInvalidSharedMemoryOffset);
183 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
184 EXPECT_EQ(0u, result->size);
186 // TODO(gman): GetShaderInfoLog
187 // TODO(gman): GetShaderPrecisionFormat
189 // TODO(gman): GetShaderSource
190 // TODO(gman): GetString
192 TEST_P(GLES2DecoderTest2, GetSyncivValidArgs) {
193 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
194 SpecializedSetup<cmds::GetSynciv, 0>(true);
195 typedef cmds::GetSynciv::Result Result;
196 Result* result = static_cast<Result*>(shared_memory_address_);
197 EXPECT_CALL(
198 *gl_, GetSynciv(reinterpret_cast<GLsync>(kServiceSyncId), GL_SYNC_STATUS,
199 decoder_->GetGLES2Util()->GLGetNumValuesReturned(
200 GL_SYNC_STATUS),
201 nullptr, result->GetData()));
202 result->size = 0;
203 cmds::GetSynciv cmd;
204 cmd.Init(client_sync_id_, GL_SYNC_STATUS, shared_memory_id_,
205 shared_memory_offset_);
206 decoder_->set_unsafe_es3_apis_enabled(true);
207 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
208 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SYNC_STATUS),
209 result->GetNumResults());
210 EXPECT_EQ(GL_NO_ERROR, GetGLError());
211 decoder_->set_unsafe_es3_apis_enabled(false);
212 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
215 TEST_P(GLES2DecoderTest2, GetTexParameterfvValidArgs) {
216 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
217 SpecializedSetup<cmds::GetTexParameterfv, 0>(true);
218 typedef cmds::GetTexParameterfv::Result Result;
219 Result* result = static_cast<Result*>(shared_memory_address_);
220 EXPECT_CALL(*gl_, GetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
221 result->GetData()));
222 result->size = 0;
223 cmds::GetTexParameterfv cmd;
224 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
225 shared_memory_offset_);
226 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
227 EXPECT_EQ(
228 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
229 result->GetNumResults());
230 EXPECT_EQ(GL_NO_ERROR, GetGLError());
233 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs0_0) {
234 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
235 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
236 cmds::GetTexParameterfv::Result* result =
237 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
238 result->size = 0;
239 cmds::GetTexParameterfv cmd;
240 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
241 shared_memory_offset_);
242 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
243 EXPECT_EQ(0u, result->size);
244 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
247 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs1_0) {
248 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
249 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
250 cmds::GetTexParameterfv::Result* result =
251 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
252 result->size = 0;
253 cmds::GetTexParameterfv cmd;
254 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, shared_memory_id_,
255 shared_memory_offset_);
256 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
257 EXPECT_EQ(0u, result->size);
258 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
261 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs2_0) {
262 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
263 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
264 cmds::GetTexParameterfv::Result* result =
265 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
266 result->size = 0;
267 cmds::GetTexParameterfv cmd;
268 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, kInvalidSharedMemoryId, 0);
269 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
270 EXPECT_EQ(0u, result->size);
273 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs2_1) {
274 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
275 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
276 cmds::GetTexParameterfv::Result* result =
277 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
278 result->size = 0;
279 cmds::GetTexParameterfv cmd;
280 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
281 kInvalidSharedMemoryOffset);
282 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
283 EXPECT_EQ(0u, result->size);
286 TEST_P(GLES2DecoderTest2, GetTexParameterivValidArgs) {
287 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
288 SpecializedSetup<cmds::GetTexParameteriv, 0>(true);
289 typedef cmds::GetTexParameteriv::Result Result;
290 Result* result = static_cast<Result*>(shared_memory_address_);
291 EXPECT_CALL(*gl_, GetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
292 result->GetData()));
293 result->size = 0;
294 cmds::GetTexParameteriv cmd;
295 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
296 shared_memory_offset_);
297 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
298 EXPECT_EQ(
299 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
300 result->GetNumResults());
301 EXPECT_EQ(GL_NO_ERROR, GetGLError());
304 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs0_0) {
305 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
306 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
307 cmds::GetTexParameteriv::Result* result =
308 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
309 result->size = 0;
310 cmds::GetTexParameteriv cmd;
311 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
312 shared_memory_offset_);
313 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
314 EXPECT_EQ(0u, result->size);
315 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
318 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs1_0) {
319 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
320 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
321 cmds::GetTexParameteriv::Result* result =
322 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
323 result->size = 0;
324 cmds::GetTexParameteriv cmd;
325 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, shared_memory_id_,
326 shared_memory_offset_);
327 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
328 EXPECT_EQ(0u, result->size);
329 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
332 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs2_0) {
333 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
334 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
335 cmds::GetTexParameteriv::Result* result =
336 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
337 result->size = 0;
338 cmds::GetTexParameteriv cmd;
339 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, kInvalidSharedMemoryId, 0);
340 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
341 EXPECT_EQ(0u, result->size);
344 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs2_1) {
345 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
346 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
347 cmds::GetTexParameteriv::Result* result =
348 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
349 result->size = 0;
350 cmds::GetTexParameteriv cmd;
351 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
352 kInvalidSharedMemoryOffset);
353 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
354 EXPECT_EQ(0u, result->size);
356 // TODO(gman): GetTransformFeedbackVarying
358 // TODO(gman): GetUniformBlockIndex
360 // TODO(gman): GetUniformfv
362 // TODO(gman): GetUniformiv
364 // TODO(gman): GetUniformuiv
366 // TODO(gman): GetUniformIndices
368 // TODO(gman): GetUniformLocation
370 TEST_P(GLES2DecoderTest2, GetVertexAttribfvValidArgs) {
371 SpecializedSetup<cmds::GetVertexAttribfv, 0>(true);
372 typedef cmds::GetVertexAttribfv::Result Result;
373 Result* result = static_cast<Result*>(shared_memory_address_);
374 result->size = 0;
375 cmds::GetVertexAttribfv cmd;
376 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
377 shared_memory_offset_);
378 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
379 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
380 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
381 result->GetNumResults());
382 EXPECT_EQ(GL_NO_ERROR, GetGLError());
385 TEST_P(GLES2DecoderTest2, GetVertexAttribfvInvalidArgs2_0) {
386 EXPECT_CALL(*gl_, GetVertexAttribfv(_, _, _)).Times(0);
387 SpecializedSetup<cmds::GetVertexAttribfv, 0>(false);
388 cmds::GetVertexAttribfv::Result* result =
389 static_cast<cmds::GetVertexAttribfv::Result*>(shared_memory_address_);
390 result->size = 0;
391 cmds::GetVertexAttribfv cmd;
392 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, kInvalidSharedMemoryId, 0);
393 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
394 EXPECT_EQ(0u, result->size);
397 TEST_P(GLES2DecoderTest2, GetVertexAttribfvInvalidArgs2_1) {
398 EXPECT_CALL(*gl_, GetVertexAttribfv(_, _, _)).Times(0);
399 SpecializedSetup<cmds::GetVertexAttribfv, 0>(false);
400 cmds::GetVertexAttribfv::Result* result =
401 static_cast<cmds::GetVertexAttribfv::Result*>(shared_memory_address_);
402 result->size = 0;
403 cmds::GetVertexAttribfv cmd;
404 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
405 kInvalidSharedMemoryOffset);
406 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
407 EXPECT_EQ(0u, result->size);
410 TEST_P(GLES2DecoderTest2, GetVertexAttribivValidArgs) {
411 SpecializedSetup<cmds::GetVertexAttribiv, 0>(true);
412 typedef cmds::GetVertexAttribiv::Result Result;
413 Result* result = static_cast<Result*>(shared_memory_address_);
414 result->size = 0;
415 cmds::GetVertexAttribiv cmd;
416 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
417 shared_memory_offset_);
418 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
419 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
420 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
421 result->GetNumResults());
422 EXPECT_EQ(GL_NO_ERROR, GetGLError());
425 TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_0) {
426 EXPECT_CALL(*gl_, GetVertexAttribiv(_, _, _)).Times(0);
427 SpecializedSetup<cmds::GetVertexAttribiv, 0>(false);
428 cmds::GetVertexAttribiv::Result* result =
429 static_cast<cmds::GetVertexAttribiv::Result*>(shared_memory_address_);
430 result->size = 0;
431 cmds::GetVertexAttribiv cmd;
432 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, kInvalidSharedMemoryId, 0);
433 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
434 EXPECT_EQ(0u, result->size);
437 TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_1) {
438 EXPECT_CALL(*gl_, GetVertexAttribiv(_, _, _)).Times(0);
439 SpecializedSetup<cmds::GetVertexAttribiv, 0>(false);
440 cmds::GetVertexAttribiv::Result* result =
441 static_cast<cmds::GetVertexAttribiv::Result*>(shared_memory_address_);
442 result->size = 0;
443 cmds::GetVertexAttribiv cmd;
444 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
445 kInvalidSharedMemoryOffset);
446 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
447 EXPECT_EQ(0u, result->size);
450 TEST_P(GLES2DecoderTest2, GetVertexAttribIivValidArgs) {
451 SpecializedSetup<cmds::GetVertexAttribIiv, 0>(true);
452 typedef cmds::GetVertexAttribIiv::Result Result;
453 Result* result = static_cast<Result*>(shared_memory_address_);
454 result->size = 0;
455 cmds::GetVertexAttribIiv cmd;
456 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
457 shared_memory_offset_);
458 decoder_->set_unsafe_es3_apis_enabled(true);
459 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
460 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
461 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
462 result->GetNumResults());
463 EXPECT_EQ(GL_NO_ERROR, GetGLError());
464 decoder_->set_unsafe_es3_apis_enabled(false);
465 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
468 TEST_P(GLES2DecoderTest2, GetVertexAttribIuivValidArgs) {
469 SpecializedSetup<cmds::GetVertexAttribIuiv, 0>(true);
470 typedef cmds::GetVertexAttribIuiv::Result Result;
471 Result* result = static_cast<Result*>(shared_memory_address_);
472 result->size = 0;
473 cmds::GetVertexAttribIuiv cmd;
474 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
475 shared_memory_offset_);
476 decoder_->set_unsafe_es3_apis_enabled(true);
477 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
478 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
479 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
480 result->GetNumResults());
481 EXPECT_EQ(GL_NO_ERROR, GetGLError());
482 decoder_->set_unsafe_es3_apis_enabled(false);
483 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
485 // TODO(gman): GetVertexAttribPointerv
487 TEST_P(GLES2DecoderTest2, HintValidArgs) {
488 EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST));
489 SpecializedSetup<cmds::Hint, 0>(true);
490 cmds::Hint cmd;
491 cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
492 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
493 EXPECT_EQ(GL_NO_ERROR, GetGLError());
496 TEST_P(GLES2DecoderTest2, HintInvalidArgs0_0) {
497 EXPECT_CALL(*gl_, Hint(_, _)).Times(0);
498 SpecializedSetup<cmds::Hint, 0>(false);
499 cmds::Hint cmd;
500 cmd.Init(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
501 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
502 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
504 // TODO(gman): InvalidateFramebufferImmediate
505 // TODO(gman): InvalidateSubFramebufferImmediate
507 TEST_P(GLES2DecoderTest2, IsBufferValidArgs) {
508 SpecializedSetup<cmds::IsBuffer, 0>(true);
509 cmds::IsBuffer cmd;
510 cmd.Init(client_buffer_id_, shared_memory_id_, shared_memory_offset_);
511 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
512 EXPECT_EQ(GL_NO_ERROR, GetGLError());
515 TEST_P(GLES2DecoderTest2, IsBufferInvalidArgsBadSharedMemoryId) {
516 SpecializedSetup<cmds::IsBuffer, 0>(false);
517 cmds::IsBuffer cmd;
518 cmd.Init(client_buffer_id_, kInvalidSharedMemoryId, shared_memory_offset_);
519 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
520 cmd.Init(client_buffer_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
521 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
524 TEST_P(GLES2DecoderTest2, IsEnabledValidArgs) {
525 SpecializedSetup<cmds::IsEnabled, 0>(true);
526 cmds::IsEnabled cmd;
527 cmd.Init(GL_BLEND, shared_memory_id_, shared_memory_offset_);
528 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
529 EXPECT_EQ(GL_NO_ERROR, GetGLError());
532 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgs0_0) {
533 EXPECT_CALL(*gl_, IsEnabled(_)).Times(0);
534 SpecializedSetup<cmds::IsEnabled, 0>(false);
535 cmds::IsEnabled cmd;
536 cmd.Init(GL_CLIP_PLANE0, shared_memory_id_, shared_memory_offset_);
537 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
538 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
541 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgs0_1) {
542 EXPECT_CALL(*gl_, IsEnabled(_)).Times(0);
543 SpecializedSetup<cmds::IsEnabled, 0>(false);
544 cmds::IsEnabled cmd;
545 cmd.Init(GL_POINT_SPRITE, shared_memory_id_, shared_memory_offset_);
546 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
547 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
550 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgsBadSharedMemoryId) {
551 SpecializedSetup<cmds::IsEnabled, 0>(false);
552 cmds::IsEnabled cmd;
553 cmd.Init(GL_BLEND, kInvalidSharedMemoryId, shared_memory_offset_);
554 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
555 cmd.Init(GL_BLEND, shared_memory_id_, kInvalidSharedMemoryOffset);
556 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
559 TEST_P(GLES2DecoderTest2, IsFramebufferValidArgs) {
560 SpecializedSetup<cmds::IsFramebuffer, 0>(true);
561 cmds::IsFramebuffer cmd;
562 cmd.Init(client_framebuffer_id_, shared_memory_id_, shared_memory_offset_);
563 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
564 EXPECT_EQ(GL_NO_ERROR, GetGLError());
567 TEST_P(GLES2DecoderTest2, IsFramebufferInvalidArgsBadSharedMemoryId) {
568 SpecializedSetup<cmds::IsFramebuffer, 0>(false);
569 cmds::IsFramebuffer cmd;
570 cmd.Init(client_framebuffer_id_, kInvalidSharedMemoryId,
571 shared_memory_offset_);
572 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
573 cmd.Init(client_framebuffer_id_, shared_memory_id_,
574 kInvalidSharedMemoryOffset);
575 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
578 TEST_P(GLES2DecoderTest2, IsProgramValidArgs) {
579 SpecializedSetup<cmds::IsProgram, 0>(true);
580 cmds::IsProgram cmd;
581 cmd.Init(client_program_id_, shared_memory_id_, shared_memory_offset_);
582 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
583 EXPECT_EQ(GL_NO_ERROR, GetGLError());
586 TEST_P(GLES2DecoderTest2, IsProgramInvalidArgsBadSharedMemoryId) {
587 SpecializedSetup<cmds::IsProgram, 0>(false);
588 cmds::IsProgram cmd;
589 cmd.Init(client_program_id_, kInvalidSharedMemoryId, shared_memory_offset_);
590 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
591 cmd.Init(client_program_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
592 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
595 TEST_P(GLES2DecoderTest2, IsRenderbufferValidArgs) {
596 SpecializedSetup<cmds::IsRenderbuffer, 0>(true);
597 cmds::IsRenderbuffer cmd;
598 cmd.Init(client_renderbuffer_id_, shared_memory_id_, shared_memory_offset_);
599 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
600 EXPECT_EQ(GL_NO_ERROR, GetGLError());
603 TEST_P(GLES2DecoderTest2, IsRenderbufferInvalidArgsBadSharedMemoryId) {
604 SpecializedSetup<cmds::IsRenderbuffer, 0>(false);
605 cmds::IsRenderbuffer cmd;
606 cmd.Init(client_renderbuffer_id_, kInvalidSharedMemoryId,
607 shared_memory_offset_);
608 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
609 cmd.Init(client_renderbuffer_id_, shared_memory_id_,
610 kInvalidSharedMemoryOffset);
611 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
614 TEST_P(GLES2DecoderTest2, IsSamplerValidArgs) {
615 SpecializedSetup<cmds::IsSampler, 0>(true);
616 cmds::IsSampler cmd;
617 cmd.Init(client_sampler_id_, shared_memory_id_, shared_memory_offset_);
618 decoder_->set_unsafe_es3_apis_enabled(true);
619 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
620 EXPECT_EQ(GL_NO_ERROR, GetGLError());
621 decoder_->set_unsafe_es3_apis_enabled(false);
622 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
625 TEST_P(GLES2DecoderTest2, IsSamplerInvalidArgsBadSharedMemoryId) {
626 SpecializedSetup<cmds::IsSampler, 0>(false);
627 decoder_->set_unsafe_es3_apis_enabled(true);
628 cmds::IsSampler cmd;
629 cmd.Init(client_sampler_id_, kInvalidSharedMemoryId, shared_memory_offset_);
630 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
631 cmd.Init(client_sampler_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
632 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
633 decoder_->set_unsafe_es3_apis_enabled(true);
636 TEST_P(GLES2DecoderTest2, IsShaderValidArgs) {
637 SpecializedSetup<cmds::IsShader, 0>(true);
638 cmds::IsShader cmd;
639 cmd.Init(client_shader_id_, shared_memory_id_, shared_memory_offset_);
640 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
641 EXPECT_EQ(GL_NO_ERROR, GetGLError());
644 TEST_P(GLES2DecoderTest2, IsShaderInvalidArgsBadSharedMemoryId) {
645 SpecializedSetup<cmds::IsShader, 0>(false);
646 cmds::IsShader cmd;
647 cmd.Init(client_shader_id_, kInvalidSharedMemoryId, shared_memory_offset_);
648 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
649 cmd.Init(client_shader_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
650 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
653 TEST_P(GLES2DecoderTest2, IsSyncValidArgs) {
654 SpecializedSetup<cmds::IsSync, 0>(true);
655 cmds::IsSync cmd;
656 cmd.Init(client_sync_id_, shared_memory_id_, shared_memory_offset_);
657 decoder_->set_unsafe_es3_apis_enabled(true);
658 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
659 EXPECT_EQ(GL_NO_ERROR, GetGLError());
660 decoder_->set_unsafe_es3_apis_enabled(false);
661 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
664 TEST_P(GLES2DecoderTest2, IsSyncInvalidArgsBadSharedMemoryId) {
665 SpecializedSetup<cmds::IsSync, 0>(false);
666 decoder_->set_unsafe_es3_apis_enabled(true);
667 cmds::IsSync cmd;
668 cmd.Init(client_sync_id_, kInvalidSharedMemoryId, shared_memory_offset_);
669 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
670 cmd.Init(client_sync_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
671 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
672 decoder_->set_unsafe_es3_apis_enabled(true);
675 TEST_P(GLES2DecoderTest2, IsTextureValidArgs) {
676 SpecializedSetup<cmds::IsTexture, 0>(true);
677 cmds::IsTexture cmd;
678 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
679 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
680 EXPECT_EQ(GL_NO_ERROR, GetGLError());
683 TEST_P(GLES2DecoderTest2, IsTextureInvalidArgsBadSharedMemoryId) {
684 SpecializedSetup<cmds::IsTexture, 0>(false);
685 cmds::IsTexture cmd;
686 cmd.Init(client_texture_id_, kInvalidSharedMemoryId, shared_memory_offset_);
687 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
688 cmd.Init(client_texture_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
689 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
692 TEST_P(GLES2DecoderTest2, IsTransformFeedbackValidArgs) {
693 SpecializedSetup<cmds::IsTransformFeedback, 0>(true);
694 cmds::IsTransformFeedback cmd;
695 cmd.Init(client_transformfeedback_id_, shared_memory_id_,
696 shared_memory_offset_);
697 decoder_->set_unsafe_es3_apis_enabled(true);
698 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
699 EXPECT_EQ(GL_NO_ERROR, GetGLError());
700 decoder_->set_unsafe_es3_apis_enabled(false);
701 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
704 TEST_P(GLES2DecoderTest2, IsTransformFeedbackInvalidArgsBadSharedMemoryId) {
705 SpecializedSetup<cmds::IsTransformFeedback, 0>(false);
706 decoder_->set_unsafe_es3_apis_enabled(true);
707 cmds::IsTransformFeedback cmd;
708 cmd.Init(client_transformfeedback_id_, kInvalidSharedMemoryId,
709 shared_memory_offset_);
710 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
711 cmd.Init(client_transformfeedback_id_, shared_memory_id_,
712 kInvalidSharedMemoryOffset);
713 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
714 decoder_->set_unsafe_es3_apis_enabled(true);
717 TEST_P(GLES2DecoderTest2, LineWidthValidArgs) {
718 EXPECT_CALL(*gl_, LineWidth(0.5f));
719 SpecializedSetup<cmds::LineWidth, 0>(true);
720 cmds::LineWidth cmd;
721 cmd.Init(0.5f);
722 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
723 EXPECT_EQ(GL_NO_ERROR, GetGLError());
726 TEST_P(GLES2DecoderTest2, LineWidthInvalidValue0_0) {
727 SpecializedSetup<cmds::LineWidth, 0>(false);
728 cmds::LineWidth cmd;
729 cmd.Init(0.0f);
730 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
731 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
734 TEST_P(GLES2DecoderTest2, LineWidthNaNValue0) {
735 SpecializedSetup<cmds::LineWidth, 0>(false);
736 cmds::LineWidth cmd;
737 cmd.Init(nanf(""));
738 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
739 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
742 TEST_P(GLES2DecoderTest2, LinkProgramValidArgs) {
743 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId));
744 SpecializedSetup<cmds::LinkProgram, 0>(true);
745 cmds::LinkProgram cmd;
746 cmd.Init(client_program_id_);
747 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
748 EXPECT_EQ(GL_NO_ERROR, GetGLError());
751 TEST_P(GLES2DecoderTest2, PauseTransformFeedbackValidArgs) {
752 EXPECT_CALL(*gl_, PauseTransformFeedback());
753 SpecializedSetup<cmds::PauseTransformFeedback, 0>(true);
754 cmds::PauseTransformFeedback cmd;
755 cmd.Init();
756 decoder_->set_unsafe_es3_apis_enabled(true);
757 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
758 EXPECT_EQ(GL_NO_ERROR, GetGLError());
759 decoder_->set_unsafe_es3_apis_enabled(false);
760 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
762 // TODO(gman): PixelStorei
764 TEST_P(GLES2DecoderTest2, PolygonOffsetValidArgs) {
765 EXPECT_CALL(*gl_, PolygonOffset(1, 2));
766 SpecializedSetup<cmds::PolygonOffset, 0>(true);
767 cmds::PolygonOffset cmd;
768 cmd.Init(1, 2);
769 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
770 EXPECT_EQ(GL_NO_ERROR, GetGLError());
773 TEST_P(GLES2DecoderTest2, ReadBufferValidArgs) {
774 EXPECT_CALL(*gl_, ReadBuffer(GL_NONE));
775 SpecializedSetup<cmds::ReadBuffer, 0>(true);
776 cmds::ReadBuffer cmd;
777 cmd.Init(GL_NONE);
778 decoder_->set_unsafe_es3_apis_enabled(true);
779 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
780 EXPECT_EQ(GL_NO_ERROR, GetGLError());
781 decoder_->set_unsafe_es3_apis_enabled(false);
782 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
784 // TODO(gman): ReadPixels
786 // TODO(gman): ReleaseShaderCompiler
788 TEST_P(GLES2DecoderTest2, RenderbufferStorageValidArgs) {
789 SpecializedSetup<cmds::RenderbufferStorage, 0>(true);
790 cmds::RenderbufferStorage cmd;
791 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
792 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
793 EXPECT_EQ(GL_NO_ERROR, GetGLError());
796 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs0_0) {
797 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
798 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
799 cmds::RenderbufferStorage cmd;
800 cmd.Init(GL_FRAMEBUFFER, GL_RGBA4, 3, 4);
801 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
802 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
805 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs2_0) {
806 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
807 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
808 cmds::RenderbufferStorage cmd;
809 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, -1, 4);
810 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
811 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
814 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs3_0) {
815 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
816 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
817 cmds::RenderbufferStorage cmd;
818 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, -1);
819 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
820 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
823 TEST_P(GLES2DecoderTest2, ResumeTransformFeedbackValidArgs) {
824 EXPECT_CALL(*gl_, ResumeTransformFeedback());
825 SpecializedSetup<cmds::ResumeTransformFeedback, 0>(true);
826 cmds::ResumeTransformFeedback cmd;
827 cmd.Init();
828 decoder_->set_unsafe_es3_apis_enabled(true);
829 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
830 EXPECT_EQ(GL_NO_ERROR, GetGLError());
831 decoder_->set_unsafe_es3_apis_enabled(false);
832 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
835 TEST_P(GLES2DecoderTest2, SampleCoverageValidArgs) {
836 EXPECT_CALL(*gl_, SampleCoverage(1, true));
837 SpecializedSetup<cmds::SampleCoverage, 0>(true);
838 cmds::SampleCoverage cmd;
839 cmd.Init(1, true);
840 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
841 EXPECT_EQ(GL_NO_ERROR, GetGLError());
844 TEST_P(GLES2DecoderTest2, SamplerParameterfValidArgs) {
845 EXPECT_CALL(*gl_, SamplerParameterf(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
846 GL_NEAREST));
847 SpecializedSetup<cmds::SamplerParameterf, 0>(true);
848 cmds::SamplerParameterf cmd;
849 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
850 decoder_->set_unsafe_es3_apis_enabled(true);
851 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
852 EXPECT_EQ(GL_NO_ERROR, GetGLError());
853 decoder_->set_unsafe_es3_apis_enabled(false);
854 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
857 TEST_P(GLES2DecoderTest2, SamplerParameterfvImmediateValidArgs) {
858 cmds::SamplerParameterfvImmediate& cmd =
859 *GetImmediateAs<cmds::SamplerParameterfvImmediate>();
860 SpecializedSetup<cmds::SamplerParameterfvImmediate, 0>(true);
861 GLfloat temp[1] = {
862 GL_NEAREST,
864 cmd.Init(kServiceSamplerId, GL_TEXTURE_MAG_FILTER, &temp[0]);
865 EXPECT_CALL(*gl_, SamplerParameterf(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
866 *reinterpret_cast<GLfloat*>(
867 ImmediateDataAddress(&cmd))));
868 decoder_->set_unsafe_es3_apis_enabled(true);
869 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
870 EXPECT_EQ(GL_NO_ERROR, GetGLError());
871 decoder_->set_unsafe_es3_apis_enabled(false);
872 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
875 TEST_P(GLES2DecoderTest2, SamplerParameteriValidArgs) {
876 EXPECT_CALL(*gl_, SamplerParameteri(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
877 GL_NEAREST));
878 SpecializedSetup<cmds::SamplerParameteri, 0>(true);
879 cmds::SamplerParameteri cmd;
880 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
881 decoder_->set_unsafe_es3_apis_enabled(true);
882 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
883 EXPECT_EQ(GL_NO_ERROR, GetGLError());
884 decoder_->set_unsafe_es3_apis_enabled(false);
885 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
888 TEST_P(GLES2DecoderTest2, SamplerParameterivImmediateValidArgs) {
889 cmds::SamplerParameterivImmediate& cmd =
890 *GetImmediateAs<cmds::SamplerParameterivImmediate>();
891 SpecializedSetup<cmds::SamplerParameterivImmediate, 0>(true);
892 GLint temp[1] = {
893 GL_NEAREST,
895 cmd.Init(kServiceSamplerId, GL_TEXTURE_MAG_FILTER, &temp[0]);
896 EXPECT_CALL(*gl_, SamplerParameteri(
897 kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
898 *reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
899 decoder_->set_unsafe_es3_apis_enabled(true);
900 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
901 EXPECT_EQ(GL_NO_ERROR, GetGLError());
902 decoder_->set_unsafe_es3_apis_enabled(false);
903 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
906 TEST_P(GLES2DecoderTest2, ScissorValidArgs) {
907 EXPECT_CALL(*gl_, Scissor(1, 2, 3, 4));
908 SpecializedSetup<cmds::Scissor, 0>(true);
909 cmds::Scissor cmd;
910 cmd.Init(1, 2, 3, 4);
911 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
912 EXPECT_EQ(GL_NO_ERROR, GetGLError());
915 TEST_P(GLES2DecoderTest2, ScissorInvalidArgs2_0) {
916 EXPECT_CALL(*gl_, Scissor(_, _, _, _)).Times(0);
917 SpecializedSetup<cmds::Scissor, 0>(false);
918 cmds::Scissor cmd;
919 cmd.Init(1, 2, -1, 4);
920 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
921 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
924 TEST_P(GLES2DecoderTest2, ScissorInvalidArgs3_0) {
925 EXPECT_CALL(*gl_, Scissor(_, _, _, _)).Times(0);
926 SpecializedSetup<cmds::Scissor, 0>(false);
927 cmds::Scissor cmd;
928 cmd.Init(1, 2, 3, -1);
929 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
930 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
932 // TODO(gman): ShaderBinary
934 TEST_P(GLES2DecoderTest2, ShaderSourceBucketValidArgs) {
935 const uint32 kBucketId = 123;
936 const char kSource0[] = "hello";
937 const char* kSource[] = {kSource0};
938 const char kValidStrEnd = 0;
939 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
940 cmds::ShaderSourceBucket cmd;
941 cmd.Init(client_shader_id_, kBucketId);
942 decoder_->set_unsafe_es3_apis_enabled(true);
943 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
946 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidArgs) {
947 const uint32 kBucketId = 123;
948 const char kSource0[] = "hello";
949 const char* kSource[] = {kSource0};
950 const char kValidStrEnd = 0;
951 decoder_->set_unsafe_es3_apis_enabled(true);
952 cmds::ShaderSourceBucket cmd;
953 // Test no bucket.
954 cmd.Init(client_shader_id_, kBucketId);
955 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
956 // Test invalid client.
957 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
958 cmd.Init(kInvalidClientId, kBucketId);
959 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
960 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
963 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidHeader) {
964 const uint32 kBucketId = 123;
965 const char kSource0[] = "hello";
966 const char* kSource[] = {kSource0};
967 const char kValidStrEnd = 0;
968 const GLsizei kCount = static_cast<GLsizei>(arraysize(kSource));
969 const GLsizei kTests[] = {
970 kCount + 1, 0, std::numeric_limits<GLsizei>::max(), -1,
972 decoder_->set_unsafe_es3_apis_enabled(true);
973 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
974 SetBucketAsCStrings(kBucketId, 1, kSource, kTests[ii], kValidStrEnd);
975 cmds::ShaderSourceBucket cmd;
976 cmd.Init(client_shader_id_, kBucketId);
977 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
981 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidStringEnding) {
982 const uint32 kBucketId = 123;
983 const char kSource0[] = "hello";
984 const char* kSource[] = {kSource0};
985 const char kInvalidStrEnd = '*';
986 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kInvalidStrEnd);
987 cmds::ShaderSourceBucket cmd;
988 cmd.Init(client_shader_id_, kBucketId);
989 decoder_->set_unsafe_es3_apis_enabled(true);
990 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
993 TEST_P(GLES2DecoderTest2, StencilFuncValidArgs) {
994 EXPECT_CALL(*gl_, StencilFunc(GL_NEVER, 2, 3));
995 SpecializedSetup<cmds::StencilFunc, 0>(true);
996 cmds::StencilFunc cmd;
997 cmd.Init(GL_NEVER, 2, 3);
998 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
999 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1002 TEST_P(GLES2DecoderTest2, StencilFuncSeparateValidArgs) {
1003 EXPECT_CALL(*gl_, StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4));
1004 SpecializedSetup<cmds::StencilFuncSeparate, 0>(true);
1005 cmds::StencilFuncSeparate cmd;
1006 cmd.Init(GL_FRONT, GL_NEVER, 3, 4);
1007 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1008 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1011 TEST_P(GLES2DecoderTest2, StencilMaskValidArgs) {
1012 SpecializedSetup<cmds::StencilMask, 0>(true);
1013 cmds::StencilMask cmd;
1014 cmd.Init(1);
1015 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1016 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1019 TEST_P(GLES2DecoderTest2, StencilMaskSeparateValidArgs) {
1020 SpecializedSetup<cmds::StencilMaskSeparate, 0>(true);
1021 cmds::StencilMaskSeparate cmd;
1022 cmd.Init(GL_FRONT, 2);
1023 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1024 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1027 TEST_P(GLES2DecoderTest2, StencilOpValidArgs) {
1028 EXPECT_CALL(*gl_, StencilOp(GL_KEEP, GL_INCR, GL_KEEP));
1029 SpecializedSetup<cmds::StencilOp, 0>(true);
1030 cmds::StencilOp cmd;
1031 cmd.Init(GL_KEEP, GL_INCR, GL_KEEP);
1032 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1033 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1036 TEST_P(GLES2DecoderTest2, StencilOpSeparateValidArgs) {
1037 EXPECT_CALL(*gl_, StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP));
1038 SpecializedSetup<cmds::StencilOpSeparate, 0>(true);
1039 cmds::StencilOpSeparate cmd;
1040 cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1041 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1042 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1044 // TODO(gman): TexImage2D
1046 // TODO(gman): TexImage3D
1048 TEST_P(GLES2DecoderTest2, TexParameterfValidArgs) {
1049 EXPECT_CALL(*gl_,
1050 TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
1051 SpecializedSetup<cmds::TexParameterf, 0>(true);
1052 cmds::TexParameterf cmd;
1053 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1054 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1055 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1058 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs0_0) {
1059 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1060 SpecializedSetup<cmds::TexParameterf, 0>(false);
1061 cmds::TexParameterf cmd;
1062 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1063 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1064 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1067 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs0_1) {
1068 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1069 SpecializedSetup<cmds::TexParameterf, 0>(false);
1070 cmds::TexParameterf cmd;
1071 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1072 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1073 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1076 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs1_0) {
1077 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1078 SpecializedSetup<cmds::TexParameterf, 0>(false);
1079 cmds::TexParameterf cmd;
1080 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_NEAREST);
1081 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1082 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1085 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateValidArgs) {
1086 cmds::TexParameterfvImmediate& cmd =
1087 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1088 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(true);
1089 GLfloat temp[1] = {
1090 GL_NEAREST,
1092 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1093 EXPECT_CALL(
1094 *gl_,
1095 TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1096 *reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1097 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1098 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1101 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs0_0) {
1102 cmds::TexParameterfvImmediate& cmd =
1103 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1104 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1106 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1107 GLfloat temp[1] = {
1108 GL_NEAREST,
1110 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1111 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1113 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1116 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs0_1) {
1117 cmds::TexParameterfvImmediate& cmd =
1118 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1119 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1121 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1122 GLfloat temp[1] = {
1123 GL_NEAREST,
1125 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1126 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1128 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1131 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs1_0) {
1132 cmds::TexParameterfvImmediate& cmd =
1133 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1134 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1136 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1137 GLfloat temp[1] = {
1138 GL_NEAREST,
1140 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, &temp[0]);
1141 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1143 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1146 TEST_P(GLES2DecoderTest2, TexParameteriValidArgs) {
1147 EXPECT_CALL(*gl_,
1148 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
1149 SpecializedSetup<cmds::TexParameteri, 0>(true);
1150 cmds::TexParameteri cmd;
1151 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1152 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1153 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1156 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs0_0) {
1157 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1158 SpecializedSetup<cmds::TexParameteri, 0>(false);
1159 cmds::TexParameteri cmd;
1160 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1161 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1162 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1165 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs0_1) {
1166 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1167 SpecializedSetup<cmds::TexParameteri, 0>(false);
1168 cmds::TexParameteri cmd;
1169 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1170 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1171 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1174 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs1_0) {
1175 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1176 SpecializedSetup<cmds::TexParameteri, 0>(false);
1177 cmds::TexParameteri cmd;
1178 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_NEAREST);
1179 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1180 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1183 TEST_P(GLES2DecoderTest2, TexParameterivImmediateValidArgs) {
1184 cmds::TexParameterivImmediate& cmd =
1185 *GetImmediateAs<cmds::TexParameterivImmediate>();
1186 SpecializedSetup<cmds::TexParameterivImmediate, 0>(true);
1187 GLint temp[1] = {
1188 GL_NEAREST,
1190 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1191 EXPECT_CALL(*gl_, TexParameteri(
1192 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1193 *reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1194 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1195 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1198 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs0_0) {
1199 cmds::TexParameterivImmediate& cmd =
1200 *GetImmediateAs<cmds::TexParameterivImmediate>();
1201 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1203 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1204 GLint temp[1] = {
1205 GL_NEAREST,
1207 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1208 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1210 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1213 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs0_1) {
1214 cmds::TexParameterivImmediate& cmd =
1215 *GetImmediateAs<cmds::TexParameterivImmediate>();
1216 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1218 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1219 GLint temp[1] = {
1220 GL_NEAREST,
1222 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1223 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1225 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1228 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs1_0) {
1229 cmds::TexParameterivImmediate& cmd =
1230 *GetImmediateAs<cmds::TexParameterivImmediate>();
1231 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1233 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1234 GLint temp[1] = {
1235 GL_NEAREST,
1237 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, &temp[0]);
1238 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1240 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1243 TEST_P(GLES2DecoderTest2, TexStorage3DValidArgs) {
1244 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6));
1245 SpecializedSetup<cmds::TexStorage3D, 0>(true);
1246 cmds::TexStorage3D cmd;
1247 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6);
1248 decoder_->set_unsafe_es3_apis_enabled(true);
1249 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1250 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1251 decoder_->set_unsafe_es3_apis_enabled(false);
1252 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1254 // TODO(gman): TexSubImage2D
1256 // TODO(gman): TexSubImage3D
1258 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketValidArgs) {
1259 const uint32 kBucketId = 123;
1260 const char kSource0[] = "hello";
1261 const char* kSource[] = {kSource0};
1262 const char kValidStrEnd = 0;
1263 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
1264 cmds::TransformFeedbackVaryingsBucket cmd;
1265 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1266 decoder_->set_unsafe_es3_apis_enabled(true);
1267 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1268 decoder_->set_unsafe_es3_apis_enabled(false);
1269 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1272 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidArgs) {
1273 const uint32 kBucketId = 123;
1274 const char kSource0[] = "hello";
1275 const char* kSource[] = {kSource0};
1276 const char kValidStrEnd = 0;
1277 decoder_->set_unsafe_es3_apis_enabled(true);
1278 cmds::TransformFeedbackVaryingsBucket cmd;
1279 // Test no bucket.
1280 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1281 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
1282 // Test invalid client.
1283 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
1284 cmd.Init(kInvalidClientId, kBucketId, GL_INTERLEAVED_ATTRIBS);
1285 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1286 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1289 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidHeader) {
1290 const uint32 kBucketId = 123;
1291 const char kSource0[] = "hello";
1292 const char* kSource[] = {kSource0};
1293 const char kValidStrEnd = 0;
1294 const GLsizei kCount = static_cast<GLsizei>(arraysize(kSource));
1295 const GLsizei kTests[] = {
1296 kCount + 1, 0, std::numeric_limits<GLsizei>::max(), -1,
1298 decoder_->set_unsafe_es3_apis_enabled(true);
1299 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
1300 SetBucketAsCStrings(kBucketId, 1, kSource, kTests[ii], kValidStrEnd);
1301 cmds::TransformFeedbackVaryingsBucket cmd;
1302 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1303 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1307 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidStringEnding) {
1308 const uint32 kBucketId = 123;
1309 const char kSource0[] = "hello";
1310 const char* kSource[] = {kSource0};
1311 const char kInvalidStrEnd = '*';
1312 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kInvalidStrEnd);
1313 cmds::TransformFeedbackVaryingsBucket cmd;
1314 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1315 decoder_->set_unsafe_es3_apis_enabled(true);
1316 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1319 TEST_P(GLES2DecoderTest2, Uniform1fValidArgs) {
1320 EXPECT_CALL(*gl_, Uniform1fv(1, 1, _));
1321 SpecializedSetup<cmds::Uniform1f, 0>(true);
1322 cmds::Uniform1f cmd;
1323 cmd.Init(1, 2);
1324 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1325 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1328 TEST_P(GLES2DecoderTest2, Uniform1fvImmediateValidArgs) {
1329 cmds::Uniform1fvImmediate& cmd = *GetImmediateAs<cmds::Uniform1fvImmediate>();
1330 EXPECT_CALL(
1331 *gl_,
1332 Uniform1fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1333 SpecializedSetup<cmds::Uniform1fvImmediate, 0>(true);
1334 GLfloat temp[1 * 2] = {
1337 cmd.Init(1, 2, &temp[0]);
1338 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1339 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1341 // TODO(gman): Uniform1i
1342 // TODO(gman): Uniform1ivImmediate
1344 TEST_P(GLES2DecoderTest2, Uniform1uiValidArgs) {
1345 EXPECT_CALL(*gl_, Uniform1uiv(1, 1, _));
1346 SpecializedSetup<cmds::Uniform1ui, 0>(true);
1347 cmds::Uniform1ui cmd;
1348 cmd.Init(1, 2);
1349 decoder_->set_unsafe_es3_apis_enabled(true);
1350 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1351 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1352 decoder_->set_unsafe_es3_apis_enabled(false);
1353 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1356 TEST_P(GLES2DecoderTest2, Uniform1uivImmediateValidArgs) {
1357 cmds::Uniform1uivImmediate& cmd =
1358 *GetImmediateAs<cmds::Uniform1uivImmediate>();
1359 EXPECT_CALL(
1360 *gl_,
1361 Uniform1uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1362 SpecializedSetup<cmds::Uniform1uivImmediate, 0>(true);
1363 GLuint temp[1 * 2] = {
1366 cmd.Init(1, 2, &temp[0]);
1367 decoder_->set_unsafe_es3_apis_enabled(true);
1368 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1369 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1370 decoder_->set_unsafe_es3_apis_enabled(false);
1371 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1374 TEST_P(GLES2DecoderTest2, Uniform2fValidArgs) {
1375 EXPECT_CALL(*gl_, Uniform2fv(1, 1, _));
1376 SpecializedSetup<cmds::Uniform2f, 0>(true);
1377 cmds::Uniform2f cmd;
1378 cmd.Init(1, 2, 3);
1379 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1380 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1383 TEST_P(GLES2DecoderTest2, Uniform2fvImmediateValidArgs) {
1384 cmds::Uniform2fvImmediate& cmd = *GetImmediateAs<cmds::Uniform2fvImmediate>();
1385 EXPECT_CALL(
1386 *gl_,
1387 Uniform2fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1388 SpecializedSetup<cmds::Uniform2fvImmediate, 0>(true);
1389 GLfloat temp[2 * 2] = {
1392 cmd.Init(1, 2, &temp[0]);
1393 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1394 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1397 TEST_P(GLES2DecoderTest2, Uniform2iValidArgs) {
1398 EXPECT_CALL(*gl_, Uniform2iv(1, 1, _));
1399 SpecializedSetup<cmds::Uniform2i, 0>(true);
1400 cmds::Uniform2i cmd;
1401 cmd.Init(1, 2, 3);
1402 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1403 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1406 TEST_P(GLES2DecoderTest2, Uniform2ivImmediateValidArgs) {
1407 cmds::Uniform2ivImmediate& cmd = *GetImmediateAs<cmds::Uniform2ivImmediate>();
1408 EXPECT_CALL(
1409 *gl_,
1410 Uniform2iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1411 SpecializedSetup<cmds::Uniform2ivImmediate, 0>(true);
1412 GLint temp[2 * 2] = {
1415 cmd.Init(1, 2, &temp[0]);
1416 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1417 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1420 TEST_P(GLES2DecoderTest2, Uniform2uiValidArgs) {
1421 EXPECT_CALL(*gl_, Uniform2uiv(1, 1, _));
1422 SpecializedSetup<cmds::Uniform2ui, 0>(true);
1423 cmds::Uniform2ui cmd;
1424 cmd.Init(1, 2, 3);
1425 decoder_->set_unsafe_es3_apis_enabled(true);
1426 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1427 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1428 decoder_->set_unsafe_es3_apis_enabled(false);
1429 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1432 TEST_P(GLES2DecoderTest2, Uniform2uivImmediateValidArgs) {
1433 cmds::Uniform2uivImmediate& cmd =
1434 *GetImmediateAs<cmds::Uniform2uivImmediate>();
1435 EXPECT_CALL(
1436 *gl_,
1437 Uniform2uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1438 SpecializedSetup<cmds::Uniform2uivImmediate, 0>(true);
1439 GLuint temp[2 * 2] = {
1442 cmd.Init(1, 2, &temp[0]);
1443 decoder_->set_unsafe_es3_apis_enabled(true);
1444 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1445 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1446 decoder_->set_unsafe_es3_apis_enabled(false);
1447 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1450 TEST_P(GLES2DecoderTest2, Uniform3fValidArgs) {
1451 EXPECT_CALL(*gl_, Uniform3fv(1, 1, _));
1452 SpecializedSetup<cmds::Uniform3f, 0>(true);
1453 cmds::Uniform3f cmd;
1454 cmd.Init(1, 2, 3, 4);
1455 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1456 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1459 TEST_P(GLES2DecoderTest2, Uniform3fvImmediateValidArgs) {
1460 cmds::Uniform3fvImmediate& cmd = *GetImmediateAs<cmds::Uniform3fvImmediate>();
1461 EXPECT_CALL(
1462 *gl_,
1463 Uniform3fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1464 SpecializedSetup<cmds::Uniform3fvImmediate, 0>(true);
1465 GLfloat temp[3 * 2] = {
1468 cmd.Init(1, 2, &temp[0]);
1469 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1470 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1473 TEST_P(GLES2DecoderTest2, Uniform3iValidArgs) {
1474 EXPECT_CALL(*gl_, Uniform3iv(1, 1, _));
1475 SpecializedSetup<cmds::Uniform3i, 0>(true);
1476 cmds::Uniform3i cmd;
1477 cmd.Init(1, 2, 3, 4);
1478 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1479 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1482 TEST_P(GLES2DecoderTest2, Uniform3ivImmediateValidArgs) {
1483 cmds::Uniform3ivImmediate& cmd = *GetImmediateAs<cmds::Uniform3ivImmediate>();
1484 EXPECT_CALL(
1485 *gl_,
1486 Uniform3iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1487 SpecializedSetup<cmds::Uniform3ivImmediate, 0>(true);
1488 GLint temp[3 * 2] = {
1491 cmd.Init(1, 2, &temp[0]);
1492 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1493 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1496 TEST_P(GLES2DecoderTest2, Uniform3uiValidArgs) {
1497 EXPECT_CALL(*gl_, Uniform3uiv(1, 1, _));
1498 SpecializedSetup<cmds::Uniform3ui, 0>(true);
1499 cmds::Uniform3ui cmd;
1500 cmd.Init(1, 2, 3, 4);
1501 decoder_->set_unsafe_es3_apis_enabled(true);
1502 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1503 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1504 decoder_->set_unsafe_es3_apis_enabled(false);
1505 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1508 TEST_P(GLES2DecoderTest2, Uniform3uivImmediateValidArgs) {
1509 cmds::Uniform3uivImmediate& cmd =
1510 *GetImmediateAs<cmds::Uniform3uivImmediate>();
1511 EXPECT_CALL(
1512 *gl_,
1513 Uniform3uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1514 SpecializedSetup<cmds::Uniform3uivImmediate, 0>(true);
1515 GLuint temp[3 * 2] = {
1518 cmd.Init(1, 2, &temp[0]);
1519 decoder_->set_unsafe_es3_apis_enabled(true);
1520 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1521 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1522 decoder_->set_unsafe_es3_apis_enabled(false);
1523 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1526 TEST_P(GLES2DecoderTest2, Uniform4fValidArgs) {
1527 EXPECT_CALL(*gl_, Uniform4fv(1, 1, _));
1528 SpecializedSetup<cmds::Uniform4f, 0>(true);
1529 cmds::Uniform4f cmd;
1530 cmd.Init(1, 2, 3, 4, 5);
1531 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1532 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1535 TEST_P(GLES2DecoderTest2, Uniform4fvImmediateValidArgs) {
1536 cmds::Uniform4fvImmediate& cmd = *GetImmediateAs<cmds::Uniform4fvImmediate>();
1537 EXPECT_CALL(
1538 *gl_,
1539 Uniform4fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1540 SpecializedSetup<cmds::Uniform4fvImmediate, 0>(true);
1541 GLfloat temp[4 * 2] = {
1544 cmd.Init(1, 2, &temp[0]);
1545 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1546 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1549 TEST_P(GLES2DecoderTest2, Uniform4iValidArgs) {
1550 EXPECT_CALL(*gl_, Uniform4iv(1, 1, _));
1551 SpecializedSetup<cmds::Uniform4i, 0>(true);
1552 cmds::Uniform4i cmd;
1553 cmd.Init(1, 2, 3, 4, 5);
1554 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1555 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1558 TEST_P(GLES2DecoderTest2, Uniform4ivImmediateValidArgs) {
1559 cmds::Uniform4ivImmediate& cmd = *GetImmediateAs<cmds::Uniform4ivImmediate>();
1560 EXPECT_CALL(
1561 *gl_,
1562 Uniform4iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1563 SpecializedSetup<cmds::Uniform4ivImmediate, 0>(true);
1564 GLint temp[4 * 2] = {
1567 cmd.Init(1, 2, &temp[0]);
1568 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1569 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1572 TEST_P(GLES2DecoderTest2, Uniform4uiValidArgs) {
1573 EXPECT_CALL(*gl_, Uniform4uiv(1, 1, _));
1574 SpecializedSetup<cmds::Uniform4ui, 0>(true);
1575 cmds::Uniform4ui cmd;
1576 cmd.Init(1, 2, 3, 4, 5);
1577 decoder_->set_unsafe_es3_apis_enabled(true);
1578 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1579 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1580 decoder_->set_unsafe_es3_apis_enabled(false);
1581 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1584 TEST_P(GLES2DecoderTest2, Uniform4uivImmediateValidArgs) {
1585 cmds::Uniform4uivImmediate& cmd =
1586 *GetImmediateAs<cmds::Uniform4uivImmediate>();
1587 EXPECT_CALL(
1588 *gl_,
1589 Uniform4uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1590 SpecializedSetup<cmds::Uniform4uivImmediate, 0>(true);
1591 GLuint temp[4 * 2] = {
1594 cmd.Init(1, 2, &temp[0]);
1595 decoder_->set_unsafe_es3_apis_enabled(true);
1596 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1597 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1598 decoder_->set_unsafe_es3_apis_enabled(false);
1599 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1601 // TODO(gman): UniformBlockBinding
1603 TEST_P(GLES2DecoderTest2, UniformMatrix2fvImmediateValidArgs) {
1604 cmds::UniformMatrix2fvImmediate& cmd =
1605 *GetImmediateAs<cmds::UniformMatrix2fvImmediate>();
1606 EXPECT_CALL(*gl_,
1607 UniformMatrix2fv(1, 2, false, reinterpret_cast<GLfloat*>(
1608 ImmediateDataAddress(&cmd))));
1609 SpecializedSetup<cmds::UniformMatrix2fvImmediate, 0>(true);
1610 GLfloat temp[4 * 2] = {
1613 cmd.Init(1, 2, &temp[0]);
1614 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1615 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1618 TEST_P(GLES2DecoderTest2, UniformMatrix2x3fvImmediateValidArgs) {
1619 cmds::UniformMatrix2x3fvImmediate& cmd =
1620 *GetImmediateAs<cmds::UniformMatrix2x3fvImmediate>();
1621 EXPECT_CALL(*gl_,
1622 UniformMatrix2x3fv(1, 2, false, reinterpret_cast<GLfloat*>(
1623 ImmediateDataAddress(&cmd))));
1624 SpecializedSetup<cmds::UniformMatrix2x3fvImmediate, 0>(true);
1625 GLfloat temp[6 * 2] = {
1628 cmd.Init(1, 2, &temp[0]);
1629 decoder_->set_unsafe_es3_apis_enabled(true);
1630 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1631 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1632 decoder_->set_unsafe_es3_apis_enabled(false);
1633 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1635 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_