Remix.run Logo
vFunct 4 days ago

I could use more 2-d line support for CAD applications as well as font drawing.

jsheard 4 days ago | parent | next [-]

Font drawing is very much out of scope for a 3D API, that's something you (or a library) would implement on top of WebGPU. Likewise for line drawing, the API may expose some simple line primitives that the hardware supports natively, but if you want anything fancier then you're expected to do it yourself with shaders which is already possible in WebGPU.

The 3D API is just meant to be a minimal portable abstraction over common low-level hardware features, composing those features into higher level constructs is intentionally left as an exercise for the user.

vFunct 3 days ago | parent | next [-]

The problem is now you have to have all sorts of additional libraries you need to load across a network.

Web APIs need more standardized functionality built in, including high-level ones, and not rely on additional libraries, because they have to download across a network.

It's like having to install an app every time you visit a site.

lmariscal 4 days ago | parent | prev [-]

I mean, they are extending support for Canvas2D, which from what I believe would allow for easier text rendering.

Lichtso 4 days ago | parent | prev | next [-]

There are libraries building on top of WebGPU for that, like:

https://github.com/linebender/vello

and (shameless plug):

https://github.com/Lichtso/contrast_renderer

nox101 4 days ago | parent | prev | next [-]

Asking for lines is like asking for your CPU to support macros. The GPU is low-level, lines are high level. You build the high level on top of the low-level with libraries etc...

wffurr 4 days ago | parent | prev | next [-]

The Canvas2D interop feature should make it very easy to draw text to a 2D canvas and then pull that into WebGPU as a texture.

flohofwoe 4 days ago | parent | prev | next [-]

WebGPU does have line primitives of course, but only the type of lines that's supported in the underlying 3D APIs (e.g. 1-pixel wide). Since the whole purpose of WebGPU is to provide a thin API over the common feature set of D3D12, Metal and Vulkan that's totally expected though.

Waterluvian 4 days ago | parent | prev [-]

Same. I do a ton of 2D map stuff and it’s always quite uncomfortable to do in shaders or very slow in a Canvas context.

The last time I tried with pixi.js the problem was smoothly zooming polygons with a constant width border thicker than hairline. Doing that was basically just generating new textures on every frame.

efnx 4 days ago | parent [-]

Just out of curiosity, what is uncomfortable about writing shaders, in your opinion?

skywal_l 4 days ago | parent [-]

debugging

efnx 3 days ago | parent [-]

I agree completely.