Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_2.cc
blob33c4bfb6e10e829f0c8b7469016a69274fa6f6e2
1 // Copyright (c) 2012 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
7 #include "gpu/command_buffer/common/gles2_cmd_format.h"
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
10 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
11 #include "gpu/command_buffer/service/context_group.h"
12 #include "gpu/command_buffer/service/program_manager.h"
13 #include "gpu/command_buffer/service/test_helper.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/gl/gl_mock.h"
17 using ::gfx::MockGLInterface;
18 using ::testing::_;
19 using ::testing::AnyNumber;
20 using ::testing::DoAll;
21 using ::testing::InSequence;
22 using ::testing::MatcherCast;
23 using ::testing::Pointee;
24 using ::testing::Return;
25 using ::testing::SetArrayArgument;
26 using ::testing::SetArgumentPointee;
27 using ::testing::StrEq;
29 namespace gpu {
30 namespace gles2 {
32 namespace {
33 void ShaderCacheCb(const std::string& key, const std::string& shader) {
35 } // namespace
37 class GLES2DecoderTest2 : public GLES2DecoderTestBase {
38 public:
39 GLES2DecoderTest2() { }
41 void TestAcceptedUniform(GLenum uniform_type, uint32 accepts_apis) {
42 SetupShaderForUniform(uniform_type);
43 bool valid_uniform = false;
45 EXPECT_CALL(*gl_, Uniform1i(1, _)).Times(AnyNumber());
46 EXPECT_CALL(*gl_, Uniform1iv(1, _, _)).Times(AnyNumber());
47 EXPECT_CALL(*gl_, Uniform2iv(1, _, _)).Times(AnyNumber());
48 EXPECT_CALL(*gl_, Uniform3iv(1, _, _)).Times(AnyNumber());
49 EXPECT_CALL(*gl_, Uniform4iv(1, _, _)).Times(AnyNumber());
50 EXPECT_CALL(*gl_, Uniform1f(1, _)).Times(AnyNumber());
51 EXPECT_CALL(*gl_, Uniform1fv(1, _, _)).Times(AnyNumber());
52 EXPECT_CALL(*gl_, Uniform2fv(1, _, _)).Times(AnyNumber());
53 EXPECT_CALL(*gl_, Uniform3fv(1, _, _)).Times(AnyNumber());
54 EXPECT_CALL(*gl_, Uniform4fv(1, _, _)).Times(AnyNumber());
55 EXPECT_CALL(*gl_, UniformMatrix2fv(1, _, _, _)).Times(AnyNumber());
56 EXPECT_CALL(*gl_, UniformMatrix3fv(1, _, _, _)).Times(AnyNumber());
57 EXPECT_CALL(*gl_, UniformMatrix4fv(1, _, _, _)).Times(AnyNumber());
60 valid_uniform = accepts_apis & Program::kUniform1i;
61 cmds::Uniform1i cmd;
62 cmd.Init(1, 2);
63 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
64 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
65 GetGLError());
69 valid_uniform = accepts_apis & Program::kUniform1i;
70 cmds::Uniform1ivImmediate& cmd =
71 *GetImmediateAs<cmds::Uniform1ivImmediate>();
72 GLint data[2][1] = {{0}};
73 cmd.Init(1, 2, &data[0][0]);
74 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
75 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
76 GetGLError());
80 valid_uniform = accepts_apis & Program::kUniform2i;
81 cmds::Uniform2i cmd;
82 cmd.Init(1, 2, 3);
83 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
84 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
85 GetGLError());
89 valid_uniform = accepts_apis & Program::kUniform2i;
90 cmds::Uniform2ivImmediate& cmd =
91 *GetImmediateAs<cmds::Uniform2ivImmediate>();
92 GLint data[2][2] = {{0}};
93 cmd.Init(1, 2, &data[0][0]);
94 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
95 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
96 GetGLError());
100 valid_uniform = accepts_apis & Program::kUniform3i;
101 cmds::Uniform3i cmd;
102 cmd.Init(1, 2, 3, 4);
103 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
104 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
105 GetGLError());
109 valid_uniform = accepts_apis & Program::kUniform3i;
110 cmds::Uniform3ivImmediate& cmd =
111 *GetImmediateAs<cmds::Uniform3ivImmediate>();
112 GLint data[2][3] = {{0}};
113 cmd.Init(1, 2, &data[0][0]);
114 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
115 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
116 GetGLError());
120 valid_uniform = accepts_apis & Program::kUniform4i;
121 cmds::Uniform4i cmd;
122 cmd.Init(1, 2, 3, 4, 5);
123 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
124 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
125 GetGLError());
129 valid_uniform = accepts_apis & Program::kUniform4i;
130 cmds::Uniform4ivImmediate& cmd =
131 *GetImmediateAs<cmds::Uniform4ivImmediate>();
132 GLint data[2][4] = {{0}};
133 cmd.Init(1, 2, &data[0][0]);
134 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
135 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
136 GetGLError());
139 ////////////////////
142 valid_uniform = accepts_apis & Program::kUniform1f;
143 cmds::Uniform1f cmd;
144 cmd.Init(1, 2);
145 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
146 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
147 GetGLError());
151 valid_uniform = accepts_apis & Program::kUniform1f;
152 cmds::Uniform1fvImmediate& cmd =
153 *GetImmediateAs<cmds::Uniform1fvImmediate>();
154 GLfloat data[2][1] = {{0.0f}};
155 cmd.Init(1, 2, &data[0][0]);
156 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
157 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
158 GetGLError());
162 valid_uniform = accepts_apis & Program::kUniform2f;
163 cmds::Uniform2f cmd;
164 cmd.Init(1, 2, 3);
165 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
166 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
167 GetGLError());
171 valid_uniform = accepts_apis & Program::kUniform2f;
172 cmds::Uniform2fvImmediate& cmd =
173 *GetImmediateAs<cmds::Uniform2fvImmediate>();
174 GLfloat data[2][2] = {{0.0f}};
175 cmd.Init(1, 2, &data[0][0]);
176 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
177 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
178 GetGLError());
182 valid_uniform = accepts_apis & Program::kUniform3f;
183 cmds::Uniform3f cmd;
184 cmd.Init(1, 2, 3, 4);
185 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
186 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
187 GetGLError());
191 valid_uniform = accepts_apis & Program::kUniform3f;
192 cmds::Uniform3fvImmediate& cmd =
193 *GetImmediateAs<cmds::Uniform3fvImmediate>();
194 GLfloat data[2][3] = {{0.0f}};
195 cmd.Init(1, 2, &data[0][0]);
196 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
197 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
198 GetGLError());
202 valid_uniform = accepts_apis & Program::kUniform4f;
203 cmds::Uniform4f cmd;
204 cmd.Init(1, 2, 3, 4, 5);
205 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
206 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
207 GetGLError());
211 valid_uniform = accepts_apis & Program::kUniform4f;
212 cmds::Uniform4fvImmediate& cmd =
213 *GetImmediateAs<cmds::Uniform4fvImmediate>();
214 GLfloat data[2][4] = {{0.0f}};
215 cmd.Init(1, 2, &data[0][0]);
216 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
217 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
218 GetGLError());
222 valid_uniform = accepts_apis & Program::kUniformMatrix2f;
223 cmds::UniformMatrix2fvImmediate& cmd =
224 *GetImmediateAs<cmds::UniformMatrix2fvImmediate>();
225 GLfloat data[2][2 * 2] = {{0.0f}};
227 cmd.Init(1, 2, &data[0][0]);
228 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
229 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
230 GetGLError());
234 valid_uniform = accepts_apis & Program::kUniformMatrix3f;
235 cmds::UniformMatrix3fvImmediate& cmd =
236 *GetImmediateAs<cmds::UniformMatrix3fvImmediate>();
237 GLfloat data[2][3 * 3] = {{0.0f}};
238 cmd.Init(1, 2, &data[0][0]);
239 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
240 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
241 GetGLError());
245 valid_uniform = accepts_apis & Program::kUniformMatrix4f;
246 cmds::UniformMatrix4fvImmediate& cmd =
247 *GetImmediateAs<cmds::UniformMatrix4fvImmediate>();
248 GLfloat data[2][4 * 4] = {{0.0f}};
249 cmd.Init(1, 2, &data[0][0]);
250 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data)));
251 EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION,
252 GetGLError());
257 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderTest2, ::testing::Bool());
259 template <>
260 void GLES2DecoderTestBase::SpecializedSetup<cmds::GetProgramInfoLog, 0>(
261 bool /* valid */) {
262 const GLuint kClientVertexShaderId = 5001;
263 const GLuint kServiceVertexShaderId = 6001;
264 const GLuint kClientFragmentShaderId = 5002;
265 const GLuint kServiceFragmentShaderId = 6002;
266 const char* log = "hello"; // Matches auto-generated unit test.
267 DoCreateShader(
268 GL_VERTEX_SHADER, kClientVertexShaderId, kServiceVertexShaderId);
269 DoCreateShader(
270 GL_FRAGMENT_SHADER, kClientFragmentShaderId, kServiceFragmentShaderId);
272 TestHelper::SetShaderStates(
273 gl_.get(), GetShader(kClientVertexShaderId), true);
274 TestHelper::SetShaderStates(
275 gl_.get(), GetShader(kClientFragmentShaderId), true);
277 InSequence dummy;
278 EXPECT_CALL(*gl_,
279 AttachShader(kServiceProgramId, kServiceVertexShaderId))
280 .Times(1)
281 .RetiresOnSaturation();
282 EXPECT_CALL(*gl_,
283 AttachShader(kServiceProgramId, kServiceFragmentShaderId))
284 .Times(1)
285 .RetiresOnSaturation();
286 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId))
287 .Times(1)
288 .RetiresOnSaturation();
289 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _))
290 .WillOnce(SetArgumentPointee<2>(1));
291 EXPECT_CALL(*gl_,
292 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _))
293 .WillOnce(SetArgumentPointee<2>(strlen(log) + 1))
294 .RetiresOnSaturation();
295 EXPECT_CALL(*gl_,
296 GetProgramInfoLog(kServiceProgramId, strlen(log) + 1, _, _))
297 .WillOnce(DoAll(
298 SetArgumentPointee<2>(strlen(log)),
299 SetArrayArgument<3>(log, log + strlen(log) + 1)))
300 .RetiresOnSaturation();
301 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _))
302 .WillOnce(SetArgumentPointee<2>(0));
303 EXPECT_CALL(
304 *gl_,
305 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _))
306 .WillOnce(SetArgumentPointee<2>(0));
307 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _))
308 .WillOnce(SetArgumentPointee<2>(0));
309 EXPECT_CALL(
310 *gl_,
311 GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, _))
312 .WillOnce(SetArgumentPointee<2>(0));
314 Program* program = GetProgram(client_program_id_);
315 ASSERT_TRUE(program != NULL);
317 cmds::AttachShader attach_cmd;
318 attach_cmd.Init(client_program_id_, kClientVertexShaderId);
319 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
321 attach_cmd.Init(client_program_id_, kClientFragmentShaderId);
322 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
324 program->Link(NULL, Program::kCountOnlyStaticallyUsed,
325 base::Bind(&ShaderCacheCb));
328 template <>
329 void GLES2DecoderTestBase::SpecializedSetup<
330 cmds::GetRenderbufferParameteriv, 0>(
331 bool /* valid */) {
332 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
333 kServiceRenderbufferId);
336 template <>
337 void GLES2DecoderTestBase::SpecializedSetup<cmds::RenderbufferStorage, 0>(
338 bool valid) {
339 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
340 kServiceRenderbufferId);
341 if (valid) {
342 EnsureRenderbufferBound(false);
343 EXPECT_CALL(*gl_, GetError())
344 .WillOnce(Return(GL_NO_ERROR))
345 .RetiresOnSaturation();
346 EXPECT_CALL(*gl_,
347 RenderbufferStorageEXT(GL_RENDERBUFFER, _, 3, 4))
348 .Times(1)
349 .RetiresOnSaturation();
350 EXPECT_CALL(*gl_, GetError())
351 .WillOnce(Return(GL_NO_ERROR))
352 .RetiresOnSaturation();
356 template <>
357 void GLES2DecoderTestBase::SpecializedSetup<cmds::GenQueriesEXTImmediate, 0>(
358 bool valid) {
359 if (!valid) {
360 // Make the client_query_id_ so that trying to make it again
361 // will fail.
362 cmds::GenQueriesEXTImmediate& cmd =
363 *GetImmediateAs<cmds::GenQueriesEXTImmediate>();
364 cmd.Init(1, &client_query_id_);
365 EXPECT_EQ(error::kNoError,
366 ExecuteImmediateCmd(cmd, sizeof(client_query_id_)));
370 template <>
371 void GLES2DecoderTestBase::SpecializedSetup<cmds::DeleteQueriesEXTImmediate, 0>(
372 bool valid) {
373 if (valid) {
374 // Make the client_query_id_ so that trying to delete it will succeed.
375 cmds::GenQueriesEXTImmediate& cmd =
376 *GetImmediateAs<cmds::GenQueriesEXTImmediate>();
377 cmd.Init(1, &client_query_id_);
378 EXPECT_EQ(error::kNoError,
379 ExecuteImmediateCmd(cmd, sizeof(client_query_id_)));
383 template <>
384 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(
385 bool /* valid */) {
386 const GLuint kClientVertexShaderId = 5001;
387 const GLuint kServiceVertexShaderId = 6001;
388 const GLuint kClientFragmentShaderId = 5002;
389 const GLuint kServiceFragmentShaderId = 6002;
390 DoCreateShader(
391 GL_VERTEX_SHADER, kClientVertexShaderId, kServiceVertexShaderId);
392 DoCreateShader(
393 GL_FRAGMENT_SHADER, kClientFragmentShaderId, kServiceFragmentShaderId);
395 TestHelper::SetShaderStates(
396 gl_.get(), GetShader(kClientVertexShaderId), true);
397 TestHelper::SetShaderStates(
398 gl_.get(), GetShader(kClientFragmentShaderId), true);
400 InSequence dummy;
401 EXPECT_CALL(*gl_,
402 AttachShader(kServiceProgramId, kServiceVertexShaderId))
403 .Times(1)
404 .RetiresOnSaturation();
405 EXPECT_CALL(*gl_,
406 AttachShader(kServiceProgramId, kServiceFragmentShaderId))
407 .Times(1)
408 .RetiresOnSaturation();
409 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _))
410 .WillOnce(SetArgumentPointee<2>(1));
411 EXPECT_CALL(*gl_,
412 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _))
413 .WillOnce(SetArgumentPointee<2>(0))
414 .RetiresOnSaturation();
415 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _))
416 .WillOnce(SetArgumentPointee<2>(0));
417 EXPECT_CALL(
418 *gl_,
419 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _))
420 .WillOnce(SetArgumentPointee<2>(0));
421 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _))
422 .WillOnce(SetArgumentPointee<2>(0));
423 EXPECT_CALL(
424 *gl_,
425 GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, _))
426 .WillOnce(SetArgumentPointee<2>(0));
428 cmds::AttachShader attach_cmd;
429 attach_cmd.Init(client_program_id_, kClientVertexShaderId);
430 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
432 attach_cmd.Init(client_program_id_, kClientFragmentShaderId);
433 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
436 template <>
437 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform1f, 0>(
438 bool /* valid */) {
439 SetupShaderForUniform(GL_FLOAT);
442 template <>
443 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform1fvImmediate, 0>(
444 bool /* valid */) {
445 SetupShaderForUniform(GL_FLOAT);
448 template <>
449 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform1ivImmediate, 0>(
450 bool /* valid */) {
451 SetupShaderForUniform(GL_INT);
454 template <>
455 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform2f, 0>(
456 bool /* valid */) {
457 SetupShaderForUniform(GL_FLOAT_VEC2);
460 template <>
461 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform2i, 0>(
462 bool /* valid */) {
463 SetupShaderForUniform(GL_INT_VEC2);
466 template <>
467 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform2fvImmediate, 0>(
468 bool /* valid */) {
469 SetupShaderForUniform(GL_FLOAT_VEC2);
472 template <>
473 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform2ivImmediate, 0>(
474 bool /* valid */) {
475 SetupShaderForUniform(GL_INT_VEC2);
478 template <>
479 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform3f, 0>(
480 bool /* valid */) {
481 SetupShaderForUniform(GL_FLOAT_VEC3);
484 template <>
485 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform3i, 0>(
486 bool /* valid */) {
487 SetupShaderForUniform(GL_INT_VEC3);
490 template <>
491 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform3fvImmediate, 0>(
492 bool /* valid */) {
493 SetupShaderForUniform(GL_FLOAT_VEC3);
496 template <>
497 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform3ivImmediate, 0>(
498 bool /* valid */) {
499 SetupShaderForUniform(GL_INT_VEC3);
502 template <>
503 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform4f, 0>(
504 bool /* valid */) {
505 SetupShaderForUniform(GL_FLOAT_VEC4);
508 template <>
509 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform4i, 0>(
510 bool /* valid */) {
511 SetupShaderForUniform(GL_INT_VEC4);
514 template <>
515 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform4fvImmediate, 0>(
516 bool /* valid */) {
517 SetupShaderForUniform(GL_FLOAT_VEC4);
520 template <>
521 void GLES2DecoderTestBase::SpecializedSetup<cmds::Uniform4ivImmediate, 0>(
522 bool /* valid */) {
523 SetupShaderForUniform(GL_INT_VEC4);
526 template <>
527 void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix2fvImmediate, 0>(
528 bool /* valid */) {
529 SetupShaderForUniform(GL_FLOAT_MAT2);
532 template <>
533 void GLES2DecoderTestBase::SpecializedSetup<cmds::TexParameterf, 0>(
534 bool /* valid */) {
535 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
538 template <>
539 void GLES2DecoderTestBase::SpecializedSetup<cmds::TexParameteri, 0>(
540 bool /* valid */) {
541 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
544 template <>
545 void GLES2DecoderTestBase::SpecializedSetup<cmds::TexParameterfvImmediate, 0>(
546 bool /* valid */) {
547 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
550 template <>
551 void GLES2DecoderTestBase::SpecializedSetup<cmds::TexParameterivImmediate, 0>(
552 bool /* valid */) {
553 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
556 template <>
557 void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribiv, 0>(
558 bool valid) {
559 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
560 DoVertexAttribPointer(1, 1, GL_FLOAT, 0, 0);
561 if (valid) {
562 EXPECT_CALL(*gl_, GetError())
563 .WillOnce(Return(GL_NO_ERROR))
564 .WillOnce(Return(GL_NO_ERROR))
565 .RetiresOnSaturation();
569 template <>
570 void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribfv, 0>(
571 bool valid) {
572 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
573 DoVertexAttribPointer(1, 1, GL_FLOAT, 0, 0);
574 if (valid) {
575 EXPECT_CALL(*gl_, GetError())
576 .WillOnce(Return(GL_NO_ERROR))
577 .WillOnce(Return(GL_NO_ERROR))
578 .RetiresOnSaturation();
582 template <>
583 void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribIiv, 0>(
584 bool valid) {
585 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
586 DoVertexAttribPointer(1, 1, GL_FLOAT, 0, 0);
587 if (valid) {
588 EXPECT_CALL(*gl_, GetError())
589 .WillOnce(Return(GL_NO_ERROR))
590 .WillOnce(Return(GL_NO_ERROR))
591 .RetiresOnSaturation();
595 template <>
596 void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribIuiv, 0>(
597 bool valid) {
598 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
599 DoVertexAttribPointer(1, 1, GL_FLOAT, 0, 0);
600 if (valid) {
601 EXPECT_CALL(*gl_, GetError())
602 .WillOnce(Return(GL_NO_ERROR))
603 .WillOnce(Return(GL_NO_ERROR))
604 .RetiresOnSaturation();
609 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h"
611 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_INT) {
612 TestAcceptedUniform(GL_INT, Program::kUniform1i);
615 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_INT_VEC2) {
616 TestAcceptedUniform(GL_INT_VEC2, Program::kUniform2i);
619 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_INT_VEC3) {
620 TestAcceptedUniform(GL_INT_VEC3, Program::kUniform3i);
623 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_INT_VEC4) {
624 TestAcceptedUniform(GL_INT_VEC4, Program::kUniform4i);
627 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_BOOL) {
628 TestAcceptedUniform(GL_BOOL, Program::kUniform1i | Program::kUniform1f);
631 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_BOOL_VEC2) {
632 TestAcceptedUniform(GL_BOOL_VEC2, Program::kUniform2i | Program::kUniform2f);
635 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_BOOL_VEC3) {
636 TestAcceptedUniform(GL_BOOL_VEC3, Program::kUniform3i | Program::kUniform3f);
639 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_BOOL_VEC4) {
640 TestAcceptedUniform(GL_BOOL_VEC4, Program::kUniform4i | Program::kUniform4f);
643 TEST_P(GLES2DecoderTest2, AcceptsUniformTypeFLOAT) {
644 TestAcceptedUniform(GL_FLOAT, Program::kUniform1f);
647 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_FLOAT_VEC2) {
648 TestAcceptedUniform(GL_FLOAT_VEC2, Program::kUniform2f);
651 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_FLOAT_VEC3) {
652 TestAcceptedUniform(GL_FLOAT_VEC3, Program::kUniform3f);
655 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_FLOAT_VEC4) {
656 TestAcceptedUniform(GL_FLOAT_VEC4, Program::kUniform4f);
659 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_FLOAT_MAT2) {
660 TestAcceptedUniform(GL_FLOAT_MAT2, Program::kUniformMatrix2f);
663 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_FLOAT_MAT3) {
664 TestAcceptedUniform(GL_FLOAT_MAT3, Program::kUniformMatrix3f);
667 TEST_P(GLES2DecoderTest2, AcceptsUniform_GL_FLOAT_MAT4) {
668 TestAcceptedUniform(GL_FLOAT_MAT4, Program::kUniformMatrix4f);
671 } // namespace gles2
672 } // namespace gpu