| 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> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include <algorithm> | 10 #include <algorithm> |
| 8 #include <string> | 11 #include <string> |
| 9 | 12 |
| 10 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 12 #include "base/strings/string_tokenizer.h" | 15 #include "base/strings/string_tokenizer.h" |
| 13 #include "gpu/command_buffer/service/buffer_manager.h" | 16 #include "gpu/command_buffer/service/buffer_manager.h" |
| 14 #include "gpu/command_buffer/service/error_state_mock.h" | 17 #include "gpu/command_buffer/service/error_state_mock.h" |
| 15 #include "gpu/command_buffer/service/feature_info.h" | 18 #include "gpu/command_buffer/service/feature_info.h" |
| 16 #include "gpu/command_buffer/service/gl_utils.h" | 19 #include "gpu/command_buffer/service/gl_utils.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 414 } |
| 412 | 415 |
| 413 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 416 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 414 ::gfx::MockGLInterface* gl, | 417 ::gfx::MockGLInterface* gl, |
| 415 const char* extensions, | 418 const char* extensions, |
| 416 const char* gl_renderer, | 419 const char* gl_renderer, |
| 417 const char* gl_version) { | 420 const char* gl_version) { |
| 418 InSequence sequence; | 421 InSequence sequence; |
| 419 | 422 |
| 420 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 423 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
| 421 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_version))) | 424 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) |
| 422 .RetiresOnSaturation(); | 425 .RetiresOnSaturation(); |
| 423 | 426 |
| 424 // Persistent storage is needed for the split extension string. | 427 // Persistent storage is needed for the split extension string. |
| 425 split_extensions_.clear(); | 428 split_extensions_.clear(); |
| 426 if (extensions) { | 429 if (extensions) { |
| 427 split_extensions_ = base::SplitString( | 430 split_extensions_ = base::SplitString( |
| 428 extensions, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 431 extensions, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 429 } | 432 } |
| 430 | 433 |
| 431 gfx::GLVersionInfo gl_info(gl_version, gl_renderer, extensions); | 434 gfx::GLVersionInfo gl_info(gl_version, gl_renderer, extensions); |
| 432 if (!gl_info.is_es && gl_info.major_version >= 3) { | 435 if (!gl_info.is_es && gl_info.major_version >= 3) { |
| 433 EXPECT_CALL(*gl, GetIntegerv(GL_NUM_EXTENSIONS, _)) | 436 EXPECT_CALL(*gl, GetIntegerv(GL_NUM_EXTENSIONS, _)) |
| 434 .WillOnce(SetArgumentPointee<1>(split_extensions_.size())) | 437 .WillOnce(SetArgumentPointee<1>(split_extensions_.size())) |
| 435 .RetiresOnSaturation(); | 438 .RetiresOnSaturation(); |
| 436 for (size_t ii = 0; ii < split_extensions_.size(); ++ii) { | 439 for (size_t ii = 0; ii < split_extensions_.size(); ++ii) { |
| 437 EXPECT_CALL(*gl, GetStringi(GL_EXTENSIONS, ii)) | 440 EXPECT_CALL(*gl, GetStringi(GL_EXTENSIONS, ii)) |
| 438 .WillOnce(Return(reinterpret_cast<const uint8*>( | 441 .WillOnce(Return( |
| 439 split_extensions_[ii].c_str()))) | 442 reinterpret_cast<const uint8_t*>(split_extensions_[ii].c_str()))) |
| 440 .RetiresOnSaturation(); | 443 .RetiresOnSaturation(); |
| 441 } | 444 } |
| 442 } else { | 445 } else { |
| 443 EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) | 446 EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) |
| 444 .WillOnce(Return(reinterpret_cast<const uint8*>(extensions))) | 447 .WillOnce(Return(reinterpret_cast<const uint8_t*>(extensions))) |
| 445 .RetiresOnSaturation(); | 448 .RetiresOnSaturation(); |
| 446 } | 449 } |
| 447 | 450 |
| 448 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 451 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
| 449 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_version))) | 452 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) |
| 450 .RetiresOnSaturation(); | 453 .RetiresOnSaturation(); |
| 451 EXPECT_CALL(*gl, GetString(GL_RENDERER)) | 454 EXPECT_CALL(*gl, GetString(GL_RENDERER)) |
| 452 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_renderer))) | 455 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_renderer))) |
| 453 .RetiresOnSaturation(); | 456 .RetiresOnSaturation(); |
| 454 | 457 |
| 455 if ((strstr(extensions, "GL_ARB_texture_float") || | 458 if ((strstr(extensions, "GL_ARB_texture_float") || |
| 456 gl_info.is_desktop_core_profile) || | 459 gl_info.is_desktop_core_profile) || |
| 457 (gl_info.is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) { | 460 (gl_info.is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) { |
| 458 static const GLuint tx_ids[] = {101, 102}; | 461 static const GLuint tx_ids[] = {101, 102}; |
| 459 static const GLuint fb_ids[] = {103, 104}; | 462 static const GLuint fb_ids[] = {103, 104}; |
| 460 const GLsizei width = 16; | 463 const GLsizei width = 16; |
| 461 EXPECT_CALL(*gl, GetIntegerv(GL_FRAMEBUFFER_BINDING, _)) | 464 EXPECT_CALL(*gl, GetIntegerv(GL_FRAMEBUFFER_BINDING, _)) |
| 462 .WillOnce(SetArgumentPointee<1>(fb_ids[0])) | 465 .WillOnce(SetArgumentPointee<1>(fb_ids[0])) |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 gfx::SetGLImplementation(implementation); | 1074 gfx::SetGLImplementation(implementation); |
| 1072 } | 1075 } |
| 1073 | 1076 |
| 1074 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { | 1077 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { |
| 1075 gfx::SetGLImplementation(old_implementation_); | 1078 gfx::SetGLImplementation(old_implementation_); |
| 1076 } | 1079 } |
| 1077 | 1080 |
| 1078 } // namespace gles2 | 1081 } // namespace gles2 |
| 1079 } // namespace gpu | 1082 } // namespace gpu |
| 1080 | 1083 |
| OLD | NEW |