| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 .WillOnce(SetArgPointee<1>(8)) | 117 .WillOnce(SetArgPointee<1>(8)) |
| 118 .RetiresOnSaturation(); | 118 .RetiresOnSaturation(); |
| 119 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) | 119 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) |
| 120 .WillOnce(SetArgPointee<1>(8)) | 120 .WillOnce(SetArgPointee<1>(8)) |
| 121 .RetiresOnSaturation(); | 121 .RetiresOnSaturation(); |
| 122 feature_info_->EnableES3Validators(); | 122 feature_info_->EnableES3Validators(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 scoped_refptr<FeatureInfo> feature_info_; | 126 scoped_refptr<FeatureInfo> feature_info_; |
| 127 scoped_ptr<TextureManager> manager_; | 127 std::unique_ptr<TextureManager> manager_; |
| 128 scoped_ptr<MockErrorState> error_state_; | 128 std::unique_ptr<MockErrorState> error_state_; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // GCC requires these declarations, but MSVC requires they not be present | 131 // GCC requires these declarations, but MSVC requires they not be present |
| 132 #ifndef COMPILER_MSVC | 132 #ifndef COMPILER_MSVC |
| 133 const GLint TextureManagerTest::kMaxTextureSize; | 133 const GLint TextureManagerTest::kMaxTextureSize; |
| 134 const GLint TextureManagerTest::kMaxCubeMapTextureSize; | 134 const GLint TextureManagerTest::kMaxCubeMapTextureSize; |
| 135 const GLint TextureManagerTest::kMaxRectangleTextureSize; | 135 const GLint TextureManagerTest::kMaxRectangleTextureSize; |
| 136 const GLint TextureManagerTest::kMaxExternalTextureSize; | 136 const GLint TextureManagerTest::kMaxExternalTextureSize; |
| 137 const GLint TextureManagerTest::kMax3DTextureSize; | 137 const GLint TextureManagerTest::kMax3DTextureSize; |
| 138 const GLint TextureManagerTest::kMax2dLevels; | 138 const GLint TextureManagerTest::kMax2dLevels; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 GpuServiceTest::TearDown(); | 755 GpuServiceTest::TearDown(); |
| 756 } | 756 } |
| 757 | 757 |
| 758 void SetParameter( | 758 void SetParameter( |
| 759 TextureRef* texture_ref, GLenum pname, GLint value, GLenum error) { | 759 TextureRef* texture_ref, GLenum pname, GLint value, GLenum error) { |
| 760 TestHelper::SetTexParameteriWithExpectations( | 760 TestHelper::SetTexParameteriWithExpectations( |
| 761 gl_.get(), error_state_.get(), manager_.get(), | 761 gl_.get(), error_state_.get(), manager_.get(), |
| 762 texture_ref, pname, value, error); | 762 texture_ref, pname, value, error); |
| 763 } | 763 } |
| 764 | 764 |
| 765 scoped_ptr<MockGLES2Decoder> decoder_; | 765 std::unique_ptr<MockGLES2Decoder> decoder_; |
| 766 scoped_ptr<MockErrorState> error_state_; | 766 std::unique_ptr<MockErrorState> error_state_; |
| 767 scoped_refptr<FeatureInfo> feature_info_; | 767 scoped_refptr<FeatureInfo> feature_info_; |
| 768 scoped_ptr<TextureManager> manager_; | 768 std::unique_ptr<TextureManager> manager_; |
| 769 scoped_refptr<TextureRef> texture_ref_; | 769 scoped_refptr<TextureRef> texture_ref_; |
| 770 }; | 770 }; |
| 771 | 771 |
| 772 class TextureTest : public TextureTestBase { | 772 class TextureTest : public TextureTestBase { |
| 773 protected: | 773 protected: |
| 774 void SetUp() override { SetUpBase(NULL, std::string()); } | 774 void SetUp() override { SetUpBase(NULL, std::string()); } |
| 775 }; | 775 }; |
| 776 | 776 |
| 777 class TextureMemoryTrackerTest : public TextureTestBase { | 777 class TextureMemoryTrackerTest : public TextureTestBase { |
| 778 protected: | 778 protected: |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 texture_manager2_->Destroy(false); | 2189 texture_manager2_->Destroy(false); |
| 2190 texture_manager2_.reset(); | 2190 texture_manager2_.reset(); |
| 2191 texture_manager1_->Destroy(false); | 2191 texture_manager1_->Destroy(false); |
| 2192 texture_manager1_.reset(); | 2192 texture_manager1_.reset(); |
| 2193 GpuServiceTest::TearDown(); | 2193 GpuServiceTest::TearDown(); |
| 2194 } | 2194 } |
| 2195 | 2195 |
| 2196 protected: | 2196 protected: |
| 2197 scoped_refptr<FeatureInfo> feature_info_; | 2197 scoped_refptr<FeatureInfo> feature_info_; |
| 2198 scoped_refptr<CountingMemoryTracker> memory_tracker1_; | 2198 scoped_refptr<CountingMemoryTracker> memory_tracker1_; |
| 2199 scoped_ptr<TextureManager> texture_manager1_; | 2199 std::unique_ptr<TextureManager> texture_manager1_; |
| 2200 scoped_refptr<CountingMemoryTracker> memory_tracker2_; | 2200 scoped_refptr<CountingMemoryTracker> memory_tracker2_; |
| 2201 scoped_ptr<TextureManager> texture_manager2_; | 2201 std::unique_ptr<TextureManager> texture_manager2_; |
| 2202 }; | 2202 }; |
| 2203 | 2203 |
| 2204 TEST_F(SharedTextureTest, DeleteTextures) { | 2204 TEST_F(SharedTextureTest, DeleteTextures) { |
| 2205 scoped_refptr<TextureRef> ref1 = texture_manager1_->CreateTexture(10, 10); | 2205 scoped_refptr<TextureRef> ref1 = texture_manager1_->CreateTexture(10, 10); |
| 2206 scoped_refptr<TextureRef> ref2 = | 2206 scoped_refptr<TextureRef> ref2 = |
| 2207 texture_manager2_->Consume(20, ref1->texture()); | 2207 texture_manager2_->Consume(20, ref1->texture()); |
| 2208 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 2208 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
| 2209 .Times(0); | 2209 .Times(0); |
| 2210 ref1 = NULL; | 2210 ref1 = NULL; |
| 2211 texture_manager1_->RemoveTexture(10); | 2211 texture_manager1_->RemoveTexture(10); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2674 ExpectValid( | 2674 ExpectValid( |
| 2675 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); | 2675 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); |
| 2676 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, | 2676 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, |
| 2677 GL_DEPTH32F_STENCIL8); | 2677 GL_DEPTH32F_STENCIL8); |
| 2678 | 2678 |
| 2679 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); | 2679 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); |
| 2680 } | 2680 } |
| 2681 | 2681 |
| 2682 } // namespace gles2 | 2682 } // namespace gles2 |
| 2683 } // namespace gpu | 2683 } // namespace gpu |
| OLD | NEW |