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.
Blocking on the ETC1/ETC2 bug, which alphabetizes the compressed texture extensions in some of the code.
Created attachment 383175 [details]
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.
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
@@ -192,6 +192,8 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
+ m_attrs.isWebGL2 = true;
@@ -215,6 +217,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
+ m_isForWebGL2 = m_attrs.isWebGL2;
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.
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!
(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)
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.
Comment on attachment 383175 [details]
I'll test manually before landing this.
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.
I confirmed this works on devices (that themselves support ASTC).
Committed r253108: <https://trac.webkit.org/changeset/253108>
Thank you Dean for testing and landing this!
*** Bug 194751 has been marked as a duplicate of this bug. ***