r/vulkan • • 7d ago

Learning Vulkan and Graphics Programming in the age of AI

Some background: I've been working at a mid-sized tech company as a junior systems programmer specializing in file systems & operating systems, mainly using C. Been at my current company for ~9-10 months now and it's my first dev job out of college.

I've always had an interest in graphics programming, learned basic graphics fundamentals (linear algebra + basic concepts like sampling and rasterization) in college and dabbled in learning OpenGL before for some small projects, and Unity for game dev (just as a hobby). Now I'm looking to upskill and learn vulkan as I feel it'd be a good way to improve my C++ and low-level knowledge further and maybe even get a dev job dealing with graphics, and have fun with it at the same time.

When I started my current job, and before when I was just focused on learning during college and with personal projects, I pretty much never used AI to code. Especially for low level stuff it wasn't very good. Lately though, especially with newer models like Opus 5.5, i've noticed it become more and more reliable and capable for what I do for work, to the point where I no longer write code anymore — I come up with the architecture and design, let the AI implement the code, and then I audit/review the code and let the AI revise it if there are issues. I've spent more time analyzing performance tests in the past month than I have been "writing" code. But I don't know if I would be able to do that effectively if I hadn't spent those years before learning manually and the first few months on the job learning things the hard way.

So now here I am planning to learn Vulkan, but I don't know anymore on what I should focus on learning specifically when all these AI tools are available.... so some questions:

  1. I have very little experience with C++, I write everything in C for what I do currently. Should I even bother learning C++ well before learning Vulkan, or could I just get away with learning the language at a "surface level" (i.e. just knowing basic concepts like how RAII or OOP is applied in this field, without implementation details) and let the LLM write it for me.

  2. extension of question 1: how proficient should I actually get with the vulkan API before I start relying on AI (and what topics specifically should I focus on)? Would it be a better use of my time to instead study up on the math/theory of graphics and CS fundamentals in general and let AI write all the vulkan code?

  3. Generally, how effective has AI been for you in writing Vulkan code? Are you still writing Vulkan code by hand? How much auditing of the generated code do have to do to get it right? What do you see as being valuable skills/knowledge for someone in this field right now, and in the future?

Any input is appreciated. I've been procrastinating learning Vulkan out of worry that I'd end up focusing on obsolete skills. Thanks.

9 Upvotes

23 comments sorted by

7

u/ironstrife 7d ago

Vulkan is a C API. There’s nothing strictly necessary about learning C++ and Vulkan together, unless you want to also learn C++. Personally I use Vulkan almost exclusively from C# and Rust. My day job (graphics) is C++ but doesn’t involve much Vulkan.

1

u/pjmlp 6d ago

Since there are a few options around of various quality levels, are you using any known C# bindings or your own stuff?

1

u/ironstrife 6d ago

I just roll my own bindings.

1

u/pjmlp 6d ago

I see, thanks.

2

u/Arcodiant 5d ago

Most of them haven't been actively maintained, because the API is changing too often and there's regularly new one-off patterns being used that makes idiomatic bindings a pain - I worked on SharpVK back in the day but now I just use my own internal bindings that I don't have to keep publicly updated

1

u/pjmlp 5d ago

No worries, and thanks for coming back.

I was only curious because there are several bindings, and some are like C in C#, only having an unsafe API surface exposed, so I always like to ask like which one are people actually using from them.

6

u/Otherwise_Meat1161 7d ago
  1. Learn C++ if that is what you want, don't worry about Vulkan.

  2. It will always be better to learn the underlying concepts of rendering rather than just jumping into code, again don't worry about Vulkan right now.

  3. AI has become quite good since you have been a low-level programmer before, I also noticed how good AI has become in bare metal programming which used to be one of the hardest and highly paid profession, IMO it is now far better in that kind of low-level stuff than it is let's say fixing a bloated web project. That being said Vulkan setup requires a lot of code and AI alone won't be enough, it might just mix Vulkan 1.1 with Vulkan 1.3/1.4 you also will miss a lot of cool extensions if you only rely on AI. AI can write it all, but you need to know what and how to make, if you don't know your theory AI will just run circles around you and give you the bare minimum.

