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

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

Issue 2905633002: Bind framebuffer to fbo_ object before readPixels, rather than multisample_fbo_ (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return FinishPrepareTextureMailboxSoftware(out_mailbox, 292 return FinishPrepareTextureMailboxSoftware(out_mailbox,
293 out_release_callback); 293 out_release_callback);
294 } else { 294 } else {
295 return FinishPrepareTextureMailboxGpu(out_mailbox, out_release_callback); 295 return FinishPrepareTextureMailboxGpu(out_mailbox, out_release_callback);
296 } 296 }
297 } 297 }
298 298
299 bool DrawingBuffer::FinishPrepareTextureMailboxSoftware( 299 bool DrawingBuffer::FinishPrepareTextureMailboxSoftware(
300 cc::TextureMailbox* out_mailbox, 300 cc::TextureMailbox* out_mailbox,
301 std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { 301 std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) {
302 DCHECK(state_restorer_);
302 std::unique_ptr<cc::SharedBitmap> bitmap = CreateOrRecycleBitmap(); 303 std::unique_ptr<cc::SharedBitmap> bitmap = CreateOrRecycleBitmap();
303 if (!bitmap) 304 if (!bitmap)
304 return false; 305 return false;
305 306
306 // Read the framebuffer into |bitmap|. 307 // Read the framebuffer into |bitmap|.
307 { 308 {
308 unsigned char* pixels = bitmap->pixels(); 309 unsigned char* pixels = bitmap->pixels();
309 DCHECK(pixels); 310 DCHECK(pixels);
310 bool need_premultiply = want_alpha_channel_ && !premultiplied_alpha_; 311 bool need_premultiply = want_alpha_channel_ && !premultiplied_alpha_;
311 WebGLImageConversion::AlphaOp op = 312 WebGLImageConversion::AlphaOp op =
312 need_premultiply ? WebGLImageConversion::kAlphaDoPremultiply 313 need_premultiply ? WebGLImageConversion::kAlphaDoPremultiply
313 : WebGLImageConversion::kAlphaDoNothing; 314 : WebGLImageConversion::kAlphaDoNothing;
xinghua.cao 2017/05/24 11:24:39 Here may be binding framebuffer on multisample_fbo
315 state_restorer_->SetFramebufferBindingDirty();
316 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_);
314 ReadBackFramebuffer(pixels, Size().Width(), Size().Height(), kReadbackSkia, 317 ReadBackFramebuffer(pixels, Size().Width(), Size().Height(), kReadbackSkia,
Zhenyao Mo 2017/05/24 20:31:01 I think BindFramebuffer(_, fbo_) should be part of
Ken Russell (switch to Gerrit) 2017/05/24 20:40:04 Looking at the code, I'm not sure it can be. Drawi
Zhenyao Mo 2017/05/24 20:53:30 kbr is right. Sorry about the noise. The code is f
xinghua.cao 2017/05/25 10:43:17 Hi, all, I am confused how to design the test case
Zhenyao Mo 2017/05/25 18:03:00 May check gl errors after PrepareTextureMailbox()
xinghua.cao 2017/05/26 15:26:23 I think it is more suitable to check the fbo bindi
315 op); 318 op);
316 } 319 }
317 320
318 *out_mailbox = cc::TextureMailbox(bitmap.get(), size_); 321 *out_mailbox = cc::TextureMailbox(bitmap.get(), size_);
319 out_mailbox->set_color_space(color_space_); 322 out_mailbox->set_color_space(color_space_);
320 323
321 // This holds a ref on the DrawingBuffer that will keep it alive until the 324 // This holds a ref on the DrawingBuffer that will keep it alive until the
322 // mailbox is released (and while the release callback is running). It also 325 // mailbox is released (and while the release callback is running). It also
323 // owns the SharedBitmap. 326 // owns the SharedBitmap.
324 auto func = WTF::Bind(&DrawingBuffer::MailboxReleasedSoftware, 327 auto func = WTF::Bind(&DrawingBuffer::MailboxReleasedSoftware,
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 if (pixel_unpack_buffer_binding_dirty_) 1383 if (pixel_unpack_buffer_binding_dirty_)
1381 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); 1384 client->DrawingBufferClientRestorePixelUnpackBufferBinding();
1382 } 1385 }
1383 1386
1384 bool DrawingBuffer::ShouldUseChromiumImage() { 1387 bool DrawingBuffer::ShouldUseChromiumImage() {
1385 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && 1388 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() &&
1386 chromium_image_usage_ == kAllowChromiumImage; 1389 chromium_image_usage_ == kAllowChromiumImage;
1387 } 1390 }
1388 1391
1389 } // namespace blink 1392 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698