| 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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <utility> | 11 #include <utility> |
| 11 | 12 |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "gpu/command_buffer/service/error_state_mock.h" | 15 #include "gpu/command_buffer/service/error_state_mock.h" |
| 16 #include "gpu/command_buffer/service/feature_info.h" | 16 #include "gpu/command_buffer/service/feature_info.h" |
| 17 #include "gpu/command_buffer/service/framebuffer_manager.h" | 17 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 18 #include "gpu/command_buffer/service/gl_stream_texture_image.h" | 18 #include "gpu/command_buffer/service/gl_stream_texture_image.h" |
| 19 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| 20 #include "gpu/command_buffer/service/gpu_service_test.h" | 20 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 21 #include "gpu/command_buffer/service/mailbox_manager.h" | 21 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 22 #include "gpu/command_buffer/service/memory_tracking.h" | 22 #include "gpu/command_buffer/service/memory_tracking.h" |
| 23 #include "gpu/command_buffer/service/mocks.h" | 23 #include "gpu/command_buffer/service/mocks.h" |
| 24 #include "gpu/command_buffer/service/test_helper.h" | 24 #include "gpu/command_buffer/service/test_helper.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 .WillOnce(SetArgPointee<1>(8)) | 116 .WillOnce(SetArgPointee<1>(8)) |
| 117 .RetiresOnSaturation(); | 117 .RetiresOnSaturation(); |
| 118 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) | 118 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) |
| 119 .WillOnce(SetArgPointee<1>(8)) | 119 .WillOnce(SetArgPointee<1>(8)) |
| 120 .RetiresOnSaturation(); | 120 .RetiresOnSaturation(); |
| 121 feature_info_->EnableES3Validators(); | 121 feature_info_->EnableES3Validators(); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 scoped_refptr<FeatureInfo> feature_info_; | 125 scoped_refptr<FeatureInfo> feature_info_; |
| 126 scoped_ptr<TextureManager> manager_; | 126 std::unique_ptr<TextureManager> manager_; |
| 127 scoped_ptr<MockErrorState> error_state_; | 127 std::unique_ptr<MockErrorState> error_state_; |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 // GCC requires these declarations, but MSVC requires they not be present | 130 // GCC requires these declarations, but MSVC requires they not be present |
| 131 #ifndef COMPILER_MSVC | 131 #ifndef COMPILER_MSVC |
| 132 const GLint TextureManagerTest::kMaxTextureSize; | 132 const GLint TextureManagerTest::kMaxTextureSize; |
| 133 const GLint TextureManagerTest::kMaxCubeMapTextureSize; | 133 const GLint TextureManagerTest::kMaxCubeMapTextureSize; |
| 134 const GLint TextureManagerTest::kMaxRectangleTextureSize; | 134 const GLint TextureManagerTest::kMaxRectangleTextureSize; |
| 135 const GLint TextureManagerTest::kMaxExternalTextureSize; | 135 const GLint TextureManagerTest::kMaxExternalTextureSize; |
| 136 const GLint TextureManagerTest::kMax3DTextureSize; | 136 const GLint TextureManagerTest::kMax3DTextureSize; |
| 137 const GLint TextureManagerTest::kMax2dLevels; | 137 const GLint TextureManagerTest::kMax2dLevels; |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 GpuServiceTest::TearDown(); | 753 GpuServiceTest::TearDown(); |
| 754 } | 754 } |
| 755 | 755 |
| 756 void SetParameter( | 756 void SetParameter( |
| 757 TextureRef* texture_ref, GLenum pname, GLint value, GLenum error) { | 757 TextureRef* texture_ref, GLenum pname, GLint value, GLenum error) { |
| 758 TestHelper::SetTexParameteriWithExpectations( | 758 TestHelper::SetTexParameteriWithExpectations( |
| 759 gl_.get(), error_state_.get(), manager_.get(), | 759 gl_.get(), error_state_.get(), manager_.get(), |
| 760 texture_ref, pname, value, error); | 760 texture_ref, pname, value, error); |
| 761 } | 761 } |
| 762 | 762 |
| 763 scoped_ptr<MockGLES2Decoder> decoder_; | 763 std::unique_ptr<MockGLES2Decoder> decoder_; |
| 764 scoped_ptr<MockErrorState> error_state_; | 764 std::unique_ptr<MockErrorState> error_state_; |
| 765 scoped_refptr<FeatureInfo> feature_info_; | 765 scoped_refptr<FeatureInfo> feature_info_; |
| 766 scoped_ptr<TextureManager> manager_; | 766 std::unique_ptr<TextureManager> manager_; |
| 767 scoped_refptr<TextureRef> texture_ref_; | 767 scoped_refptr<TextureRef> texture_ref_; |
| 768 }; | 768 }; |
| 769 | 769 |
| 770 class TextureTest : public TextureTestBase { | 770 class TextureTest : public TextureTestBase { |
| 771 protected: | 771 protected: |
| 772 void SetUp() override { SetUpBase(NULL, std::string()); } | 772 void SetUp() override { SetUpBase(NULL, std::string()); } |
| 773 }; | 773 }; |
| 774 | 774 |
| 775 class TextureMemoryTrackerTest : public TextureTestBase { | 775 class TextureMemoryTrackerTest : public TextureTestBase { |
| 776 protected: | 776 protected: |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2187 texture_manager2_->Destroy(false); | 2187 texture_manager2_->Destroy(false); |
| 2188 texture_manager2_.reset(); | 2188 texture_manager2_.reset(); |
| 2189 texture_manager1_->Destroy(false); | 2189 texture_manager1_->Destroy(false); |
| 2190 texture_manager1_.reset(); | 2190 texture_manager1_.reset(); |
| 2191 GpuServiceTest::TearDown(); | 2191 GpuServiceTest::TearDown(); |
| 2192 } | 2192 } |
| 2193 | 2193 |
| 2194 protected: | 2194 protected: |
| 2195 scoped_refptr<FeatureInfo> feature_info_; | 2195 scoped_refptr<FeatureInfo> feature_info_; |
| 2196 scoped_refptr<CountingMemoryTracker> memory_tracker1_; | 2196 scoped_refptr<CountingMemoryTracker> memory_tracker1_; |
| 2197 scoped_ptr<TextureManager> texture_manager1_; | 2197 std::unique_ptr<TextureManager> texture_manager1_; |
| 2198 scoped_refptr<CountingMemoryTracker> memory_tracker2_; | 2198 scoped_refptr<CountingMemoryTracker> memory_tracker2_; |
| 2199 scoped_ptr<TextureManager> texture_manager2_; | 2199 std::unique_ptr<TextureManager> texture_manager2_; |
| 2200 }; | 2200 }; |
| 2201 | 2201 |
| 2202 TEST_F(SharedTextureTest, DeleteTextures) { | 2202 TEST_F(SharedTextureTest, DeleteTextures) { |
| 2203 scoped_refptr<TextureRef> ref1 = texture_manager1_->CreateTexture(10, 10); | 2203 scoped_refptr<TextureRef> ref1 = texture_manager1_->CreateTexture(10, 10); |
| 2204 scoped_refptr<TextureRef> ref2 = | 2204 scoped_refptr<TextureRef> ref2 = |
| 2205 texture_manager2_->Consume(20, ref1->texture()); | 2205 texture_manager2_->Consume(20, ref1->texture()); |
| 2206 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 2206 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
| 2207 .Times(0); | 2207 .Times(0); |
| 2208 ref1 = NULL; | 2208 ref1 = NULL; |
| 2209 texture_manager1_->RemoveTexture(10); | 2209 texture_manager1_->RemoveTexture(10); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2672 ExpectValid( | 2672 ExpectValid( |
| 2673 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); | 2673 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); |
| 2674 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, | 2674 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, |
| 2675 GL_DEPTH32F_STENCIL8); | 2675 GL_DEPTH32F_STENCIL8); |
| 2676 | 2676 |
| 2677 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); | 2677 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); |
| 2678 } | 2678 } |
| 2679 | 2679 |
| 2680 } // namespace gles2 | 2680 } // namespace gles2 |
| 2681 } // namespace gpu | 2681 } // namespace gpu |
| OLD | NEW |