RESOLVED FIXED Bug 202836
Enable WebGL's ASTC extension all the time
https://bugs.webkit.org/show_bug.cgi?id=202836
Summary Enable WebGL's ASTC extension all the time
Kenneth Russell
Reported 2019-10-10 17:51:39 PDT
In Bug 185272 ASTC compressed texture support was added to the WebGL implementation. Currently it's behind a run-time flag. It should be removed from behind this flag and just enabled whenever the underlying OpenGL (ES) extensions are available, so it auto-enables whenever sufficient support is present.
Attachments
Patch (6.36 KB, patch)
2019-11-08 16:11 PST, Kenneth Russell
dino: review+
Kenneth Russell
Comment 1 2019-11-07 16:24:08 PST
Blocking on the ETC1/ETC2 bug, which alphabetizes the compressed texture extensions in some of the code.
Kenneth Russell
Comment 2 2019-11-08 16:11:16 PST
Kenneth Russell
Comment 3 2019-11-08 16:16:01 PST
Built on macOS. Still building for the iOS Simulator, with WebKit modified to always use an OpenGL ES 3.0 context, to verify the WebGL conformance test passes.
Kenneth Russell
Comment 4 2019-11-09 01:19:58 PST
I built this patch for the iOS Simulator, plus a couple of changes to GraphicsContext3DCocoa.mm to force the use of ES 3.0 contexts: diff --git a/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm b/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm index d1af803f38d..6a7c5eaa598 100644 --- a/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm +++ b/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm @@ -192,6 +192,8 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default; #endif + m_attrs.isWebGL2 = true; + #if !USE(ANGLE) #if USE(OPENGL_ES) if (m_attrs.isWebGL2) @@ -215,6 +217,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind if (m_attrs.isWebGL2) ::glEnable(GraphicsContext3D::PRIMITIVE_RESTART_FIXED_INDEX); + m_isForWebGL2 = m_attrs.isWebGL2; #elif USE(OPENGL) bool useMultisampling = m_attrs.antialias; Unfortunately https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/webgl-compressed-texture-astc.html still reported no support for ASTC textures on the iPhone SE for WebKit Development. Appreciate others' help getting this patch tested and over the finish line. Thanks.
shrekshao
Comment 5 2019-11-25 16:05:12 PST
I know this patch is for NonAngle case. The debugging shows it's Extensions3DOpenGLCommon::m_availableExtensions that doesn't include the ASTC extension string. Given that it is initialized by calling glGetStringi, I doubt if the iPhone Simulator on Mac could ever populate such extension if the underlying gpu hardware doesn't support the ASTC extension? If this could be verified I think we could only test this patch on real iPhone. Could Dean or Justin help to verify this? Thanks!
Dean Jackson
Comment 6 2019-12-03 16:11:25 PST
(In reply to shrekshao from comment #5) > I know this patch is for NonAngle case. > The debugging shows it's Extensions3DOpenGLCommon::m_availableExtensions > that doesn't include the ASTC extension string. Given that it is initialized > by calling glGetStringi, I doubt if the iPhone Simulator on Mac could ever > populate such extension if the underlying gpu hardware doesn't support the > ASTC extension? If this could be verified I think we could only test this > patch on real iPhone. Could Dean or Justin help to verify this? Thanks! I'll test, but from what I recall, ASTC is only supported on device (and as Ken pointed out, > iPhone SE)
Dean Jackson
Comment 7 2019-12-03 16:13:02 PST
Oh. I also think ASTC was only supported on devices when using a GLES 3 context, not a GLES 2 context :( That's why Justin put it behind a flag for now.
Dean Jackson
Comment 8 2019-12-03 16:13:59 PST
Comment on attachment 383175 [details] Patch r=me I'll test manually before landing this.
Kenneth Russell
Comment 9 2019-12-03 16:59:42 PST
Thanks Dean for helping with this. Please see the diff in https://bugs.webkit.org/show_bug.cgi?id=202836#c4 which was needed to force WebGL to use an ES3 context by default. Still the simulator didn't appear to support ASTC compressed textures - maybe not surprising since the emulation path would be much more complex than ETC? ETC is supported by the simulator.
Radar WebKit Bug Importer
Comment 10 2019-12-04 10:02:49 PST
Dean Jackson
Comment 11 2019-12-04 10:03:03 PST
I confirmed this works on devices (that themselves support ASTC).
Radar WebKit Bug Importer
Comment 12 2019-12-04 10:03:09 PST
Dean Jackson
Comment 13 2019-12-04 10:05:30 PST
Kenneth Russell
Comment 14 2019-12-04 11:07:39 PST
Thank you Dean for testing and landing this!
Kenneth Russell
Comment 15 2020-02-18 16:48:08 PST
*** Bug 194751 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.