Changeset 247453 in webkit
- Timestamp:
- Jul 15, 2019 3:27:45 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247452 r247453 1 2019-07-15 Dean Jackson <dino@apple.com> 2 3 [WebGL] Remove software rendering and simplify context creation on macOS 4 https://bugs.webkit.org/show_bug.cgi?id=199789 5 6 Reviewed by Sam Weinig. 7 8 We don't ever want to fall-back to the software renderer. We'd be better 9 off failing to create the context completely. 10 11 Also, the number of fall-back attempts we were making before hitting 12 the software renderer was overkill. All hardware we support should 13 handle a 32bpp buffer. 14 15 Lastly, we don't want to support supersampling - multisampling only. 16 17 I lied… there is one more thing - failing to create the context 18 was causing an ASSERT trying to remove the GC3D from the global list. 19 20 * html/canvas/WebGLRenderingContextBase.cpp: 21 (WebCore::WebGLRenderingContextBase::create): 22 * page/Settings.yaml: Remove forceSoftwareWebGL setting. 23 * platform/graphics/GraphicsContext3DAttributes.h: 24 * platform/graphics/GraphicsContext3DManager.cpp: 25 (WebCore::GraphicsContext3DManager::addContext): 26 (WebCore::GraphicsContext3DManager::removeContext): 27 (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): 28 * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: 29 (WebCore::GraphicsContext3D::GraphicsContext3D): 30 (WebCore::setPixelFormat): Deleted. 31 1 32 2019-07-14 Dean Jackson <dino@apple.com> 2 33 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r247452 r247453 562 562 } 563 563 } 564 565 if (frame->settings().forceSoftwareWebGLRendering())566 attributes.forceSoftwareRenderer = true;567 564 568 565 if (frame->settings().forceWebGLUsesLowPower()) { -
trunk/Source/WebCore/page/Settings.yaml
r247444 r247453 238 238 unhandledPromiseRejectionToConsoleEnabled: 239 239 initial: true 240 forceSoftwareWebGLRendering:241 initial: false242 240 forceWebGLUsesLowPower: 243 241 initial: false -
trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h
r234380 r247453 47 47 48 48 // Additional attributes. 49 bool forceSoftwareRenderer { false };50 49 bool shareResources { true }; 51 50 bool isWebGL2 { false }; -
trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp
r246554 r247453 161 161 if (!context) 162 162 return; 163 163 164 164 #if PLATFORM(MAC) && !ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 165 165 if (!m_contexts.size()) … … 174 174 void GraphicsContext3DManager::removeContext(GraphicsContext3D* context) 175 175 { 176 ASSERT(m_contexts.contains(context)); 176 if (!m_contexts.contains(context)) 177 return; 177 178 m_contexts.removeFirst(context); 178 179 m_contextWindowMap.remove(context); … … 208 209 void GraphicsContext3DManager::removeContextRequiringHighPerformance(GraphicsContext3D* context) 209 210 { 211 if (!context) 212 return; 213 210 214 if (!m_contextsRequiringHighPerformance.contains(context)) 211 215 return; -
trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
r247422 r247453 99 99 }; 100 100 101 #if USE(OPENGL)102 103 static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, bool isWebGL2, bool allowOfflineRenderers)104 {105 attribs.clear();106 107 attribs.append(kCGLPFAColorSize);108 attribs.append(static_cast<CGLPixelFormatAttribute>(colorBits));109 attribs.append(kCGLPFADepthSize);110 attribs.append(static_cast<CGLPixelFormatAttribute>(depthBits));111 112 // This attribute, while mentioning offline renderers, is actually113 // allowing us to request the integrated graphics on a dual GPU114 // system, and not force the discrete GPU.115 // See https://developer.apple.com/library/mac/technotes/tn2229/_index.html116 if (allowOfflineRenderers)117 attribs.append(kCGLPFAAllowOfflineRenderers);118 119 if (accelerated)120 attribs.append(kCGLPFAAccelerated);121 else {122 attribs.append(kCGLPFARendererID);123 attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLRendererGenericFloatID));124 }125 126 if (supersample && !antialias)127 attribs.append(kCGLPFASupersample);128 129 if (closest)130 attribs.append(kCGLPFAClosestPolicy);131 132 if (antialias) {133 attribs.append(kCGLPFAMultisample);134 attribs.append(kCGLPFASampleBuffers);135 attribs.append(static_cast<CGLPixelFormatAttribute>(1));136 attribs.append(kCGLPFASamples);137 attribs.append(static_cast<CGLPixelFormatAttribute>(4));138 }139 140 if (isWebGL2) {141 // FIXME: Instead of backing a WebGL2 GraphicsContext3D with a OpenGL 4 context, we should instead back it with ANGLE.142 // Use an OpenGL 4 context for now until the ANGLE backend is ready.143 attribs.append(kCGLPFAOpenGLProfile);144 attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_GL4_Core));145 }146 147 attribs.append(static_cast<CGLPixelFormatAttribute>(0));148 }149 150 #endif // USE(OPENGL)151 152 101 RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle) 153 102 { … … 290 239 ::glEnable(GraphicsContext3D::PRIMITIVE_RESTART_FIXED_INDEX); 291 240 #elif USE(OPENGL) 292 Vector<CGLPixelFormatAttribute> attribs; 293 CGLPixelFormatObj pixelFormatObj = 0; 294 GLint numPixelFormats = 0; 295 241 296 242 #if HAVE(APPLE_GRAPHICS_CONTROL) 297 243 m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default; … … 300 246 #endif 301 247 302 // If we're configured to demand the software renderer, we'll303 // do so. We attempt to create contexts in this order:304 //305 // 1) 32 bit RGBA/32 bit depth/supersampled306 // 2) 32 bit RGBA/32 bit depth307 // 3) 32 bit RGBA/16 bit depth308 //309 // If we were not forced into software mode already, our final attempt is310 // to try that:311 //312 // 4) closest to 32 bit RGBA/16 bit depth/software renderer313 //314 // If none of that works, we fail and leave m_contextObj as nullptr.315 316 248 bool useMultisampling = m_attrs.antialias; 317 249 318 setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers()); 250 Vector<CGLPixelFormatAttribute> attribs; 251 CGLPixelFormatObj pixelFormatObj = 0; 252 GLint numPixelFormats = 0; 253 254 attribs.append(kCGLPFAAccelerated); 255 attribs.append(kCGLPFAColorSize); 256 attribs.append(static_cast<CGLPixelFormatAttribute>(32)); 257 attribs.append(kCGLPFADepthSize); 258 attribs.append(static_cast<CGLPixelFormatAttribute>(32)); 259 260 // This attribute, while mentioning offline renderers, is actually 261 // allowing us to request the integrated graphics on a dual GPU 262 // system, and not force the discrete GPU. 263 // See https://developer.apple.com/library/mac/technotes/tn2229/_index.html 264 if (allowOfflineRenderers()) 265 attribs.append(kCGLPFAAllowOfflineRenderers); 266 267 if (useMultisampling) { 268 attribs.append(kCGLPFAMultisample); 269 attribs.append(kCGLPFASampleBuffers); 270 attribs.append(static_cast<CGLPixelFormatAttribute>(1)); 271 attribs.append(kCGLPFASamples); 272 attribs.append(static_cast<CGLPixelFormatAttribute>(4)); 273 } 274 275 if (attrs.isWebGL2) { 276 // FIXME: Instead of backing a WebGL2 GraphicsContext3D with a OpenGL 4 context, we should instead back it with ANGLE. 277 // Use an OpenGL 4 context for now until the ANGLE backend is ready. 278 attribs.append(kCGLPFAOpenGLProfile); 279 attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_GL4_Core)); 280 } 281 282 attribs.append(static_cast<CGLPixelFormatAttribute>(0)); 283 319 284 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats); 320 321 if (!numPixelFormats) {322 setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());323 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);324 325 if (!numPixelFormats) {326 setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());327 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);328 329 if (!numPixelFormats) {330 setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());331 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);332 333 if (!attrs.forceSoftwareRenderer && !numPixelFormats) {334 setPixelFormat(attribs, 32, 16, false, false, true, false, attrs.isWebGL2, allowOfflineRenderers());335 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);336 useMultisampling = false;337 }338 }339 }340 }341 285 342 286 if (!numPixelFormats) -
trunk/Source/WebKit/ChangeLog
r247444 r247453 1 2019-07-15 Dean Jackson <dino@apple.com> 2 3 [WebGL] Remove software rendering and simplify context creation on macOS 4 https://bugs.webkit.org/show_bug.cgi?id=199789 5 6 Reviewed by Sam Weinig. 7 8 Remove force software WebGL setting. 9 10 * Shared/WebPreferences.yaml: 11 * UIProcess/API/C/WKPreferences.cpp: 12 (WKPreferencesSetForceSoftwareWebGLRendering): Deleted. 13 (WKPreferencesGetForceSoftwareWebGLRendering): Deleted. 14 * UIProcess/API/C/WKPreferencesRefPrivate.h: 15 1 16 2019-07-15 Daniel Bates <dabates@apple.com> 2 17 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r247388 r247453 130 130 type: bool 131 131 defaultValue: true 132 133 ForceSoftwareWebGLRendering:134 type: bool135 defaultValue: false136 132 137 133 Accelerated2dCanvasEnabled: -
trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
r246807 r247453 470 470 } 471 471 472 void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef, bool flag)473 {474 toImpl(preferencesRef)->setForceSoftwareWebGLRendering(flag);475 }476 477 bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef)478 {479 return toImpl(preferencesRef)->forceSoftwareWebGLRendering();480 }481 482 472 void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef, bool flag) 483 473 { -
trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
r246444 r247453 92 92 93 93 // Defaults to false. 94 WK_EXPORT void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef, bool);95 WK_EXPORT bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef);96 97 // Defaults to false.98 94 WK_EXPORT void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef, bool); 99 95 WK_EXPORT bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r247416 r247453 1 2019-07-15 Dean Jackson <dino@apple.com> 2 3 [WebGL] Remove software rendering and simplify context creation on macOS 4 https://bugs.webkit.org/show_bug.cgi?id=199789 5 6 Reviewed by Sam Weinig. 7 8 Remove force software WebGL setting. 9 10 * WebView/WebPreferenceKeysPrivate.h: 11 * WebView/WebPreferences.mm: 12 (+[WebPreferences initialize]): 13 (-[WebPreferences forceSoftwareWebGLRendering]): Deleted. 14 (-[WebPreferences setForceSoftwareWebGLRendering:]): Deleted. 15 * WebView/WebPreferencesPrivate.h: 16 * WebView/WebView.mm: 17 (-[WebView _preferencesChanged:]): 18 1 19 2019-07-13 Zalan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
r246444 r247453 119 119 #define WebKitWebGL2EnabledPreferenceKey @"WebKitWebGL2Enabled" 120 120 #define WebKitWebGPUEnabledPreferenceKey @"WebKitWebGPUEnabled" 121 #define WebKitForceSoftwareWebGLRenderingPreferenceKey @"WebKitForceSoftwareWebGLRendering"122 121 #define WebKitForceWebGLUsesLowPowerPreferenceKey @"WebKitForceWebGLUsesLowPower" 123 122 #define WebKitAccelerated2dCanvasEnabledPreferenceKey @"WebKitAccelerated2dCanvasEnabled" -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
r246444 r247453 507 507 [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey, 508 508 [NSNumber numberWithBool:YES], WebKitWebGLEnabledPreferenceKey, 509 [NSNumber numberWithBool:NO], WebKitForceSoftwareWebGLRenderingPreferenceKey,510 509 [NSNumber numberWithBool:YES], WebKitForceWebGLUsesLowPowerPreferenceKey, 511 510 [NSNumber numberWithBool:NO], WebKitAccelerated2dCanvasEnabledPreferenceKey, … … 2145 2144 } 2146 2145 2147 - (BOOL)forceSoftwareWebGLRendering2148 {2149 return [self _boolValueForKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];2150 }2151 2152 - (void)setForceSoftwareWebGLRendering:(BOOL)forced2153 {2154 [self _setBoolValue:forced forKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];2155 }2156 2157 2146 - (BOOL)forceLowPowerGPUForWebGL 2158 2147 { -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
r246444 r247453 275 275 - (BOOL)webGL2Enabled; 276 276 - (void)setWebGL2Enabled:(BOOL)enabled; 277 278 - (BOOL)forceSoftwareWebGLRendering;279 - (void)setForceSoftwareWebGLRendering:(BOOL)forced;280 277 281 278 - (BOOL)forceLowPowerGPUForWebGL; -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r247117 r247453 2940 2940 settings.setSubpixelAntialiasedLayerTextEnabled([preferences subpixelAntialiasedLayerTextEnabled]); 2941 2941 2942 settings.setForceSoftwareWebGLRendering([preferences forceSoftwareWebGLRendering]);2943 2942 settings.setForceWebGLUsesLowPower([preferences forceLowPowerGPUForWebGL]); 2944 2943 settings.setAccelerated2dCanvasEnabled([preferences accelerated2dCanvasEnabled]);
Note: See TracChangeset
for help on using the changeset viewer.