Bug 295566
| Summary: | Safari in iOS reports support for texture-compression-bc feature | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | castano |
| Component: | WebGPU | Assignee: | Mike Wyrzykowski <mwyrzykowski> |
| Status: | RESOLVED FIXED | ||
| Severity: | Trivial | CC: | mwyrzykowski, tzagallo, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | iPhone / iPad | ||
| OS: | Unspecified | ||
castano
The following code:
if (adapter.features.has("texture-compression-bc")) {
features.push("texture-compression-bc");
}
const device = await adapter.requestDevice({ requiredFeatures: features });
ends up requesting the 'texture-compression-bc' feature, which iOS devices do not support. As a result, application tries to load textures with BC formats and this fails silently without creating a valid resource.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Mike Wyrzykowski
Apple9 iOS devices support it, see https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
Mike Wyrzykowski
Do you have a repro case? It looks like we only report it supported when the MTLDevice says its supported:
https://github.com/WebKit/WebKit/blob/3637869868d64861362d2cf84c63ad771996de2e/Source/WebGPU/WebGPU/HardwareCapabilities.mm#L127
if (device.supportsBCTextureCompression) {
features.append(WGPUFeatureName_TextureCompressionBC);
features.append(WGPUFeatureName_TextureCompressionBCSliced3D);
}
Mike Wyrzykowski
It's also supported by all M-chip iPads, see the the footnote from the feature set link:
Some GPU devices in the Apple7 and Apple8 families support BC texture compression in iPadOS. You can check
an individual GPU’s support for this feature by inspecting its MTLDevice.supportsBCTextureCompression
property at runtime. As of Apple9 all GPU’s have support.
Mike Wyrzykowski
If you can indicate which iPhone or iPad is failing, that would be appreciated and I can take a look. It's possible the root cause is a different issue.
iPhone 15 (non-Pro) and iPhone 14 (Pro) and lower phones should not be reporting support for BC textures. If that is not the case then certainly there is an issue.
castano
I had no idea this had been added to to the Apple9 family and was present in iOS also. Thanks for correcting me.
The problem must be something else. Here's a simple repro case:
https://ludicon.com/webspark/
This loads a regular texture and converts it to a block compression format in a compute shader. When using BC1 or BC7 no error is produced, but the output is blank. When using ASTC the example works as expected and shows the compressed texture. Is there any way to enable more verbose error logging?
Mike Wyrzykowski
Reopening given the repro, thank you
Radar WebKit Bug Importer
<rdar://problem/155293617>
Mike Wyrzykowski
Adding pushErrorScope / popErrorScope, https://www.w3.org/TR/webgpu/#dom-gpudevice-pusherrorscope , says:
An error occurred while creating sampler: setBindGroup: invalid bind group
Mike Wyrzykowski
oh that is because the texture is not getting created:
GPUTexture.createView: texture is not valid
Mike Wyrzykowski
Well that would do it:
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
case WGPUTextureFormat_BC1RGBAUnorm:
return MTLPixelFormatBC1_RGBA;
Mike Wyrzykowski
thanks for reporting this!
Mike Wyrzykowski
Pull request: https://github.com/WebKit/WebKit/pull/47725
castano
Thanks for the quick fix!
And for pointing me to the error scope documentation.
EWS
Committed 297133@main (f8ccf55729a1): <https://commits.webkit.org/297133@main>
Reviewed commits have been landed. Closing PR #47725 and removing active labels.