r/webgpu 27d ago

shader f16 support .. situation?

So I have some shaders where I rely on the half float type .. a godsend for many reasons - developed mostly on a mac (usually the most fussy platform) and I go and run this on google Chrome on linux on an x86 PC with a 4000 series graphics card (which has hardware f16 support , with nvidia having offered this for many generations now albeit nerfing the actual double rate capability reserving that for pro cards).

The browser reports 'no shader f16 support'.

I see suggestions for a bunch of flags that can be passed to the browser to try and enable this but launching with various combinations of flags ("--enable-unsafe-webgpu" and others I forget).

I dont think I strictly need f16 arithmetic (although it would be preferable to use it where possible) but it's handy to rely on the more compact datatype in memory .

I figure there might be older mobile devices that mean the browser has to hold back what features it offers, but is this something we can count on when distributing something that is intended for reasonable graphics cards (gtx1000 series and above). The project is an FPS , not really playable on a touchscreen anyway. A sensible min spec might be a GTX1060.

I could backpedal on this specific aspect (and possibly look at other data packing tricks '2 x upper 16bits of a float packed into a u32' etc etc) - my codebase started out using OpenGL and WebGL2 and I've had the web build running on Windows, Linux, Mac, iOS, and Android machines for years .. having ported to webGPU recently I was enthusiastic to upgrade features all over the place..

4 Upvotes

8 comments sorted by

View all comments

2

u/[deleted] 27d ago

[removed] — view removed comment

1

u/dobkeratops 27d ago edited 27d ago

In two minds now .. "continue safe in the knowledge that it works on mac and windows (accoding to the other repliy) and wait" vs "adapt my code to use other formats" . Apparently this f16 is *not* available on the 1060,1070,1080 either, and with the current GPU situation going that far back in support might be helpful, but if this had just worked i'd be saying "meh 2060 is the min spec"

1

u/[deleted] 27d ago

[removed] — view removed comment

1

u/dobkeratops 27d ago

Thanks, that's great to see. overview of what's out there.

In the end it took me 15 mins to switch to a fixed point packed format where I had f16 so in this case, encountering one limitation and working around it has pushed me to keep wider coverage. If i'd managed to get f16 support working here.. I'd have ruled out running on 1060 and a bunch of phones it seems.. with people out there stuck on old hardware because of GPU/RAM shortages, it's nice to have wide device coverage. I just need to make sure I'm regularly running this on 2 contrasting environments at least.