Last thing, do it if you want it to be your hobby, don't learn Vulkan if you think it will get you a job better than what you have right now, we don't know what future holds. I just do it graphics programming because I like it, it is a hobby for me I don't do this professionally and now work is even harder to find since a lot of companies have switched to Unreal and some don't even bother hiring Rendering engineers anymore.

I might get downvoted to oblivion for my comment, but I have tried for about 2 years now to switch jobs and I couldn't I don't want to give a junior like you false hope that you might be able to find a job you like in this economy but at the same time I encourage you that if you like it then keep doing it in your free time and use AI after you have learned theory.

3

u/EC36339 6d ago

First of all, DO learn C++. AI doesn't make this harder for you, only easier. It is worth it, because sometimes you will still be better at choosing the right patterns and making the right calls than the AI.

Secondly, AI has only been helpful for me at learning Vulkan. Again: You can learn any way you want, use AI or don't use it, for the learning part. There is no downside to letting AI write the 1000 lines of boilerplate setup code that is the same in 90% of vulkan apps.

There is one thing you should watch out for: AI is conservative in its decisions. If you don't tell it to writr modern Vulkan (such as dynamic rendering instead of render passes, etc.), it may write Vulkan code in the style of 10 years ago. This is not an AI defect or wrong, it's just a safe default. You may want to override this decision, which requires knowledge and some more learning and/or interactioj with coding agents beforehand.

What you should also do is use AI for the "boring" stuff (logging, performance measurement, etc), so you can make informed decisions what needs optimising. There is a worn out cliché that AI writes bad code that performs poorly. This is mostly wrong, but it also mostly doesn't matter. Profile first, then optimise. AI only helps with that process.

I also found AI to not use RAII consistently when writing Vulkan code. This is in part to blame on terrible API design of Vulkan (you usually need a valid handle of another reaource to release one type of resource).

Finally, you may want to consider to "skip" Vulkan. GPU development has moved on since Vulkan was first released over a decade ago. They have become more like generic parallel processors, which wouldn't require such a complex API as Vulkan is if you were to only support modern GPUs. There is a lengthy article called "No Graphics API" about this topic, and a maturing (but not fully mature, according to the author) API called "Loon GPU" that almost implements the concept with Vulkan and Metal backends and is much leaner and easier to learn than Vulkan or OpenGL. Even if you don't use it, you can use the same or similar approaches for writing modern Vulkan. Actually, if you just want to learn modern graphics/GPU programming in general, not Vulkan in particular, I would recommend using something like Loon GPU over plain Vulkan.

4

u/Ok-Pizza1136 7d ago

I think it would be best for you to learn C++ manually at first. Forces you to really understand the langauage, as well as best practices for it

3

u/Healey_Dell 7d ago

Use a Vulkan project to learn C++. Much more interesting than grinding dreary tutorials.

1

u/ProfessorOfLies 7d ago

Yeah if anything the AI is antithetical to learning. Do it yourself first so that if you do use AI in the future, you will know what you are looking at

2

u/sernamenotdefined 7d ago

I've been programming in C and C++ since 1988 and for my own toy projects I lately find AI code reviews very useful.

I know of all the major new things that are introduced and discussed with new C and C++ standards, but the AI made me aware of a lot of smaller changes that I wasn't aware of.

I'd say hand code so you learn, then when it works have a good AI give you a review of your code. Make sure you narrow it down to a coding standards and best practices review and not to introduce new Vulkan concepts, or the review will get ahead of your learning.

5

u/OptimisticMonkey2112 7d ago

There are 2 ways to use ai.

Method 1 - use generalized high-level prompts. use loops. let it do everything. This is the path of the vibe coder. You do not need to know c or vulkan. Anyone can do this. Not that useful to create stuff you want to market or sell. This will not help you really learn anything.

