WebGPU now available for testing in Safari Technology Preview
webkit.org
webkit.org
IIRC Safari had the flag too that time, not just the Technical Preview.
Apple is using WebXR for the Vision Pro, but it isn't clear if it will ever be available on iPhones.
By all accounts, Apple's /only/ stance was that if WebGPU used SPIR-V it would be a non-starter for them, due to ongoing legal issues between Apple and Khronos.
Apple actually proposed WebHLSL in collaboration with Microsoft, to have HLSL be the standard.
Mozilla employee's stance[0] was that SPIRV was too low level, did not fit with the goals of WebGPU portability and security, and expressed concern that Khronos may add functionality to SPIRV they cannot support in WebGPU like raytracing instructions .. 'So we'd always be on the verge of forking SPIR-V in some way.'
It was also noted by many people that even if a bytecode format was used, it would still have to be translated to the target (HLSL/DXIL, MSL, etc.) in almost the same way a text format would.
Nobody proposed a 'GPU WASM equivalent' or an alternative bytecode format, only SPIRV was ever considered AFAIK.
The hard truth is that shader compilation is a fucking nightmare, people do not realize how bad it is across the different native APIs. SPIR-V is good, but it doesn't solve that - and presents other challenges if you are a web browser API. Vulkan and SPIRV are not the golden goose many make them out to be.
[0] https://github.com/gpuweb/gpuweb/issues/847#issuecomment-642...
And exactly, Apple did not want SPIR-V (a bytecode) and proposed WebHLSL (a textual source language) instead. So, I think my statement that Apple preferred a textual format over a bytecode is correct. They could have proposed another bytecode format, but as you noted, nobody did.
It does not really matter anyway, because the GPU hardware and software paradigms are still undergoing rapid change. And there are a whole lot of under-specified things like memory models, scheduling order, control flow uniformity etc. which I expect will take another iteration of standards to be established.
> By all accounts, Apple's /only/ stance was that if WebGPU used SPIR-V it would be a non-starter for them
This is false. Apple's other stance, very strongly stated, was that no binary IR of any kind was acceptable, full stop. Lichtso's original comment is right. Apple explicitly rejected "GPU WASM equivalent or an alternative bytecode format", not just SPIR-V. They would only accept a textual programming language.
Now Apple didn't mandate WGSL, but clearly they wouldn't have accepted GLSL either for their unfortunate legal reasons so that pretty much leaves WHLSL or "new language" as the only options. I don't know why WHLSL ultimately lost. I remember hearing arguments that HLSL as a language was essentially implementation defined rather than rigorously standardized, making it hard to realize any benefit of code portability or reuse from existing codebases.
> I had a chance to work with SPIR-V rather intimately, and I’m becoming convinced that most of the defenders of this format (who like to criticize WGSL in turn) have little experience actually doing anything with it [...] I was one of them. SPIR-V is probably a good format for what it was made for: driver compilers. It’s not as good for the intermediate portable representations of your shaders.
[0] http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html
> Apple's other stance, very strongly stated, was that no binary IR of any kind was acceptable, full stop.
Very strongly stated /where/?
I linked my source, in which kvark clearly stated two things (not as part of his 'devils advocate' position) that directly contradict your claim:
> There is much more to it than just "Apple cannot do X" that often shows up.
> the group agreed to [...] take the semantics of SPIR-V where it makes sense
If there really is a source for it, I'd love to see it (genuinely).
OK, I found what I believe are the most relevant meeting notes [1]. Unfortunately the meeting notes are not a straight transcript and not everything that was said is in there verbatim. There were also side discussions not captured at all. The meeting notes say "Apple would strongly prefer a text-based language to a binary one". This is really an understatement of their position on the matter, and the notes don't capture the most contentious arguments well. But you can at least see in the notes that Apple was arguing strenuously against binary formats generically, even more so than SPIR-V itself in this meeting, going as far as arguing that a hypothetical SPIR-V assembly in text format would be better than SPIR-V in binary form.
[1] https://docs.google.com/document/d/1CmKo59tjZwmePVrFpHpIG0W5...
That means easier builds for the developer, smaller apps, receiving implicit upgrades in lockstep with the OS. Take the example of new metal versions enabling new optimization avenues. Bundling your own dependency would mean that you need to keep on top of the changes to take advantage of it , but with a system framework you’d get it whenever Apple’s engineers enable it.
This makes me suspicious that something has changed to push the balance here, and it must be something to do with trying to offload the execution of LLMs and related neural networks on to clients to reduce the cost of doing it server side.
If a random webpage is asking to use my GPU (especially if it's a sketchy-looking site I just got redirected to), that would raise flags and I'd deny access. If a game or visualization requests access, especially if it's something I've heard others praise, I'd take the risk.
Sure, someone could embed a vulnerability in some decent app which uses the GPU for actual rendering, but it's a lot harder.
I like the permission idea.
I've seen this argument being made quite often. However, I have yet to any evidence given. Can you provide concrete examples of how WebGPU is less secure than WebGL or other web APIs?
By the way, it was tiresome when people told me to go Google answers. It's just as tiresome when people tell me to go ask an AI. I'm here to talk with real people, not computers.
Besides, HN is a place where there's often an expert who will know far more than what's widely available on the web about even the most obscure of technical knowledge.
Source? "GPUs feel low-level like C and C is unsafe" is a vibes argument.
> (The spectre countermeasures around high resolution timing can still bite you).
The fact this is a problem at the highest of levels provides further damning evidence that this isn't a large change to the status quo.
From the preview page:
To enable WebGPU, turn on the “WebGPU”, “GPU Process: DOM Rendering” and “GPU Process: Canvas Rendering” feature flags in the Feature Flags tab in Safari Preferences. If you don’t see the Feature Flags tab, you need to first check “Show features for web developers” in the Advanced tab.
Same here.
Took a beat to realize I was looking at the OP and WebGPU demos in Safari.app instead of Safari Technology Preview.app.
Or was it that metal came from a team in Apple that helped work on WebGPU?
Apple plays that game well.
Then the standard changed a bit, but it was still based on modern GPU APIs
It's not really anything to do with WebGPU in particular.
It is almost a rule with webkit new features.
Those new APIs almost work, but you need to use user-agent detection to make sure it really works and it does not fail randomly/silently when it is in home screen or some other iOS browser.
As with all STP releases, this is the time to report issues before the feature makes it into the next version of Safari.
It just silently fails. UA detection is needed for detecting bug version.
For example Wake lock API has been broken from iOS 16.4 that is like over 9 months.
Or zindex rendering was flickering between iOS 15.7 to 16.4
Some renderings work in Desktop safari but it is different in mobile safari with same version.
It sucks but it is reality of iOS developer experience.
I’ve never actually developed against Chromium, and my position as a staunch Firefox user (and a Nightly user at that, for at least eleven of the last thirteen years) may be negatively affecting my judgement in this, but although what you say may be true from a features perspective, I don’t find that at all difficult to manage, and from a bugs perspective my impression is that Chromium has historically tended to be much buggier: that Firefox shipped better quality, later, while Chromium shipped lower quality, earlier. Though I do get the sense that this is less true than it used to be, and that Chromium is generally of higher quality for features of a certain age now than five years ago. And I reiterate, this is about the vibes I’ve got, as a Firefox user. I’ve tended to have to file more interesting or problematic bugs against Chromium than against Firefox.
https://i.imgur.com/lMHkiH8.jpg
"Reload Without Content Blockers" and "Reload Reducing Other Privacy Protections" might be what you need. It might be Safari's anti-tracking/cookie features that might be at fault or it might be that you have a content blocker that's causing an issue. If you're using iCloud Private Relay, it's possible that sites are filtering those IP addresses or there's a DNS issue and you can use "Reload and Show IP Address" to check that. For example, iCloud Private Relay often uses Cloudflare's DNS. archive.is doesn't work with Cloudflare's DNS (because Cloudflare won't leak your location to their DNS servers and so archive.is returns bad results to them).
It's usually smaller things like SVGs not working with CSS animations, or SVG filters causing weird edge case issues, but I'd really expect any major browser to fully support something like SVG and it's a little disappointing to find that the browser is the issue.
See this post for historical context: https://codepen.io/AmeliaBR/post/me-and-svg
https://mutraction.dev/sandbox/?view=normal
Reports say there is some iframe load failure showing in the network monitor. Every file being loaded is a normal static file served from a CDN. Also, sometimes, when it fails there's a rare chance that a reload will make it work?
Like can PWAs run in background or respond to location changes, etc
And I haven’t heard anyone say “you know I have a really great experience with web apps. I wish all of my apps were web apps on mobile and Electron on my computer”
I think a part of it is an "app craze", i.e. organizations want "apps" just because "an app" is something fancier and totally different than "just a website". I have done an "app" like this (implemented as an optionally installable website).
Also many people, including many developers, also vastly underestimate what can be done with contemporary browsers, so they assume that "a native app" is needed if you e.g. want to take a picture or read a file.
My main concern is monetization.
With a PWA the traditional monetization method of selling apps doesn’t work. So, your options will be a subscription or ads.
But, a subscription is too much hustle for small utilities and casual games. And I love apps like Procreate that are paid, without subscription and ad-free.
How so? Offer to install the pwa and unlock functionality only after the user has paid. How is that different from a paid "app"?
Everything is doable, and I recognize that my comment of “doesn’t work” was exaggerated.
But I don’t think small apps will do all that work when it is easier to monetize with ads. A more likely scenario for ad-free utilities will be having umbrella subscriptions a la Netflix (like Apple Arcade).
I’m a web dev, too, and I read many enthusiastic articles about PWAs as the future. (Mostly from Google evangelism, for a good business reason). But, the “old school” guy in me that grown-up loading games in diskettes feels that something is lost and more invasive in that future. (I’m not comparing it with the current App Store experience but with the experience of macOS/Windows/Linux, where you can still manually install app binaries).
We're basically there already unfortunately, even for store-distributed software. Apps like Procreate and Pixelmator are a rarity these days.
It definitely doesn't help that the App Store makes charging for new major versions awkward, and that upgrade discounts are basically impossible, but I suspect the main reason is that most developers just make more money from subs than purchases.
As a consumer though, it sucks. Subscriptions are fine if your product has an ongoing cost to you as the developer, for example server or API fees. And I really don't mind JetBrains-style subs, where you can cancel any time and you retain access to the last version you paid for, for as long as it still works on your machine. But, while I appreciate the need for ongoing revenue to continue paying salaries, I am not interested in renting software in perpetuity—that's not a fair deal. Especially when it robs me of the ability to stick with an older version if I prefer it.
Not really, no
> There is no real reason to have a native app.
Except, you know, for all the reasons where anything web-based sucks: resources needed to run, fast reaction times, performant animations, rich complex controls etc.
The web, unfortunately, made everyone accept the most limited and under-developed version of what things could be.
But you have to apply them to DOM. Where every single little thing results in a re-layout and repaint. There are reasons why you still can't animate height: auto.
The built-in controls also don't help. Can't find it now, but details set display:none or visibility:none on closed contents, and that can't be animated.
And there are a million such things.
The development experience for a PWA could be a dream and it won’t matter if users don’t like them.
User acceptance is all that matters.
WebGPU feels like an outlier in that respect but then it is intended as a “better” WebGL so it makes sense that if you already have WebGL you might as well have WebGPU. It’s a lot closer to Apple’s Metal API than WebGL is so they have an interest in people switching.
My point is that Apple is competing with other browser implementations on MacOS, yet I’ve very rarely used anything other than Safari. Most exceptions have actually been because I need a plugin to debug the JS framework I’m using.
I read that both Google and Mozilla are developing non webkit iOS browsers in anticipation of some regulatory changes, and also that Apple has been staffing up the webkit/Safari team in response.
If WebKit's market share on iOS were to drop this low, web developers would likely test for WebKit a lot less, and tolerate WebKit's missing features a lot less, and Apple would soon face much worse web compatibility problems on both platforms. To prevent that they saw that they needed to seriously step up their investment in WebKit, and from what I've observed it seems like they did. Though perhaps not yet to the level they really need. Old habits die hard.
Of course they could just do what Microsoft did and give up. I'm glad they haven't.
[1] [Edit: this site was wrong, see below for better numbers]
https://radar.cloudflare.com/reports/browser-market-share-20...
Cloudflare puts Safari at a bit under 40% for MacOS, so it looks like I’m very much n=1 and not particularly representative. Marketshare for Safari on MacOS is close to 85%, so I can definitely see that changing if users could install real alternate browsers.
In Apple's case, I think there's some utility behind their drive for WebGPU: it's basically Apple's Metal graphics API. If WebGPU takes off, it'll mean a lot of developers getting familiar with something very similar to Apple's Metal API. Apple seems to be pursuing a long-term strategy of bringing more games to their platform. From the Game Porting Toolkit to ray tracing in their processors to Apple Vision to simply giving gaming a lot more attention in their keynotes.
And Apple might be well positioned to capitalize on gaming. A $130 Apple TV has a lot more CPU and graphics power than a Nintendo Switch. The same applies to the iPhones people are carrying around. It might not compete with giant consoles from Microsoft and Sony, but Apple has been showing that it can offer impressive gaming performance.
Fast forward to 2026: does a next-gen Apple TV have hardware ray tracing? Apple put a 2021 A15 processor in the 2022 Apple TV. It seems reasonable that they could put something better than a 2023 A17 Pro in a 2026 Apple TV (a 3 year old processor at that point). Sure, Microsoft and Sony will have next-gen consoles, but at what point are graphics facing diminishing returns? Nintendo has the most popular console even though it's older and was low-powered to begin with. For PC games, one must assume that some people are running graphics cards that are older.
I'm not saying this will happen. Companies can be fickle. However, Apple has show a reasonably consistent (if slow) move toward games over the past year or two. They're making the investments now and WebGPU's Metal-like API could be part of that strategy.
Heck, maybe WebGPU is even a strategy to avoid lawsuits from companies like Epic and anti-trust action from regulators. If you don't like the App Store rules, just use WebGPU. If games with native-level graphics can be distributed via the web, then there isn't nearly as much for regulators to go after the App Store.
This came out in the Epic Trial. Those people are much less likely to put a credit card on any random site.
Candy Crush games could already be done on the web on mobile - it wouldn’t be nearly as monetizable
Apple Pay is only in certain counties, with supported banks/cards. iTunes/App Store supports a plethora of payment options across the world, as well as Apple Pay.
Both companies are working very hard to remove this image though for obvious political reasons.
There is literally, for now, zero risk of that. companies will have devs meet the customers where they are at. Of the largest mobile market share platform in the USA doesn’t support PWA or only supports it without features the company requires, said company will build an iOS app. As has been the case.
Application developers will not go anywhere, for many reasons:
- iOS is where the money's at
- PWAs are not "apps". They are web apps with all the limitations it implies. You want complex functionality, rich controls, fluid animations and a billion other things? You go for native apps.
iOS 16.4 added new wake lock api but it does not work in PWA. Still not fixed in iOS 17.2
iOS 17 removed dark/light mode switching in PWA. Still broken in iOS 17.2
I'm really doubtful Apple sees Safari as competition for their app store distribution. I don't think that matches reality of how most consumers use mobile devices and spend money.
I don’t think they see Safari as competing with the App Store. Even with the recent PWA additions it doesn’t seem to matter.
At this point I’d say Safari is 100% a hedge against being fully dependent on Google/Chrome. It started to not be dependent on MS/IE and improve what MS didn’t care a ton about.
Apple HATES being fully dependent on others for very important stuff. They’ve been burned too many times.
Safari is great. I love it. But there’s no way it is ever going away even if they are forced to preload 18 different app stores and 4 browsers on every phone by the different governments of the world.
It’s Apple keeping control of Apple’s destiny.
How could the performance of a web app ever be faster than a native app? That’s impossible.
On the PWA side, best guess is anti-competition scrutiny.
Main issues:
* Since introduction of sandboxing the memory-usage is far too high. It was pretty low before.
* WebRTC. They had it nearly implemented years ago. Then removed it because they were unhappy with it. But their new approach isn’t available until now.
* Many more developers needed. This means me?
* Epiphany releases are linked to GNOME releases. Only applications which are integrated parts of GNOME should do that. The rigid six months release cycle is problematic.
Regarding memory usage. Sandboxing depends on multi-process. The multi-process shouldn’t be an issue. The sandboxing was added in late 2019 and - if I remember correctly - Epiphany started to eat memory. Like probably most people I keep my tabs when closing/opening the Web-browser. The developers are nice and explained, that for all previous existing tabs a separate sandbox process and a render-process is already started with a blank page. And due to need separation no process is allowed to share memory with others. What is needed is only showing a label on the tab until the tab is actually used.And. Midori? There was previously also Midori using WebKitGtk. I liked it and it was pretty nice. But something awkward happened and an unrelated people took over the name and started to ship Electron (i.e. Google Chrome) as “Midori”. It looks untrustworthy to me, I recommend to not install it.
If you use Midori on Archlinux you should be save - they ship and old and original version of Midori. But it is old.
Apple, WebKit and WebKitGtk work together for many years. Good work.
It’s slowly becoming closer to chromium in cutting edge feature support.
This is shaping up to be a fun battle ahead.
The major OS release cadence only seems to affect major UI revamps which aren't that frequent anyway, so it's not that much of a limitation.
You can now also update Safari independently of macOS, which is nice for IT environments that restrict major macOS updates until they have been approved.
Hopefully in the future they will also allow that for iOS, so that older devices that can't update have some more longevity for web apps (and so that we as web developers don't need to support as many older versions)
Mind you the version string in Safari might not change as well. Gotta look at the build number.
As a Safari user since release day I never felt like they slowed development or that they have accelerated it lately.
But people are certainly more aware. Maybe it’s more of an “it’s all coming together” for a number of longer term things just hitting around the same time?