Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 977 { | 977 { |
| 978 ScopedStateRestorer scoped_state_restorer(this); | 978 ScopedStateRestorer scoped_state_restorer(this); |
| 979 ResolveIfNeeded(); | 979 ResolveIfNeeded(); |
| 980 } | 980 } |
| 981 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 981 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 982 } | 982 } |
| 983 | 983 |
| 984 void DrawingBuffer::ResolveMultisampleFramebufferInternal() { | 984 void DrawingBuffer::ResolveMultisampleFramebufferInternal() { |
| 985 DCHECK(state_restorer_); | 985 DCHECK(state_restorer_); |
| 986 state_restorer_->SetFramebufferBindingDirty(); | 986 state_restorer_->SetFramebufferBindingDirty(); |
| 987 if (WantExplicitResolve() && !contents_change_resolved_) { | 987 if (WantExplicitResolve()) { |
| 988 state_restorer_->SetClearStateDirty(); | 988 state_restorer_->SetClearStateDirty(); |
| 989 gl_->BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, multisample_fbo_); | 989 gl_->BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, multisample_fbo_); |
| 990 gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, fbo_); | 990 gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, fbo_); |
| 991 gl_->Disable(GL_SCISSOR_TEST); | 991 gl_->Disable(GL_SCISSOR_TEST); |
| 992 | 992 |
| 993 int width = size_.Width(); | 993 int width = size_.Width(); |
| 994 int height = size_.Height(); | 994 int height = size_.Height(); |
| 995 // Use NEAREST, because there is no scale performed during the blit. | 995 // Use NEAREST, because there is no scale performed during the blit. |
| 996 GLuint filter = GL_NEAREST; | 996 GLuint filter = GL_NEAREST; |
| 997 | 997 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1010 gl_->Clear(GL_COLOR_BUFFER_BIT); | 1010 gl_->Clear(GL_COLOR_BUFFER_BIT); |
| 1011 } | 1011 } |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 1014 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 1015 if (anti_aliasing_mode_ == kScreenSpaceAntialiasing) | 1015 if (anti_aliasing_mode_ == kScreenSpaceAntialiasing) |
| 1016 gl_->ApplyScreenSpaceAntialiasingCHROMIUM(); | 1016 gl_->ApplyScreenSpaceAntialiasingCHROMIUM(); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 void DrawingBuffer::ResolveIfNeeded() { | 1019 void DrawingBuffer::ResolveIfNeeded() { |
| 1020 if (anti_aliasing_mode_ != kNone) | 1020 if (anti_aliasing_mode_ != kNone && !contents_change_resolved_) |
|
Zhenyao Mo
2017/04/13 17:36:06
This is a behavioral change. Because before even
xinghua.cao
2017/04/26 10:46:37
Zhenyao, I had made a more carefully investigation
Ken Russell (switch to Gerrit)
2017/04/28 00:10:00
This sounds correct. One note: DrawingBuffer::Prep
dshwang
2017/04/28 02:08:29
I think so.
dshwang
2017/04/28 02:48:42
ResolveMultisampleFramebufferInternal() set fbo di
| |
| 1021 ResolveMultisampleFramebufferInternal(); | 1021 ResolveMultisampleFramebufferInternal(); |
| 1022 contents_change_resolved_ = true; | 1022 contents_change_resolved_ = true; |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 void DrawingBuffer::RestoreFramebufferBindings() { | 1025 void DrawingBuffer::RestoreFramebufferBindings() { |
| 1026 client_->DrawingBufferClientRestoreFramebufferBinding(); | 1026 client_->DrawingBufferClientRestoreFramebufferBinding(); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 void DrawingBuffer::RestoreAllState() { | 1029 void DrawingBuffer::RestoreAllState() { |
| 1030 client_->DrawingBufferClientRestoreScissorTest(); | 1030 client_->DrawingBufferClientRestoreScissorTest(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1060 data_size *= height; | 1060 data_size *= height; |
| 1061 if (!data_size.IsValid()) | 1061 if (!data_size.IsValid()) |
| 1062 return false; | 1062 return false; |
| 1063 | 1063 |
| 1064 WTF::ArrayBufferContents pixels(width * height, 4, | 1064 WTF::ArrayBufferContents pixels(width * height, 4, |
| 1065 WTF::ArrayBufferContents::kNotShared, | 1065 WTF::ArrayBufferContents::kNotShared, |
| 1066 WTF::ArrayBufferContents::kDontInitialize); | 1066 WTF::ArrayBufferContents::kDontInitialize); |
| 1067 | 1067 |
| 1068 GLuint fbo = 0; | 1068 GLuint fbo = 0; |
| 1069 state_restorer_->SetFramebufferBindingDirty(); | 1069 state_restorer_->SetFramebufferBindingDirty(); |
| 1070 if (source_buffer == kFrontBuffer && front_color_buffer_) { | 1070 if (source_buffer == kFrontBuffer && front_color_buffer_) { |
|
xinghua.cao
2017/04/28 02:40:08
Hi, all, another question here.
I think if context
dshwang
2017/04/28 02:48:42
public methods are guard by |state_restorer_| and
xinghua.cao
2017/04/28 02:56:02
Yes, here is no problem. Thank you @dshwang.
| |
| 1071 gl_->GenFramebuffers(1, &fbo); | 1071 gl_->GenFramebuffers(1, &fbo); |
| 1072 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo); | 1072 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo); |
| 1073 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 1073 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 1074 front_color_buffer_->parameters.target, | 1074 front_color_buffer_->parameters.target, |
| 1075 front_color_buffer_->texture_id, 0); | 1075 front_color_buffer_->texture_id, 0); |
| 1076 } else { | 1076 } else { |
| 1077 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 1077 gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 ReadBackFramebuffer(static_cast<unsigned char*>(pixels.Data()), width, height, | 1080 ReadBackFramebuffer(static_cast<unsigned char*>(pixels.Data()), width, height, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1301 if (pixel_unpack_buffer_binding_dirty_) | 1301 if (pixel_unpack_buffer_binding_dirty_) |
| 1302 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); | 1302 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 bool DrawingBuffer::ShouldUseChromiumImage() { | 1305 bool DrawingBuffer::ShouldUseChromiumImage() { |
| 1306 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && | 1306 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && |
| 1307 chromium_image_usage_ == kAllowChromiumImage; | 1307 chromium_image_usage_ == kAllowChromiumImage; |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 } // namespace blink | 1310 } // namespace blink |
| OLD | NEW |