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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "gpu/command_buffer/service/error_state_mock.h" | 8 #include "gpu/command_buffer/service/error_state_mock.h" |
9 #include "gpu/command_buffer/service/feature_info.h" | 9 #include "gpu/command_buffer/service/feature_info.h" |
10 #include "gpu/command_buffer/service/framebuffer_manager.h" | 10 #include "gpu/command_buffer/service/framebuffer_manager.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 renderbuffer_manager_->Destroy(false); | 133 renderbuffer_manager_->Destroy(false); |
134 } | 134 } |
135 | 135 |
136 protected: | 136 protected: |
137 void SetUp() override { | 137 void SetUp() override { |
138 bool is_es3 = false; | 138 bool is_es3 = false; |
139 if (context_type_ == CONTEXT_TYPE_WEBGL2 || | 139 if (context_type_ == CONTEXT_TYPE_WEBGL2 || |
140 context_type_ == CONTEXT_TYPE_OPENGLES3) | 140 context_type_ == CONTEXT_TYPE_OPENGLES3) |
141 is_es3 = true; | 141 is_es3 = true; |
142 InitializeContext(is_es3 ? "3.0" : "2.0", "GL_EXT_framebuffer_object"); | 142 InitializeContext(is_es3 ? "3.0" : "2.0", "GL_EXT_framebuffer_object"); |
| 143 if (is_es3) { |
| 144 TestHelper::SetupFetureInfoEnableES3ValidatorsExpectations(gl_.get()); |
| 145 feature_info_->EnableES3ValidatorsForTesting(); |
| 146 } |
143 } | 147 } |
144 | 148 |
145 void InitializeContext(const char* gl_version, const char* extensions) { | 149 void InitializeContext(const char* gl_version, const char* extensions) { |
146 GpuServiceTest::SetUpWithGLVersion(gl_version, extensions); | 150 GpuServiceTest::SetUpWithGLVersion(gl_version, extensions); |
147 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(gl_.get(), | 151 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
148 extensions, "", gl_version, context_type_); | 152 gl_.get(), extensions, "", gl_version, context_type_, false); |
149 feature_info_->InitializeForTesting(context_type_); | 153 feature_info_->InitializeForTesting(context_type_); |
150 decoder_.reset(new MockGLES2Decoder()); | 154 decoder_.reset(new MockGLES2Decoder()); |
151 manager_.CreateFramebuffer(kClient1Id, kService1Id); | 155 manager_.CreateFramebuffer(kClient1Id, kService1Id); |
152 error_state_.reset(new ::testing::StrictMock<gles2::MockErrorState>()); | 156 error_state_.reset(new ::testing::StrictMock<gles2::MockErrorState>()); |
153 framebuffer_ = manager_.GetFramebuffer(kClient1Id); | 157 framebuffer_ = manager_.GetFramebuffer(kClient1Id); |
154 ASSERT_TRUE(framebuffer_ != nullptr); | 158 ASSERT_TRUE(framebuffer_ != nullptr); |
155 } | 159 } |
156 | 160 |
157 ContextType context_type_; | 161 ContextType context_type_; |
158 FramebufferManager manager_; | 162 FramebufferManager manager_; |
159 Framebuffer* framebuffer_; | 163 Framebuffer* framebuffer_; |
160 scoped_refptr<FeatureInfo> feature_info_; | 164 scoped_refptr<FeatureInfo> feature_info_; |
161 std::unique_ptr<TextureManager> texture_manager_; | 165 std::unique_ptr<TextureManager> texture_manager_; |
162 std::unique_ptr<RenderbufferManager> renderbuffer_manager_; | 166 std::unique_ptr<RenderbufferManager> renderbuffer_manager_; |
163 std::unique_ptr<MockErrorState> error_state_; | 167 std::unique_ptr<MockErrorState> error_state_; |
164 std::unique_ptr<MockGLES2Decoder> decoder_; | 168 std::unique_ptr<MockGLES2Decoder> decoder_; |
165 }; | 169 }; |
166 | 170 |
167 class FramebufferInfoTest : public FramebufferInfoTestBase { | 171 class FramebufferInfoTest : public FramebufferInfoTestBase { |
168 public: | 172 public: |
169 FramebufferInfoTest() : FramebufferInfoTestBase(CONTEXT_TYPE_OPENGLES2) {} | 173 FramebufferInfoTest() : FramebufferInfoTestBase(CONTEXT_TYPE_OPENGLES3) {} |
170 }; | 174 }; |
171 | 175 |
172 // GCC requires these declarations, but MSVC requires they not be present | 176 // GCC requires these declarations, but MSVC requires they not be present |
173 #ifndef COMPILER_MSVC | 177 #ifndef COMPILER_MSVC |
174 const GLuint FramebufferInfoTestBase::kClient1Id; | 178 const GLuint FramebufferInfoTestBase::kClient1Id; |
175 const GLuint FramebufferInfoTestBase::kService1Id; | 179 const GLuint FramebufferInfoTestBase::kService1Id; |
176 #endif | 180 #endif |
177 | 181 |
178 TEST_F(FramebufferInfoTest, Basic) { | 182 TEST_F(FramebufferInfoTest, Basic) { |
179 EXPECT_EQ(kService1Id, framebuffer_->service_id()); | 183 EXPECT_EQ(kService1Id, framebuffer_->service_id()); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 const GLsizei kSamples1 = 0; | 491 const GLsizei kSamples1 = 0; |
488 const GLsizei kWidth2 = 16; | 492 const GLsizei kWidth2 = 16; |
489 const GLsizei kHeight2 = 32; | 493 const GLsizei kHeight2 = 32; |
490 const GLint kLevel2 = 0; | 494 const GLint kLevel2 = 0; |
491 const GLenum kFormat2 = GL_RGB; | 495 const GLenum kFormat2 = GL_RGB; |
492 const GLenum kTarget2 = GL_TEXTURE_2D; | 496 const GLenum kTarget2 = GL_TEXTURE_2D; |
493 const GLsizei kSamples2 = 0; | 497 const GLsizei kSamples2 = 0; |
494 const GLsizei kWidth3 = 75; | 498 const GLsizei kWidth3 = 75; |
495 const GLsizei kHeight3 = 123; | 499 const GLsizei kHeight3 = 123; |
496 const GLint kLevel3 = 0; | 500 const GLint kLevel3 = 0; |
497 const GLenum kFormat3 = GL_RGBA; | 501 const GLenum kFormat3 = GL_RGB565; |
498 const GLsizei kSamples3 = 0; | 502 const GLsizei kSamples3 = 0; |
499 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 503 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
500 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 504 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
501 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 505 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
502 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), | 506 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), |
503 framebuffer_->IsPossiblyComplete(feature_info_.get())); | 507 framebuffer_->IsPossiblyComplete(feature_info_.get())); |
504 | 508 |
505 texture_manager_->CreateTexture(kTextureClient1Id, kTextureService1Id); | 509 texture_manager_->CreateTexture(kTextureClient1Id, kTextureService1Id); |
506 scoped_refptr<TextureRef> texture1( | 510 scoped_refptr<TextureRef> texture1( |
507 texture_manager_->GetTexture(kTextureClient1Id)); | 511 texture_manager_->GetTexture(kTextureClient1Id)); |
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 renderbuffer_manager_->GetRenderbuffer(kRenderbufferClientId); | 1647 renderbuffer_manager_->GetRenderbuffer(kRenderbufferClientId); |
1644 ASSERT_TRUE(renderbuffer != nullptr); | 1648 ASSERT_TRUE(renderbuffer != nullptr); |
1645 framebuffer_->AttachRenderbuffer(GL_COLOR_ATTACHMENT1, renderbuffer); | 1649 framebuffer_->AttachRenderbuffer(GL_COLOR_ATTACHMENT1, renderbuffer); |
1646 EXPECT_TRUE(framebuffer_->GetReadBufferAttachment()); | 1650 EXPECT_TRUE(framebuffer_->GetReadBufferAttachment()); |
1647 } | 1651 } |
1648 | 1652 |
1649 } // namespace gles2 | 1653 } // namespace gles2 |
1650 } // namespace gpu | 1654 } // namespace gpu |
1651 | 1655 |
1652 | 1656 |
OLD | NEW |