Chromium Code Reviews| 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 <memory> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 static const GLint kMaxExternalTextureSize = 32; | 61 static const GLint kMaxExternalTextureSize = 32; |
| 62 static const GLint kMax3DTextureSize = 512; | 62 static const GLint kMax3DTextureSize = 512; |
| 63 static const GLint kMaxArrayTextureLayers = 256; | 63 static const GLint kMaxArrayTextureLayers = 256; |
| 64 static const GLint kMax2dLevels = 6; | 64 static const GLint kMax2dLevels = 6; |
| 65 static const GLint kMaxCubeMapLevels = 4; | 65 static const GLint kMaxCubeMapLevels = 4; |
| 66 static const GLint kMaxExternalLevels = 1; | 66 static const GLint kMaxExternalLevels = 1; |
| 67 static const GLint kMax3dLevels = 10; | 67 static const GLint kMax3dLevels = 10; |
| 68 static const bool kUseDefaultTextures = false; | 68 static const bool kUseDefaultTextures = false; |
| 69 | 69 |
| 70 TextureManagerTest() { | 70 TextureManagerTest() { |
| 71 // Always run with this command line, but the ES3 features are not | 71 GpuDriverBugWorkarounds gpu_driver_bug_workaround; |
| 72 // enabled without FeatureInfo::EnableES3Validators(). | 72 feature_info_ = new FeatureInfo(gpu_driver_bug_workaround); |
| 73 base::CommandLine command_line(0, nullptr); | |
| 74 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); | |
| 75 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); | |
| 76 feature_info_ = new FeatureInfo(command_line, gpu_driver_bug_workaround); | |
| 77 } | 73 } |
| 78 | 74 |
| 79 ~TextureManagerTest() override {} | 75 ~TextureManagerTest() override {} |
| 80 | 76 |
| 81 protected: | 77 protected: |
| 82 void SetUp() override { | 78 void SetUp() override { |
| 83 GpuServiceTest::SetUp(); | 79 GpuServiceTest::SetUp(); |
| 84 manager_.reset(new TextureManager( | 80 manager_.reset(new TextureManager( |
| 85 NULL, feature_info_.get(), kMaxTextureSize, kMaxCubeMapTextureSize, | 81 NULL, feature_info_.get(), kMaxTextureSize, kMaxCubeMapTextureSize, |
| 86 kMaxRectangleTextureSize, kMax3DTextureSize, kMaxArrayTextureLayers, | 82 kMaxRectangleTextureSize, kMax3DTextureSize, kMaxArrayTextureLayers, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 101 void SetParameter( | 97 void SetParameter( |
| 102 TextureRef* texture_ref, GLenum pname, GLint value, GLenum error) { | 98 TextureRef* texture_ref, GLenum pname, GLint value, GLenum error) { |
| 103 TestHelper::SetTexParameteriWithExpectations( | 99 TestHelper::SetTexParameteriWithExpectations( |
| 104 gl_.get(), error_state_.get(), manager_.get(), | 100 gl_.get(), error_state_.get(), manager_.get(), |
| 105 texture_ref, pname, value, error); | 101 texture_ref, pname, value, error); |
| 106 } | 102 } |
| 107 | 103 |
| 108 void SetupFeatureInfo(const char* gl_extensions, | 104 void SetupFeatureInfo(const char* gl_extensions, |
| 109 const char* gl_version, | 105 const char* gl_version, |
| 110 bool enable_es3) { | 106 bool enable_es3) { |
| 107 ContextType context_type = | |
| 108 enable_es3 ? CONTEXT_TYPE_OPENGLES3 : CONTEXT_TYPE_OPENGLES2; | |
|
Zhenyao Mo
2016/11/02 21:46:28
nit: wrong indent
Kai Ninomiya
2016/11/02 22:43:21
Done.
| |
| 111 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 109 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 112 gl_.get(), gl_extensions, "", gl_version, | 110 gl_.get(), gl_extensions, "", gl_version, context_type); |
| 113 feature_info_->context_type(), enable_es3); | 111 feature_info_->InitializeForTesting(context_type); |
| 114 feature_info_->InitializeForTesting(); | 112 if (feature_info_->IsWebGL2OrES3Context()) { |
|
Zhenyao Mo
2016/11/02 21:46:28
Can we ASSERT here?
Kai Ninomiya
2016/11/02 22:43:21
Done.
| |
| 115 if (enable_es3) { | |
| 116 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) | 113 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) |
| 117 .WillOnce(SetArgPointee<1>(8)) | 114 .WillOnce(SetArgPointee<1>(8)) |
| 118 .RetiresOnSaturation(); | 115 .RetiresOnSaturation(); |
| 119 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) | 116 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) |
| 120 .WillOnce(SetArgPointee<1>(8)) | 117 .WillOnce(SetArgPointee<1>(8)) |
| 121 .RetiresOnSaturation(); | 118 .RetiresOnSaturation(); |
| 122 feature_info_->EnableES3Validators(); | 119 feature_info_->EnableES3Validators(); |
| 123 } | 120 } |
| 124 } | 121 } |
| 125 | 122 |
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2193 texture_manager2_.reset(); | 2190 texture_manager2_.reset(); |
| 2194 texture_manager1_->Destroy(false); | 2191 texture_manager1_->Destroy(false); |
| 2195 texture_manager1_.reset(); | 2192 texture_manager1_.reset(); |
| 2196 GpuServiceTest::TearDown(); | 2193 GpuServiceTest::TearDown(); |
| 2197 } | 2194 } |
| 2198 | 2195 |
| 2199 protected: | 2196 protected: |
| 2200 void SetupFeatureInfo(const char* gl_extensions, | 2197 void SetupFeatureInfo(const char* gl_extensions, |
| 2201 const char* gl_version, | 2198 const char* gl_version, |
| 2202 bool enable_es3) { | 2199 bool enable_es3) { |
| 2200 ContextType context_type = | |
| 2201 enable_es3 ? CONTEXT_TYPE_OPENGLES3 : CONTEXT_TYPE_OPENGLES2; | |
|
Zhenyao Mo
2016/11/02 21:46:28
nit: wrong indent
Kai Ninomiya
2016/11/02 22:43:21
Done.
| |
| 2203 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 2202 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 2204 gl_.get(), gl_extensions, "", gl_version, | 2203 gl_.get(), gl_extensions, "", gl_version, context_type); |
| 2205 feature_info_->context_type(), enable_es3); | 2204 feature_info_->InitializeForTesting(context_type); |
| 2206 feature_info_->InitializeForTesting(); | 2205 if (feature_info_->IsWebGL2OrES3Context()) { |
|
Zhenyao Mo
2016/11/02 21:46:28
Can we ASSERT here?
Kai Ninomiya
2016/11/02 22:43:21
Done.
| |
| 2207 if (enable_es3) { | |
| 2208 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) | 2206 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) |
| 2209 .WillOnce(SetArgPointee<1>(8)) | 2207 .WillOnce(SetArgPointee<1>(8)) |
| 2210 .RetiresOnSaturation(); | 2208 .RetiresOnSaturation(); |
| 2211 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) | 2209 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) |
| 2212 .WillOnce(SetArgPointee<1>(8)) | 2210 .WillOnce(SetArgPointee<1>(8)) |
| 2213 .RetiresOnSaturation(); | 2211 .RetiresOnSaturation(); |
| 2214 feature_info_->EnableES3Validators(); | 2212 feature_info_->EnableES3Validators(); |
| 2215 } | 2213 } |
| 2216 } | 2214 } |
| 2217 | 2215 |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2693 ExpectValid( | 2691 ExpectValid( |
| 2694 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); | 2692 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); |
| 2695 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, | 2693 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, |
| 2696 GL_DEPTH32F_STENCIL8); | 2694 GL_DEPTH32F_STENCIL8); |
| 2697 | 2695 |
| 2698 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); | 2696 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); |
| 2699 } | 2697 } |
| 2700 | 2698 |
| 2701 } // namespace gles2 | 2699 } // namespace gles2 |
| 2702 } // namespace gpu | 2700 } // namespace gpu |
| OLD | NEW |