AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
How to Write a 2D UI on the GPU
We started with this Rust crate called Pathfinder, which is Patrick Walton wrote it. It's really cool ideas in there about doing like Bezier curve 2D rendering on the GPU. But that was too slow and so finally we just boiled it down to what do we actually need to draw? Like what is a 2D UI? And it boils down to some rounded corner boxes with borders and padding,. We need to get glyphs and icons on the screen. So we ended up just like writing our own shader code. To this day, it's like we have like maybe 600 lines of shaders code. The code we have to run on the GPUs are much simpler than a 3D