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

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

Issue 2597933002: Avoid to resolve CMAA for read and draw without content changed or with content committed. (Closed)
Patch Set: rebase code Created 3 years, 8 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 m_gl->ClearStencil(0); 961 m_gl->ClearStencil(0);
962 clearMask |= GL_STENCIL_BUFFER_BIT; 962 clearMask |= GL_STENCIL_BUFFER_BIT;
963 m_gl->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); 963 m_gl->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF);
964 } 964 }
965 965
966 clearFramebuffersInternal(clearMask); 966 clearFramebuffersInternal(clearMask);
967 return true; 967 return true;
968 } 968 }
969 969
970 void DrawingBuffer::resolveAndBindForReadAndDraw() { 970 void DrawingBuffer::resolveAndBindForReadAndDraw() {
971 { 971 if (m_contentsChanged) {
dshwang 2017/04/08 02:16:32 I think it's better to change m_antiAliasingMode !
Zhenyao Mo 2017/04/12 23:38:08 I agree !m_contentsChangeResolved is a better cond
xinghua.cao 2017/04/13 10:50:24 It seems a repeating condition here, thank you.
972 ScopedStateRestorer scopedStateRestorer(this); 972 ScopedStateRestorer scopedStateRestorer(this);
973 resolveIfNeeded(); 973 resolveIfNeeded();
974 } 974 }
975 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); 975 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
976 } 976 }
977 977
978 void DrawingBuffer::resolveMultisampleFramebufferInternal() { 978 void DrawingBuffer::resolveMultisampleFramebufferInternal() {
979 DCHECK(m_stateRestorer); 979 DCHECK(m_stateRestorer);
980 m_stateRestorer->setFramebufferBindingDirty(); 980 m_stateRestorer->setFramebufferBindingDirty();
981 if (wantExplicitResolve() && !m_contentsChangeResolved) { 981 if (wantExplicitResolve() && !m_contentsChangeResolved) {
(...skipping 17 matching lines...) Expand all
999 contextProvider() 999 contextProvider()
1000 ->getCapabilities() 1000 ->getCapabilities()
1001 .disable_multisampling_color_mask_usage) { 1001 .disable_multisampling_color_mask_usage) {
1002 m_gl->ClearColor(0, 0, 0, 1); 1002 m_gl->ClearColor(0, 0, 0, 1);
1003 m_gl->ColorMask(false, false, false, true); 1003 m_gl->ColorMask(false, false, false, true);
1004 m_gl->Clear(GL_COLOR_BUFFER_BIT); 1004 m_gl->Clear(GL_COLOR_BUFFER_BIT);
1005 } 1005 }
1006 } 1006 }
1007 1007
1008 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); 1008 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
1009 if (m_antiAliasingMode == ScreenSpaceAntialiasing) 1009 if (m_antiAliasingMode == ScreenSpaceAntialiasing &&
1010 !m_contentsChangeResolved)
1010 m_gl->ApplyScreenSpaceAntialiasingCHROMIUM(); 1011 m_gl->ApplyScreenSpaceAntialiasingCHROMIUM();
1011 } 1012 }
1012 1013
1013 void DrawingBuffer::resolveIfNeeded() { 1014 void DrawingBuffer::resolveIfNeeded() {
1014 if (m_antiAliasingMode != None) 1015 if (m_antiAliasingMode != None)
1015 resolveMultisampleFramebufferInternal(); 1016 resolveMultisampleFramebufferInternal();
1016 m_contentsChangeResolved = true; 1017 m_contentsChangeResolved = true;
1017 } 1018 }
1018 1019
1019 void DrawingBuffer::restoreFramebufferBindings() { 1020 void DrawingBuffer::restoreFramebufferBindings() {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 if (m_pixelUnpackBufferBindingDirty) 1297 if (m_pixelUnpackBufferBindingDirty)
1297 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); 1298 client->DrawingBufferClientRestorePixelUnpackBufferBinding();
1298 } 1299 }
1299 1300
1300 bool DrawingBuffer::shouldUseChromiumImage() { 1301 bool DrawingBuffer::shouldUseChromiumImage() {
1301 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && 1302 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() &&
1302 m_chromiumImageUsage == AllowChromiumImage; 1303 m_chromiumImageUsage == AllowChromiumImage;
1303 } 1304 }
1304 1305
1305 } // namespace blink 1306 } // 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