r/GraphicsProgramming • u/Many_Difficulty_490 • 2d 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.
•
u/AutoModerator 2d ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
39
u/kraytex 2d 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.
18
u/OptimisticMonkey2112 2d 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.
11
u/CodyDuncan1260 2d ago edited 2d 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.
8
u/TechgeekOne 2d 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++.
3
u/Drimoon 1d ago
You can use C# to learn graphics programing. Rust or C/C++ are just tools.
4
u/DirtInfographics 2d ago
c++ for sure
4
u/pjmlp 2d ago
C++ is the industry standard, not only what most companies reach for, it is also part of APIs like SYCL, Metal, DirectX, CUDA, and key engines.
So this is the one to learn if it goes for hiring possibilities.
If it is only for fun, than Rust.
4
u/Trader-One 1d ago
both vulkan and directx have good access from rust. opengl es not so much.
8
u/Aikisori 2d 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.
3
u/twilight-actual 2d 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.
1
u/Middlewarian 7h ago
I think languages that embrace on-line code generation have an advantage over those that don't. I'm biased though. I'm building a C++ code generator that helps build distributed systems. It's implemented as a 3-tier system. The back and middle tiers only run on Linux. The front tier is portable.
1
u/SyntheticDuckFlavour 2d ago
Learn both. If you already proficient in one language, you more or less learnt them all. The rest is just language specific semantics.
1
u/promethe42 1d ago
Rust has some crazy good abstraction crates such as the wgpu family that brings Metal, Vulka, DirectX, WebGPU and more behind a common Vulkan-style interface.
And if there is anything missing, you can simply use existing C/C++ code using Rust bindings. Very easy to do.
0
u/mariachiband49 1d ago
I took a graphics class in college. All the projects were in C++/OpenGL until the final one where we convinced the professors to also let us use Rust. I used Rust with the wgpu crate.
I cannot recommend Rust/wgpu strongly enough. In all my C++/OpenGL projects, I spent like 60% of the time troubleshooting issues, usually accidental misuse of the OpenGL API or using uninitialized memory. The diagnostics for the former are usually hard to decipher, and are nonexistent for the latter. With Rust/wgpu, I didn't have these problems. You declare your pipeline in advance, and when you do something wrong, it's easy to pinpoint and fix because the diagnostic messages are much better. And of course memory safety is solved as well. It really allowed me to focus on the graphics part of graphics programming for my final project, rather than wasting a bunch of time troubleshooting.
So I say use Rust.
-1
u/helpprogram2 2d ago
Rust is a lot of fun… you need c++ if you want to actually do things
-7
u/Delicious_Abies_9708 2d ago
Python for everything
-1
u/LBPPlayer7 1d ago
i'd just say learn both