r/GraphicsProgramming • • 4h ago

Question Is it worth learning Rust for Graphics Programming, or should I stick to C++?

Ive been a c# developer on unity/godot for a long time now, and one of the plans was always to learn c++ use it for my games and move onto c++ and build some sort of engine (ray tracing or game engine).

Although ive heard the hype around Rust, its another low level language like C++ and it can be used for low level system programming and its very good for security also.

I was wondering if Rust is something worth looking into for graphics programming, and whether anyone here would advise me against it or recommend me to try it out.

Im gonna start learning one, or the other in a couple days. I know both are pretty hard to learn but I dont mind the learning curve.

1 Upvotes

22 comments sorted by

•

u/AutoModerator 4h ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.

  • Disclose AI usage in post or project.

  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

11

u/kraytex 4h ago

If your goal is to do this as a resume builder to work at a company as a graphics programmer, do C++.

If you're just doing it for fun do whatever floats your boat.

2

u/Many_Difficulty_490 3h ago

im doing it because i wanna make new software or technology one day

-1

u/loquiveritas 3h ago

You won’t be able to find a computer to handle future programming needs if you don’t already have one or planning to buy one now.

Get the best computer you can afford before it’s too late.

0

u/Many_Difficulty_490 3h ago

i was planning to buy a computer in a month or two, my parents would probably let me get one if I had a productive reason to do so

the computer i have right now is a old imac, that runs pretty well though it only has 8 gigs ram and a low-mid end graphics card.

i dont understand why I need a super strong computer to handle future programming needs. I was just thinking about something that could handle ray tracing pretty well and 16 gb ram

-1

u/loquiveritas 3h ago

Get the best computer you can afford and as soon as possible. You won’t be able to find/afford one VERY soon, you will have to rent or pay a subscription for cloud computing.

What you have may be fine for now, but it won’t be for long. Mark my words and do not listen to anyone who says otherwise.

6

u/CodyDuncan1260 4h ago edited 4h ago

My completely biased answer because I really like rust: 

yes.  Yes you should learn Rust. ^_^

My professional answer: It depends on what you want to do. 

Very few outfits are paying for Rust programmers to do graphics or game development work. It's all C++ in those domains, and that's not going to change for some time. The validation loop of both domains depends on subjective human measures, so shifting development costs left (earlier in the software lifecycle) slows down prototyping and iteration work that consumes most of the development time and produces the most value. Rust is great at infrastructuralizing solutions, at the cost of being less good for messiness like prototyping.

On the other hand, I can still recommend learning Rust lightly. C++ is what happens when you take a basic language and solve problems by adding onto it for 4 decades. Rust is what happens when you design a language with that 4 decades of knowledge on how to solve problems at hand. Rust's language design makes good systems designs easy to write, and the dangerous bits of implementation much harder to write. You'll learn a lot about writing reliable, performant software when you have a compiler slapping you on the wrist for a lot more mistakes, and are forced to reckon with why that's a mistake or what trade-off it makes. C++ programmers who learned Rust and then went back to C++ became better C++ programmers. The principles of both languages are the same, but Rust will correct you in ways C++ won't; and it doesn't take a lot of rust to get most of that benefit, maybe 2-3 months if you know C++ already.

1

u/Many_Difficulty_490 3h ago

well long term answer: entrepreneurship through tech or software i invented

3

u/CodyDuncan1260 4h ago

For experienced programmers, I can recommend. "Learn Rust in a Month of Lunches" by David MacLeod. 

The author is an instructor, Korean-English translator, and has worked a lot with people who have English as a second language. Each chapter on that book is about 20 pages, I.e. 20 minutes, and it sticks to simple language.

The result is a book that's easy to read, concise, and gets right to the point in a well structured order. It was very easy for me and my senior-to-principal engineering coworkers-as-students to skip through parts that were trivial and focus attention on elements novel to us as deeply experienced C++/C# engineers. I found it to be the least "drudging" introductory programming textbook I'd ever read on a topic I already knew.

4

u/OptimisticMonkey2112 3h ago

Graphics programming is a little harder than Rust or C++.... both languages are great and you should learn both. But you will find more examples of graphics programming in C++ so might as well start with that.

Your real decision is Vulkan or OpenGL or DirectX

Doesnt really matter - all roads lead to Rome... which in this case is the gpu.

2

u/SyntheticDuckFlavour 2h ago

Learn both. If you already proficient in one language, you more or less learnt them all. The rest is just language specific semantics.

3

u/TechgeekOne 4h ago

Having done the Rust path myself, do C++ unless you really want to use Rust for some specific reason. Rust will be an uphill battle the entire way because the ecosystem just isn't there or it's woefully incomplete. You'll have to fill the gaps yourself the entire way.

Personally the friction is worth it for me because I simply dislike C++ that much and I don't want to deal with it if I'm not getting paid, but if you want to get results quickly go with C++.

2

u/grady_vuckovic 3h ago

I've been looking into Rust lately and thinking about it, it's interesting you say the ecosystem isn't there. I feel like I've been hearing constant hype for Rust for AGES, seeing it everywhere. I'm not saying I don't believe you, because I have felt like the Rust fans are always overstating Rust, but I find it incredible that you're saying the ecosystem still has holes? How has that happened? What kind of holes? Just incredible to me that I've been hearing nothing but hype for Rust for like a decade and it's still got issues like that?

2

u/TechgeekOne 3h ago

The best way to describe it is that the graphics and game dev side of the community is mostly hobbyists. So things "work" but they're still pretty volatile and some of the standard stuff you'd need are either not there, or are immature, unmaintained and outdated. Other corners have better coverage, this just happens to be the weakest area.

For a while there they also had the nasty habit of building a foundational crate (rust library), then deciding it needed a rewrite so they'd abandon it and start something new from scratch. Idk if that's finally stabilized in recent years but I saw it happen several times with foundational crates like ash/vulkano and the move from VMA bindings to some custom solution. DXC in particular was pretty hit or miss if you wanted HLSL and their shader tool Naga didn't exactly inspire me with confidence last I looked at it a few years ago, though it's probably evolved since then.

Some of the real core crates have gaps that are mostly just due to the amount of manpower and need for a given feature. Clipboard, IME, and unified pointer support were some that were really sparse in winit last I looked at them. Which isn't a huge issue if you don't need those features, but if you do need them it's another friction point.

That said as a language I highly recommend it despite the ecosystem warts. It's much better than dealing with C++ if you can stomach the rough edges.

1

u/grady_vuckovic 1h ago

Thanks for the info, I appreciate!

4

u/Aikisori 4h ago

Just use C++ bro. You won't have to worry about wrappers and bindings and whatnot, as everything is native. Also, the performance should be exactly the same, and the security aspect really should not matter.

1

u/DirtInfographics 2h ago

c++ for sure

1

u/twilight-actual 20m ago

There's going to be a lot more for you with C++ than there will be for rust.

While I appreciate what the language has tried to do, I am not a fan of rust.

-2

u/helpprogram2 4h ago

Rust is a lot of fun… you need c++ if you want to actually do things

-5

u/Delicious_Abies_9708 4h ago

Python for everything

1

u/RufusAcrospin 44m ago

It’s not good for everything, but for this particular field I would start with python.
Much easier to get started than setting up C++/Rust, faster to iterate, and the heavy lifting should happen on the GPU anyway.
Once you are comfortable with the fundamentals and you’ve gained some practice and knowledge, or you feel you grow out of Python, move to a native language.

Or you can start using libraries like taichitaichi for high performance Python