OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const GLint TestHelper::kMaxProgramTexelOffset; | 95 const GLint TestHelper::kMaxProgramTexelOffset; |
96 const GLint TestHelper::kMinProgramTexelOffset; | 96 const GLint TestHelper::kMinProgramTexelOffset; |
97 const GLint TestHelper::kMaxTransformFeedbackSeparateAttribs; | 97 const GLint TestHelper::kMaxTransformFeedbackSeparateAttribs; |
98 const GLint TestHelper::kMaxUniformBufferBindings; | 98 const GLint TestHelper::kMaxUniformBufferBindings; |
99 const GLint TestHelper::kUniformBufferOffsetAlignment; | 99 const GLint TestHelper::kUniformBufferOffsetAlignment; |
100 #endif | 100 #endif |
101 | 101 |
102 std::vector<std::string> TestHelper::split_extensions_; | 102 std::vector<std::string> TestHelper::split_extensions_; |
103 | 103 |
104 void TestHelper::SetupTextureInitializationExpectations( | 104 void TestHelper::SetupTextureInitializationExpectations( |
105 ::gfx::MockGLInterface* gl, | 105 ::gl::MockGLInterface* gl, |
106 GLenum target, | 106 GLenum target, |
107 bool use_default_textures) { | 107 bool use_default_textures) { |
108 InSequence sequence; | 108 InSequence sequence; |
109 | 109 |
110 bool needs_initialization = (target != GL_TEXTURE_EXTERNAL_OES); | 110 bool needs_initialization = (target != GL_TEXTURE_EXTERNAL_OES); |
111 bool needs_faces = (target == GL_TEXTURE_CUBE_MAP); | 111 bool needs_faces = (target == GL_TEXTURE_CUBE_MAP); |
112 bool is_3d_or_2d_array_target = (target == GL_TEXTURE_3D || | 112 bool is_3d_or_2d_array_target = (target == GL_TEXTURE_3D || |
113 target == GL_TEXTURE_2D_ARRAY); | 113 target == GL_TEXTURE_2D_ARRAY); |
114 | 114 |
115 static GLuint texture_2d_ids[] = { | 115 static GLuint texture_2d_ids[] = { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 } | 196 } |
197 } | 197 } |
198 } | 198 } |
199 EXPECT_CALL(*gl, BindTexture(target, 0)) | 199 EXPECT_CALL(*gl, BindTexture(target, 0)) |
200 .Times(1) | 200 .Times(1) |
201 .RetiresOnSaturation(); | 201 .RetiresOnSaturation(); |
202 } | 202 } |
203 | 203 |
204 void TestHelper::SetupTextureManagerInitExpectations( | 204 void TestHelper::SetupTextureManagerInitExpectations( |
205 ::gfx::MockGLInterface* gl, | 205 ::gl::MockGLInterface* gl, |
206 bool is_es3_enabled, | 206 bool is_es3_enabled, |
207 bool is_desktop_core_profile, | 207 bool is_desktop_core_profile, |
208 const char* extensions, | 208 const char* extensions, |
209 bool use_default_textures) { | 209 bool use_default_textures) { |
210 InSequence sequence; | 210 InSequence sequence; |
211 | 211 |
212 SetupTextureInitializationExpectations( | 212 SetupTextureInitializationExpectations( |
213 gl, GL_TEXTURE_2D, use_default_textures); | 213 gl, GL_TEXTURE_2D, use_default_textures); |
214 SetupTextureInitializationExpectations( | 214 SetupTextureInitializationExpectations( |
215 gl, GL_TEXTURE_CUBE_MAP, use_default_textures); | 215 gl, GL_TEXTURE_CUBE_MAP, use_default_textures); |
(...skipping 23 matching lines...) Expand all Loading... |
239 SetupTextureInitializationExpectations( | 239 SetupTextureInitializationExpectations( |
240 gl, GL_TEXTURE_EXTERNAL_OES, use_default_textures); | 240 gl, GL_TEXTURE_EXTERNAL_OES, use_default_textures); |
241 } | 241 } |
242 if (arb_texture_rectangle) { | 242 if (arb_texture_rectangle) { |
243 SetupTextureInitializationExpectations( | 243 SetupTextureInitializationExpectations( |
244 gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures); | 244 gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 void TestHelper::SetupTextureDestructionExpectations( | 248 void TestHelper::SetupTextureDestructionExpectations( |
249 ::gfx::MockGLInterface* gl, | 249 ::gl::MockGLInterface* gl, |
250 GLenum target, | 250 GLenum target, |
251 bool use_default_textures) { | 251 bool use_default_textures) { |
252 if (!use_default_textures) | 252 if (!use_default_textures) |
253 return; | 253 return; |
254 | 254 |
255 GLuint texture_id = 0; | 255 GLuint texture_id = 0; |
256 switch (target) { | 256 switch (target) { |
257 case GL_TEXTURE_2D: | 257 case GL_TEXTURE_2D: |
258 texture_id = kServiceDefaultTexture2dId; | 258 texture_id = kServiceDefaultTexture2dId; |
259 break; | 259 break; |
(...skipping 15 matching lines...) Expand all Loading... |
275 default: | 275 default: |
276 NOTREACHED(); | 276 NOTREACHED(); |
277 } | 277 } |
278 | 278 |
279 EXPECT_CALL(*gl, DeleteTextures(1, Pointee(texture_id))) | 279 EXPECT_CALL(*gl, DeleteTextures(1, Pointee(texture_id))) |
280 .Times(1) | 280 .Times(1) |
281 .RetiresOnSaturation(); | 281 .RetiresOnSaturation(); |
282 } | 282 } |
283 | 283 |
284 void TestHelper::SetupTextureManagerDestructionExpectations( | 284 void TestHelper::SetupTextureManagerDestructionExpectations( |
285 ::gfx::MockGLInterface* gl, | 285 ::gl::MockGLInterface* gl, |
286 bool is_es3_enabled, | 286 bool is_es3_enabled, |
287 bool is_desktop_core_profile, | 287 bool is_desktop_core_profile, |
288 const char* extensions, | 288 const char* extensions, |
289 bool use_default_textures) { | 289 bool use_default_textures) { |
290 SetupTextureDestructionExpectations(gl, GL_TEXTURE_2D, use_default_textures); | 290 SetupTextureDestructionExpectations(gl, GL_TEXTURE_2D, use_default_textures); |
291 SetupTextureDestructionExpectations( | 291 SetupTextureDestructionExpectations( |
292 gl, GL_TEXTURE_CUBE_MAP, use_default_textures); | 292 gl, GL_TEXTURE_CUBE_MAP, use_default_textures); |
293 | 293 |
294 if (is_es3_enabled) { | 294 if (is_es3_enabled) { |
295 SetupTextureDestructionExpectations( | 295 SetupTextureDestructionExpectations( |
(...skipping 24 matching lines...) Expand all Loading... |
320 SetupTextureDestructionExpectations( | 320 SetupTextureDestructionExpectations( |
321 gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures); | 321 gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures); |
322 } | 322 } |
323 | 323 |
324 EXPECT_CALL(*gl, DeleteTextures(TextureManager::kNumDefaultTextures, _)) | 324 EXPECT_CALL(*gl, DeleteTextures(TextureManager::kNumDefaultTextures, _)) |
325 .Times(1) | 325 .Times(1) |
326 .RetiresOnSaturation(); | 326 .RetiresOnSaturation(); |
327 } | 327 } |
328 | 328 |
329 void TestHelper::SetupContextGroupInitExpectations( | 329 void TestHelper::SetupContextGroupInitExpectations( |
330 ::gfx::MockGLInterface* gl, | 330 ::gl::MockGLInterface* gl, |
331 const DisallowedFeatures& disallowed_features, | 331 const DisallowedFeatures& disallowed_features, |
332 const char* extensions, | 332 const char* extensions, |
333 const char* gl_version, | 333 const char* gl_version, |
334 bool bind_generates_resource) { | 334 bool bind_generates_resource) { |
335 InSequence sequence; | 335 InSequence sequence; |
336 | 336 |
337 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version); | 337 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version); |
338 | 338 |
339 gfx::GLVersionInfo gl_info(gl_version, "", extensions); | 339 gl::GLVersionInfo gl_info(gl_version, "", extensions); |
340 | 340 |
341 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _)) | 341 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _)) |
342 .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize)) | 342 .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize)) |
343 .RetiresOnSaturation(); | 343 .RetiresOnSaturation(); |
344 if (strstr(extensions, "GL_EXT_framebuffer_multisample") || | 344 if (strstr(extensions, "GL_EXT_framebuffer_multisample") || |
345 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || | 345 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || |
346 gl_info.is_es3 || gl_info.is_desktop_core_profile) { | 346 gl_info.is_es3 || gl_info.is_desktop_core_profile) { |
347 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) | 347 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) |
348 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) | 348 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) |
349 .RetiresOnSaturation(); | 349 .RetiresOnSaturation(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 .Times(testing::Between(0, 1)) | 459 .Times(testing::Between(0, 1)) |
460 .WillRepeatedly(SetArgumentPointee<1>(kMinProgramTexelOffset)) | 460 .WillRepeatedly(SetArgumentPointee<1>(kMinProgramTexelOffset)) |
461 .RetiresOnSaturation(); | 461 .RetiresOnSaturation(); |
462 | 462 |
463 bool use_default_textures = bind_generates_resource; | 463 bool use_default_textures = bind_generates_resource; |
464 SetupTextureManagerInitExpectations( | 464 SetupTextureManagerInitExpectations( |
465 gl, false, gl_info.is_desktop_core_profile, extensions, | 465 gl, false, gl_info.is_desktop_core_profile, extensions, |
466 use_default_textures); | 466 use_default_textures); |
467 } | 467 } |
468 | 468 |
469 void TestHelper::SetupFeatureInfoInitExpectations( | 469 void TestHelper::SetupFeatureInfoInitExpectations(::gl::MockGLInterface* gl, |
470 ::gfx::MockGLInterface* gl, const char* extensions) { | 470 const char* extensions) { |
471 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", ""); | 471 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", ""); |
472 } | 472 } |
473 | 473 |
474 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 474 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
475 ::gfx::MockGLInterface* gl, | 475 ::gl::MockGLInterface* gl, |
476 const char* extensions, | 476 const char* extensions, |
477 const char* gl_renderer, | 477 const char* gl_renderer, |
478 const char* gl_version, | 478 const char* gl_version, |
479 bool enable_es3) { | 479 bool enable_es3) { |
480 InSequence sequence; | 480 InSequence sequence; |
481 | 481 |
482 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 482 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
483 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) | 483 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) |
484 .RetiresOnSaturation(); | 484 .RetiresOnSaturation(); |
485 | 485 |
486 // Persistent storage is needed for the split extension string. | 486 // Persistent storage is needed for the split extension string. |
487 split_extensions_.clear(); | 487 split_extensions_.clear(); |
488 if (extensions) { | 488 if (extensions) { |
489 split_extensions_ = base::SplitString( | 489 split_extensions_ = base::SplitString( |
490 extensions, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 490 extensions, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
491 } | 491 } |
492 | 492 |
493 gfx::GLVersionInfo gl_info(gl_version, gl_renderer, extensions); | 493 gl::GLVersionInfo gl_info(gl_version, gl_renderer, extensions); |
494 if (!gl_info.is_es && gl_info.major_version >= 3) { | 494 if (!gl_info.is_es && gl_info.major_version >= 3) { |
495 EXPECT_CALL(*gl, GetIntegerv(GL_NUM_EXTENSIONS, _)) | 495 EXPECT_CALL(*gl, GetIntegerv(GL_NUM_EXTENSIONS, _)) |
496 .WillOnce(SetArgumentPointee<1>(split_extensions_.size())) | 496 .WillOnce(SetArgumentPointee<1>(split_extensions_.size())) |
497 .RetiresOnSaturation(); | 497 .RetiresOnSaturation(); |
498 for (size_t ii = 0; ii < split_extensions_.size(); ++ii) { | 498 for (size_t ii = 0; ii < split_extensions_.size(); ++ii) { |
499 EXPECT_CALL(*gl, GetStringi(GL_EXTENSIONS, ii)) | 499 EXPECT_CALL(*gl, GetStringi(GL_EXTENSIONS, ii)) |
500 .WillOnce(Return( | 500 .WillOnce(Return( |
501 reinterpret_cast<const uint8_t*>(split_extensions_[ii].c_str()))) | 501 reinterpret_cast<const uint8_t*>(split_extensions_[ii].c_str()))) |
502 .RetiresOnSaturation(); | 502 .RetiresOnSaturation(); |
503 } | 503 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 .Times(1) | 692 .Times(1) |
693 .RetiresOnSaturation(); | 693 .RetiresOnSaturation(); |
694 #if DCHECK_IS_ON() | 694 #if DCHECK_IS_ON() |
695 EXPECT_CALL(*gl, GetError()) | 695 EXPECT_CALL(*gl, GetError()) |
696 .WillOnce(Return(GL_NO_ERROR)) | 696 .WillOnce(Return(GL_NO_ERROR)) |
697 .RetiresOnSaturation(); | 697 .RetiresOnSaturation(); |
698 #endif | 698 #endif |
699 } | 699 } |
700 } | 700 } |
701 | 701 |
702 void TestHelper::SetupExpectationsForClearingUniforms( | 702 void TestHelper::SetupExpectationsForClearingUniforms(::gl::MockGLInterface* gl, |
703 ::gfx::MockGLInterface* gl, UniformInfo* uniforms, size_t num_uniforms) { | 703 UniformInfo* uniforms, |
| 704 size_t num_uniforms) { |
704 for (size_t ii = 0; ii < num_uniforms; ++ii) { | 705 for (size_t ii = 0; ii < num_uniforms; ++ii) { |
705 const UniformInfo& info = uniforms[ii]; | 706 const UniformInfo& info = uniforms[ii]; |
706 switch (info.type) { | 707 switch (info.type) { |
707 case GL_FLOAT: | 708 case GL_FLOAT: |
708 EXPECT_CALL(*gl, Uniform1fv(info.real_location, info.size, _)) | 709 EXPECT_CALL(*gl, Uniform1fv(info.real_location, info.size, _)) |
709 .Times(1) | 710 .Times(1) |
710 .RetiresOnSaturation(); | 711 .RetiresOnSaturation(); |
711 break; | 712 break; |
712 case GL_FLOAT_VEC2: | 713 case GL_FLOAT_VEC2: |
713 EXPECT_CALL(*gl, Uniform2fv(info.real_location, info.size, _)) | 714 EXPECT_CALL(*gl, Uniform2fv(info.real_location, info.size, _)) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 .RetiresOnSaturation(); | 794 .RetiresOnSaturation(); |
794 break; | 795 break; |
795 default: | 796 default: |
796 NOTREACHED(); | 797 NOTREACHED(); |
797 break; | 798 break; |
798 } | 799 } |
799 } | 800 } |
800 } | 801 } |
801 | 802 |
802 void TestHelper::SetupProgramSuccessExpectations( | 803 void TestHelper::SetupProgramSuccessExpectations( |
803 ::gfx::MockGLInterface* gl, | 804 ::gl::MockGLInterface* gl, |
804 const FeatureInfo* feature_info, | 805 const FeatureInfo* feature_info, |
805 AttribInfo* attribs, | 806 AttribInfo* attribs, |
806 size_t num_attribs, | 807 size_t num_attribs, |
807 UniformInfo* uniforms, | 808 UniformInfo* uniforms, |
808 size_t num_uniforms, | 809 size_t num_uniforms, |
809 VaryingInfo* varyings, | 810 VaryingInfo* varyings, |
810 size_t num_varyings, | 811 size_t num_varyings, |
811 ProgramOutputInfo* program_outputs, | 812 ProgramOutputInfo* program_outputs, |
812 size_t num_program_outputs, | 813 size_t num_program_outputs, |
813 GLuint service_id) { | 814 GLuint service_id) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 .RetiresOnSaturation(); | 959 .RetiresOnSaturation(); |
959 } else { | 960 } else { |
960 // Test case must not use indices, or the context of the testcase has to | 961 // Test case must not use indices, or the context of the testcase has to |
961 // support the dual source blending. | 962 // support the dual source blending. |
962 DCHECK(info.index == 0); | 963 DCHECK(info.index == 0); |
963 } | 964 } |
964 } | 965 } |
965 } | 966 } |
966 } | 967 } |
967 | 968 |
968 void TestHelper::SetupShaderExpectations(::gfx::MockGLInterface* gl, | 969 void TestHelper::SetupShaderExpectations(::gl::MockGLInterface* gl, |
969 const FeatureInfo* feature_info, | 970 const FeatureInfo* feature_info, |
970 AttribInfo* attribs, | 971 AttribInfo* attribs, |
971 size_t num_attribs, | 972 size_t num_attribs, |
972 UniformInfo* uniforms, | 973 UniformInfo* uniforms, |
973 size_t num_uniforms, | 974 size_t num_uniforms, |
974 GLuint service_id) { | 975 GLuint service_id) { |
975 InSequence s; | 976 InSequence s; |
976 | 977 |
977 EXPECT_CALL(*gl, LinkProgram(service_id)).Times(1).RetiresOnSaturation(); | 978 EXPECT_CALL(*gl, LinkProgram(service_id)).Times(1).RetiresOnSaturation(); |
978 | 979 |
979 SetupProgramSuccessExpectations(gl, feature_info, attribs, num_attribs, | 980 SetupProgramSuccessExpectations(gl, feature_info, attribs, num_attribs, |
980 uniforms, num_uniforms, nullptr, 0, nullptr, | 981 uniforms, num_uniforms, nullptr, 0, nullptr, |
981 0, service_id); | 982 0, service_id); |
982 } | 983 } |
983 | 984 |
984 void TestHelper::SetupShaderExpectationsWithVaryings( | 985 void TestHelper::SetupShaderExpectationsWithVaryings( |
985 ::gfx::MockGLInterface* gl, | 986 ::gl::MockGLInterface* gl, |
986 const FeatureInfo* feature_info, | 987 const FeatureInfo* feature_info, |
987 AttribInfo* attribs, | 988 AttribInfo* attribs, |
988 size_t num_attribs, | 989 size_t num_attribs, |
989 UniformInfo* uniforms, | 990 UniformInfo* uniforms, |
990 size_t num_uniforms, | 991 size_t num_uniforms, |
991 VaryingInfo* varyings, | 992 VaryingInfo* varyings, |
992 size_t num_varyings, | 993 size_t num_varyings, |
993 ProgramOutputInfo* program_outputs, | 994 ProgramOutputInfo* program_outputs, |
994 size_t num_program_outputs, | 995 size_t num_program_outputs, |
995 GLuint service_id) { | 996 GLuint service_id) { |
996 InSequence s; | 997 InSequence s; |
997 | 998 |
998 EXPECT_CALL(*gl, | 999 EXPECT_CALL(*gl, |
999 LinkProgram(service_id)) | 1000 LinkProgram(service_id)) |
1000 .Times(1) | 1001 .Times(1) |
1001 .RetiresOnSaturation(); | 1002 .RetiresOnSaturation(); |
1002 | 1003 |
1003 SetupProgramSuccessExpectations( | 1004 SetupProgramSuccessExpectations( |
1004 gl, feature_info, attribs, num_attribs, uniforms, num_uniforms, varyings, | 1005 gl, feature_info, attribs, num_attribs, uniforms, num_uniforms, varyings, |
1005 num_varyings, program_outputs, num_program_outputs, service_id); | 1006 num_varyings, program_outputs, num_program_outputs, service_id); |
1006 } | 1007 } |
1007 | 1008 |
1008 void TestHelper::DoBufferData( | 1009 void TestHelper::DoBufferData(::gl::MockGLInterface* gl, |
1009 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 1010 MockErrorState* error_state, |
1010 BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size, | 1011 BufferManager* manager, |
1011 GLenum usage, const GLvoid* data, GLenum error) { | 1012 Buffer* buffer, |
| 1013 GLenum target, |
| 1014 GLsizeiptr size, |
| 1015 GLenum usage, |
| 1016 const GLvoid* data, |
| 1017 GLenum error) { |
1012 EXPECT_CALL(*error_state, CopyRealGLErrorsToWrapper(_, _, _)) | 1018 EXPECT_CALL(*error_state, CopyRealGLErrorsToWrapper(_, _, _)) |
1013 .Times(1) | 1019 .Times(1) |
1014 .RetiresOnSaturation(); | 1020 .RetiresOnSaturation(); |
1015 if (manager->IsUsageClientSideArray(usage)) { | 1021 if (manager->IsUsageClientSideArray(usage)) { |
1016 EXPECT_CALL(*gl, BufferData(target, 0, _, usage)) | 1022 EXPECT_CALL(*gl, BufferData(target, 0, _, usage)) |
1017 .Times(1) | 1023 .Times(1) |
1018 .RetiresOnSaturation(); | 1024 .RetiresOnSaturation(); |
1019 } else { | 1025 } else { |
1020 EXPECT_CALL(*gl, BufferData(target, size, _, usage)) | 1026 EXPECT_CALL(*gl, BufferData(target, size, _, usage)) |
1021 .Times(1) | 1027 .Times(1) |
1022 .RetiresOnSaturation(); | 1028 .RetiresOnSaturation(); |
1023 } | 1029 } |
1024 EXPECT_CALL(*error_state, PeekGLError(_, _, _)) | 1030 EXPECT_CALL(*error_state, PeekGLError(_, _, _)) |
1025 .WillOnce(Return(error)) | 1031 .WillOnce(Return(error)) |
1026 .RetiresOnSaturation(); | 1032 .RetiresOnSaturation(); |
1027 manager->DoBufferData(error_state, buffer, target, size, usage, data); | 1033 manager->DoBufferData(error_state, buffer, target, size, usage, data); |
1028 } | 1034 } |
1029 | 1035 |
1030 void TestHelper::SetTexParameteriWithExpectations( | 1036 void TestHelper::SetTexParameteriWithExpectations(::gl::MockGLInterface* gl, |
1031 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 1037 MockErrorState* error_state, |
1032 TextureManager* manager, TextureRef* texture_ref, | 1038 TextureManager* manager, |
1033 GLenum pname, GLint value, GLenum error) { | 1039 TextureRef* texture_ref, |
| 1040 GLenum pname, |
| 1041 GLint value, |
| 1042 GLenum error) { |
1034 if (error == GL_NO_ERROR) { | 1043 if (error == GL_NO_ERROR) { |
1035 EXPECT_CALL(*gl, TexParameteri(texture_ref->texture()->target(), | 1044 EXPECT_CALL(*gl, TexParameteri(texture_ref->texture()->target(), |
1036 pname, value)) | 1045 pname, value)) |
1037 .Times(1) | 1046 .Times(1) |
1038 .RetiresOnSaturation(); | 1047 .RetiresOnSaturation(); |
1039 } else if (error == GL_INVALID_ENUM) { | 1048 } else if (error == GL_INVALID_ENUM) { |
1040 EXPECT_CALL(*error_state, SetGLErrorInvalidEnum(_, _, _, value, _)) | 1049 EXPECT_CALL(*error_state, SetGLErrorInvalidEnum(_, _, _, value, _)) |
1041 .Times(1) | 1050 .Times(1) |
1042 .RetiresOnSaturation(); | 1051 .RetiresOnSaturation(); |
1043 } else { | 1052 } else { |
1044 EXPECT_CALL(*error_state, SetGLErrorInvalidParami(_, _, error, _, _, _)) | 1053 EXPECT_CALL(*error_state, SetGLErrorInvalidParami(_, _, error, _, _, _)) |
1045 .Times(1) | 1054 .Times(1) |
1046 .RetiresOnSaturation(); | 1055 .RetiresOnSaturation(); |
1047 } | 1056 } |
1048 manager->SetParameteri("", error_state, texture_ref, pname, value); | 1057 manager->SetParameteri("", error_state, texture_ref, pname, value); |
1049 } | 1058 } |
1050 | 1059 |
1051 // static | 1060 // static |
1052 void TestHelper::SetShaderStates( | 1061 void TestHelper::SetShaderStates( |
1053 ::gfx::MockGLInterface* gl, | 1062 ::gl::MockGLInterface* gl, |
1054 Shader* shader, | 1063 Shader* shader, |
1055 bool expected_valid, | 1064 bool expected_valid, |
1056 const std::string* const expected_log_info, | 1065 const std::string* const expected_log_info, |
1057 const std::string* const expected_translated_source, | 1066 const std::string* const expected_translated_source, |
1058 const int* const expected_shader_version, | 1067 const int* const expected_shader_version, |
1059 const AttributeMap* const expected_attrib_map, | 1068 const AttributeMap* const expected_attrib_map, |
1060 const UniformMap* const expected_uniform_map, | 1069 const UniformMap* const expected_uniform_map, |
1061 const VaryingMap* const expected_varying_map, | 1070 const VaryingMap* const expected_varying_map, |
1062 const InterfaceBlockMap* const expected_interface_block_map, | 1071 const InterfaceBlockMap* const expected_interface_block_map, |
1063 const OutputVariableList* const expected_output_variable_list, | 1072 const OutputVariableList* const expected_output_variable_list, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 GL_COMPILE_STATUS, | 1136 GL_COMPILE_STATUS, |
1128 NotNull())) // status | 1137 NotNull())) // status |
1129 .WillOnce(SetArgumentPointee<2>(GL_TRUE)) | 1138 .WillOnce(SetArgumentPointee<2>(GL_TRUE)) |
1130 .RetiresOnSaturation(); | 1139 .RetiresOnSaturation(); |
1131 } | 1140 } |
1132 shader->RequestCompile(translator, Shader::kGL); | 1141 shader->RequestCompile(translator, Shader::kGL); |
1133 shader->DoCompile(); | 1142 shader->DoCompile(); |
1134 } | 1143 } |
1135 | 1144 |
1136 // static | 1145 // static |
1137 void TestHelper::SetShaderStates( | 1146 void TestHelper::SetShaderStates(::gl::MockGLInterface* gl, |
1138 ::gfx::MockGLInterface* gl, Shader* shader, bool valid) { | 1147 Shader* shader, |
| 1148 bool valid) { |
1139 SetShaderStates(gl, shader, valid, nullptr, nullptr, nullptr, nullptr, | 1149 SetShaderStates(gl, shader, valid, nullptr, nullptr, nullptr, nullptr, |
1140 nullptr, nullptr, nullptr, nullptr, nullptr); | 1150 nullptr, nullptr, nullptr, nullptr, nullptr); |
1141 } | 1151 } |
1142 | 1152 |
1143 // static | 1153 // static |
1144 sh::Attribute TestHelper::ConstructAttribute( | 1154 sh::Attribute TestHelper::ConstructAttribute( |
1145 GLenum type, GLint array_size, GLenum precision, | 1155 GLenum type, GLint array_size, GLenum precision, |
1146 bool static_use, const std::string& name) { | 1156 bool static_use, const std::string& name) { |
1147 return ConstructShaderVariable<sh::Attribute>( | 1157 return ConstructShaderVariable<sh::Attribute>( |
1148 type, array_size, precision, static_use, name); | 1158 type, array_size, precision, static_use, name); |
(...skipping 19 matching lines...) Expand all Loading... |
1168 GLenum type, | 1178 GLenum type, |
1169 GLint array_size, | 1179 GLint array_size, |
1170 GLenum precision, | 1180 GLenum precision, |
1171 bool static_use, | 1181 bool static_use, |
1172 const std::string& name) { | 1182 const std::string& name) { |
1173 return ConstructShaderVariable<sh::OutputVariable>( | 1183 return ConstructShaderVariable<sh::OutputVariable>( |
1174 type, array_size, precision, static_use, name); | 1184 type, array_size, precision, static_use, name); |
1175 } | 1185 } |
1176 | 1186 |
1177 ScopedGLImplementationSetter::ScopedGLImplementationSetter( | 1187 ScopedGLImplementationSetter::ScopedGLImplementationSetter( |
1178 gfx::GLImplementation implementation) | 1188 gl::GLImplementation implementation) |
1179 : old_implementation_(gfx::GetGLImplementation()) { | 1189 : old_implementation_(gl::GetGLImplementation()) { |
1180 gfx::SetGLImplementation(implementation); | 1190 gl::SetGLImplementation(implementation); |
1181 } | 1191 } |
1182 | 1192 |
1183 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { | 1193 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { |
1184 gfx::SetGLImplementation(old_implementation_); | 1194 gl::SetGLImplementation(old_implementation_); |
1185 } | 1195 } |
1186 | 1196 |
1187 } // namespace gles2 | 1197 } // namespace gles2 |
1188 } // namespace gpu | 1198 } // namespace gpu |
1189 | 1199 |
OLD | NEW |