r/cpp • • 29d ago

slughorn: C++20 library implementing the Slug GPU vector-graphics technique

https://github.com/AlphaPixel/slughorn
43 Upvotes

12 comments sorted by

26

u/XenonOfArcticus 29d ago

Kinda weird to be scrolling r/cpp and see our own library pop up. Thanks u/hellfoundry !

Happy to answer questions.

We have a BIG update coming that makes a bunch of stuff better and faster, especially for supporting 3D rendering of cartographic maps (Google Maps - like). It's not quite ready.

8

u/Cubicool 29d ago

Yeah, for real. :) If anyone has questions/requests, let us know. WE DIDN'T DO THIS, it truly was a funsies thing for us to encounter...

6

u/XenonOfArcticus 29d ago

What Cubicool means is we didn't astroturf this post. I literally snorted Cherry Coca-Cola when I saw this pop up in my feed this morning. And we'd love to answer questions about the library if anyone has any.

3

u/delta_p_delta_x 29d ago

Any chance of a C++20 module interface file, using the ABI-breaking style? Ideally the module interface would also have import std;. Since AI was already used in development, it'd be a relatively straightforward addition. We have good priors that can be used as examples.

The tooling is mature and easy to use—CMake 4.5.0-rc1 and later, and modern compiler toolchains released in the past ~1 year.

2

u/Cubicool 29d ago

I'm still using Ubu24 as my main test dev environment, and last time I checked, the GCC/Clang it ships had trouble with this (but I'm still a HUGE C++ fan (weirdly), and I love all the new features). I'll look into this, as its honestly been at least a year since I last even THOUGHT about this C++ feature. If you want to make an issue...? :)

3

u/delta_p_delta_x 28d ago

If you want to make an issue...?

Happy to. I am a bit of an advocate for C++20 modules. :)

10

u/STL MSVC STL Dev 29d ago

I will approve this because it at least disclosed its AI-generated readme and looks to be more than the typical one-contributor just-published projects that we routinely remove and redirect to Show&Tell.

8

u/Cubicool 29d ago • Bravo

Thanks for that! And... AI wrote PARTS of the README, but certainly not all of it. :) I'm thinking of ditching the Skia parts at the bottom (as we've come SO FAR since I felt like it was necessary that I justify how/why slughorn is different, it's not even worth mentioning anymore...) I'm not saying we COMPETE (we do different things in the same "domain"), and while Skia was a heavy initial influence, these days it's mostly just the HTML Cavnas API, the SVG spec, and Blend2D (which I've come to adore, moreso than Cairo even).

Also, more about AI: my boss had to drag me kicking-and-screaming into agentic workflow comfort, and I still treat it cautiously. But I don't want to become a dinosaur either. I see the future, and I'm still trying to find where I/we will fit in it...

2

u/thebomby 29d ago

Looks like a very nice way to make styled vector-like games

3

u/Cubicool 29d ago

That's the (eventual) goal, for sure! Right now, something like Rive (which our company also has a decent amount of experience with) would be superior if you didn't want want to roll your own stack (and were happy with their editor), but that gap will hopefully close with more time and interest.

Slug--as a "concept"--differs dramatically from other approaches in HOW it rasterizes vector content, moving MOST of the work into the fragment shader/stage and using the vertex pipeline purely to address the "where am I allowed to render?" question. However, our current contract work is blurring that line a little by combining both dynamic vertex generation (not PURE "geometry shaders", but by abusing `gl_InstanceID` and its equivalents) to emit normalized shapes/strokes that are then immediately passed to the standard Slug fragment pipeline. It's a cool hybrid I'm having a lot of success with!

-2

u/altmly 28d ago

That's nice, I asked Claude to just reimplenent slug based on the paper and reference shader in my engine for custom font effects and it was done in 45 minutes. Kinda impressive and freeing, not having to rely on libraries and their maintainers anymore. 

5

u/XenonOfArcticus 28d ago

Hey, if that <float>s your boat, you do you.

A similar effort by one of our associates is actually what drew our attention to the Slug algorithm patent-freeing announcement this spring. We reviewed their Claude implementation, and while it did work, it was sorely lacking in a ton of ways. So, we hand-built our own over the past ~6 months to address those weaknesses using our own expertise in glyph rendering over literal decades. Slughorn actually contains significant capability not found in the original Slug papers and references, and we're adding more improvements as we speak.

Claude is really good at telling you "I've finished creating the Mona Lisa", but when you go to use the thing it gave you, you find it glazed what it did heavily.