OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 6 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
7 #include "gpu/command_buffer/service/gl_mock.h" | 8 #include "gpu/command_buffer/service/gl_mock.h" |
8 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 9 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 | 11 |
11 using ::gles2::MockGLInterface; | 12 using ::gles2::MockGLInterface; |
12 using ::testing::_; | 13 using ::testing::_; |
13 using ::testing::DoAll; | 14 using ::testing::DoAll; |
14 using ::testing::InSequence; | 15 using ::testing::InSequence; |
15 using ::testing::MatcherCast; | 16 using ::testing::MatcherCast; |
16 using ::testing::Pointee; | 17 using ::testing::Pointee; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 282 |
282 template <> | 283 template <> |
283 void GLES2DecoderTest::SpecializedSetup<LinkProgram, 0>() { | 284 void GLES2DecoderTest::SpecializedSetup<LinkProgram, 0>() { |
284 InSequence dummy; | 285 InSequence dummy; |
285 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) | 286 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) |
286 .WillOnce(SetArgumentPointee<2>(0)); | 287 .WillOnce(SetArgumentPointee<2>(0)); |
287 EXPECT_CALL( | 288 EXPECT_CALL( |
288 *gl_, | 289 *gl_, |
289 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) | 290 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) |
290 .WillOnce(SetArgumentPointee<2>(0)); | 291 .WillOnce(SetArgumentPointee<2>(0)); |
| 292 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _)) |
| 293 .WillOnce(SetArgumentPointee<2>(0)); |
| 294 EXPECT_CALL( |
| 295 *gl_, |
| 296 GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, _)) |
| 297 .WillOnce(SetArgumentPointee<2>(0)); |
291 }; | 298 }; |
292 | 299 |
293 | 300 |
294 class GLES2DecoderWithShaderTest : public GLES2DecoderTest { | 301 class GLES2DecoderWithShaderTest : public GLES2DecoderTest { |
295 public: | 302 public: |
296 GLES2DecoderWithShaderTest() | 303 GLES2DecoderWithShaderTest() |
297 : GLES2DecoderTest() { | 304 : GLES2DecoderTest() { |
298 } | 305 } |
299 | 306 |
300 static const GLint kNumAttribs = 3; | |
301 static const GLint kMaxAttribLength = 10; | |
302 static const GLsizei kNumVertices = 100; | 307 static const GLsizei kNumVertices = 100; |
303 static const GLsizei kNumIndices = 10; | 308 static const GLsizei kNumIndices = 10; |
304 static const int kValidIndexRangeStart = 1; | 309 static const int kValidIndexRangeStart = 1; |
305 static const int kValidIndexRangeCount = 7; | 310 static const int kValidIndexRangeCount = 7; |
306 static const int kInvalidIndexRangeStart = 0; | 311 static const int kInvalidIndexRangeStart = 0; |
307 static const int kInvalidIndexRangeCount = 7; | 312 static const int kInvalidIndexRangeCount = 7; |
308 static const int kOutOfRangeIndexRangeEnd = 10; | 313 static const int kOutOfRangeIndexRangeEnd = 10; |
| 314 static const GLint kNumAttribs = 3; |
| 315 static const GLint kMaxAttribLength = 10; |
309 static const char* kAttrib1Name; | 316 static const char* kAttrib1Name; |
310 static const char* kAttrib2Name; | 317 static const char* kAttrib2Name; |
311 static const char* kAttrib3Name; | 318 static const char* kAttrib3Name; |
| 319 static const GLint kNumUniforms = 3; |
| 320 static const GLint kMaxUniformLength = 10; |
| 321 static const char* kUniform1Name; |
| 322 static const char* kUniform2Name; |
| 323 static const char* kUniform3Name; |
| 324 static const GLint kUniform1Size = 1; |
| 325 static const GLint kUniform2Size = 3; |
| 326 static const GLint kUniform3Size = 2; |
| 327 static const GLint kUniform1Location = 0; |
| 328 static const GLint kUniform2Location = 1; |
| 329 static const GLint kUniform3Location = 2; |
| 330 static const GLenum kUniform1Type = GL_FLOAT_VEC4; |
| 331 static const GLenum kUniform2Type = GL_INT_VEC2; |
| 332 static const GLenum kUniform3Type = GL_FLOAT_VEC3; |
| 333 static const GLint kInvalidUniformLocation = 3; |
312 | 334 |
313 protected: | 335 protected: |
314 virtual void SetUp() { | 336 virtual void SetUp() { |
315 GLES2DecoderTest::SetUp(); | 337 GLES2DecoderTest::SetUp(); |
316 | 338 |
317 { | 339 { |
318 struct AttribInfo { | 340 struct AttribInfo { |
319 const char* name; | 341 const char* name; |
320 GLint size; | 342 GLint size; |
321 GLenum type; | 343 GLenum type; |
322 GLint location; | 344 GLint location; |
323 }; | 345 }; |
324 static AttribInfo attribs[] = { | 346 static AttribInfo attribs[] = { |
325 { kAttrib1Name, 1, GL_FLOAT_VEC4, 0, }, | 347 { kAttrib1Name, 1, GL_FLOAT_VEC4, 0, }, |
326 { kAttrib2Name, 1, GL_FLOAT_VEC2, 1, }, | 348 { kAttrib2Name, 1, GL_FLOAT_VEC2, 1, }, |
327 { kAttrib3Name, 1, GL_FLOAT_VEC3, 2, }, | 349 { kAttrib3Name, 1, GL_FLOAT_VEC3, 2, }, |
328 }; | 350 }; |
| 351 struct UniformInfo { |
| 352 const char* name; |
| 353 GLint size; |
| 354 GLenum type; |
| 355 GLint location; |
| 356 }; |
| 357 static UniformInfo uniforms[] = { |
| 358 { kUniform1Name, kUniform1Size, GL_FLOAT_VEC4, kUniform1Location, }, |
| 359 { kUniform2Name, kUniform2Size, GL_INT_VEC2, kUniform2Location, }, |
| 360 { kUniform3Name, kUniform3Size, GL_FLOAT_VEC3, kUniform3Location, }, |
| 361 }; |
| 362 |
329 LinkProgram cmd; | 363 LinkProgram cmd; |
330 cmd.Init(client_program_id_); | 364 cmd.Init(client_program_id_); |
331 | 365 |
332 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId)) | |
333 .Times(1) | |
334 .RetiresOnSaturation(); | |
335 EXPECT_CALL(*gl_, GetError()) | |
336 .WillOnce(Return(GL_NO_ERROR)) | |
337 .RetiresOnSaturation(); | |
338 EXPECT_CALL(*gl_, | |
339 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) | |
340 .WillOnce(SetArgumentPointee<2>(kNumAttribs)) | |
341 .RetiresOnSaturation(); | |
342 EXPECT_CALL(*gl_, | |
343 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) | |
344 .WillOnce(SetArgumentPointee<2>(kMaxAttribLength)) | |
345 .RetiresOnSaturation(); | |
346 { | 366 { |
347 InSequence s; | 367 InSequence s; |
| 368 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId)) |
| 369 .Times(1) |
| 370 .RetiresOnSaturation(); |
| 371 EXPECT_CALL(*gl_, GetError()) |
| 372 .WillOnce(Return(GL_NO_ERROR)) |
| 373 .RetiresOnSaturation(); |
| 374 EXPECT_CALL(*gl_, |
| 375 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) |
| 376 .WillOnce(SetArgumentPointee<2>(kNumAttribs)) |
| 377 .RetiresOnSaturation(); |
| 378 EXPECT_CALL(*gl_, |
| 379 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) |
| 380 .WillOnce(SetArgumentPointee<2>(kMaxAttribLength)) |
| 381 .RetiresOnSaturation(); |
348 for (GLint ii = 0; ii < kNumAttribs; ++ii) { | 382 for (GLint ii = 0; ii < kNumAttribs; ++ii) { |
349 const AttribInfo& info = attribs[ii]; | 383 const AttribInfo& info = attribs[ii]; |
350 EXPECT_CALL(*gl_, | 384 EXPECT_CALL(*gl_, |
351 GetActiveAttrib(kServiceProgramId, ii, | 385 GetActiveAttrib(kServiceProgramId, ii, |
352 kMaxAttribLength + 1, _, _, _, _)) | 386 kMaxAttribLength, _, _, _, _)) |
353 .WillOnce(DoAll( | 387 .WillOnce(DoAll( |
354 SetArgumentPointee<3>(strlen(info.name)), | 388 SetArgumentPointee<3>(strlen(info.name)), |
355 SetArgumentPointee<4>(info.size), | 389 SetArgumentPointee<4>(info.size), |
356 SetArgumentPointee<5>(info.type), | 390 SetArgumentPointee<5>(info.type), |
357 SetArrayArgument<6>(info.name, | 391 SetArrayArgument<6>(info.name, |
358 info.name + strlen(info.name) + 1))) | 392 info.name + strlen(info.name) + 1))) |
359 .RetiresOnSaturation(); | 393 .RetiresOnSaturation(); |
360 EXPECT_CALL(*gl_, GetAttribLocation(kServiceProgramId, | 394 EXPECT_CALL(*gl_, GetAttribLocation(kServiceProgramId, |
361 StrEq(info.name))) | 395 StrEq(info.name))) |
362 .WillOnce(Return(info.location)) | 396 .WillOnce(Return(info.location)) |
363 .RetiresOnSaturation(); | 397 .RetiresOnSaturation(); |
364 } | 398 } |
| 399 EXPECT_CALL(*gl_, |
| 400 GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _)) |
| 401 .WillOnce(SetArgumentPointee<2>(kNumUniforms)) |
| 402 .RetiresOnSaturation(); |
| 403 EXPECT_CALL(*gl_, |
| 404 GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, _)) |
| 405 .WillOnce(SetArgumentPointee<2>(kMaxUniformLength)) |
| 406 .RetiresOnSaturation(); |
| 407 for (GLint ii = 0; ii < kNumUniforms; ++ii) { |
| 408 const UniformInfo& info = uniforms[ii]; |
| 409 EXPECT_CALL(*gl_, |
| 410 GetActiveUniform(kServiceProgramId, ii, |
| 411 kMaxUniformLength, _, _, _, _)) |
| 412 .WillOnce(DoAll( |
| 413 SetArgumentPointee<3>(strlen(info.name)), |
| 414 SetArgumentPointee<4>(info.size), |
| 415 SetArgumentPointee<5>(info.type), |
| 416 SetArrayArgument<6>(info.name, |
| 417 info.name + strlen(info.name) + 1))) |
| 418 .RetiresOnSaturation(); |
| 419 EXPECT_CALL(*gl_, GetUniformLocation(kServiceProgramId, |
| 420 StrEq(info.name))) |
| 421 .WillOnce(Return(info.location)) |
| 422 .RetiresOnSaturation(); |
| 423 } |
365 } | 424 } |
366 | 425 |
367 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 426 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
368 } | 427 } |
369 | 428 |
370 { | 429 { |
371 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) | 430 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) |
372 .Times(1) | 431 .Times(1) |
373 .RetiresOnSaturation(); | 432 .RetiresOnSaturation(); |
374 UseProgram cmd; | 433 UseProgram cmd; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 const GLsizei GLES2DecoderWithShaderTest::kNumVertices; | 545 const GLsizei GLES2DecoderWithShaderTest::kNumVertices; |
487 const GLsizei GLES2DecoderWithShaderTest::kNumIndices; | 546 const GLsizei GLES2DecoderWithShaderTest::kNumIndices; |
488 const int GLES2DecoderWithShaderTest::kValidIndexRangeStart; | 547 const int GLES2DecoderWithShaderTest::kValidIndexRangeStart; |
489 const int GLES2DecoderWithShaderTest::kValidIndexRangeCount; | 548 const int GLES2DecoderWithShaderTest::kValidIndexRangeCount; |
490 const int GLES2DecoderWithShaderTest::kInvalidIndexRangeStart; | 549 const int GLES2DecoderWithShaderTest::kInvalidIndexRangeStart; |
491 const int GLES2DecoderWithShaderTest::kInvalidIndexRangeCount; | 550 const int GLES2DecoderWithShaderTest::kInvalidIndexRangeCount; |
492 const int GLES2DecoderWithShaderTest::kOutOfRangeIndexRangeEnd; | 551 const int GLES2DecoderWithShaderTest::kOutOfRangeIndexRangeEnd; |
493 const char* GLES2DecoderWithShaderTest::kAttrib1Name = "attrib1"; | 552 const char* GLES2DecoderWithShaderTest::kAttrib1Name = "attrib1"; |
494 const char* GLES2DecoderWithShaderTest::kAttrib2Name = "attrib2"; | 553 const char* GLES2DecoderWithShaderTest::kAttrib2Name = "attrib2"; |
495 const char* GLES2DecoderWithShaderTest::kAttrib3Name = "attrib3"; | 554 const char* GLES2DecoderWithShaderTest::kAttrib3Name = "attrib3"; |
| 555 const char* GLES2DecoderWithShaderTest::kUniform1Name = "uniform1"; |
| 556 const char* GLES2DecoderWithShaderTest::kUniform2Name = "uniform2"; |
| 557 const char* GLES2DecoderWithShaderTest::kUniform3Name = "uniform3"; |
496 | 558 |
497 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { | 559 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { |
498 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 560 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
499 .Times(1) | 561 .Times(1) |
500 .RetiresOnSaturation(); | 562 .RetiresOnSaturation(); |
501 DrawArrays cmd; | 563 DrawArrays cmd; |
502 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 564 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
503 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 565 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
504 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 566 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
505 } | 567 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER, | 845 cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER, |
784 kInvalidSharedMemoryId, shared_memory_offset_); | 846 kInvalidSharedMemoryId, shared_memory_offset_); |
785 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 847 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
786 | 848 |
787 // Test memory offset bad fails. | 849 // Test memory offset bad fails. |
788 cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER, | 850 cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER, |
789 shared_memory_id_, kInvalidSharedMemoryOffset); | 851 shared_memory_id_, kInvalidSharedMemoryOffset); |
790 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 852 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
791 } | 853 } |
792 | 854 |
| 855 TEST_F(GLES2DecoderWithShaderTest, GetUniformivSucceeds) { |
| 856 GetUniformiv cmd; |
| 857 cmd.Init(client_program_id_, kUniform2Location, |
| 858 kSharedMemoryId, kSharedMemoryOffset); |
| 859 EXPECT_CALL(*gl_, GetUniformiv(kServiceProgramId, kUniform2Location, _)) |
| 860 .Times(1); |
| 861 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 862 EXPECT_EQ(kUniform2Size * GLES2Util::GetGLDataTypeSize(kUniform2Type), |
| 863 result_->size); |
| 864 } |
| 865 |
| 866 TEST_F(GLES2DecoderWithShaderTest, GetUniformivBadProgramFails) { |
| 867 GetUniformiv cmd; |
| 868 // non-existant program |
| 869 cmd.Init(kInvalidClientId, kUniform2Location, |
| 870 kSharedMemoryId, kSharedMemoryOffset); |
| 871 EXPECT_CALL(*gl_, GetUniformiv(_, _, _)) |
| 872 .Times(0); |
| 873 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 874 EXPECT_EQ(0, result_->size); |
| 875 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 876 // Valid id that is not a program. The GL spec requires a different error for |
| 877 // this case. |
| 878 result_->size = kInitialResult; |
| 879 cmd.Init(client_texture_id_, kUniform2Location, |
| 880 kSharedMemoryId, kSharedMemoryOffset); |
| 881 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 882 EXPECT_EQ(0, result_->size); |
| 883 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 884 // Unlinked program |
| 885 EXPECT_CALL(*gl_, CreateProgram()) |
| 886 .Times(1) |
| 887 .WillOnce(Return(kNewServiceId)) |
| 888 .RetiresOnSaturation(); |
| 889 CreateProgram cmd2; |
| 890 cmd2.Init(kNewClientId); |
| 891 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 892 result_->size = kInitialResult; |
| 893 cmd.Init(kNewClientId, kUniform2Location, |
| 894 kSharedMemoryId, kSharedMemoryOffset); |
| 895 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 896 EXPECT_EQ(0, result_->size); |
| 897 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 898 } |
| 899 |
| 900 TEST_F(GLES2DecoderWithShaderTest, GetUniformivBadLocationFails) { |
| 901 GetUniformiv cmd; |
| 902 // invalid location |
| 903 cmd.Init(client_program_id_, kInvalidUniformLocation, |
| 904 kSharedMemoryId, kSharedMemoryOffset); |
| 905 EXPECT_CALL(*gl_, GetUniformiv(_, _, _)) |
| 906 .Times(0); |
| 907 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 908 EXPECT_EQ(0, result_->size); |
| 909 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 910 } |
| 911 |
| 912 TEST_F(GLES2DecoderWithShaderTest, GetUniformivBadSharedMemoryFails) { |
| 913 GetUniformiv cmd; |
| 914 cmd.Init(client_program_id_, kUniform2Location, |
| 915 kInvalidSharedMemoryId, kSharedMemoryOffset); |
| 916 EXPECT_CALL(*gl_, GetUniformiv(_, _, _)) |
| 917 .Times(0); |
| 918 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 919 cmd.Init(client_program_id_, kUniform2Location, |
| 920 kSharedMemoryId, kInvalidSharedMemoryOffset); |
| 921 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 922 }; |
| 923 |
| 924 TEST_F(GLES2DecoderWithShaderTest, GetUniformfvSucceeds) { |
| 925 GetUniformfv cmd; |
| 926 cmd.Init(client_program_id_, kUniform2Location, |
| 927 kSharedMemoryId, kSharedMemoryOffset); |
| 928 EXPECT_CALL(*gl_, GetUniformfv(kServiceProgramId, kUniform2Location, _)) |
| 929 .Times(1); |
| 930 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 931 EXPECT_EQ(kUniform2Size * GLES2Util::GetGLDataTypeSize(kUniform2Type), |
| 932 result_->size); |
| 933 } |
| 934 |
| 935 TEST_F(GLES2DecoderWithShaderTest, GetUniformfvBadProgramFails) { |
| 936 GetUniformfv cmd; |
| 937 // non-existant program |
| 938 cmd.Init(kInvalidClientId, kUniform2Location, |
| 939 kSharedMemoryId, kSharedMemoryOffset); |
| 940 EXPECT_CALL(*gl_, GetUniformfv(_, _, _)) |
| 941 .Times(0); |
| 942 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 943 EXPECT_EQ(0, result_->size); |
| 944 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 945 // Valid id that is not a program. The GL spec requires a different error for |
| 946 // this case. |
| 947 result_->size = kInitialResult; |
| 948 cmd.Init(client_texture_id_, kUniform2Location, |
| 949 kSharedMemoryId, kSharedMemoryOffset); |
| 950 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 951 EXPECT_EQ(0, result_->size); |
| 952 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 953 // Unlinked program |
| 954 EXPECT_CALL(*gl_, CreateProgram()) |
| 955 .Times(1) |
| 956 .WillOnce(Return(kNewServiceId)) |
| 957 .RetiresOnSaturation(); |
| 958 CreateProgram cmd2; |
| 959 cmd2.Init(kNewClientId); |
| 960 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 961 result_->size = kInitialResult; |
| 962 cmd.Init(kNewClientId, kUniform2Location, |
| 963 kSharedMemoryId, kSharedMemoryOffset); |
| 964 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 965 EXPECT_EQ(0, result_->size); |
| 966 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 967 } |
| 968 |
| 969 TEST_F(GLES2DecoderWithShaderTest, GetUniformfvBadLocationFails) { |
| 970 GetUniformfv cmd; |
| 971 // invalid location |
| 972 cmd.Init(client_program_id_, kInvalidUniformLocation, |
| 973 kSharedMemoryId, kSharedMemoryOffset); |
| 974 EXPECT_CALL(*gl_, GetUniformfv(_, _, _)) |
| 975 .Times(0); |
| 976 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 977 EXPECT_EQ(0, result_->size); |
| 978 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 979 } |
| 980 |
| 981 TEST_F(GLES2DecoderWithShaderTest, GetUniformfvBadSharedMemoryFails) { |
| 982 GetUniformfv cmd; |
| 983 cmd.Init(client_program_id_, kUniform2Location, |
| 984 kInvalidSharedMemoryId, kSharedMemoryOffset); |
| 985 EXPECT_CALL(*gl_, GetUniformfv(_, _, _)) |
| 986 .Times(0); |
| 987 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 988 cmd.Init(client_program_id_, kUniform2Location, |
| 989 kSharedMemoryId, kInvalidSharedMemoryOffset); |
| 990 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 991 }; |
793 | 992 |
794 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_autogen.h" | 993 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_autogen.h" |
795 | 994 |
796 } // namespace gles2 | 995 } // namespace gles2 |
797 } // namespace gpu | 996 } // namespace gpu |
798 | 997 |
799 | 998 |
OLD | NEW |