1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 // It is included by gles2_cmd_decoder_unittest_1.cc
12 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_
13 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_
15 // TODO(gman): ActiveTexture
17 TEST_P(GLES2DecoderTest1
, AttachShaderValidArgs
) {
18 EXPECT_CALL(*gl_
, AttachShader(kServiceProgramId
, kServiceShaderId
));
19 SpecializedSetup
<cmds::AttachShader
, 0>(true);
20 cmds::AttachShader cmd
;
21 cmd
.Init(client_program_id_
, client_shader_id_
);
22 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
23 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
25 // TODO(gman): BindAttribLocationBucket
27 TEST_P(GLES2DecoderTest1
, BindBufferValidArgs
) {
28 EXPECT_CALL(*gl_
, BindBuffer(GL_ARRAY_BUFFER
, kServiceBufferId
));
29 SpecializedSetup
<cmds::BindBuffer
, 0>(true);
31 cmd
.Init(GL_ARRAY_BUFFER
, client_buffer_id_
);
32 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
33 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
36 TEST_P(GLES2DecoderTest1
, BindBufferValidArgsNewId
) {
37 EXPECT_CALL(*gl_
, BindBuffer(GL_ARRAY_BUFFER
, kNewServiceId
));
38 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
39 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
40 SpecializedSetup
<cmds::BindBuffer
, 0>(true);
42 cmd
.Init(GL_ARRAY_BUFFER
, kNewClientId
);
43 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
44 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
45 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
48 TEST_P(GLES2DecoderTest1
, BindBufferInvalidArgs0_0
) {
49 EXPECT_CALL(*gl_
, BindBuffer(_
, _
)).Times(0);
50 SpecializedSetup
<cmds::BindBuffer
, 0>(false);
52 cmd
.Init(GL_RENDERBUFFER
, client_buffer_id_
);
53 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
54 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
57 TEST_P(GLES2DecoderTest1
, BindBufferBaseValidArgs
) {
59 *gl_
, BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kServiceBufferId
));
60 SpecializedSetup
<cmds::BindBufferBase
, 0>(true);
61 cmds::BindBufferBase cmd
;
62 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, client_buffer_id_
);
63 decoder_
->set_unsafe_es3_apis_enabled(true);
64 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
65 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
66 decoder_
->set_unsafe_es3_apis_enabled(false);
67 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
70 TEST_P(GLES2DecoderTest1
, BindBufferBaseValidArgsNewId
) {
72 BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kNewServiceId
));
73 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
74 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
75 SpecializedSetup
<cmds::BindBufferBase
, 0>(true);
76 cmds::BindBufferBase cmd
;
77 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kNewClientId
);
78 decoder_
->set_unsafe_es3_apis_enabled(true);
79 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
80 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
81 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
82 decoder_
->set_unsafe_es3_apis_enabled(false);
83 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
86 TEST_P(GLES2DecoderTest1
, BindBufferRangeValidArgs
) {
87 EXPECT_CALL(*gl_
, BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER
, 2,
88 kServiceBufferId
, 4, 4));
89 SpecializedSetup
<cmds::BindBufferRange
, 0>(true);
90 cmds::BindBufferRange cmd
;
91 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, client_buffer_id_
, 4, 4);
92 decoder_
->set_unsafe_es3_apis_enabled(true);
93 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
94 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
95 decoder_
->set_unsafe_es3_apis_enabled(false);
96 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
99 TEST_P(GLES2DecoderTest1
, BindBufferRangeValidArgsNewId
) {
100 EXPECT_CALL(*gl_
, BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER
, 2,
101 kNewServiceId
, 4, 4));
102 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
103 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
104 SpecializedSetup
<cmds::BindBufferRange
, 0>(true);
105 cmds::BindBufferRange cmd
;
106 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kNewClientId
, 4, 4);
107 decoder_
->set_unsafe_es3_apis_enabled(true);
108 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
109 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
110 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
111 decoder_
->set_unsafe_es3_apis_enabled(false);
112 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
115 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgs
) {
116 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kServiceFramebufferId
));
117 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
118 cmds::BindFramebuffer cmd
;
119 cmd
.Init(GL_FRAMEBUFFER
, client_framebuffer_id_
);
120 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
121 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
124 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgsNewId
) {
125 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kNewServiceId
));
126 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
127 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
128 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
129 cmds::BindFramebuffer cmd
;
130 cmd
.Init(GL_FRAMEBUFFER
, kNewClientId
);
131 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
132 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
133 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
136 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_0
) {
137 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
138 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
139 cmds::BindFramebuffer cmd
;
140 cmd
.Init(GL_RENDERBUFFER
, client_framebuffer_id_
);
141 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
142 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
145 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgs
) {
147 BindRenderbufferEXT(GL_RENDERBUFFER
, kServiceRenderbufferId
));
148 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
149 cmds::BindRenderbuffer cmd
;
150 cmd
.Init(GL_RENDERBUFFER
, client_renderbuffer_id_
);
151 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
152 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
155 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgsNewId
) {
156 EXPECT_CALL(*gl_
, BindRenderbufferEXT(GL_RENDERBUFFER
, kNewServiceId
));
157 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
158 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
159 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
160 cmds::BindRenderbuffer cmd
;
161 cmd
.Init(GL_RENDERBUFFER
, kNewClientId
);
162 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
163 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
164 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
167 TEST_P(GLES2DecoderTest1
, BindRenderbufferInvalidArgs0_0
) {
168 EXPECT_CALL(*gl_
, BindRenderbufferEXT(_
, _
)).Times(0);
169 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(false);
170 cmds::BindRenderbuffer cmd
;
171 cmd
.Init(GL_FRAMEBUFFER
, client_renderbuffer_id_
);
172 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
173 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
176 TEST_P(GLES2DecoderTest1
, BindSamplerValidArgs
) {
177 EXPECT_CALL(*gl_
, BindSampler(1, kServiceSamplerId
));
178 SpecializedSetup
<cmds::BindSampler
, 0>(true);
179 cmds::BindSampler cmd
;
180 cmd
.Init(1, client_sampler_id_
);
181 decoder_
->set_unsafe_es3_apis_enabled(true);
182 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
183 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
184 decoder_
->set_unsafe_es3_apis_enabled(false);
185 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
188 TEST_P(GLES2DecoderTest1
, BindTextureValidArgs
) {
189 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kServiceTextureId
));
190 SpecializedSetup
<cmds::BindTexture
, 0>(true);
191 cmds::BindTexture cmd
;
192 cmd
.Init(GL_TEXTURE_2D
, client_texture_id_
);
193 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
194 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
197 TEST_P(GLES2DecoderTest1
, BindTextureValidArgsNewId
) {
198 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kNewServiceId
));
199 EXPECT_CALL(*gl_
, GenTextures(1, _
))
200 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
201 SpecializedSetup
<cmds::BindTexture
, 0>(true);
202 cmds::BindTexture cmd
;
203 cmd
.Init(GL_TEXTURE_2D
, kNewClientId
);
204 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
205 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
206 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
209 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_0
) {
210 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
211 SpecializedSetup
<cmds::BindTexture
, 0>(false);
212 cmds::BindTexture cmd
;
213 cmd
.Init(GL_TEXTURE_1D
, client_texture_id_
);
214 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
215 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
218 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_1
) {
219 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
220 SpecializedSetup
<cmds::BindTexture
, 0>(false);
221 cmds::BindTexture cmd
;
222 cmd
.Init(GL_TEXTURE_3D
, client_texture_id_
);
223 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
224 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
227 TEST_P(GLES2DecoderTest1
, BindTransformFeedbackValidArgs
) {
228 EXPECT_CALL(*gl_
, BindTransformFeedback(GL_TRANSFORM_FEEDBACK
,
229 kServiceTransformFeedbackId
));
230 SpecializedSetup
<cmds::BindTransformFeedback
, 0>(true);
231 cmds::BindTransformFeedback cmd
;
232 cmd
.Init(GL_TRANSFORM_FEEDBACK
, client_transformfeedback_id_
);
233 decoder_
->set_unsafe_es3_apis_enabled(true);
234 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
235 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
236 decoder_
->set_unsafe_es3_apis_enabled(false);
237 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
240 TEST_P(GLES2DecoderTest1
, BlendColorValidArgs
) {
241 EXPECT_CALL(*gl_
, BlendColor(1, 2, 3, 4));
242 SpecializedSetup
<cmds::BlendColor
, 0>(true);
243 cmds::BlendColor cmd
;
244 cmd
.Init(1, 2, 3, 4);
245 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
246 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
249 TEST_P(GLES2DecoderTest1
, BlendEquationValidArgs
) {
250 EXPECT_CALL(*gl_
, BlendEquation(GL_FUNC_SUBTRACT
));
251 SpecializedSetup
<cmds::BlendEquation
, 0>(true);
252 cmds::BlendEquation cmd
;
253 cmd
.Init(GL_FUNC_SUBTRACT
);
254 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
255 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
258 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_0
) {
259 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
260 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
261 cmds::BlendEquation cmd
;
263 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
264 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
267 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateValidArgs
) {
268 EXPECT_CALL(*gl_
, BlendEquationSeparate(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
));
269 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(true);
270 cmds::BlendEquationSeparate cmd
;
271 cmd
.Init(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
272 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
273 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
276 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_0
) {
277 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
278 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
279 cmds::BlendEquationSeparate cmd
;
280 cmd
.Init(GL_NONE
, GL_FUNC_ADD
);
281 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
282 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
285 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_0
) {
286 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
287 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
288 cmds::BlendEquationSeparate cmd
;
289 cmd
.Init(GL_FUNC_SUBTRACT
, GL_NONE
);
290 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
291 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
294 TEST_P(GLES2DecoderTest1
, BlendFuncValidArgs
) {
295 EXPECT_CALL(*gl_
, BlendFunc(GL_ZERO
, GL_ZERO
));
296 SpecializedSetup
<cmds::BlendFunc
, 0>(true);
298 cmd
.Init(GL_ZERO
, GL_ZERO
);
299 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
300 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
303 TEST_P(GLES2DecoderTest1
, BlendFuncSeparateValidArgs
) {
304 EXPECT_CALL(*gl_
, BlendFuncSeparate(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
));
305 SpecializedSetup
<cmds::BlendFuncSeparate
, 0>(true);
306 cmds::BlendFuncSeparate cmd
;
307 cmd
.Init(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
308 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
309 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
311 // TODO(gman): BufferData
313 // TODO(gman): BufferSubData
315 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusValidArgs
) {
316 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
));
317 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(true);
318 cmds::CheckFramebufferStatus cmd
;
319 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
320 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
321 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
324 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_0
) {
325 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
326 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
327 cmds::CheckFramebufferStatus cmd
;
328 cmd
.Init(GL_RENDERBUFFER
, shared_memory_id_
, shared_memory_offset_
);
329 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
330 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
333 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgsBadSharedMemoryId
) {
334 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
)).Times(0);
335 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
336 cmds::CheckFramebufferStatus cmd
;
337 cmd
.Init(GL_FRAMEBUFFER
, kInvalidSharedMemoryId
, shared_memory_offset_
);
338 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
339 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
340 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
343 TEST_P(GLES2DecoderTest1
, ClearValidArgs
) {
344 EXPECT_CALL(*gl_
, Clear(1));
345 SpecializedSetup
<cmds::Clear
, 0>(true);
348 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
349 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
351 // TODO(gman): ClearBufferfi
352 // TODO(gman): ClearBufferfvImmediate
353 // TODO(gman): ClearBufferivImmediate
354 // TODO(gman): ClearBufferuivImmediate
356 TEST_P(GLES2DecoderTest1
, ClearColorValidArgs
) {
357 EXPECT_CALL(*gl_
, ClearColor(1, 2, 3, 4));
358 SpecializedSetup
<cmds::ClearColor
, 0>(true);
359 cmds::ClearColor cmd
;
360 cmd
.Init(1, 2, 3, 4);
361 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
362 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
365 TEST_P(GLES2DecoderTest1
, ClearDepthfValidArgs
) {
366 EXPECT_CALL(*gl_
, ClearDepth(0.5f
));
367 SpecializedSetup
<cmds::ClearDepthf
, 0>(true);
368 cmds::ClearDepthf cmd
;
370 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
371 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
374 TEST_P(GLES2DecoderTest1
, ClearStencilValidArgs
) {
375 EXPECT_CALL(*gl_
, ClearStencil(1));
376 SpecializedSetup
<cmds::ClearStencil
, 0>(true);
377 cmds::ClearStencil cmd
;
379 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
380 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
382 // TODO(gman): ClientWaitSync
384 TEST_P(GLES2DecoderTest1
, ColorMaskValidArgs
) {
385 SpecializedSetup
<cmds::ColorMask
, 0>(true);
387 cmd
.Init(true, true, true, true);
388 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
389 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
391 // TODO(gman): CompileShader
392 // TODO(gman): CompressedTexImage2DBucket
393 // TODO(gman): CompressedTexImage2D
395 // TODO(gman): CompressedTexSubImage2DBucket
396 // TODO(gman): CompressedTexSubImage2D
398 // TODO(gman): CompressedTexImage3DBucket
399 // TODO(gman): CompressedTexImage3D
401 // TODO(gman): CompressedTexSubImage3DBucket
402 // TODO(gman): CompressedTexSubImage3D
404 TEST_P(GLES2DecoderTest1
, CopyBufferSubDataValidArgs
) {
406 CopyBufferSubData(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5));
407 SpecializedSetup
<cmds::CopyBufferSubData
, 0>(true);
408 cmds::CopyBufferSubData cmd
;
409 cmd
.Init(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5);
410 decoder_
->set_unsafe_es3_apis_enabled(true);
411 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
412 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
413 decoder_
->set_unsafe_es3_apis_enabled(false);
414 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
416 // TODO(gman): CopyTexImage2D
418 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DValidArgs
) {
419 EXPECT_CALL(*gl_
, CopyTexSubImage2D(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8));
420 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(true);
421 cmds::CopyTexSubImage2D cmd
;
422 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
423 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
424 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
427 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs0_0
) {
428 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
429 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
430 cmds::CopyTexSubImage2D cmd
;
431 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, 2, 3, 4, 5, 6, 7, 8);
432 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
433 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
436 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs6_0
) {
437 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
438 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
439 cmds::CopyTexSubImage2D cmd
;
440 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, -1, 8);
441 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
442 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
445 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs7_0
) {
446 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
447 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
448 cmds::CopyTexSubImage2D cmd
;
449 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, -1);
450 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
451 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
454 TEST_P(GLES2DecoderTest1
, CopyTexSubImage3DValidArgs
) {
455 EXPECT_CALL(*gl_
, CopyTexSubImage3D(GL_TEXTURE_3D
, 2, 3, 4, 5, 6, 7, 8, 9));
456 SpecializedSetup
<cmds::CopyTexSubImage3D
, 0>(true);
457 cmds::CopyTexSubImage3D cmd
;
458 cmd
.Init(GL_TEXTURE_3D
, 2, 3, 4, 5, 6, 7, 8, 9);
459 decoder_
->set_unsafe_es3_apis_enabled(true);
460 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
461 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
462 decoder_
->set_unsafe_es3_apis_enabled(false);
463 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
466 TEST_P(GLES2DecoderTest1
, CreateProgramValidArgs
) {
467 EXPECT_CALL(*gl_
, CreateProgram()).WillOnce(Return(kNewServiceId
));
468 SpecializedSetup
<cmds::CreateProgram
, 0>(true);
469 cmds::CreateProgram cmd
;
470 cmd
.Init(kNewClientId
);
471 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
472 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
473 EXPECT_TRUE(GetProgram(kNewClientId
));
476 TEST_P(GLES2DecoderTest1
, CreateShaderValidArgs
) {
477 EXPECT_CALL(*gl_
, CreateShader(GL_VERTEX_SHADER
))
478 .WillOnce(Return(kNewServiceId
));
479 SpecializedSetup
<cmds::CreateShader
, 0>(true);
480 cmds::CreateShader cmd
;
481 cmd
.Init(GL_VERTEX_SHADER
, kNewClientId
);
482 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
483 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
484 EXPECT_TRUE(GetShader(kNewClientId
));
487 TEST_P(GLES2DecoderTest1
, CreateShaderInvalidArgs0_0
) {
488 EXPECT_CALL(*gl_
, CreateShader(_
)).Times(0);
489 SpecializedSetup
<cmds::CreateShader
, 0>(false);
490 cmds::CreateShader cmd
;
491 cmd
.Init(GL_GEOMETRY_SHADER
, kNewClientId
);
492 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
493 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
496 TEST_P(GLES2DecoderTest1
, CullFaceValidArgs
) {
497 EXPECT_CALL(*gl_
, CullFace(GL_FRONT
));
498 SpecializedSetup
<cmds::CullFace
, 0>(true);
501 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
502 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
505 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateValidArgs
) {
506 EXPECT_CALL(*gl_
, DeleteBuffersARB(1, Pointee(kServiceBufferId
))).Times(1);
507 cmds::DeleteBuffersImmediate
& cmd
=
508 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
509 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(true);
510 cmd
.Init(1, &client_buffer_id_
);
511 EXPECT_EQ(error::kNoError
,
512 ExecuteImmediateCmd(cmd
, sizeof(client_buffer_id_
)));
513 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
514 EXPECT_TRUE(GetBuffer(client_buffer_id_
) == NULL
);
517 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateInvalidArgs
) {
518 cmds::DeleteBuffersImmediate
& cmd
=
519 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
520 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(false);
521 GLuint temp
= kInvalidClientId
;
523 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
526 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateValidArgs
) {
527 EXPECT_CALL(*gl_
, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId
)))
529 cmds::DeleteFramebuffersImmediate
& cmd
=
530 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
531 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(true);
532 cmd
.Init(1, &client_framebuffer_id_
);
533 EXPECT_EQ(error::kNoError
,
534 ExecuteImmediateCmd(cmd
, sizeof(client_framebuffer_id_
)));
535 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
536 EXPECT_TRUE(GetFramebuffer(client_framebuffer_id_
) == NULL
);
539 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateInvalidArgs
) {
540 cmds::DeleteFramebuffersImmediate
& cmd
=
541 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
542 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(false);
543 GLuint temp
= kInvalidClientId
;
545 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
548 TEST_P(GLES2DecoderTest1
, DeleteProgramValidArgs
) {
549 EXPECT_CALL(*gl_
, DeleteProgram(kServiceProgramId
));
550 SpecializedSetup
<cmds::DeleteProgram
, 0>(true);
551 cmds::DeleteProgram cmd
;
552 cmd
.Init(client_program_id_
);
553 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
554 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
557 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateValidArgs
) {
558 EXPECT_CALL(*gl_
, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId
)))
560 cmds::DeleteRenderbuffersImmediate
& cmd
=
561 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
562 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(true);
563 cmd
.Init(1, &client_renderbuffer_id_
);
564 EXPECT_EQ(error::kNoError
,
565 ExecuteImmediateCmd(cmd
, sizeof(client_renderbuffer_id_
)));
566 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
567 EXPECT_TRUE(GetRenderbuffer(client_renderbuffer_id_
) == NULL
);
570 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateInvalidArgs
) {
571 cmds::DeleteRenderbuffersImmediate
& cmd
=
572 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
573 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(false);
574 GLuint temp
= kInvalidClientId
;
576 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
579 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateValidArgs
) {
580 EXPECT_CALL(*gl_
, DeleteSamplers(1, Pointee(kServiceSamplerId
))).Times(1);
581 cmds::DeleteSamplersImmediate
& cmd
=
582 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
583 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(true);
584 cmd
.Init(1, &client_sampler_id_
);
585 decoder_
->set_unsafe_es3_apis_enabled(true);
586 EXPECT_EQ(error::kNoError
,
587 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
588 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
589 EXPECT_FALSE(GetSamplerServiceId(client_sampler_id_
, NULL
));
590 decoder_
->set_unsafe_es3_apis_enabled(false);
591 EXPECT_EQ(error::kUnknownCommand
,
592 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
595 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateInvalidArgs
) {
596 cmds::DeleteSamplersImmediate
& cmd
=
597 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
598 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(false);
599 GLuint temp
= kInvalidClientId
;
601 decoder_
->set_unsafe_es3_apis_enabled(true);
602 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
603 decoder_
->set_unsafe_es3_apis_enabled(false);
604 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
607 TEST_P(GLES2DecoderTest1
, DeleteSyncValidArgs
) {
608 EXPECT_CALL(*gl_
, DeleteSync(reinterpret_cast<GLsync
>(kServiceSyncId
)));
609 SpecializedSetup
<cmds::DeleteSync
, 0>(true);
610 cmds::DeleteSync cmd
;
611 cmd
.Init(client_sync_id_
);
612 decoder_
->set_unsafe_es3_apis_enabled(true);
613 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
614 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
615 decoder_
->set_unsafe_es3_apis_enabled(false);
616 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
619 TEST_P(GLES2DecoderTest1
, DeleteShaderValidArgs
) {
620 EXPECT_CALL(*gl_
, DeleteShader(kServiceShaderId
));
621 SpecializedSetup
<cmds::DeleteShader
, 0>(true);
622 cmds::DeleteShader cmd
;
623 cmd
.Init(client_shader_id_
);
624 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
625 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
628 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateValidArgs
) {
629 EXPECT_CALL(*gl_
, DeleteTextures(1, Pointee(kServiceTextureId
))).Times(1);
630 cmds::DeleteTexturesImmediate
& cmd
=
631 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
632 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(true);
633 cmd
.Init(1, &client_texture_id_
);
634 EXPECT_EQ(error::kNoError
,
635 ExecuteImmediateCmd(cmd
, sizeof(client_texture_id_
)));
636 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
637 EXPECT_TRUE(GetTexture(client_texture_id_
) == NULL
);
640 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateInvalidArgs
) {
641 cmds::DeleteTexturesImmediate
& cmd
=
642 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
643 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(false);
644 GLuint temp
= kInvalidClientId
;
646 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
649 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateValidArgs
) {
651 DeleteTransformFeedbacks(1, Pointee(kServiceTransformFeedbackId
)))
653 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
654 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
655 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(true);
656 cmd
.Init(1, &client_transformfeedback_id_
);
657 decoder_
->set_unsafe_es3_apis_enabled(true);
658 EXPECT_EQ(error::kNoError
,
659 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
660 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
662 GetTransformFeedbackServiceId(client_transformfeedback_id_
, NULL
));
663 decoder_
->set_unsafe_es3_apis_enabled(false);
664 EXPECT_EQ(error::kUnknownCommand
,
665 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
668 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateInvalidArgs
) {
669 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
670 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
671 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(false);
672 GLuint temp
= kInvalidClientId
;
674 decoder_
->set_unsafe_es3_apis_enabled(true);
675 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
676 decoder_
->set_unsafe_es3_apis_enabled(false);
677 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
680 TEST_P(GLES2DecoderTest1
, DepthFuncValidArgs
) {
681 EXPECT_CALL(*gl_
, DepthFunc(GL_NEVER
));
682 SpecializedSetup
<cmds::DepthFunc
, 0>(true);
685 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
686 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
689 TEST_P(GLES2DecoderTest1
, DepthMaskValidArgs
) {
690 SpecializedSetup
<cmds::DepthMask
, 0>(true);
693 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
694 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
697 TEST_P(GLES2DecoderTest1
, DepthRangefValidArgs
) {
698 EXPECT_CALL(*gl_
, DepthRange(1, 2));
699 SpecializedSetup
<cmds::DepthRangef
, 0>(true);
700 cmds::DepthRangef cmd
;
702 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
703 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
706 TEST_P(GLES2DecoderTest1
, DetachShaderValidArgs
) {
707 EXPECT_CALL(*gl_
, DetachShader(kServiceProgramId
, kServiceShaderId
));
708 SpecializedSetup
<cmds::DetachShader
, 0>(true);
709 cmds::DetachShader cmd
;
710 cmd
.Init(client_program_id_
, client_shader_id_
);
711 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
712 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
715 TEST_P(GLES2DecoderTest1
, DisableValidArgs
) {
716 SetupExpectationsForEnableDisable(GL_BLEND
, false);
717 SpecializedSetup
<cmds::Disable
, 0>(true);
720 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
721 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
724 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_0
) {
725 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
726 SpecializedSetup
<cmds::Disable
, 0>(false);
728 cmd
.Init(GL_CLIP_PLANE0
);
729 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
730 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
733 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_1
) {
734 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
735 SpecializedSetup
<cmds::Disable
, 0>(false);
737 cmd
.Init(GL_POINT_SPRITE
);
738 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
739 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
742 TEST_P(GLES2DecoderTest1
, DisableVertexAttribArrayValidArgs
) {
743 EXPECT_CALL(*gl_
, DisableVertexAttribArray(1));
744 SpecializedSetup
<cmds::DisableVertexAttribArray
, 0>(true);
745 cmds::DisableVertexAttribArray cmd
;
747 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
748 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
750 // TODO(gman): DrawArrays
752 // TODO(gman): DrawElements
754 TEST_P(GLES2DecoderTest1
, EnableValidArgs
) {
755 SetupExpectationsForEnableDisable(GL_BLEND
, true);
756 SpecializedSetup
<cmds::Enable
, 0>(true);
759 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
760 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
763 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_0
) {
764 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
765 SpecializedSetup
<cmds::Enable
, 0>(false);
767 cmd
.Init(GL_CLIP_PLANE0
);
768 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
769 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
772 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_1
) {
773 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
774 SpecializedSetup
<cmds::Enable
, 0>(false);
776 cmd
.Init(GL_POINT_SPRITE
);
777 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
778 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
781 TEST_P(GLES2DecoderTest1
, EnableVertexAttribArrayValidArgs
) {
782 EXPECT_CALL(*gl_
, EnableVertexAttribArray(1));
783 SpecializedSetup
<cmds::EnableVertexAttribArray
, 0>(true);
784 cmds::EnableVertexAttribArray cmd
;
786 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
787 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
790 TEST_P(GLES2DecoderTest1
, FenceSyncValidArgs
) {
791 const GLsync kNewServiceIdGLuint
= reinterpret_cast<GLsync
>(kNewServiceId
);
792 EXPECT_CALL(*gl_
, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE
, 0))
793 .WillOnce(Return(kNewServiceIdGLuint
));
794 SpecializedSetup
<cmds::FenceSync
, 0>(true);
796 cmd
.Init(kNewClientId
);
797 decoder_
->set_unsafe_es3_apis_enabled(true);
798 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
799 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
800 GLsync service_id
= 0;
801 EXPECT_TRUE(GetSyncServiceId(kNewClientId
, &service_id
));
802 EXPECT_EQ(kNewServiceIdGLuint
, service_id
);
803 decoder_
->set_unsafe_es3_apis_enabled(false);
804 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
807 TEST_P(GLES2DecoderTest1
, FinishValidArgs
) {
808 EXPECT_CALL(*gl_
, Finish());
809 SpecializedSetup
<cmds::Finish
, 0>(true);
812 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
813 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
816 TEST_P(GLES2DecoderTest1
, FlushValidArgs
) {
817 EXPECT_CALL(*gl_
, Flush());
818 SpecializedSetup
<cmds::Flush
, 0>(true);
821 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
822 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
825 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferValidArgs
) {
826 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(
827 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
828 kServiceRenderbufferId
));
829 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(true);
830 cmds::FramebufferRenderbuffer cmd
;
831 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
832 client_renderbuffer_id_
);
833 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
834 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
837 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_0
) {
838 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
839 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
840 cmds::FramebufferRenderbuffer cmd
;
841 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
842 client_renderbuffer_id_
);
843 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
844 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
847 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs2_0
) {
848 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
849 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
850 cmds::FramebufferRenderbuffer cmd
;
851 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_FRAMEBUFFER
,
852 client_renderbuffer_id_
);
853 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
854 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
857 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DValidArgs
) {
859 FramebufferTexture2DEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
860 GL_TEXTURE_2D
, kServiceTextureId
, 0));
861 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(true);
862 cmds::FramebufferTexture2D cmd
;
863 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
865 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
866 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
869 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_0
) {
870 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
871 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
872 cmds::FramebufferTexture2D cmd
;
873 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
875 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
876 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
879 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs2_0
) {
880 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
881 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
882 cmds::FramebufferTexture2D cmd
;
883 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_PROXY_TEXTURE_CUBE_MAP
,
885 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
886 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
889 TEST_P(GLES2DecoderTest1
, FramebufferTextureLayerValidArgs
) {
891 FramebufferTextureLayer(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
892 kServiceTextureId
, 4, 5));
893 SpecializedSetup
<cmds::FramebufferTextureLayer
, 0>(true);
894 cmds::FramebufferTextureLayer cmd
;
895 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, client_texture_id_
, 4, 5);
896 decoder_
->set_unsafe_es3_apis_enabled(true);
897 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
898 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
899 decoder_
->set_unsafe_es3_apis_enabled(false);
900 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
903 TEST_P(GLES2DecoderTest1
, FrontFaceValidArgs
) {
904 EXPECT_CALL(*gl_
, FrontFace(GL_CW
));
905 SpecializedSetup
<cmds::FrontFace
, 0>(true);
908 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
909 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
912 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateValidArgs
) {
913 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
914 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
915 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
916 GLuint temp
= kNewClientId
;
917 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(true);
919 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
920 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
921 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
924 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateInvalidArgs
) {
925 EXPECT_CALL(*gl_
, GenBuffersARB(_
, _
)).Times(0);
926 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
927 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(false);
928 cmd
->Init(1, &client_buffer_id_
);
929 EXPECT_EQ(error::kInvalidArguments
,
930 ExecuteImmediateCmd(*cmd
, sizeof(&client_buffer_id_
)));
933 TEST_P(GLES2DecoderTest1
, GenerateMipmapValidArgs
) {
934 EXPECT_CALL(*gl_
, GenerateMipmapEXT(GL_TEXTURE_2D
));
935 SpecializedSetup
<cmds::GenerateMipmap
, 0>(true);
936 cmds::GenerateMipmap cmd
;
937 cmd
.Init(GL_TEXTURE_2D
);
938 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
939 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
942 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_0
) {
943 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
944 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
945 cmds::GenerateMipmap cmd
;
946 cmd
.Init(GL_TEXTURE_1D
);
947 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
948 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
951 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_1
) {
952 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
953 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
954 cmds::GenerateMipmap cmd
;
955 cmd
.Init(GL_TEXTURE_3D
);
956 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
957 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
960 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateValidArgs
) {
961 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
962 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
963 cmds::GenFramebuffersImmediate
* cmd
=
964 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
965 GLuint temp
= kNewClientId
;
966 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(true);
968 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
969 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
970 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
973 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateInvalidArgs
) {
974 EXPECT_CALL(*gl_
, GenFramebuffersEXT(_
, _
)).Times(0);
975 cmds::GenFramebuffersImmediate
* cmd
=
976 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
977 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(false);
978 cmd
->Init(1, &client_framebuffer_id_
);
979 EXPECT_EQ(error::kInvalidArguments
,
980 ExecuteImmediateCmd(*cmd
, sizeof(&client_framebuffer_id_
)));
983 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateValidArgs
) {
984 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
985 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
986 cmds::GenRenderbuffersImmediate
* cmd
=
987 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
988 GLuint temp
= kNewClientId
;
989 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(true);
991 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
992 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
993 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
996 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateInvalidArgs
) {
997 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(_
, _
)).Times(0);
998 cmds::GenRenderbuffersImmediate
* cmd
=
999 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1000 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(false);
1001 cmd
->Init(1, &client_renderbuffer_id_
);
1002 EXPECT_EQ(error::kInvalidArguments
,
1003 ExecuteImmediateCmd(*cmd
, sizeof(&client_renderbuffer_id_
)));
1006 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateValidArgs
) {
1007 EXPECT_CALL(*gl_
, GenSamplers(1, _
))
1008 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1009 cmds::GenSamplersImmediate
* cmd
=
1010 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1011 GLuint temp
= kNewClientId
;
1012 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(true);
1013 decoder_
->set_unsafe_es3_apis_enabled(true);
1014 cmd
->Init(1, &temp
);
1015 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1016 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1018 EXPECT_TRUE(GetSamplerServiceId(kNewClientId
, &service_id
));
1019 EXPECT_EQ(kNewServiceId
, service_id
);
1020 decoder_
->set_unsafe_es3_apis_enabled(false);
1021 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1024 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateInvalidArgs
) {
1025 EXPECT_CALL(*gl_
, GenSamplers(_
, _
)).Times(0);
1026 cmds::GenSamplersImmediate
* cmd
=
1027 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1028 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(false);
1029 cmd
->Init(1, &client_sampler_id_
);
1030 decoder_
->set_unsafe_es3_apis_enabled(true);
1031 EXPECT_EQ(error::kInvalidArguments
,
1032 ExecuteImmediateCmd(*cmd
, sizeof(&client_sampler_id_
)));
1033 decoder_
->set_unsafe_es3_apis_enabled(false);
1036 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateValidArgs
) {
1037 EXPECT_CALL(*gl_
, GenTextures(1, _
))
1038 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1039 cmds::GenTexturesImmediate
* cmd
=
1040 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1041 GLuint temp
= kNewClientId
;
1042 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(true);
1043 cmd
->Init(1, &temp
);
1044 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1045 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1046 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
1049 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateInvalidArgs
) {
1050 EXPECT_CALL(*gl_
, GenTextures(_
, _
)).Times(0);
1051 cmds::GenTexturesImmediate
* cmd
=
1052 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1053 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(false);
1054 cmd
->Init(1, &client_texture_id_
);
1055 EXPECT_EQ(error::kInvalidArguments
,
1056 ExecuteImmediateCmd(*cmd
, sizeof(&client_texture_id_
)));
1059 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateValidArgs
) {
1060 EXPECT_CALL(*gl_
, GenTransformFeedbacks(1, _
))
1061 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1062 cmds::GenTransformFeedbacksImmediate
* cmd
=
1063 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1064 GLuint temp
= kNewClientId
;
1065 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(true);
1066 decoder_
->set_unsafe_es3_apis_enabled(true);
1067 cmd
->Init(1, &temp
);
1068 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1069 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1071 EXPECT_TRUE(GetTransformFeedbackServiceId(kNewClientId
, &service_id
));
1072 EXPECT_EQ(kNewServiceId
, service_id
);
1073 decoder_
->set_unsafe_es3_apis_enabled(false);
1074 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1077 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateInvalidArgs
) {
1078 EXPECT_CALL(*gl_
, GenTransformFeedbacks(_
, _
)).Times(0);
1079 cmds::GenTransformFeedbacksImmediate
* cmd
=
1080 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1081 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(false);
1082 cmd
->Init(1, &client_transformfeedback_id_
);
1083 decoder_
->set_unsafe_es3_apis_enabled(true);
1084 EXPECT_EQ(error::kInvalidArguments
,
1085 ExecuteImmediateCmd(*cmd
, sizeof(&client_transformfeedback_id_
)));
1086 decoder_
->set_unsafe_es3_apis_enabled(false);
1088 // TODO(gman): GetActiveAttrib
1090 // TODO(gman): GetActiveUniform
1092 // TODO(gman): GetActiveUniformBlockiv
1094 // TODO(gman): GetActiveUniformBlockName
1096 // TODO(gman): GetActiveUniformsiv
1098 // TODO(gman): GetAttachedShaders
1100 // TODO(gman): GetAttribLocation
1102 TEST_P(GLES2DecoderTest1
, GetBooleanvValidArgs
) {
1103 EXPECT_CALL(*gl_
, GetError())
1104 .WillOnce(Return(GL_NO_ERROR
))
1105 .WillOnce(Return(GL_NO_ERROR
))
1106 .RetiresOnSaturation();
1107 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
1108 typedef cmds::GetBooleanv::Result Result
;
1109 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1110 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1112 cmds::GetBooleanv cmd
;
1113 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1114 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1115 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1116 result
->GetNumResults());
1117 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1120 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
1121 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1122 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1123 cmds::GetBooleanv::Result
* result
=
1124 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1126 cmds::GetBooleanv cmd
;
1127 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1128 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1129 EXPECT_EQ(0u, result
->size
);
1130 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1133 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_0
) {
1134 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1135 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1136 cmds::GetBooleanv::Result
* result
=
1137 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1139 cmds::GetBooleanv cmd
;
1140 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1141 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1142 EXPECT_EQ(0u, result
->size
);
1145 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
1146 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1147 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1148 cmds::GetBooleanv::Result
* result
=
1149 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1151 cmds::GetBooleanv cmd
;
1152 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1153 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1154 EXPECT_EQ(0u, result
->size
);
1157 TEST_P(GLES2DecoderTest1
, GetBufferParameteri64vValidArgs
) {
1158 SpecializedSetup
<cmds::GetBufferParameteri64v
, 0>(true);
1159 typedef cmds::GetBufferParameteri64v::Result Result
;
1160 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1162 cmds::GetBufferParameteri64v cmd
;
1163 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1164 shared_memory_offset_
);
1165 decoder_
->set_unsafe_es3_apis_enabled(true);
1166 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1167 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1168 result
->GetNumResults());
1169 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1170 decoder_
->set_unsafe_es3_apis_enabled(false);
1171 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1174 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
1175 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
1176 typedef cmds::GetBufferParameteriv::Result Result
;
1177 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1179 cmds::GetBufferParameteriv cmd
;
1180 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1181 shared_memory_offset_
);
1182 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1183 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1184 result
->GetNumResults());
1185 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1188 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
1189 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1190 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1191 cmds::GetBufferParameteriv::Result
* result
=
1192 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1194 cmds::GetBufferParameteriv cmd
;
1195 cmd
.Init(GL_RENDERBUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1196 shared_memory_offset_
);
1197 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1198 EXPECT_EQ(0u, result
->size
);
1199 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1202 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
1203 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1204 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1205 cmds::GetBufferParameteriv::Result
* result
=
1206 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1208 cmds::GetBufferParameteriv cmd
;
1209 cmd
.Init(GL_ARRAY_BUFFER
, GL_PIXEL_PACK_BUFFER
, shared_memory_id_
,
1210 shared_memory_offset_
);
1211 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1212 EXPECT_EQ(0u, result
->size
);
1213 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1216 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1217 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1218 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1219 cmds::GetBufferParameteriv::Result
* result
=
1220 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1222 cmds::GetBufferParameteriv cmd
;
1223 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1224 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1225 EXPECT_EQ(0u, result
->size
);
1228 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1229 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1230 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1231 cmds::GetBufferParameteriv::Result
* result
=
1232 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1234 cmds::GetBufferParameteriv cmd
;
1235 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1236 kInvalidSharedMemoryOffset
);
1237 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1238 EXPECT_EQ(0u, result
->size
);
1241 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1242 EXPECT_CALL(*gl_
, GetError());
1243 SpecializedSetup
<cmds::GetError
, 0>(true);
1245 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1246 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1247 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1250 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1251 EXPECT_CALL(*gl_
, GetError()).Times(0);
1252 SpecializedSetup
<cmds::GetError
, 0>(false);
1254 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1255 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1256 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1257 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1260 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1261 EXPECT_CALL(*gl_
, GetError())
1262 .WillOnce(Return(GL_NO_ERROR
))
1263 .WillOnce(Return(GL_NO_ERROR
))
1264 .RetiresOnSaturation();
1265 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1266 typedef cmds::GetFloatv::Result Result
;
1267 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1268 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1270 cmds::GetFloatv cmd
;
1271 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1272 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1273 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1274 result
->GetNumResults());
1275 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1278 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1279 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1280 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1281 cmds::GetFloatv::Result
* result
=
1282 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1284 cmds::GetFloatv cmd
;
1285 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1286 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1287 EXPECT_EQ(0u, result
->size
);
1288 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1291 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1292 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1293 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1294 cmds::GetFloatv::Result
* result
=
1295 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1297 cmds::GetFloatv cmd
;
1298 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1299 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1300 EXPECT_EQ(0u, result
->size
);
1303 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1304 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1305 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1306 cmds::GetFloatv::Result
* result
=
1307 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1309 cmds::GetFloatv cmd
;
1310 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1311 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1312 EXPECT_EQ(0u, result
->size
);
1314 // TODO(gman): GetFragDataLocation
1316 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1317 EXPECT_CALL(*gl_
, GetError())
1318 .WillOnce(Return(GL_NO_ERROR
))
1319 .WillOnce(Return(GL_NO_ERROR
))
1320 .RetiresOnSaturation();
1321 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1322 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1323 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1325 GetFramebufferAttachmentParameterivEXT(
1326 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1327 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result
->GetData()));
1329 cmds::GetFramebufferAttachmentParameteriv cmd
;
1330 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1331 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1332 shared_memory_offset_
);
1333 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1334 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1335 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1336 result
->GetNumResults());
1337 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1340 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1341 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1343 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1344 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1345 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1346 shared_memory_address_
);
1348 cmds::GetFramebufferAttachmentParameteriv cmd
;
1349 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
,
1350 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1351 shared_memory_offset_
);
1352 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1353 EXPECT_EQ(0u, result
->size
);
1354 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1357 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1358 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1360 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1361 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1362 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1363 shared_memory_address_
);
1365 cmds::GetFramebufferAttachmentParameteriv cmd
;
1366 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1367 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, kInvalidSharedMemoryId
, 0);
1368 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1369 EXPECT_EQ(0u, result
->size
);
1372 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1373 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1375 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1376 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1377 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1378 shared_memory_address_
);
1380 cmds::GetFramebufferAttachmentParameteriv cmd
;
1381 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1382 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1383 kInvalidSharedMemoryOffset
);
1384 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1385 EXPECT_EQ(0u, result
->size
);
1388 TEST_P(GLES2DecoderTest1
, GetInteger64vValidArgs
) {
1389 EXPECT_CALL(*gl_
, GetError())
1390 .WillOnce(Return(GL_NO_ERROR
))
1391 .WillOnce(Return(GL_NO_ERROR
))
1392 .RetiresOnSaturation();
1393 SpecializedSetup
<cmds::GetInteger64v
, 0>(true);
1394 typedef cmds::GetInteger64v::Result Result
;
1395 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1396 EXPECT_CALL(*gl_
, GetInteger64v(GL_ACTIVE_TEXTURE
, result
->GetData()));
1398 cmds::GetInteger64v cmd
;
1399 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1400 decoder_
->set_unsafe_es3_apis_enabled(true);
1401 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1402 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1403 result
->GetNumResults());
1404 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1405 decoder_
->set_unsafe_es3_apis_enabled(false);
1406 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1409 TEST_P(GLES2DecoderTest1
, GetIntegeri_vValidArgs
) {
1410 EXPECT_CALL(*gl_
, GetError())
1411 .WillOnce(Return(GL_NO_ERROR
))
1412 .WillOnce(Return(GL_NO_ERROR
))
1413 .RetiresOnSaturation();
1414 SpecializedSetup
<cmds::GetIntegeri_v
, 0>(true);
1415 typedef cmds::GetIntegeri_v::Result Result
;
1416 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1417 EXPECT_CALL(*gl_
, GetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1418 result
->GetData()));
1420 cmds::GetIntegeri_v cmd
;
1421 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1422 shared_memory_offset_
);
1423 decoder_
->set_unsafe_es3_apis_enabled(true);
1424 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1425 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1426 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1427 result
->GetNumResults());
1428 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1429 decoder_
->set_unsafe_es3_apis_enabled(false);
1430 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1433 TEST_P(GLES2DecoderTest1
, GetInteger64i_vValidArgs
) {
1434 EXPECT_CALL(*gl_
, GetError())
1435 .WillOnce(Return(GL_NO_ERROR
))
1436 .WillOnce(Return(GL_NO_ERROR
))
1437 .RetiresOnSaturation();
1438 SpecializedSetup
<cmds::GetInteger64i_v
, 0>(true);
1439 typedef cmds::GetInteger64i_v::Result Result
;
1440 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1441 EXPECT_CALL(*gl_
, GetInteger64i_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1442 result
->GetData()));
1444 cmds::GetInteger64i_v cmd
;
1445 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1446 shared_memory_offset_
);
1447 decoder_
->set_unsafe_es3_apis_enabled(true);
1448 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1449 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1450 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1451 result
->GetNumResults());
1452 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1453 decoder_
->set_unsafe_es3_apis_enabled(false);
1454 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1457 TEST_P(GLES2DecoderTest1
, GetIntegervValidArgs
) {
1458 EXPECT_CALL(*gl_
, GetError())
1459 .WillOnce(Return(GL_NO_ERROR
))
1460 .WillOnce(Return(GL_NO_ERROR
))
1461 .RetiresOnSaturation();
1462 SpecializedSetup
<cmds::GetIntegerv
, 0>(true);
1463 typedef cmds::GetIntegerv::Result Result
;
1464 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1465 EXPECT_CALL(*gl_
, GetIntegerv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1467 cmds::GetIntegerv cmd
;
1468 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1469 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1470 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1471 result
->GetNumResults());
1472 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1475 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs0_0
) {
1476 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1477 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1478 cmds::GetIntegerv::Result
* result
=
1479 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1481 cmds::GetIntegerv cmd
;
1482 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1483 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1484 EXPECT_EQ(0u, result
->size
);
1485 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1488 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_0
) {
1489 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1490 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1491 cmds::GetIntegerv::Result
* result
=
1492 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1494 cmds::GetIntegerv cmd
;
1495 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1496 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1497 EXPECT_EQ(0u, result
->size
);
1500 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_1
) {
1501 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1502 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1503 cmds::GetIntegerv::Result
* result
=
1504 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1506 cmds::GetIntegerv cmd
;
1507 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1508 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1509 EXPECT_EQ(0u, result
->size
);
1511 // TODO(gman): GetInternalformativ
1513 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1514 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1515 typedef cmds::GetProgramiv::Result Result
;
1516 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1518 cmds::GetProgramiv cmd
;
1519 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1520 shared_memory_offset_
);
1521 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1522 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1523 result
->GetNumResults());
1524 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1527 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs1_0
) {
1528 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1529 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1530 cmds::GetProgramiv::Result
* result
=
1531 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1533 cmds::GetProgramiv cmd
;
1534 cmd
.Init(client_program_id_
, GL_PROGRAM_BINARY_RETRIEVABLE_HINT
,
1535 shared_memory_id_
, shared_memory_offset_
);
1536 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1537 EXPECT_EQ(0u, result
->size
);
1538 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1541 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1542 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1543 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1544 cmds::GetProgramiv::Result
* result
=
1545 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1547 cmds::GetProgramiv cmd
;
1548 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1549 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1550 EXPECT_EQ(0u, result
->size
);
1553 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1554 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1555 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1556 cmds::GetProgramiv::Result
* result
=
1557 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1559 cmds::GetProgramiv cmd
;
1560 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1561 kInvalidSharedMemoryOffset
);
1562 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1563 EXPECT_EQ(0u, result
->size
);
1565 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_