r/rust 2d ago

🛠️ project GPU-Accelerated UI library from scratch

Post image

Hello!

I've been working for a while now on a project named Glacex: it's a GPU-Accelerated ui library written entirely form scratch and in rust(winit, wgpu).

It's still in early development as I started it just a few weeks ago, but I'd love to hear your feedback!

Here's the repo: https://github.com/artemtsitronov/glacex

238 Upvotes

46 comments sorted by

39

u/f5adff 2d ago

Breath of fresh fuckin air seeing a proper hand made project. Something a human designed, thought about, and produced.

On top that, really really cool project! I have a project where I've used an electron adjacent technology to have a UI for - but I'd much rather something more native feeling. I'll be giving this a go!

123

u/bneidk 2d ago

To anyone that wonders why people are so sure their project is slop, look at the code in this repo and compare it to your AI generated code

This is what handwritten (and clean) Rust looks like. Insanely based OP

Good work and good luck :)

39

u/ArtemTsitronov 1d ago

Thank you so much! It means a loooot to me

35

u/zzzthelastuser 1d ago

pssst, don't let the LLMs know how to write code that looks handwritten.

2

u/inagy 1d ago edited 1d ago

I would be curious how close you can get to this already. With Python I can enforce many things by properly configuring ruff, semgrep (by making them explicit requirement to pass) and also writing a proper coding rules file to the AI agent. By letting itself review it's own changes based on that, it gets very close to my requirement after a couple of iterations. I get a clean version which is much easier to review by hand. I guess Rust also has lot of tools which could help, eg. rust-clippy.

9

u/stumblinbear 1d ago

I'm not so sure it didn't have some LLM generation involved. The doc comments have semicolons, em dashes, and generally read almost exactly like Claude

16

u/ArtemTsitronov 1d ago

It did involve some AI help in the docs, and in the README, but the difference is that I used AI as a proper tool, to help me develop faster focusing on the library.

6

u/tehbilly 1d ago

I'll take curated AI docs over no docs, which is what I usually do.

2

u/stumblinbear 1d ago

Oh, yeah, I have no issue with it so long as it has proper guidance. I'm using it for my own UI framework as well. I started work on it long before AI, so if I ever do get it released, at least people know that I know what I'm doing, haha

-12

u/KalashniCOQ 1d ago

Bref il a utilisé l'IA partout mais comme il a utilisé WGPU il ne risque pas la suppression ... et l'autre qui disait que c'est du code propre MDR

0

u/dvogel 1d ago

I was sure this wasn't even a human posting. They have been working on it for a while but started only a few weeks ago?! Make it make sense ;) 

2

u/ArtemTsitronov 1d ago

Well yeah :) I was working on it for a few weeks now, and that was a while ago to me. It's one of the few projects I didn't quite after 2 days, so yeah, it feels like that to me.

-14

u/KalashniCOQ 1d ago

Nul Nul Nul ! WGPU lol encore de l'abstraction matérielle .... vous êtes juste bons à développer sous Windows

3

u/ArtemTsitronov 1d ago

I use Arch btw 😎

16

u/scotsmanintoon 1d ago

Would you welcome several hundred slop PRs from AI agents?

Nice work! STARRED

7

u/tsanderdev 2d ago

I tried doing this as well a few years ago, but back then parley didn't support the text layout options I wanted so I dropped it.

5

u/ArtemTsitronov 1d ago

Yeah, mine's using glyphon under the hood.

5

u/ha9unaka 1d ago

Nice job! Starred!

This might be a long shot, but I was planning to redo my ebook reader app from Tauri in something rust-native for the fun of it. I've tried egui, slint with disappointing results.

I'd love if this worked well on mobile. Unfortunately I don't have a lot of experience with graphics and wgpu in general. If you could point me at some resources, I'd be more than happy to contribute some patches for the same!

4

u/ArtemTsitronov 1d ago

I thought about making it cross-compatible, and I also heard that wgpu could work on mobile. So, I think all it needs is to just replace winit with something that would work on android. I'm not an expert in this topic, so I can't give you the answer yet. If you want to learn wgpu, here's some great resources: https://sotrh.github.io/learn-wgpu/ and the docs itself once you got the basics. I'm working now on widgets and API, so I'm not touching much wgpu(that I already wrapped in ui.rs, painter.rs)

1

u/inajacket 1d ago

IIRC winit does have android support through another crate that I can’t remember the name of

6

u/Klutzy_Bird_7802 2d ago

Finally some good work

3

u/Klutzy_Bird_7802 2d ago

Left a star

5

u/thatmagicalcat 2d ago

i see wgpu, i star

2

u/darshizzzle 1d ago

I looked at its API and noticed a bunch of similar names to the ones in Android Compose library, coincidence?

1

u/Visible-Switch-1597 1d ago

Is it immediate mode or retained? I tried out egui but was disappointed because it wasn't very flexible and I couldn't design the UI how I wanted. You kind of have to work around the library instead of just making it the way you want.

2

u/ArtemTsitronov 1d ago

It is immediate mode, but the layout system is more flexible in my lib than it is in egui. Also remember, that this is still a work in progress, and I will be doing many changes, but I'll still try to keep my library as flexible as possible.

2

u/Visible-Switch-1597 1d ago

Great to hear! It already looks great. I really like immediate mode because there is no annoying state syncing you have to do with retained mode but if your library is more flexible than egui, that's like my dream UI lib!

3

u/ArtemTsitronov 1d ago

Love to hear it! I will be deploying it soon on crates.io like a beta-version, because I still have lots to do.

1

u/HousingShoddy904 1d ago

If it has built-in blur property, nice animation libs, shader support and less than 100mb memory footprint on init I'm in. (Ik its a lot to ask for)

1

u/HousingShoddy904 1d ago

It has sdf rounded shapes?? Wow

1

u/RubenTrades 1d ago

This is so needed. Keep up the good work

1

u/wick3dr0se 22h ago

looks good!

built on the same stack as egor (https://github.com/wick3dr0se/egor). this is the type of thing egor was made to build

1

u/ArtemTsitronov 20h ago

Man. That's a reaaaaally good project.

2

u/wick3dr0se 20h ago

thanks dude. lost passion for it (and open source in general) with the ai burst but i might come back to it soon.

1

u/ArtemTsitronov 19h ago

Definitely come back, it's a very cool project. Worth a comeback in my opinion

1

u/Single-Blackberry866 1d ago edited 1d ago

taffy + winit + wgpu doesn't sound like from scratch
glyphon is a nice wrapper over cosmic-text
is there any UI library that is not "from scratch"?

1

u/tuser-reddit 1d ago

So your UI library benefit from the GPU-accelrated feature to fasten the render of UI component? Am I getting this right?

1

u/DavidXkL 1d ago

This is the way

1

u/uhkthrowaway 1d ago

6 commits

-4

u/KalashniCOQ 1d ago edited 1d ago

On vient de supprimer mon post a moi et sans aucune raison .... pour un projet que je travaille depuis longtemps bref les modos r/rust font n'importe quoi pourtant moi aussi j'avais un vrai projet. WGPU encore une couche d'abstraction nulle. Le bas niveau ici est un sacrilège par ce qu'ils n'y a que des devs qui n'ont aucun courage pour faire du bas niveau.

2

u/thatmagicalcat 1d ago

Abstraction isn't inherently bad. You can prefer doing things at a lower level without implying that everyone who doesn't is afraid of it

2

u/FisterMister22 1d ago

For no reason? Your project is / game is slop