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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 for (GLenum i = GL_DRAW_BUFFER2_ARB; | 1064 for (GLenum i = GL_DRAW_BUFFER2_ARB; |
1065 i < GL_DRAW_BUFFER0_ARB + kMaxDrawBuffers; ++i) { | 1065 i < GL_DRAW_BUFFER0_ARB + kMaxDrawBuffers; ++i) { |
1066 EXPECT_EQ(static_cast<GLenum>(GL_NONE), | 1066 EXPECT_EQ(static_cast<GLenum>(GL_NONE), |
1067 framebuffer_->GetDrawBuffer(i)); | 1067 framebuffer_->GetDrawBuffer(i)); |
1068 } | 1068 } |
1069 | 1069 |
1070 // Only draw buffer 1 needs clearing, so we need to mask draw buffer 0. | 1070 // Only draw buffer 1 needs clearing, so we need to mask draw buffer 0. |
1071 EXPECT_CALL(*gl_, DrawBuffersARB(kMaxDrawBuffers, _)) | 1071 EXPECT_CALL(*gl_, DrawBuffersARB(kMaxDrawBuffers, _)) |
1072 .Times(1) | 1072 .Times(1) |
1073 .RetiresOnSaturation(); | 1073 .RetiresOnSaturation(); |
1074 EXPECT_TRUE(framebuffer_->PrepareDrawBuffersForClear()); | 1074 EXPECT_TRUE( |
| 1075 framebuffer_->PrepareDrawBuffersForClearingUninitializedAttachments()); |
1075 | 1076 |
1076 // Now we disable draw buffer 1. | 1077 // Now we disable draw buffer 1. |
1077 buffers[1] = GL_NONE; | 1078 buffers[1] = GL_NONE; |
1078 framebuffer_->SetDrawBuffers(2, buffers); | 1079 framebuffer_->SetDrawBuffers(2, buffers); |
1079 // We will enable the disabled draw buffer for clear(), and disable it | 1080 // We will enable the disabled draw buffer for clear(), and disable it |
1080 // after the clear. | 1081 // after the clear. |
1081 EXPECT_CALL(*gl_, DrawBuffersARB(kMaxDrawBuffers, _)) | 1082 EXPECT_CALL(*gl_, DrawBuffersARB(kMaxDrawBuffers, _)) |
1082 .Times(1) | 1083 .Times(1) |
1083 .RetiresOnSaturation(); | 1084 .RetiresOnSaturation(); |
1084 EXPECT_TRUE(framebuffer_->PrepareDrawBuffersForClear()); | 1085 EXPECT_TRUE( |
| 1086 framebuffer_->PrepareDrawBuffersForClearingUninitializedAttachments()); |
1085 | 1087 |
1086 // Now we disable draw buffer 0, enable draw buffer 1. | 1088 // Now we disable draw buffer 0, enable draw buffer 1. |
1087 buffers[0] = GL_NONE; | 1089 buffers[0] = GL_NONE; |
1088 buffers[1] = GL_COLOR_ATTACHMENT1; | 1090 buffers[1] = GL_COLOR_ATTACHMENT1; |
1089 framebuffer_->SetDrawBuffers(2, buffers); | 1091 framebuffer_->SetDrawBuffers(2, buffers); |
1090 // This is the perfect setting for clear. No need to call DrawBuffers(). | 1092 // This is the perfect setting for clear. No need to call DrawBuffers(). |
1091 EXPECT_FALSE(framebuffer_->PrepareDrawBuffersForClear()); | 1093 EXPECT_FALSE( |
| 1094 framebuffer_->PrepareDrawBuffersForClearingUninitializedAttachments()); |
1092 } | 1095 } |
1093 | 1096 |
1094 class FramebufferInfoFloatTest : public FramebufferInfoTest { | 1097 class FramebufferInfoFloatTest : public FramebufferInfoTest { |
1095 public: | 1098 public: |
1096 FramebufferInfoFloatTest() | 1099 FramebufferInfoFloatTest() |
1097 : FramebufferInfoTest() { | 1100 : FramebufferInfoTest() { |
1098 } | 1101 } |
1099 ~FramebufferInfoFloatTest() override {} | 1102 ~FramebufferInfoFloatTest() override {} |
1100 | 1103 |
1101 protected: | 1104 protected: |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 renderbuffer_manager_->GetRenderbuffer(kRenderbufferClientId); | 1421 renderbuffer_manager_->GetRenderbuffer(kRenderbufferClientId); |
1419 ASSERT_TRUE(renderbuffer != NULL); | 1422 ASSERT_TRUE(renderbuffer != NULL); |
1420 framebuffer_->AttachRenderbuffer(GL_COLOR_ATTACHMENT1, renderbuffer); | 1423 framebuffer_->AttachRenderbuffer(GL_COLOR_ATTACHMENT1, renderbuffer); |
1421 EXPECT_TRUE(framebuffer_->GetReadBufferAttachment()); | 1424 EXPECT_TRUE(framebuffer_->GetReadBufferAttachment()); |
1422 } | 1425 } |
1423 | 1426 |
1424 } // namespace gles2 | 1427 } // namespace gles2 |
1425 } // namespace gpu | 1428 } // namespace gpu |
1426 | 1429 |
1427 | 1430 |
OLD | NEW |