| 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/program_manager.h" | 5 #include "gpu/command_buffer/service/program_manager.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> |
| 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 18 #include "gpu/command_buffer/service/common_decoder.h" | 18 #include "gpu/command_buffer/service/common_decoder.h" |
| 19 #include "gpu/command_buffer/service/feature_info.h" | 19 #include "gpu/command_buffer/service/feature_info.h" |
| 20 #include "gpu/command_buffer/service/gpu_preferences.h" | 20 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 21 #include "gpu/command_buffer/service/gpu_service_test.h" | 21 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 22 #include "gpu/command_buffer/service/gpu_switches.h" | 22 #include "gpu/command_buffer/service/gpu_switches.h" |
| 23 #include "gpu/command_buffer/service/mocks.h" | 23 #include "gpu/command_buffer/service/mocks.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Parameters same as GpuServiceTest::SetUp | 79 // Parameters same as GpuServiceTest::SetUp |
| 80 SetUpBase("2.0", "GL_EXT_framebuffer_object"); | 80 SetUpBase("2.0", "GL_EXT_framebuffer_object"); |
| 81 } | 81 } |
| 82 void TearDown() override { | 82 void TearDown() override { |
| 83 manager_->Destroy(false); | 83 manager_->Destroy(false); |
| 84 manager_.reset(); | 84 manager_.reset(); |
| 85 feature_info_ = nullptr; | 85 feature_info_ = nullptr; |
| 86 GpuServiceTest::TearDown(); | 86 GpuServiceTest::TearDown(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 scoped_ptr<ProgramManager> manager_; | 89 std::unique_ptr<ProgramManager> manager_; |
| 90 GpuPreferences gpu_preferences_; | 90 GpuPreferences gpu_preferences_; |
| 91 scoped_refptr<FeatureInfo> feature_info_; | 91 scoped_refptr<FeatureInfo> feature_info_; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 class ProgramManagerTest : public ProgramManagerTestBase {}; | 94 class ProgramManagerTest : public ProgramManagerTestBase {}; |
| 95 | 95 |
| 96 TEST_F(ProgramManagerTest, Basic) { | 96 TEST_F(ProgramManagerTest, Basic) { |
| 97 const GLuint kClient1Id = 1; | 97 const GLuint kClient1Id = 1; |
| 98 const GLuint kService1Id = 11; | 98 const GLuint kService1Id = 11; |
| 99 const GLuint kClient2Id = 2; | 99 const GLuint kClient2Id = 2; |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 ShaderSource(shader_id, 1, Pointee(src), NULL)).Times(1); | 2111 ShaderSource(shader_id, 1, Pointee(src), NULL)).Times(1); |
| 2112 EXPECT_CALL(*gl_.get(), CompileShader(shader_id)).Times(1); | 2112 EXPECT_CALL(*gl_.get(), CompileShader(shader_id)).Times(1); |
| 2113 EXPECT_CALL(*gl_.get(), GetShaderiv(shader_id, GL_COMPILE_STATUS, _)) | 2113 EXPECT_CALL(*gl_.get(), GetShaderiv(shader_id, GL_COMPILE_STATUS, _)) |
| 2114 .WillOnce(SetArgPointee<2>(GL_FALSE)); | 2114 .WillOnce(SetArgPointee<2>(GL_FALSE)); |
| 2115 EXPECT_CALL(*gl_.get(), GetShaderiv(shader_id, GL_INFO_LOG_LENGTH, _)) | 2115 EXPECT_CALL(*gl_.get(), GetShaderiv(shader_id, GL_INFO_LOG_LENGTH, _)) |
| 2116 .WillOnce(SetArgPointee<2>(0)); | 2116 .WillOnce(SetArgPointee<2>(0)); |
| 2117 EXPECT_CALL(*gl_.get(), GetShaderInfoLog(shader_id, 0, _, _)) | 2117 EXPECT_CALL(*gl_.get(), GetShaderInfoLog(shader_id, 0, _, _)) |
| 2118 .Times(1); | 2118 .Times(1); |
| 2119 } | 2119 } |
| 2120 | 2120 |
| 2121 scoped_ptr<MockProgramCache> cache_; | 2121 std::unique_ptr<MockProgramCache> cache_; |
| 2122 | 2122 |
| 2123 Shader* vertex_shader_; | 2123 Shader* vertex_shader_; |
| 2124 Shader* fragment_shader_; | 2124 Shader* fragment_shader_; |
| 2125 Program* program_; | 2125 Program* program_; |
| 2126 ShaderManager shader_manager_; | 2126 ShaderManager shader_manager_; |
| 2127 }; | 2127 }; |
| 2128 | 2128 |
| 2129 // GCC requires these declarations, but MSVC requires they not be present | 2129 // GCC requires these declarations, but MSVC requires they not be present |
| 2130 #ifndef COMPILER_MSVC | 2130 #ifndef COMPILER_MSVC |
| 2131 const GLuint ProgramManagerWithCacheTest::kClientProgramId; | 2131 const GLuint ProgramManagerWithCacheTest::kClientProgramId; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 ProgramManagerDualSourceBlendingES2Test, | 2397 ProgramManagerDualSourceBlendingES2Test, |
| 2398 testing::Values( | 2398 testing::Values( |
| 2399 make_gl_ext_tuple("3.2", | 2399 make_gl_ext_tuple("3.2", |
| 2400 "GL_ARB_draw_buffers GL_ARB_blend_func_extended " | 2400 "GL_ARB_draw_buffers GL_ARB_blend_func_extended " |
| 2401 "GL_ARB_program_interface_query"), | 2401 "GL_ARB_program_interface_query"), |
| 2402 make_gl_ext_tuple("opengl es 3.1", | 2402 make_gl_ext_tuple("opengl es 3.1", |
| 2403 "GL_EXT_draw_buffers GL_EXT_blend_func_extended"))); | 2403 "GL_EXT_draw_buffers GL_EXT_blend_func_extended"))); |
| 2404 | 2404 |
| 2405 } // namespace gles2 | 2405 } // namespace gles2 |
| 2406 } // namespace gpu | 2406 } // namespace gpu |
| OLD | NEW |