Infobar material design refresh: bg color
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_2_autogen.h
blob858c166e7025cdb742a9ca7e56720fc476479ccd
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())
41 .WillOnce(Return(GL_NO_ERROR))
42 .WillOnce(Return(GL_NO_ERROR))
43 .RetiresOnSaturation();
44 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(true);
45 typedef cmds::GetRenderbufferParameteriv::Result Result;
46 Result* result = static_cast<Result*>(shared_memory_address_);
47 EXPECT_CALL(
48 *gl_, GetRenderbufferParameterivEXT(
49 GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, result->GetData()));
50 result->size = 0;
51 cmds::GetRenderbufferParameteriv cmd;
52 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
53 shared_memory_offset_);
54 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
55 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
56 GL_RENDERBUFFER_RED_SIZE),
57 result->GetNumResults());
58 EXPECT_EQ(GL_NO_ERROR, GetGLError());
61 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs0_0) {
62 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
63 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
64 cmds::GetRenderbufferParameteriv::Result* result =
65 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
66 shared_memory_address_);
67 result->size = 0;
68 cmds::GetRenderbufferParameteriv cmd;
69 cmd.Init(GL_FRAMEBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
70 shared_memory_offset_);
71 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
72 EXPECT_EQ(0u, result->size);
73 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
76 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs2_0) {
77 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
78 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
79 cmds::GetRenderbufferParameteriv::Result* result =
80 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
81 shared_memory_address_);
82 result->size = 0;
83 cmds::GetRenderbufferParameteriv cmd;
84 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, kInvalidSharedMemoryId,
85 0);
86 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
87 EXPECT_EQ(0u, result->size);
90 TEST_P(GLES2DecoderTest2, GetRenderbufferParameterivInvalidArgs2_1) {
91 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
92 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
93 cmds::GetRenderbufferParameteriv::Result* result =
94 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
95 shared_memory_address_);
96 result->size = 0;
97 cmds::GetRenderbufferParameteriv cmd;
98 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
99 kInvalidSharedMemoryOffset);
100 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
101 EXPECT_EQ(0u, result->size);
104 TEST_P(GLES2DecoderTest2, GetSamplerParameterfvValidArgs) {
105 EXPECT_CALL(*gl_, GetError())
106 .WillOnce(Return(GL_NO_ERROR))
107 .WillOnce(Return(GL_NO_ERROR))
108 .RetiresOnSaturation();
109 SpecializedSetup<cmds::GetSamplerParameterfv, 0>(true);
110 typedef cmds::GetSamplerParameterfv::Result Result;
111 Result* result = static_cast<Result*>(shared_memory_address_);
112 EXPECT_CALL(*gl_,
113 GetSamplerParameterfv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
114 result->GetData()));
115 result->size = 0;
116 cmds::GetSamplerParameterfv cmd;
117 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
118 shared_memory_offset_);
119 decoder_->set_unsafe_es3_apis_enabled(true);
120 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
121 EXPECT_EQ(
122 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
123 result->GetNumResults());
124 EXPECT_EQ(GL_NO_ERROR, GetGLError());
125 decoder_->set_unsafe_es3_apis_enabled(false);
126 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
129 TEST_P(GLES2DecoderTest2, GetSamplerParameterivValidArgs) {
130 EXPECT_CALL(*gl_, GetError())
131 .WillOnce(Return(GL_NO_ERROR))
132 .WillOnce(Return(GL_NO_ERROR))
133 .RetiresOnSaturation();
134 SpecializedSetup<cmds::GetSamplerParameteriv, 0>(true);
135 typedef cmds::GetSamplerParameteriv::Result Result;
136 Result* result = static_cast<Result*>(shared_memory_address_);
137 EXPECT_CALL(*gl_,
138 GetSamplerParameteriv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
139 result->GetData()));
140 result->size = 0;
141 cmds::GetSamplerParameteriv cmd;
142 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
143 shared_memory_offset_);
144 decoder_->set_unsafe_es3_apis_enabled(true);
145 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
146 EXPECT_EQ(
147 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
148 result->GetNumResults());
149 EXPECT_EQ(GL_NO_ERROR, GetGLError());
150 decoder_->set_unsafe_es3_apis_enabled(false);
151 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
154 TEST_P(GLES2DecoderTest2, GetShaderivValidArgs) {
155 EXPECT_CALL(*gl_, GetError())
156 .WillOnce(Return(GL_NO_ERROR))
157 .WillOnce(Return(GL_NO_ERROR))
158 .RetiresOnSaturation();
159 SpecializedSetup<cmds::GetShaderiv, 0>(true);
160 typedef cmds::GetShaderiv::Result Result;
161 Result* result = static_cast<Result*>(shared_memory_address_);
162 EXPECT_CALL(*gl_,
163 GetShaderiv(kServiceShaderId, GL_SHADER_TYPE, result->GetData()));
164 result->size = 0;
165 cmds::GetShaderiv cmd;
166 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
167 shared_memory_offset_);
168 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
169 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE),
170 result->GetNumResults());
171 EXPECT_EQ(GL_NO_ERROR, GetGLError());
174 TEST_P(GLES2DecoderTest2, GetShaderivInvalidArgs2_0) {
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, kInvalidSharedMemoryId, 0);
182 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
183 EXPECT_EQ(0u, result->size);
186 TEST_P(GLES2DecoderTest2, GetShaderivInvalidArgs2_1) {
187 EXPECT_CALL(*gl_, GetShaderiv(_, _, _)).Times(0);
188 SpecializedSetup<cmds::GetShaderiv, 0>(false);
189 cmds::GetShaderiv::Result* result =
190 static_cast<cmds::GetShaderiv::Result*>(shared_memory_address_);
191 result->size = 0;
192 cmds::GetShaderiv cmd;
193 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
194 kInvalidSharedMemoryOffset);
195 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
196 EXPECT_EQ(0u, result->size);
198 // TODO(gman): GetShaderInfoLog
199 // TODO(gman): GetShaderPrecisionFormat
201 // TODO(gman): GetShaderSource
202 // TODO(gman): GetString
204 TEST_P(GLES2DecoderTest2, GetSyncivValidArgs) {
205 EXPECT_CALL(*gl_, GetError())
206 .WillOnce(Return(GL_NO_ERROR))
207 .WillOnce(Return(GL_NO_ERROR))
208 .RetiresOnSaturation();
209 SpecializedSetup<cmds::GetSynciv, 0>(true);
210 typedef cmds::GetSynciv::Result Result;
211 Result* result = static_cast<Result*>(shared_memory_address_);
212 EXPECT_CALL(
213 *gl_, GetSynciv(reinterpret_cast<GLsync>(kServiceSyncId), GL_SYNC_STATUS,
214 decoder_->GetGLES2Util()->GLGetNumValuesReturned(
215 GL_SYNC_STATUS),
216 nullptr, result->GetData()));
217 result->size = 0;
218 cmds::GetSynciv cmd;
219 cmd.Init(client_sync_id_, GL_SYNC_STATUS, shared_memory_id_,
220 shared_memory_offset_);
221 decoder_->set_unsafe_es3_apis_enabled(true);
222 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
223 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SYNC_STATUS),
224 result->GetNumResults());
225 EXPECT_EQ(GL_NO_ERROR, GetGLError());
226 decoder_->set_unsafe_es3_apis_enabled(false);
227 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
230 TEST_P(GLES2DecoderTest2, GetTexParameterfvValidArgs) {
231 EXPECT_CALL(*gl_, GetError())
232 .WillOnce(Return(GL_NO_ERROR))
233 .WillOnce(Return(GL_NO_ERROR))
234 .RetiresOnSaturation();
235 SpecializedSetup<cmds::GetTexParameterfv, 0>(true);
236 typedef cmds::GetTexParameterfv::Result Result;
237 Result* result = static_cast<Result*>(shared_memory_address_);
238 EXPECT_CALL(*gl_, GetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
239 result->GetData()));
240 result->size = 0;
241 cmds::GetTexParameterfv cmd;
242 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
243 shared_memory_offset_);
244 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
245 EXPECT_EQ(
246 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
247 result->GetNumResults());
248 EXPECT_EQ(GL_NO_ERROR, GetGLError());
251 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs0_0) {
252 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
253 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
254 cmds::GetTexParameterfv::Result* result =
255 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
256 result->size = 0;
257 cmds::GetTexParameterfv cmd;
258 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
259 shared_memory_offset_);
260 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
261 EXPECT_EQ(0u, result->size);
262 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
265 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs1_0) {
266 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
267 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
268 cmds::GetTexParameterfv::Result* result =
269 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
270 result->size = 0;
271 cmds::GetTexParameterfv cmd;
272 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, shared_memory_id_,
273 shared_memory_offset_);
274 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
275 EXPECT_EQ(0u, result->size);
276 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
279 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs2_0) {
280 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
281 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
282 cmds::GetTexParameterfv::Result* result =
283 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
284 result->size = 0;
285 cmds::GetTexParameterfv cmd;
286 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, kInvalidSharedMemoryId, 0);
287 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
288 EXPECT_EQ(0u, result->size);
291 TEST_P(GLES2DecoderTest2, GetTexParameterfvInvalidArgs2_1) {
292 EXPECT_CALL(*gl_, GetTexParameterfv(_, _, _)).Times(0);
293 SpecializedSetup<cmds::GetTexParameterfv, 0>(false);
294 cmds::GetTexParameterfv::Result* result =
295 static_cast<cmds::GetTexParameterfv::Result*>(shared_memory_address_);
296 result->size = 0;
297 cmds::GetTexParameterfv cmd;
298 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
299 kInvalidSharedMemoryOffset);
300 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
301 EXPECT_EQ(0u, result->size);
304 TEST_P(GLES2DecoderTest2, GetTexParameterivValidArgs) {
305 EXPECT_CALL(*gl_, GetError())
306 .WillOnce(Return(GL_NO_ERROR))
307 .WillOnce(Return(GL_NO_ERROR))
308 .RetiresOnSaturation();
309 SpecializedSetup<cmds::GetTexParameteriv, 0>(true);
310 typedef cmds::GetTexParameteriv::Result Result;
311 Result* result = static_cast<Result*>(shared_memory_address_);
312 EXPECT_CALL(*gl_, GetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
313 result->GetData()));
314 result->size = 0;
315 cmds::GetTexParameteriv cmd;
316 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
317 shared_memory_offset_);
318 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
319 EXPECT_EQ(
320 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
321 result->GetNumResults());
322 EXPECT_EQ(GL_NO_ERROR, GetGLError());
325 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs0_0) {
326 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
327 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
328 cmds::GetTexParameteriv::Result* result =
329 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
330 result->size = 0;
331 cmds::GetTexParameteriv cmd;
332 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
333 shared_memory_offset_);
334 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
335 EXPECT_EQ(0u, result->size);
336 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
339 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs1_0) {
340 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
341 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
342 cmds::GetTexParameteriv::Result* result =
343 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
344 result->size = 0;
345 cmds::GetTexParameteriv cmd;
346 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, shared_memory_id_,
347 shared_memory_offset_);
348 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
349 EXPECT_EQ(0u, result->size);
350 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
353 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs2_0) {
354 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
355 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
356 cmds::GetTexParameteriv::Result* result =
357 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
358 result->size = 0;
359 cmds::GetTexParameteriv cmd;
360 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, kInvalidSharedMemoryId, 0);
361 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
362 EXPECT_EQ(0u, result->size);
365 TEST_P(GLES2DecoderTest2, GetTexParameterivInvalidArgs2_1) {
366 EXPECT_CALL(*gl_, GetTexParameteriv(_, _, _)).Times(0);
367 SpecializedSetup<cmds::GetTexParameteriv, 0>(false);
368 cmds::GetTexParameteriv::Result* result =
369 static_cast<cmds::GetTexParameteriv::Result*>(shared_memory_address_);
370 result->size = 0;
371 cmds::GetTexParameteriv cmd;
372 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
373 kInvalidSharedMemoryOffset);
374 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
375 EXPECT_EQ(0u, result->size);
377 // TODO(gman): GetTransformFeedbackVarying
379 // TODO(gman): GetUniformBlockIndex
381 // TODO(gman): GetUniformfv
383 // TODO(gman): GetUniformiv
385 // TODO(gman): GetUniformuiv
387 // TODO(gman): GetUniformIndices
389 // TODO(gman): GetUniformLocation
391 TEST_P(GLES2DecoderTest2, GetVertexAttribfvValidArgs) {
392 SpecializedSetup<cmds::GetVertexAttribfv, 0>(true);
393 typedef cmds::GetVertexAttribfv::Result Result;
394 Result* result = static_cast<Result*>(shared_memory_address_);
395 result->size = 0;
396 cmds::GetVertexAttribfv cmd;
397 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
398 shared_memory_offset_);
399 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
400 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
401 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
402 result->GetNumResults());
403 EXPECT_EQ(GL_NO_ERROR, GetGLError());
406 TEST_P(GLES2DecoderTest2, GetVertexAttribfvInvalidArgs2_0) {
407 EXPECT_CALL(*gl_, GetVertexAttribfv(_, _, _)).Times(0);
408 SpecializedSetup<cmds::GetVertexAttribfv, 0>(false);
409 cmds::GetVertexAttribfv::Result* result =
410 static_cast<cmds::GetVertexAttribfv::Result*>(shared_memory_address_);
411 result->size = 0;
412 cmds::GetVertexAttribfv cmd;
413 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, kInvalidSharedMemoryId, 0);
414 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
415 EXPECT_EQ(0u, result->size);
418 TEST_P(GLES2DecoderTest2, GetVertexAttribfvInvalidArgs2_1) {
419 EXPECT_CALL(*gl_, GetVertexAttribfv(_, _, _)).Times(0);
420 SpecializedSetup<cmds::GetVertexAttribfv, 0>(false);
421 cmds::GetVertexAttribfv::Result* result =
422 static_cast<cmds::GetVertexAttribfv::Result*>(shared_memory_address_);
423 result->size = 0;
424 cmds::GetVertexAttribfv cmd;
425 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
426 kInvalidSharedMemoryOffset);
427 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
428 EXPECT_EQ(0u, result->size);
431 TEST_P(GLES2DecoderTest2, GetVertexAttribivValidArgs) {
432 SpecializedSetup<cmds::GetVertexAttribiv, 0>(true);
433 typedef cmds::GetVertexAttribiv::Result Result;
434 Result* result = static_cast<Result*>(shared_memory_address_);
435 result->size = 0;
436 cmds::GetVertexAttribiv cmd;
437 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
438 shared_memory_offset_);
439 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
440 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
441 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
442 result->GetNumResults());
443 EXPECT_EQ(GL_NO_ERROR, GetGLError());
446 TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_0) {
447 EXPECT_CALL(*gl_, GetVertexAttribiv(_, _, _)).Times(0);
448 SpecializedSetup<cmds::GetVertexAttribiv, 0>(false);
449 cmds::GetVertexAttribiv::Result* result =
450 static_cast<cmds::GetVertexAttribiv::Result*>(shared_memory_address_);
451 result->size = 0;
452 cmds::GetVertexAttribiv cmd;
453 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, kInvalidSharedMemoryId, 0);
454 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
455 EXPECT_EQ(0u, result->size);
458 TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_1) {
459 EXPECT_CALL(*gl_, GetVertexAttribiv(_, _, _)).Times(0);
460 SpecializedSetup<cmds::GetVertexAttribiv, 0>(false);
461 cmds::GetVertexAttribiv::Result* result =
462 static_cast<cmds::GetVertexAttribiv::Result*>(shared_memory_address_);
463 result->size = 0;
464 cmds::GetVertexAttribiv cmd;
465 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
466 kInvalidSharedMemoryOffset);
467 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
468 EXPECT_EQ(0u, result->size);
471 TEST_P(GLES2DecoderTest2, GetVertexAttribIivValidArgs) {
472 SpecializedSetup<cmds::GetVertexAttribIiv, 0>(true);
473 typedef cmds::GetVertexAttribIiv::Result Result;
474 Result* result = static_cast<Result*>(shared_memory_address_);
475 result->size = 0;
476 cmds::GetVertexAttribIiv cmd;
477 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
478 shared_memory_offset_);
479 decoder_->set_unsafe_es3_apis_enabled(true);
480 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
481 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
482 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
483 result->GetNumResults());
484 EXPECT_EQ(GL_NO_ERROR, GetGLError());
485 decoder_->set_unsafe_es3_apis_enabled(false);
486 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
489 TEST_P(GLES2DecoderTest2, GetVertexAttribIuivValidArgs) {
490 SpecializedSetup<cmds::GetVertexAttribIuiv, 0>(true);
491 typedef cmds::GetVertexAttribIuiv::Result Result;
492 Result* result = static_cast<Result*>(shared_memory_address_);
493 result->size = 0;
494 cmds::GetVertexAttribIuiv cmd;
495 cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
496 shared_memory_offset_);
497 decoder_->set_unsafe_es3_apis_enabled(true);
498 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
499 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
500 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
501 result->GetNumResults());
502 EXPECT_EQ(GL_NO_ERROR, GetGLError());
503 decoder_->set_unsafe_es3_apis_enabled(false);
504 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
506 // TODO(gman): GetVertexAttribPointerv
508 TEST_P(GLES2DecoderTest2, HintValidArgs) {
509 EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST));
510 SpecializedSetup<cmds::Hint, 0>(true);
511 cmds::Hint cmd;
512 cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
513 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
514 EXPECT_EQ(GL_NO_ERROR, GetGLError());
517 TEST_P(GLES2DecoderTest2, HintInvalidArgs0_0) {
518 EXPECT_CALL(*gl_, Hint(_, _)).Times(0);
519 SpecializedSetup<cmds::Hint, 0>(false);
520 cmds::Hint cmd;
521 cmd.Init(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
522 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
523 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
525 // TODO(gman): InvalidateFramebufferImmediate
526 // TODO(gman): InvalidateSubFramebufferImmediate
528 TEST_P(GLES2DecoderTest2, IsBufferValidArgs) {
529 SpecializedSetup<cmds::IsBuffer, 0>(true);
530 cmds::IsBuffer cmd;
531 cmd.Init(client_buffer_id_, shared_memory_id_, shared_memory_offset_);
532 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
533 EXPECT_EQ(GL_NO_ERROR, GetGLError());
536 TEST_P(GLES2DecoderTest2, IsBufferInvalidArgsBadSharedMemoryId) {
537 SpecializedSetup<cmds::IsBuffer, 0>(false);
538 cmds::IsBuffer cmd;
539 cmd.Init(client_buffer_id_, kInvalidSharedMemoryId, shared_memory_offset_);
540 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
541 cmd.Init(client_buffer_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
542 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
545 TEST_P(GLES2DecoderTest2, IsEnabledValidArgs) {
546 SpecializedSetup<cmds::IsEnabled, 0>(true);
547 cmds::IsEnabled cmd;
548 cmd.Init(GL_BLEND, shared_memory_id_, shared_memory_offset_);
549 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
550 EXPECT_EQ(GL_NO_ERROR, GetGLError());
553 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgs0_0) {
554 EXPECT_CALL(*gl_, IsEnabled(_)).Times(0);
555 SpecializedSetup<cmds::IsEnabled, 0>(false);
556 cmds::IsEnabled cmd;
557 cmd.Init(GL_CLIP_PLANE0, shared_memory_id_, shared_memory_offset_);
558 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
559 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
562 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgs0_1) {
563 EXPECT_CALL(*gl_, IsEnabled(_)).Times(0);
564 SpecializedSetup<cmds::IsEnabled, 0>(false);
565 cmds::IsEnabled cmd;
566 cmd.Init(GL_POINT_SPRITE, shared_memory_id_, shared_memory_offset_);
567 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
568 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
571 TEST_P(GLES2DecoderTest2, IsEnabledInvalidArgsBadSharedMemoryId) {
572 SpecializedSetup<cmds::IsEnabled, 0>(false);
573 cmds::IsEnabled cmd;
574 cmd.Init(GL_BLEND, kInvalidSharedMemoryId, shared_memory_offset_);
575 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
576 cmd.Init(GL_BLEND, shared_memory_id_, kInvalidSharedMemoryOffset);
577 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
580 TEST_P(GLES2DecoderTest2, IsFramebufferValidArgs) {
581 SpecializedSetup<cmds::IsFramebuffer, 0>(true);
582 cmds::IsFramebuffer cmd;
583 cmd.Init(client_framebuffer_id_, shared_memory_id_, shared_memory_offset_);
584 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
585 EXPECT_EQ(GL_NO_ERROR, GetGLError());
588 TEST_P(GLES2DecoderTest2, IsFramebufferInvalidArgsBadSharedMemoryId) {
589 SpecializedSetup<cmds::IsFramebuffer, 0>(false);
590 cmds::IsFramebuffer cmd;
591 cmd.Init(client_framebuffer_id_, kInvalidSharedMemoryId,
592 shared_memory_offset_);
593 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
594 cmd.Init(client_framebuffer_id_, shared_memory_id_,
595 kInvalidSharedMemoryOffset);
596 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
599 TEST_P(GLES2DecoderTest2, IsProgramValidArgs) {
600 SpecializedSetup<cmds::IsProgram, 0>(true);
601 cmds::IsProgram cmd;
602 cmd.Init(client_program_id_, shared_memory_id_, shared_memory_offset_);
603 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
604 EXPECT_EQ(GL_NO_ERROR, GetGLError());
607 TEST_P(GLES2DecoderTest2, IsProgramInvalidArgsBadSharedMemoryId) {
608 SpecializedSetup<cmds::IsProgram, 0>(false);
609 cmds::IsProgram cmd;
610 cmd.Init(client_program_id_, kInvalidSharedMemoryId, shared_memory_offset_);
611 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
612 cmd.Init(client_program_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
613 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
616 TEST_P(GLES2DecoderTest2, IsRenderbufferValidArgs) {
617 SpecializedSetup<cmds::IsRenderbuffer, 0>(true);
618 cmds::IsRenderbuffer cmd;
619 cmd.Init(client_renderbuffer_id_, shared_memory_id_, shared_memory_offset_);
620 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
621 EXPECT_EQ(GL_NO_ERROR, GetGLError());
624 TEST_P(GLES2DecoderTest2, IsRenderbufferInvalidArgsBadSharedMemoryId) {
625 SpecializedSetup<cmds::IsRenderbuffer, 0>(false);
626 cmds::IsRenderbuffer cmd;
627 cmd.Init(client_renderbuffer_id_, kInvalidSharedMemoryId,
628 shared_memory_offset_);
629 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
630 cmd.Init(client_renderbuffer_id_, shared_memory_id_,
631 kInvalidSharedMemoryOffset);
632 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
635 TEST_P(GLES2DecoderTest2, IsSamplerValidArgs) {
636 SpecializedSetup<cmds::IsSampler, 0>(true);
637 cmds::IsSampler cmd;
638 cmd.Init(client_sampler_id_, shared_memory_id_, shared_memory_offset_);
639 decoder_->set_unsafe_es3_apis_enabled(true);
640 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
641 EXPECT_EQ(GL_NO_ERROR, GetGLError());
642 decoder_->set_unsafe_es3_apis_enabled(false);
643 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
646 TEST_P(GLES2DecoderTest2, IsSamplerInvalidArgsBadSharedMemoryId) {
647 SpecializedSetup<cmds::IsSampler, 0>(false);
648 decoder_->set_unsafe_es3_apis_enabled(true);
649 cmds::IsSampler cmd;
650 cmd.Init(client_sampler_id_, kInvalidSharedMemoryId, shared_memory_offset_);
651 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
652 cmd.Init(client_sampler_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
653 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
654 decoder_->set_unsafe_es3_apis_enabled(true);
657 TEST_P(GLES2DecoderTest2, IsShaderValidArgs) {
658 SpecializedSetup<cmds::IsShader, 0>(true);
659 cmds::IsShader cmd;
660 cmd.Init(client_shader_id_, shared_memory_id_, shared_memory_offset_);
661 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
662 EXPECT_EQ(GL_NO_ERROR, GetGLError());
665 TEST_P(GLES2DecoderTest2, IsShaderInvalidArgsBadSharedMemoryId) {
666 SpecializedSetup<cmds::IsShader, 0>(false);
667 cmds::IsShader cmd;
668 cmd.Init(client_shader_id_, kInvalidSharedMemoryId, shared_memory_offset_);
669 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
670 cmd.Init(client_shader_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
671 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
674 TEST_P(GLES2DecoderTest2, IsSyncValidArgs) {
675 SpecializedSetup<cmds::IsSync, 0>(true);
676 cmds::IsSync cmd;
677 cmd.Init(client_sync_id_, shared_memory_id_, shared_memory_offset_);
678 decoder_->set_unsafe_es3_apis_enabled(true);
679 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
680 EXPECT_EQ(GL_NO_ERROR, GetGLError());
681 decoder_->set_unsafe_es3_apis_enabled(false);
682 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
685 TEST_P(GLES2DecoderTest2, IsSyncInvalidArgsBadSharedMemoryId) {
686 SpecializedSetup<cmds::IsSync, 0>(false);
687 decoder_->set_unsafe_es3_apis_enabled(true);
688 cmds::IsSync cmd;
689 cmd.Init(client_sync_id_, kInvalidSharedMemoryId, shared_memory_offset_);
690 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
691 cmd.Init(client_sync_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
692 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
693 decoder_->set_unsafe_es3_apis_enabled(true);
696 TEST_P(GLES2DecoderTest2, IsTextureValidArgs) {
697 SpecializedSetup<cmds::IsTexture, 0>(true);
698 cmds::IsTexture cmd;
699 cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
700 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
701 EXPECT_EQ(GL_NO_ERROR, GetGLError());
704 TEST_P(GLES2DecoderTest2, IsTextureInvalidArgsBadSharedMemoryId) {
705 SpecializedSetup<cmds::IsTexture, 0>(false);
706 cmds::IsTexture cmd;
707 cmd.Init(client_texture_id_, kInvalidSharedMemoryId, shared_memory_offset_);
708 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
709 cmd.Init(client_texture_id_, shared_memory_id_, kInvalidSharedMemoryOffset);
710 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
713 TEST_P(GLES2DecoderTest2, IsTransformFeedbackValidArgs) {
714 SpecializedSetup<cmds::IsTransformFeedback, 0>(true);
715 cmds::IsTransformFeedback cmd;
716 cmd.Init(client_transformfeedback_id_, shared_memory_id_,
717 shared_memory_offset_);
718 decoder_->set_unsafe_es3_apis_enabled(true);
719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
720 EXPECT_EQ(GL_NO_ERROR, GetGLError());
721 decoder_->set_unsafe_es3_apis_enabled(false);
722 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
725 TEST_P(GLES2DecoderTest2, IsTransformFeedbackInvalidArgsBadSharedMemoryId) {
726 SpecializedSetup<cmds::IsTransformFeedback, 0>(false);
727 decoder_->set_unsafe_es3_apis_enabled(true);
728 cmds::IsTransformFeedback cmd;
729 cmd.Init(client_transformfeedback_id_, kInvalidSharedMemoryId,
730 shared_memory_offset_);
731 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
732 cmd.Init(client_transformfeedback_id_, shared_memory_id_,
733 kInvalidSharedMemoryOffset);
734 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
735 decoder_->set_unsafe_es3_apis_enabled(true);
738 TEST_P(GLES2DecoderTest2, LineWidthValidArgs) {
739 EXPECT_CALL(*gl_, LineWidth(0.5f));
740 SpecializedSetup<cmds::LineWidth, 0>(true);
741 cmds::LineWidth cmd;
742 cmd.Init(0.5f);
743 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
744 EXPECT_EQ(GL_NO_ERROR, GetGLError());
747 TEST_P(GLES2DecoderTest2, LineWidthInvalidValue0_0) {
748 SpecializedSetup<cmds::LineWidth, 0>(false);
749 cmds::LineWidth cmd;
750 cmd.Init(0.0f);
751 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
752 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
755 TEST_P(GLES2DecoderTest2, LineWidthNaNValue0) {
756 SpecializedSetup<cmds::LineWidth, 0>(false);
757 cmds::LineWidth cmd;
758 cmd.Init(nanf(""));
759 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
760 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
763 TEST_P(GLES2DecoderTest2, LinkProgramValidArgs) {
764 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId));
765 SpecializedSetup<cmds::LinkProgram, 0>(true);
766 cmds::LinkProgram cmd;
767 cmd.Init(client_program_id_);
768 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
769 EXPECT_EQ(GL_NO_ERROR, GetGLError());
772 TEST_P(GLES2DecoderTest2, PauseTransformFeedbackValidArgs) {
773 EXPECT_CALL(*gl_, PauseTransformFeedback());
774 SpecializedSetup<cmds::PauseTransformFeedback, 0>(true);
775 cmds::PauseTransformFeedback cmd;
776 cmd.Init();
777 decoder_->set_unsafe_es3_apis_enabled(true);
778 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
779 EXPECT_EQ(GL_NO_ERROR, GetGLError());
780 decoder_->set_unsafe_es3_apis_enabled(false);
781 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
783 // TODO(gman): PixelStorei
785 TEST_P(GLES2DecoderTest2, PolygonOffsetValidArgs) {
786 EXPECT_CALL(*gl_, PolygonOffset(1, 2));
787 SpecializedSetup<cmds::PolygonOffset, 0>(true);
788 cmds::PolygonOffset cmd;
789 cmd.Init(1, 2);
790 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
791 EXPECT_EQ(GL_NO_ERROR, GetGLError());
794 TEST_P(GLES2DecoderTest2, ReadBufferValidArgs) {
795 EXPECT_CALL(*gl_, ReadBuffer(GL_NONE));
796 SpecializedSetup<cmds::ReadBuffer, 0>(true);
797 cmds::ReadBuffer cmd;
798 cmd.Init(GL_NONE);
799 decoder_->set_unsafe_es3_apis_enabled(true);
800 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
801 EXPECT_EQ(GL_NO_ERROR, GetGLError());
802 decoder_->set_unsafe_es3_apis_enabled(false);
803 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
805 // TODO(gman): ReadPixels
807 // TODO(gman): ReleaseShaderCompiler
809 TEST_P(GLES2DecoderTest2, RenderbufferStorageValidArgs) {
810 SpecializedSetup<cmds::RenderbufferStorage, 0>(true);
811 cmds::RenderbufferStorage cmd;
812 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
813 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
814 EXPECT_EQ(GL_NO_ERROR, GetGLError());
817 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs0_0) {
818 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
819 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
820 cmds::RenderbufferStorage cmd;
821 cmd.Init(GL_FRAMEBUFFER, GL_RGBA4, 3, 4);
822 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
823 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
826 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs2_0) {
827 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
828 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
829 cmds::RenderbufferStorage cmd;
830 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, -1, 4);
831 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
832 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
835 TEST_P(GLES2DecoderTest2, RenderbufferStorageInvalidArgs3_0) {
836 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0);
837 SpecializedSetup<cmds::RenderbufferStorage, 0>(false);
838 cmds::RenderbufferStorage cmd;
839 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, -1);
840 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
841 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
844 TEST_P(GLES2DecoderTest2, ResumeTransformFeedbackValidArgs) {
845 EXPECT_CALL(*gl_, ResumeTransformFeedback());
846 SpecializedSetup<cmds::ResumeTransformFeedback, 0>(true);
847 cmds::ResumeTransformFeedback cmd;
848 cmd.Init();
849 decoder_->set_unsafe_es3_apis_enabled(true);
850 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
851 EXPECT_EQ(GL_NO_ERROR, GetGLError());
852 decoder_->set_unsafe_es3_apis_enabled(false);
853 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
856 TEST_P(GLES2DecoderTest2, SampleCoverageValidArgs) {
857 EXPECT_CALL(*gl_, SampleCoverage(1, true));
858 SpecializedSetup<cmds::SampleCoverage, 0>(true);
859 cmds::SampleCoverage cmd;
860 cmd.Init(1, true);
861 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
862 EXPECT_EQ(GL_NO_ERROR, GetGLError());
865 TEST_P(GLES2DecoderTest2, SamplerParameterfValidArgs) {
866 EXPECT_CALL(*gl_, SamplerParameterf(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
867 GL_NEAREST));
868 SpecializedSetup<cmds::SamplerParameterf, 0>(true);
869 cmds::SamplerParameterf cmd;
870 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
871 decoder_->set_unsafe_es3_apis_enabled(true);
872 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
873 EXPECT_EQ(GL_NO_ERROR, GetGLError());
874 decoder_->set_unsafe_es3_apis_enabled(false);
875 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
878 TEST_P(GLES2DecoderTest2, SamplerParameterfvImmediateValidArgs) {
879 cmds::SamplerParameterfvImmediate& cmd =
880 *GetImmediateAs<cmds::SamplerParameterfvImmediate>();
881 SpecializedSetup<cmds::SamplerParameterfvImmediate, 0>(true);
882 GLfloat temp[1] = {
883 GL_NEAREST,
885 cmd.Init(kServiceSamplerId, GL_TEXTURE_MAG_FILTER, &temp[0]);
886 EXPECT_CALL(*gl_, SamplerParameterf(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
887 *reinterpret_cast<GLfloat*>(
888 ImmediateDataAddress(&cmd))));
889 decoder_->set_unsafe_es3_apis_enabled(true);
890 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
891 EXPECT_EQ(GL_NO_ERROR, GetGLError());
892 decoder_->set_unsafe_es3_apis_enabled(false);
893 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
896 TEST_P(GLES2DecoderTest2, SamplerParameteriValidArgs) {
897 EXPECT_CALL(*gl_, SamplerParameteri(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
898 GL_NEAREST));
899 SpecializedSetup<cmds::SamplerParameteri, 0>(true);
900 cmds::SamplerParameteri cmd;
901 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
902 decoder_->set_unsafe_es3_apis_enabled(true);
903 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
904 EXPECT_EQ(GL_NO_ERROR, GetGLError());
905 decoder_->set_unsafe_es3_apis_enabled(false);
906 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
909 TEST_P(GLES2DecoderTest2, SamplerParameterivImmediateValidArgs) {
910 cmds::SamplerParameterivImmediate& cmd =
911 *GetImmediateAs<cmds::SamplerParameterivImmediate>();
912 SpecializedSetup<cmds::SamplerParameterivImmediate, 0>(true);
913 GLint temp[1] = {
914 GL_NEAREST,
916 cmd.Init(kServiceSamplerId, GL_TEXTURE_MAG_FILTER, &temp[0]);
917 EXPECT_CALL(*gl_, SamplerParameteri(
918 kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
919 *reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
920 decoder_->set_unsafe_es3_apis_enabled(true);
921 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
922 EXPECT_EQ(GL_NO_ERROR, GetGLError());
923 decoder_->set_unsafe_es3_apis_enabled(false);
924 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
927 TEST_P(GLES2DecoderTest2, ScissorValidArgs) {
928 EXPECT_CALL(*gl_, Scissor(1, 2, 3, 4));
929 SpecializedSetup<cmds::Scissor, 0>(true);
930 cmds::Scissor cmd;
931 cmd.Init(1, 2, 3, 4);
932 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
933 EXPECT_EQ(GL_NO_ERROR, GetGLError());
936 TEST_P(GLES2DecoderTest2, ScissorInvalidArgs2_0) {
937 EXPECT_CALL(*gl_, Scissor(_, _, _, _)).Times(0);
938 SpecializedSetup<cmds::Scissor, 0>(false);
939 cmds::Scissor cmd;
940 cmd.Init(1, 2, -1, 4);
941 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
942 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
945 TEST_P(GLES2DecoderTest2, ScissorInvalidArgs3_0) {
946 EXPECT_CALL(*gl_, Scissor(_, _, _, _)).Times(0);
947 SpecializedSetup<cmds::Scissor, 0>(false);
948 cmds::Scissor cmd;
949 cmd.Init(1, 2, 3, -1);
950 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
951 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
953 // TODO(gman): ShaderBinary
955 TEST_P(GLES2DecoderTest2, ShaderSourceBucketValidArgs) {
956 const uint32 kBucketId = 123;
957 const char kSource0[] = "hello";
958 const char* kSource[] = {kSource0};
959 const char kValidStrEnd = 0;
960 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
961 cmds::ShaderSourceBucket cmd;
962 cmd.Init(client_shader_id_, kBucketId);
963 decoder_->set_unsafe_es3_apis_enabled(true);
964 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
967 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidArgs) {
968 const uint32 kBucketId = 123;
969 const char kSource0[] = "hello";
970 const char* kSource[] = {kSource0};
971 const char kValidStrEnd = 0;
972 decoder_->set_unsafe_es3_apis_enabled(true);
973 cmds::ShaderSourceBucket cmd;
974 // Test no bucket.
975 cmd.Init(client_shader_id_, kBucketId);
976 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
977 // Test invalid client.
978 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
979 cmd.Init(kInvalidClientId, kBucketId);
980 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
981 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
984 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidHeader) {
985 const uint32 kBucketId = 123;
986 const char kSource0[] = "hello";
987 const char* kSource[] = {kSource0};
988 const char kValidStrEnd = 0;
989 const GLsizei kCount = static_cast<GLsizei>(arraysize(kSource));
990 const GLsizei kTests[] = {
991 kCount + 1, 0, std::numeric_limits<GLsizei>::max(), -1,
993 decoder_->set_unsafe_es3_apis_enabled(true);
994 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
995 SetBucketAsCStrings(kBucketId, 1, kSource, kTests[ii], kValidStrEnd);
996 cmds::ShaderSourceBucket cmd;
997 cmd.Init(client_shader_id_, kBucketId);
998 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1002 TEST_P(GLES2DecoderTest2, ShaderSourceBucketInvalidStringEnding) {
1003 const uint32 kBucketId = 123;
1004 const char kSource0[] = "hello";
1005 const char* kSource[] = {kSource0};
1006 const char kInvalidStrEnd = '*';
1007 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kInvalidStrEnd);
1008 cmds::ShaderSourceBucket cmd;
1009 cmd.Init(client_shader_id_, kBucketId);
1010 decoder_->set_unsafe_es3_apis_enabled(true);
1011 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1014 TEST_P(GLES2DecoderTest2, StencilFuncValidArgs) {
1015 EXPECT_CALL(*gl_, StencilFunc(GL_NEVER, 2, 3));
1016 SpecializedSetup<cmds::StencilFunc, 0>(true);
1017 cmds::StencilFunc cmd;
1018 cmd.Init(GL_NEVER, 2, 3);
1019 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1020 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1023 TEST_P(GLES2DecoderTest2, StencilFuncSeparateValidArgs) {
1024 EXPECT_CALL(*gl_, StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4));
1025 SpecializedSetup<cmds::StencilFuncSeparate, 0>(true);
1026 cmds::StencilFuncSeparate cmd;
1027 cmd.Init(GL_FRONT, GL_NEVER, 3, 4);
1028 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1029 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1032 TEST_P(GLES2DecoderTest2, StencilMaskValidArgs) {
1033 SpecializedSetup<cmds::StencilMask, 0>(true);
1034 cmds::StencilMask cmd;
1035 cmd.Init(1);
1036 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1037 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1040 TEST_P(GLES2DecoderTest2, StencilMaskSeparateValidArgs) {
1041 SpecializedSetup<cmds::StencilMaskSeparate, 0>(true);
1042 cmds::StencilMaskSeparate cmd;
1043 cmd.Init(GL_FRONT, 2);
1044 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1045 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1048 TEST_P(GLES2DecoderTest2, StencilOpValidArgs) {
1049 EXPECT_CALL(*gl_, StencilOp(GL_KEEP, GL_INCR, GL_KEEP));
1050 SpecializedSetup<cmds::StencilOp, 0>(true);
1051 cmds::StencilOp cmd;
1052 cmd.Init(GL_KEEP, GL_INCR, GL_KEEP);
1053 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1054 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1057 TEST_P(GLES2DecoderTest2, StencilOpSeparateValidArgs) {
1058 EXPECT_CALL(*gl_, StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP));
1059 SpecializedSetup<cmds::StencilOpSeparate, 0>(true);
1060 cmds::StencilOpSeparate cmd;
1061 cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1062 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1063 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1065 // TODO(gman): TexImage2D
1067 // TODO(gman): TexImage3D
1069 TEST_P(GLES2DecoderTest2, TexParameterfValidArgs) {
1070 EXPECT_CALL(*gl_,
1071 TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
1072 SpecializedSetup<cmds::TexParameterf, 0>(true);
1073 cmds::TexParameterf cmd;
1074 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1075 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1076 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1079 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs0_0) {
1080 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1081 SpecializedSetup<cmds::TexParameterf, 0>(false);
1082 cmds::TexParameterf cmd;
1083 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1084 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1085 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1088 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs0_1) {
1089 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1090 SpecializedSetup<cmds::TexParameterf, 0>(false);
1091 cmds::TexParameterf cmd;
1092 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1093 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1094 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1097 TEST_P(GLES2DecoderTest2, TexParameterfInvalidArgs1_0) {
1098 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1099 SpecializedSetup<cmds::TexParameterf, 0>(false);
1100 cmds::TexParameterf cmd;
1101 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_NEAREST);
1102 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1103 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1106 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateValidArgs) {
1107 cmds::TexParameterfvImmediate& cmd =
1108 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1109 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(true);
1110 GLfloat temp[1] = {
1111 GL_NEAREST,
1113 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1114 EXPECT_CALL(
1115 *gl_,
1116 TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1117 *reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1118 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1119 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1122 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs0_0) {
1123 cmds::TexParameterfvImmediate& cmd =
1124 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1125 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1127 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1128 GLfloat temp[1] = {
1129 GL_NEAREST,
1131 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1132 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1134 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1137 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs0_1) {
1138 cmds::TexParameterfvImmediate& cmd =
1139 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1140 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1142 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1143 GLfloat temp[1] = {
1144 GL_NEAREST,
1146 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1147 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1149 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1152 TEST_P(GLES2DecoderTest2, TexParameterfvImmediateInvalidArgs1_0) {
1153 cmds::TexParameterfvImmediate& cmd =
1154 *GetImmediateAs<cmds::TexParameterfvImmediate>();
1155 EXPECT_CALL(*gl_, TexParameterf(_, _, _)).Times(0);
1157 SpecializedSetup<cmds::TexParameterfvImmediate, 0>(false);
1158 GLfloat temp[1] = {
1159 GL_NEAREST,
1161 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, &temp[0]);
1162 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1164 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1167 TEST_P(GLES2DecoderTest2, TexParameteriValidArgs) {
1168 EXPECT_CALL(*gl_,
1169 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
1170 SpecializedSetup<cmds::TexParameteri, 0>(true);
1171 cmds::TexParameteri cmd;
1172 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1173 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1174 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1177 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs0_0) {
1178 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1179 SpecializedSetup<cmds::TexParameteri, 0>(false);
1180 cmds::TexParameteri cmd;
1181 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1182 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1183 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1186 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs0_1) {
1187 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1188 SpecializedSetup<cmds::TexParameteri, 0>(false);
1189 cmds::TexParameteri cmd;
1190 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1192 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1195 TEST_P(GLES2DecoderTest2, TexParameteriInvalidArgs1_0) {
1196 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1197 SpecializedSetup<cmds::TexParameteri, 0>(false);
1198 cmds::TexParameteri cmd;
1199 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_NEAREST);
1200 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1201 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1204 TEST_P(GLES2DecoderTest2, TexParameterivImmediateValidArgs) {
1205 cmds::TexParameterivImmediate& cmd =
1206 *GetImmediateAs<cmds::TexParameterivImmediate>();
1207 SpecializedSetup<cmds::TexParameterivImmediate, 0>(true);
1208 GLint temp[1] = {
1209 GL_NEAREST,
1211 cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1212 EXPECT_CALL(*gl_, TexParameteri(
1213 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
1214 *reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1215 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1216 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1219 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs0_0) {
1220 cmds::TexParameterivImmediate& cmd =
1221 *GetImmediateAs<cmds::TexParameterivImmediate>();
1222 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1224 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1225 GLint temp[1] = {
1226 GL_NEAREST,
1228 cmd.Init(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1229 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1231 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1234 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs0_1) {
1235 cmds::TexParameterivImmediate& cmd =
1236 *GetImmediateAs<cmds::TexParameterivImmediate>();
1237 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1239 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1240 GLint temp[1] = {
1241 GL_NEAREST,
1243 cmd.Init(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, &temp[0]);
1244 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1246 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1249 TEST_P(GLES2DecoderTest2, TexParameterivImmediateInvalidArgs1_0) {
1250 cmds::TexParameterivImmediate& cmd =
1251 *GetImmediateAs<cmds::TexParameterivImmediate>();
1252 EXPECT_CALL(*gl_, TexParameteri(_, _, _)).Times(0);
1254 SpecializedSetup<cmds::TexParameterivImmediate, 0>(false);
1255 GLint temp[1] = {
1256 GL_NEAREST,
1258 cmd.Init(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, &temp[0]);
1259 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1261 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1264 TEST_P(GLES2DecoderTest2, TexStorage3DValidArgs) {
1265 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6));
1266 SpecializedSetup<cmds::TexStorage3D, 0>(true);
1267 cmds::TexStorage3D cmd;
1268 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6);
1269 decoder_->set_unsafe_es3_apis_enabled(true);
1270 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1271 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1272 decoder_->set_unsafe_es3_apis_enabled(false);
1273 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1275 // TODO(gman): TexSubImage2D
1277 // TODO(gman): TexSubImage3D
1279 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketValidArgs) {
1280 EXPECT_CALL(*gl_, TransformFeedbackVaryings(kServiceProgramId, 1, _,
1281 GL_INTERLEAVED_ATTRIBS));
1282 const uint32 kBucketId = 123;
1283 const char kSource0[] = "hello";
1284 const char* kSource[] = {kSource0};
1285 const char kValidStrEnd = 0;
1286 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
1287 cmds::TransformFeedbackVaryingsBucket cmd;
1288 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1289 decoder_->set_unsafe_es3_apis_enabled(true);
1290 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1291 decoder_->set_unsafe_es3_apis_enabled(false);
1292 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1295 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidArgs) {
1296 const uint32 kBucketId = 123;
1297 const char kSource0[] = "hello";
1298 const char* kSource[] = {kSource0};
1299 const char kValidStrEnd = 0;
1300 decoder_->set_unsafe_es3_apis_enabled(true);
1301 cmds::TransformFeedbackVaryingsBucket cmd;
1302 // Test no bucket.
1303 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1304 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
1305 // Test invalid client.
1306 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kValidStrEnd);
1307 cmd.Init(kInvalidClientId, kBucketId, GL_INTERLEAVED_ATTRIBS);
1308 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1309 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1312 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidHeader) {
1313 const uint32 kBucketId = 123;
1314 const char kSource0[] = "hello";
1315 const char* kSource[] = {kSource0};
1316 const char kValidStrEnd = 0;
1317 const GLsizei kCount = static_cast<GLsizei>(arraysize(kSource));
1318 const GLsizei kTests[] = {
1319 kCount + 1, 0, std::numeric_limits<GLsizei>::max(), -1,
1321 decoder_->set_unsafe_es3_apis_enabled(true);
1322 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
1323 SetBucketAsCStrings(kBucketId, 1, kSource, kTests[ii], kValidStrEnd);
1324 cmds::TransformFeedbackVaryingsBucket cmd;
1325 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1326 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1330 TEST_P(GLES2DecoderTest2, TransformFeedbackVaryingsBucketInvalidStringEnding) {
1331 const uint32 kBucketId = 123;
1332 const char kSource0[] = "hello";
1333 const char* kSource[] = {kSource0};
1334 const char kInvalidStrEnd = '*';
1335 SetBucketAsCStrings(kBucketId, 1, kSource, 1, kInvalidStrEnd);
1336 cmds::TransformFeedbackVaryingsBucket cmd;
1337 cmd.Init(client_program_id_, kBucketId, GL_INTERLEAVED_ATTRIBS);
1338 decoder_->set_unsafe_es3_apis_enabled(true);
1339 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
1342 TEST_P(GLES2DecoderTest2, Uniform1fValidArgs) {
1343 EXPECT_CALL(*gl_, Uniform1fv(1, 1, _));
1344 SpecializedSetup<cmds::Uniform1f, 0>(true);
1345 cmds::Uniform1f cmd;
1346 cmd.Init(1, 2);
1347 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1348 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1351 TEST_P(GLES2DecoderTest2, Uniform1fvImmediateValidArgs) {
1352 cmds::Uniform1fvImmediate& cmd = *GetImmediateAs<cmds::Uniform1fvImmediate>();
1353 EXPECT_CALL(
1354 *gl_,
1355 Uniform1fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1356 SpecializedSetup<cmds::Uniform1fvImmediate, 0>(true);
1357 GLfloat temp[1 * 2] = {
1360 cmd.Init(1, 2, &temp[0]);
1361 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1362 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1364 // TODO(gman): Uniform1i
1365 // TODO(gman): Uniform1ivImmediate
1367 TEST_P(GLES2DecoderTest2, Uniform1uiValidArgs) {
1368 EXPECT_CALL(*gl_, Uniform1uiv(1, 1, _));
1369 SpecializedSetup<cmds::Uniform1ui, 0>(true);
1370 cmds::Uniform1ui cmd;
1371 cmd.Init(1, 2);
1372 decoder_->set_unsafe_es3_apis_enabled(true);
1373 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1374 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1375 decoder_->set_unsafe_es3_apis_enabled(false);
1376 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1379 TEST_P(GLES2DecoderTest2, Uniform1uivImmediateValidArgs) {
1380 cmds::Uniform1uivImmediate& cmd =
1381 *GetImmediateAs<cmds::Uniform1uivImmediate>();
1382 EXPECT_CALL(
1383 *gl_,
1384 Uniform1uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1385 SpecializedSetup<cmds::Uniform1uivImmediate, 0>(true);
1386 GLuint temp[1 * 2] = {
1389 cmd.Init(1, 2, &temp[0]);
1390 decoder_->set_unsafe_es3_apis_enabled(true);
1391 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1392 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1393 decoder_->set_unsafe_es3_apis_enabled(false);
1394 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1397 TEST_P(GLES2DecoderTest2, Uniform2fValidArgs) {
1398 EXPECT_CALL(*gl_, Uniform2fv(1, 1, _));
1399 SpecializedSetup<cmds::Uniform2f, 0>(true);
1400 cmds::Uniform2f 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, Uniform2fvImmediateValidArgs) {
1407 cmds::Uniform2fvImmediate& cmd = *GetImmediateAs<cmds::Uniform2fvImmediate>();
1408 EXPECT_CALL(
1409 *gl_,
1410 Uniform2fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1411 SpecializedSetup<cmds::Uniform2fvImmediate, 0>(true);
1412 GLfloat 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, Uniform2iValidArgs) {
1421 EXPECT_CALL(*gl_, Uniform2iv(1, 1, _));
1422 SpecializedSetup<cmds::Uniform2i, 0>(true);
1423 cmds::Uniform2i cmd;
1424 cmd.Init(1, 2, 3);
1425 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1426 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1429 TEST_P(GLES2DecoderTest2, Uniform2ivImmediateValidArgs) {
1430 cmds::Uniform2ivImmediate& cmd = *GetImmediateAs<cmds::Uniform2ivImmediate>();
1431 EXPECT_CALL(
1432 *gl_,
1433 Uniform2iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1434 SpecializedSetup<cmds::Uniform2ivImmediate, 0>(true);
1435 GLint temp[2 * 2] = {
1438 cmd.Init(1, 2, &temp[0]);
1439 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1440 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1443 TEST_P(GLES2DecoderTest2, Uniform2uiValidArgs) {
1444 EXPECT_CALL(*gl_, Uniform2uiv(1, 1, _));
1445 SpecializedSetup<cmds::Uniform2ui, 0>(true);
1446 cmds::Uniform2ui cmd;
1447 cmd.Init(1, 2, 3);
1448 decoder_->set_unsafe_es3_apis_enabled(true);
1449 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1450 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1451 decoder_->set_unsafe_es3_apis_enabled(false);
1452 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1455 TEST_P(GLES2DecoderTest2, Uniform2uivImmediateValidArgs) {
1456 cmds::Uniform2uivImmediate& cmd =
1457 *GetImmediateAs<cmds::Uniform2uivImmediate>();
1458 EXPECT_CALL(
1459 *gl_,
1460 Uniform2uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1461 SpecializedSetup<cmds::Uniform2uivImmediate, 0>(true);
1462 GLuint temp[2 * 2] = {
1465 cmd.Init(1, 2, &temp[0]);
1466 decoder_->set_unsafe_es3_apis_enabled(true);
1467 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1468 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1469 decoder_->set_unsafe_es3_apis_enabled(false);
1470 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1473 TEST_P(GLES2DecoderTest2, Uniform3fValidArgs) {
1474 EXPECT_CALL(*gl_, Uniform3fv(1, 1, _));
1475 SpecializedSetup<cmds::Uniform3f, 0>(true);
1476 cmds::Uniform3f 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, Uniform3fvImmediateValidArgs) {
1483 cmds::Uniform3fvImmediate& cmd = *GetImmediateAs<cmds::Uniform3fvImmediate>();
1484 EXPECT_CALL(
1485 *gl_,
1486 Uniform3fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1487 SpecializedSetup<cmds::Uniform3fvImmediate, 0>(true);
1488 GLfloat 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, Uniform3iValidArgs) {
1497 EXPECT_CALL(*gl_, Uniform3iv(1, 1, _));
1498 SpecializedSetup<cmds::Uniform3i, 0>(true);
1499 cmds::Uniform3i cmd;
1500 cmd.Init(1, 2, 3, 4);
1501 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1502 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1505 TEST_P(GLES2DecoderTest2, Uniform3ivImmediateValidArgs) {
1506 cmds::Uniform3ivImmediate& cmd = *GetImmediateAs<cmds::Uniform3ivImmediate>();
1507 EXPECT_CALL(
1508 *gl_,
1509 Uniform3iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1510 SpecializedSetup<cmds::Uniform3ivImmediate, 0>(true);
1511 GLint temp[3 * 2] = {
1514 cmd.Init(1, 2, &temp[0]);
1515 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1516 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1519 TEST_P(GLES2DecoderTest2, Uniform3uiValidArgs) {
1520 EXPECT_CALL(*gl_, Uniform3uiv(1, 1, _));
1521 SpecializedSetup<cmds::Uniform3ui, 0>(true);
1522 cmds::Uniform3ui cmd;
1523 cmd.Init(1, 2, 3, 4);
1524 decoder_->set_unsafe_es3_apis_enabled(true);
1525 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1526 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1527 decoder_->set_unsafe_es3_apis_enabled(false);
1528 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1531 TEST_P(GLES2DecoderTest2, Uniform3uivImmediateValidArgs) {
1532 cmds::Uniform3uivImmediate& cmd =
1533 *GetImmediateAs<cmds::Uniform3uivImmediate>();
1534 EXPECT_CALL(
1535 *gl_,
1536 Uniform3uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1537 SpecializedSetup<cmds::Uniform3uivImmediate, 0>(true);
1538 GLuint temp[3 * 2] = {
1541 cmd.Init(1, 2, &temp[0]);
1542 decoder_->set_unsafe_es3_apis_enabled(true);
1543 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1544 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1545 decoder_->set_unsafe_es3_apis_enabled(false);
1546 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1549 TEST_P(GLES2DecoderTest2, Uniform4fValidArgs) {
1550 EXPECT_CALL(*gl_, Uniform4fv(1, 1, _));
1551 SpecializedSetup<cmds::Uniform4f, 0>(true);
1552 cmds::Uniform4f 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, Uniform4fvImmediateValidArgs) {
1559 cmds::Uniform4fvImmediate& cmd = *GetImmediateAs<cmds::Uniform4fvImmediate>();
1560 EXPECT_CALL(
1561 *gl_,
1562 Uniform4fv(1, 2, reinterpret_cast<GLfloat*>(ImmediateDataAddress(&cmd))));
1563 SpecializedSetup<cmds::Uniform4fvImmediate, 0>(true);
1564 GLfloat 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, Uniform4iValidArgs) {
1573 EXPECT_CALL(*gl_, Uniform4iv(1, 1, _));
1574 SpecializedSetup<cmds::Uniform4i, 0>(true);
1575 cmds::Uniform4i cmd;
1576 cmd.Init(1, 2, 3, 4, 5);
1577 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1578 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1581 TEST_P(GLES2DecoderTest2, Uniform4ivImmediateValidArgs) {
1582 cmds::Uniform4ivImmediate& cmd = *GetImmediateAs<cmds::Uniform4ivImmediate>();
1583 EXPECT_CALL(
1584 *gl_,
1585 Uniform4iv(1, 2, reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1586 SpecializedSetup<cmds::Uniform4ivImmediate, 0>(true);
1587 GLint temp[4 * 2] = {
1590 cmd.Init(1, 2, &temp[0]);
1591 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1592 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1595 TEST_P(GLES2DecoderTest2, Uniform4uiValidArgs) {
1596 EXPECT_CALL(*gl_, Uniform4uiv(1, 1, _));
1597 SpecializedSetup<cmds::Uniform4ui, 0>(true);
1598 cmds::Uniform4ui cmd;
1599 cmd.Init(1, 2, 3, 4, 5);
1600 decoder_->set_unsafe_es3_apis_enabled(true);
1601 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1602 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1603 decoder_->set_unsafe_es3_apis_enabled(false);
1604 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1607 TEST_P(GLES2DecoderTest2, Uniform4uivImmediateValidArgs) {
1608 cmds::Uniform4uivImmediate& cmd =
1609 *GetImmediateAs<cmds::Uniform4uivImmediate>();
1610 EXPECT_CALL(
1611 *gl_,
1612 Uniform4uiv(1, 2, reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1613 SpecializedSetup<cmds::Uniform4uivImmediate, 0>(true);
1614 GLuint temp[4 * 2] = {
1617 cmd.Init(1, 2, &temp[0]);
1618 decoder_->set_unsafe_es3_apis_enabled(true);
1619 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1620 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1621 decoder_->set_unsafe_es3_apis_enabled(false);
1622 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1624 // TODO(gman): UniformBlockBinding
1626 TEST_P(GLES2DecoderTest2, UniformMatrix2fvImmediateValidArgs) {
1627 cmds::UniformMatrix2fvImmediate& cmd =
1628 *GetImmediateAs<cmds::UniformMatrix2fvImmediate>();
1629 EXPECT_CALL(*gl_,
1630 UniformMatrix2fv(1, 2, false, reinterpret_cast<GLfloat*>(
1631 ImmediateDataAddress(&cmd))));
1632 SpecializedSetup<cmds::UniformMatrix2fvImmediate, 0>(true);
1633 GLfloat temp[4 * 2] = {
1636 cmd.Init(1, 2, &temp[0]);
1637 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1638 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1641 TEST_P(GLES2DecoderTest2, UniformMatrix2x3fvImmediateValidArgs) {
1642 cmds::UniformMatrix2x3fvImmediate& cmd =
1643 *GetImmediateAs<cmds::UniformMatrix2x3fvImmediate>();
1644 EXPECT_CALL(*gl_,
1645 UniformMatrix2x3fv(1, 2, false, reinterpret_cast<GLfloat*>(
1646 ImmediateDataAddress(&cmd))));
1647 SpecializedSetup<cmds::UniformMatrix2x3fvImmediate, 0>(true);
1648 GLfloat temp[6 * 2] = {
1651 cmd.Init(1, 2, &temp[0]);
1652 decoder_->set_unsafe_es3_apis_enabled(true);
1653 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1654 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1655 decoder_->set_unsafe_es3_apis_enabled(false);
1656 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1658 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_