Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferSoftwareRenderingTest.cpp

Issue 2905633002: Bind framebuffer to fbo_ object before readPixels, rather than multisample_fbo_ (Closed)
Patch Set: rebase code Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/gpu/DrawingBuffer.h" 5 #include "platform/graphics/gpu/DrawingBuffer.h"
6 6
7 #include "cc/resources/single_release_callback.h" 7 #include "cc/resources/single_release_callback.h"
8 #include "cc/resources/texture_mailbox.h" 8 #include "cc/resources/texture_mailbox.h"
9 #include "gpu/command_buffer/client/gles2_interface_stub.h" 9 #include "gpu/command_buffer/client/gles2_interface_stub.h"
10 #include "platform/graphics/gpu/DrawingBufferTestHelpers.h" 10 #include "platform/graphics/gpu/DrawingBufferTestHelpers.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class DrawingBufferSoftwareRenderingTest : public Test { 46 class DrawingBufferSoftwareRenderingTest : public Test {
47 protected: 47 protected:
48 void SetUp() override { 48 void SetUp() override {
49 IntSize initial_size(kInitialWidth, kInitialHeight); 49 IntSize initial_size(kInitialWidth, kInitialHeight);
50 std::unique_ptr<GLES2InterfaceForTests> gl = 50 std::unique_ptr<GLES2InterfaceForTests> gl =
51 WTF::WrapUnique(new GLES2InterfaceForTests); 51 WTF::WrapUnique(new GLES2InterfaceForTests);
52 std::unique_ptr<WebGraphicsContext3DProviderSoftwareRenderingForTests> 52 std::unique_ptr<WebGraphicsContext3DProviderSoftwareRenderingForTests>
53 provider = WTF::WrapUnique( 53 provider = WTF::WrapUnique(
54 new WebGraphicsContext3DProviderSoftwareRenderingForTests( 54 new WebGraphicsContext3DProviderSoftwareRenderingForTests(
55 std::move(gl))); 55 std::move(gl)));
56 GLES2InterfaceForTests* gl_ =
57 static_cast<GLES2InterfaceForTests*>(provider->ContextGL());
xinghua.cao 2017/06/02 16:06:28 provider will been released after "std::move(provi
Ken Russell (switch to Gerrit) 2017/06/02 21:52:50 Understood. It might be desirable to clean up the
56 drawing_buffer_ = DrawingBufferForTests::Create( 58 drawing_buffer_ = DrawingBufferForTests::Create(
57 std::move(provider), nullptr, initial_size, DrawingBuffer::kPreserve, 59 std::move(provider), gl_, initial_size, DrawingBuffer::kPreserve,
58 kDisableMultisampling); 60 kDisableMultisampling);
59 CHECK(drawing_buffer_); 61 CHECK(drawing_buffer_);
60 } 62 }
61 63
62 RefPtr<DrawingBufferForTests> drawing_buffer_; 64 RefPtr<DrawingBufferForTests> drawing_buffer_;
63 bool is_software_rendering_ = false; 65 bool is_software_rendering_ = false;
64 }; 66 };
65 67
66 TEST_F(DrawingBufferSoftwareRenderingTest, bitmapRecycling) { 68 TEST_F(DrawingBufferSoftwareRenderingTest, BitmapRecycling) {
67 cc::TextureMailbox texture_mailbox; 69 cc::TextureMailbox texture_mailbox;
68 std::unique_ptr<cc::SingleReleaseCallback> release_callback1; 70 std::unique_ptr<cc::SingleReleaseCallback> release_callback1;
69 std::unique_ptr<cc::SingleReleaseCallback> release_callback2; 71 std::unique_ptr<cc::SingleReleaseCallback> release_callback2;
70 std::unique_ptr<cc::SingleReleaseCallback> release_callback3; 72 std::unique_ptr<cc::SingleReleaseCallback> release_callback3;
71 IntSize initial_size(kInitialWidth, kInitialHeight); 73 IntSize initial_size(kInitialWidth, kInitialHeight);
72 IntSize alternate_size(kInitialWidth, kAlternateHeight); 74 IntSize alternate_size(kInitialWidth, kAlternateHeight);
73 75
74 drawing_buffer_->Resize(initial_size); 76 drawing_buffer_->Resize(initial_size);
75 drawing_buffer_->MarkContentsChanged(); 77 drawing_buffer_->MarkContentsChanged();
76 drawing_buffer_->PrepareTextureMailbox( 78 drawing_buffer_->PrepareTextureMailbox(
(...skipping 17 matching lines...) Expand all
94 drawing_buffer_->PrepareTextureMailbox( 96 drawing_buffer_->PrepareTextureMailbox(
95 &texture_mailbox, 97 &texture_mailbox,
96 &release_callback3); // cause recycling queue to be purged due to resize 98 &release_callback3); // cause recycling queue to be purged due to resize
97 EXPECT_EQ(0, drawing_buffer_->RecycledBitmapCount()); 99 EXPECT_EQ(0, drawing_buffer_->RecycledBitmapCount());
98 release_callback3->Run(gpu::SyncToken(), false /* lostResource */); 100 release_callback3->Run(gpu::SyncToken(), false /* lostResource */);
99 EXPECT_EQ(1, drawing_buffer_->RecycledBitmapCount()); 101 EXPECT_EQ(1, drawing_buffer_->RecycledBitmapCount());
100 102
101 drawing_buffer_->BeginDestruction(); 103 drawing_buffer_->BeginDestruction();
102 } 104 }
103 105
106 TEST_F(DrawingBufferSoftwareRenderingTest, FramebufferBinding) {
107 GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests();
108 cc::TextureMailbox texture_mailbox;
109 std::unique_ptr<cc::SingleReleaseCallback> release_callback;
110 IntSize initial_size(kInitialWidth, kInitialHeight);
111 GLint drawBinding = 0, readBinding = 0;
112
113 GLuint draw_framebuffer_binding = 0xbeef3;
114 GLuint read_framebuffer_binding = 0xbeef4;
115 gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_framebuffer_binding);
116 gl_->BindFramebuffer(GL_READ_FRAMEBUFFER, read_framebuffer_binding);
117 gl_->SaveState();
118 drawing_buffer_->Resize(initial_size);
119 drawing_buffer_->MarkContentsChanged();
120 drawing_buffer_->PrepareTextureMailbox(&texture_mailbox, &release_callback);
121 gl_->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawBinding);
122 gl_->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readBinding);
123 EXPECT_EQ(static_cast<GLint>(draw_framebuffer_binding), drawBinding);
124 EXPECT_EQ(static_cast<GLint>(read_framebuffer_binding), readBinding);
125 release_callback->Run(gpu::SyncToken(), false /* lostResource */);
126
127 drawing_buffer_->BeginDestruction();
128 }
129
104 } // unnamed namespace 130 } // unnamed namespace
105 } // blink 131 } // blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698