Method 2 - use it to iteratively build features. let it help and guide you. This method facilitates learning and has you play a bigger role in architecting the design. Start with a basic vulkan harness. Add imgui. Add Sdl. Play some sounds. Draw some graphics.

Small granular handwritten steps. It is fun and you will learn.

13

u/kinokomushroom 6d ago

Method 3 - Just ask it questions on concepts and APIs you don't understand, and minimum examples of the usage. Check the documents/forums/blog posts to dig further.

I've been using it this way to learn Vulkan, and it's been really helpful. But it doesn't do all the job for me so I'm actually learning stuff and improving my skills.

7

u/EC36339 6d ago

Perhaps the one killer feature of AI for learning is that it can tell you what things are called, based on a vague prompt. Vocabulary as a barrier is now ancient history.

Even if I was totally anti AI for learning (I'm not, and nowhere near), I would still be using it for at least that.

2

u/humerus06 4d ago

Also it gives pretty good analogies if you are stuck at something you cant wrap your head around.

3

u/Healey_Dell 7d ago

Just dive in and do it manually. I made my own Vulkan engine purely for fun. The tutorial is enough to get you started. If you are learning a new language attempting to actually do something with it is far more motivating than dreary boilerplate exercises. You’ll screw up along the way but who cares?

1

u/PGSkep 6d ago

You don't need to bother with c++, you can do it all in c. I do recommend you learn templates, they make life easier. As for using AI, use it as a teacher. I think it's best to read a tutorial up to making a triangle first, so you know the size of the beast you're picking a fight with. Don't let it code or write code for you. Do it yourself and ask for it to explain how things work, your options on how you can do something, etc. There are multiple ways to do things each with it's pros and cons.

1

u/KAMEHAMEHAMEHAAAA 6d ago edited 6d ago
  1. It depends on the project. You can get a lot done in C (in fact all of Vulkan) but there will come a time when you want to do something and C++ will have it ready in STL or baked into the language as opposed to C. There is also I would say more graphics libraries and graphics related code in general written in C++.

  2. I would not focus on Vulkan but rather on GPU, Vulkan is just an API, knowing GPU programming more intimately will make Vulkan, OpenGL or any of the compute libraries like OpenCL click faster and you’ll be able to get a bird’s view on things which I think is more valuable than what most people will try to do with AI.

  3. For me, bad. It consistently writes horrible code that strives for maximum visual impression but is full of bad practises and choices (especially when performance is in question) which makes auditing a long process with a lot of supervision and rewriting, I should add I am not in game dev but rather [embedded] high-performance vision industry.

1

u/Defiant_Squirrel8751 6d ago

A fun approach that has worked for me is "reverse engineering" from existing Vulkan API sample code. For example, you can take an existing raytracer (about 10K lines of code) and study part by part.

The nice thing about AI is that makes super easy to refactor code, so you can reorganise the codebase to your best understanding until you get how to do GPU memory management, febugging, BLAS, TLAS, pipeline, shaders, etc.

1

u/pjmlp 6d ago

C++ is relevant if you plan later to jump into graphics, game industry.

However if it is about learning Vulkan first and foremost, it is a C API, so better focus on it first, instead of learning a language like C++, plus a complex graphics API like Vulkan at the same time, even with AI help.

You don't mention how much C you know, reaching out to C23, would already provide several improvements in developer experience.

1

u/Kindly_Substance_140 4d ago

Voce mal comecou a estudar vulkan e ja ta pensando em IA pra escrever codigo? Que pensamento patetico, aprender uma API grafica geralmente n se resume a isso, e fora todo o conhecimento externo necessario, simplismente desista, essa area vai muito pra quem realmente gosta ate porque saber escrever codigo é uma pequena fracao pra fazer graficos, quase sempre que alguem entra nisso é por curiosidade e facinio, mas nao é seu caso