▲ | 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. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | 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): | ||||||||||||||||||||||||||
▲ | 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. | ||||||||||||||||||||||||||
|