WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
226975
iPhone 6S - iOS 15.0 - unable to retrieve WebGL2 context
https://bugs.webkit.org/show_bug.cgi?id=226975
Summary
iPhone 6S - iOS 15.0 - unable to retrieve WebGL2 context
Luigi De Rosa
Reported
2021-06-14 08:47:40 PDT
Created
attachment 431330
[details]
WebGL2 not active Browser is unable to get webgl2 context, even though is well enabled in settings (by default). version: iOS15.0 hardware: iPhone 6S
Attachments
WebGL2 not active
(3.12 MB, video/mp4)
2021-06-14 08:47 PDT
,
Luigi De Rosa
no flags
Details
Patch
(2.24 KB, patch)
2021-06-23 04:31 PDT
,
Kimmo Kinnunen
no flags
Details
Formatted Diff
Diff
Patch
(2.36 KB, patch)
2021-06-24 05:28 PDT
,
Kimmo Kinnunen
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2021-06-14 17:07:21 PDT
rdar://78966563
Kenneth Russell
Comment 2
2021-06-16 11:03:24 PDT
Kyle mentioned on Slack that ANGLE's Metal backend looks for Apple GPU Family 4 at a minimum, possibly because of features around depth comparison samplers. The restriction was added in:
https://chromium-review.googlesource.com/c/angle/angle/+/2433332
and is related to:
https://bugs.chromium.org/p/angleproject/issues/detail?id=5107
It's not completely clear to me why GPU Family 4 is needed. It doesn't seem to add features over GPU Family 3 that are required to implement GLES 3.0:
https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
Kimmo Kinnunen
Comment 3
2021-06-22 04:21:41 PDT
To recap: Limitation "iOS GPU Family 4 || macOS GPU Family 1 means GLES 3.0" went in with the shadow texture implementation. This implementation was with GLSL -> SPIRV -> MSL code-path. It is assumed that this intended to check support of non-trivial `sample_compare` `lod_options` parameters `lod` and `gradient`. This check is errorneous since this is not what the docs say today, at least from the direct-to-msl implementation perspective. The docs say that a) `sample_compare` has `lod_options` b) On macOS `sample_compare` does not support non-trivial `lod_options` prior to Metal 2.2 [sic] c) On macOS some hardware supports `sample_compare` `lod` and `gradient` Metal 2.3. [sic] So the doc leaves a bit much for the reader to intrepret about non-trivial `lod_options`. My interpretation is: - On iOS it is always supported (unknown if this is true) - On macOS it is not supported by default - On macOS Metal >= 2.3 it is supported on unspecified GPUs So the correct check is: `iOS || (macOS && Metal >= 2.3 && GPU == unspecified GPU)` In direct-to-metal translator we already have feature flags for these features: ANGLE_FEATURE_CONDITION((&mFeatures), allowSamplerCompareGradient, supportsEitherGPUFamily(3,1)); ANGLE_FEATURE_CONDITION((&mFeatures), allowSamplerCompareLod, supportsEitherGPUFamily(3,1)); The condition is not consistent with my interpretation of the specification. However, it is more convenient condition, since it enables support for all supported iOS devices. The feature flag is queried in the _shaders_. As an aside: I don't understand why the shaders aren't generated per feature flag. However, I'm not versed enough in the functions to understand if the `else` branches are correct. If I understand correctly, they are not, as otherwise we shouldn't have the `sample_compare` function in the first place. The plan of action based on my interpretation: 1) To support WebGL 2.0 on iPhone, iPad at the A9, A10 processor level: - downgrade the GLES 3.0 GPU family check to 3. 2) To support GLSL shadow samplers correctly on new macOS versions: - implement the fallback correctly - implement the unspecified gpu check correctly 3) To support GLSL shadow samplers correctly on older macOS versions - implement the Metal version check correctly The fast path that currently is the only implemented version cannot be supported on older macOSes at the moment due to Metal versions shipped in these OSes. Reference:
https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
! ios-metal2.1: Support the unified graphics and computing language revision 2.1 programs for iOS 12. ! ios-metal2.2: Support the unified graphics and computing language revision 2.2 programs for iOS 13. ! ios-metal2.3: Support the unified graphics and computing language revision 2.3 programs for iOS 14. ! macos-metal2.1: Support the unified graphics and computing language revision 2.1 programs for macOS 10.14. ! macos-metal2.2: Support the unified graphics and computing language revision 2.2 programs for macOS 10.15. ! macos-metal2.3: Support the unified graphics and computing language revision 2.3 programs for macOS 11.0.
> On macOS prior to Metal 2.2, for sample_compare functions, bias and gradient* are not supported, and lod must be a zero constant. In Metal 2.3, this restriction is lifted for some hardware. > Since Metal 2.2, you can specify a LOD range for a sampler.
Kenneth Russell
Comment 4
2021-06-22 16:42:02 PDT
Great investigation Kimmo! It would be great if we could address the issues you've found iteratively. Getting WebGL 2.0 support on A9 and A10 GPUs on iOS is probably the most time-critical issue. Would it be possible to separate out that change, and to do the needed macOS fixes in a follow-up bug? Is there a way to find out if the assertion is true that sample_compare's lod_options are always supported on iOS?
Kimmo Kinnunen
Comment 5
2021-06-23 04:31:06 PDT
Created
attachment 432030
[details]
Patch
EWS Watchlist
Comment 6
2021-06-23 04:32:10 PDT
Note that there are important steps to take when updating ANGLE. See
https://trac.webkit.org/wiki/UpdatingANGLE
Kenneth Russell
Comment 7
2021-06-23 23:11:12 PDT
Comment on
attachment 432030
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=432030&action=review
> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm:-374 > -#if TARGET_OS_SIMULATOR // Simulator should be able to support ES3, despite not supporting iOS GPU
A bunch of tests are newly failing on the iOS simulator bot. Should this #ifdef be kept?
Kyle Piddington
Comment 8
2021-06-23 23:12:33 PDT
Comment on
attachment 432030
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=432030&action=review
>> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm:-374 >> -#if TARGET_OS_SIMULATOR // Simulator should be able to support ES3, despite not supporting iOS GPU > > A bunch of tests are newly failing on the iOS simulator bot. Should this #ifdef be kept?
In this case, yes. iOS simulator supports GPUFamily 2, but not 3, which is why we're going to see test failures.
Kimmo Kinnunen
Comment 9
2021-06-24 05:28:20 PDT
Created
attachment 432152
[details]
Patch
Kenneth Russell
Comment 10
2021-06-24 18:44:57 PDT
Comment on
attachment 432152
[details]
Patch Looks good! r+
EWS
Comment 11
2021-06-28 03:03:19 PDT
Committed
r279327
(
239202@main
): <
https://commits.webkit.org/239202@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 432152
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug