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()).WillRepeatedly(Return(GL_NO_ERROR
));
1104 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
1105 typedef cmds::GetBooleanv::Result Result
;
1106 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1107 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1109 cmds::GetBooleanv cmd
;
1110 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1111 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1112 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1113 result
->GetNumResults());
1114 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1117 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
1118 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1119 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1120 cmds::GetBooleanv::Result
* result
=
1121 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1123 cmds::GetBooleanv cmd
;
1124 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1125 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1126 EXPECT_EQ(0u, result
->size
);
1127 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1130 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_0
) {
1131 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1132 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1133 cmds::GetBooleanv::Result
* result
=
1134 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1136 cmds::GetBooleanv cmd
;
1137 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1138 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1139 EXPECT_EQ(0u, result
->size
);
1142 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
1143 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1144 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1145 cmds::GetBooleanv::Result
* result
=
1146 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1148 cmds::GetBooleanv cmd
;
1149 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1150 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1151 EXPECT_EQ(0u, result
->size
);
1154 TEST_P(GLES2DecoderTest1
, GetBufferParameteri64vValidArgs
) {
1155 SpecializedSetup
<cmds::GetBufferParameteri64v
, 0>(true);
1156 typedef cmds::GetBufferParameteri64v::Result Result
;
1157 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1159 cmds::GetBufferParameteri64v cmd
;
1160 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1161 shared_memory_offset_
);
1162 decoder_
->set_unsafe_es3_apis_enabled(true);
1163 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1164 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1165 result
->GetNumResults());
1166 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1167 decoder_
->set_unsafe_es3_apis_enabled(false);
1168 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1171 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
1172 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
1173 typedef cmds::GetBufferParameteriv::Result Result
;
1174 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1176 cmds::GetBufferParameteriv cmd
;
1177 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1178 shared_memory_offset_
);
1179 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1180 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1181 result
->GetNumResults());
1182 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1185 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
1186 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1187 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1188 cmds::GetBufferParameteriv::Result
* result
=
1189 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1191 cmds::GetBufferParameteriv cmd
;
1192 cmd
.Init(GL_RENDERBUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1193 shared_memory_offset_
);
1194 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1195 EXPECT_EQ(0u, result
->size
);
1196 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1199 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
1200 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1201 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1202 cmds::GetBufferParameteriv::Result
* result
=
1203 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1205 cmds::GetBufferParameteriv cmd
;
1206 cmd
.Init(GL_ARRAY_BUFFER
, GL_PIXEL_PACK_BUFFER
, shared_memory_id_
,
1207 shared_memory_offset_
);
1208 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1209 EXPECT_EQ(0u, result
->size
);
1210 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1213 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1214 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1215 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1216 cmds::GetBufferParameteriv::Result
* result
=
1217 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1219 cmds::GetBufferParameteriv cmd
;
1220 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1221 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1222 EXPECT_EQ(0u, result
->size
);
1225 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1226 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1227 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1228 cmds::GetBufferParameteriv::Result
* result
=
1229 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1231 cmds::GetBufferParameteriv cmd
;
1232 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1233 kInvalidSharedMemoryOffset
);
1234 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1235 EXPECT_EQ(0u, result
->size
);
1238 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1239 EXPECT_CALL(*gl_
, GetError());
1240 SpecializedSetup
<cmds::GetError
, 0>(true);
1242 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1243 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1244 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1247 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1248 EXPECT_CALL(*gl_
, GetError()).Times(0);
1249 SpecializedSetup
<cmds::GetError
, 0>(false);
1251 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1252 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1253 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1254 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1257 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1258 EXPECT_CALL(*gl_
, GetError()).WillRepeatedly(Return(GL_NO_ERROR
));
1259 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1260 typedef cmds::GetFloatv::Result Result
;
1261 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1262 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1264 cmds::GetFloatv cmd
;
1265 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1266 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1267 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1268 result
->GetNumResults());
1269 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1272 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1273 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1274 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1275 cmds::GetFloatv::Result
* result
=
1276 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1278 cmds::GetFloatv cmd
;
1279 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1280 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1281 EXPECT_EQ(0u, result
->size
);
1282 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1285 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1286 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1287 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1288 cmds::GetFloatv::Result
* result
=
1289 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1291 cmds::GetFloatv cmd
;
1292 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1293 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1294 EXPECT_EQ(0u, result
->size
);
1297 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1298 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1299 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1300 cmds::GetFloatv::Result
* result
=
1301 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1303 cmds::GetFloatv cmd
;
1304 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1305 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1306 EXPECT_EQ(0u, result
->size
);
1308 // TODO(gman): GetFragDataLocation
1310 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1311 EXPECT_CALL(*gl_
, GetError()).WillRepeatedly(Return(GL_NO_ERROR
));
1312 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1313 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1314 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1316 GetFramebufferAttachmentParameterivEXT(
1317 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1318 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result
->GetData()));
1320 cmds::GetFramebufferAttachmentParameteriv cmd
;
1321 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1322 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1323 shared_memory_offset_
);
1324 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1325 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1326 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1327 result
->GetNumResults());
1328 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1331 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1332 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1334 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1335 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1336 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1337 shared_memory_address_
);
1339 cmds::GetFramebufferAttachmentParameteriv cmd
;
1340 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
,
1341 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1342 shared_memory_offset_
);
1343 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1344 EXPECT_EQ(0u, result
->size
);
1345 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1348 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1349 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1351 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1352 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1353 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1354 shared_memory_address_
);
1356 cmds::GetFramebufferAttachmentParameteriv cmd
;
1357 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1358 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, kInvalidSharedMemoryId
, 0);
1359 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1360 EXPECT_EQ(0u, result
->size
);
1363 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1364 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1366 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1367 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1368 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1369 shared_memory_address_
);
1371 cmds::GetFramebufferAttachmentParameteriv cmd
;
1372 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1373 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1374 kInvalidSharedMemoryOffset
);
1375 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1376 EXPECT_EQ(0u, result
->size
);
1379 TEST_P(GLES2DecoderTest1
, GetInteger64vValidArgs
) {
1380 EXPECT_CALL(*gl_
, GetError()).WillRepeatedly(Return(GL_NO_ERROR
));
1381 SpecializedSetup
<cmds::GetInteger64v
, 0>(true);
1382 typedef cmds::GetInteger64v::Result Result
;
1383 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1384 EXPECT_CALL(*gl_
, GetInteger64v(GL_ACTIVE_TEXTURE
, result
->GetData()));
1386 cmds::GetInteger64v cmd
;
1387 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1388 decoder_
->set_unsafe_es3_apis_enabled(true);
1389 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1390 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1391 result
->GetNumResults());
1392 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1393 decoder_
->set_unsafe_es3_apis_enabled(false);
1394 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1397 TEST_P(GLES2DecoderTest1
, GetIntegeri_vValidArgs
) {
1398 EXPECT_CALL(*gl_
, GetError()).WillRepeatedly(Return(GL_NO_ERROR
));
1399 SpecializedSetup
<cmds::GetIntegeri_v
, 0>(true);
1400 typedef cmds::GetIntegeri_v::Result Result
;
1401 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1402 EXPECT_CALL(*gl_
, GetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1403 result
->GetData()));
1405 cmds::GetIntegeri_v cmd
;
1406 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1407 shared_memory_offset_
);
1408 decoder_
->set_unsafe_es3_apis_enabled(true);
1409 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1410 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1411 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1412 result
->GetNumResults());
1413 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1414 decoder_
->set_unsafe_es3_apis_enabled(false);
1415 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1418 TEST_P(GLES2DecoderTest1
, GetInteger64i_vValidArgs
) {
1419 EXPECT_CALL(*gl_
, GetError()).WillRepeatedly(Return(GL_NO_ERROR
));
1420 SpecializedSetup
<cmds::GetInteger64i_v
, 0>(true);
1421 typedef cmds::GetInteger64i_v::Result Result
;
1422 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1423 EXPECT_CALL(*gl_
, GetInteger64i_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1424 result
->GetData()));
1426 cmds::GetInteger64i_v cmd
;
1427 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1428 shared_memory_offset_
);
1429 decoder_
->set_unsafe_es3_apis_enabled(true);
1430 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1431 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1432 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1433 result
->GetNumResults());
1434 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1435 decoder_
->set_unsafe_es3_apis_enabled(false);
1436 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1439 TEST_P(GLES2DecoderTest1
, GetIntegervValidArgs
) {
1440 EXPECT_CALL(*gl_
, GetError()).WillRepeatedly(Return(GL_NO_ERROR
));
1441 SpecializedSetup
<cmds::GetIntegerv
, 0>(true);
1442 typedef cmds::GetIntegerv::Result Result
;
1443 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1444 EXPECT_CALL(*gl_
, GetIntegerv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1446 cmds::GetIntegerv cmd
;
1447 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1448 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1449 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1450 result
->GetNumResults());
1451 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1454 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs0_0
) {
1455 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1456 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1457 cmds::GetIntegerv::Result
* result
=
1458 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1460 cmds::GetIntegerv cmd
;
1461 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1462 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1463 EXPECT_EQ(0u, result
->size
);
1464 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1467 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_0
) {
1468 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1469 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1470 cmds::GetIntegerv::Result
* result
=
1471 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1473 cmds::GetIntegerv cmd
;
1474 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1475 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1476 EXPECT_EQ(0u, result
->size
);
1479 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_1
) {
1480 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1481 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1482 cmds::GetIntegerv::Result
* result
=
1483 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1485 cmds::GetIntegerv cmd
;
1486 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1487 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1488 EXPECT_EQ(0u, result
->size
);
1490 // TODO(gman): GetInternalformativ
1492 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1493 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1494 typedef cmds::GetProgramiv::Result Result
;
1495 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1497 cmds::GetProgramiv cmd
;
1498 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1499 shared_memory_offset_
);
1500 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1501 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1502 result
->GetNumResults());
1503 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1506 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs1_0
) {
1507 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1508 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1509 cmds::GetProgramiv::Result
* result
=
1510 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1512 cmds::GetProgramiv cmd
;
1513 cmd
.Init(client_program_id_
, GL_PROGRAM_BINARY_RETRIEVABLE_HINT
,
1514 shared_memory_id_
, shared_memory_offset_
);
1515 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1516 EXPECT_EQ(0u, result
->size
);
1517 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1520 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1521 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1522 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1523 cmds::GetProgramiv::Result
* result
=
1524 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1526 cmds::GetProgramiv cmd
;
1527 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1528 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1529 EXPECT_EQ(0u, result
->size
);
1532 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1533 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1534 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1535 cmds::GetProgramiv::Result
* result
=
1536 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1538 cmds::GetProgramiv cmd
;
1539 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1540 kInvalidSharedMemoryOffset
);
1541 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1542 EXPECT_EQ(0u, result
->size
);
1544 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_