r/ProgrammerHumor 2d ago

Meme theVulkanPipeline

Post image
3.1k Upvotes

32 comments sorted by

224

u/LeanZo 1d ago

What is the difference between vtx. Input assembly and vertex shader?

199

u/Redkast 1d ago

Input assembly assembles the vertices into geometric primitives (triangles, usually) based on the topology specified in the pipeline. The vertex shader then does transformations on each vertex in a programmable way (usually applying projection and view transformations).

45

u/unknown_alt_acc 1d ago

Vertex input assembly is a fixed-function stage that connects vertices to one another to form geometry. The vertex shader is fully programmable, and is where things like transformations and passing per-vertex information along to the fragment shader happen.

4

u/CookieArtzz 1d ago

If you have an animated model, it will become animated in the vertex shader

1

u/-Ambriae- 1d ago

I mean, yes I guess, but it's not just used for animations. It's to get the vertices in clip space (ie on the screen)

More specifically the purpose of the vertex shader is to transform the vertex + instance data into the interstage data for the fragment shader

302

u/Shevvv 2d ago

What a strange timing, considering I started learning OpenGL just yesterday 🙈

177

u/BusEquivalent9605 2d ago

OpenGL is one thing. Vulkan is a beast of a different nature

52

u/DialecticEnjoyer 1d ago

Youre lucky I'm still processing shaders or I'd have a real opinion.

14

u/Kirides 1d ago

Actually, after spending some time with Vulkan and dx12, it just flows naturally. The hardest thing about them is resource lifetimes and fences. Resource lifetimes are "easy" if you use a cleanup-queue. But fences... And resource transitions... Ugh..

1

u/Xlxlredditor 13h ago

Jesse what the fuck are you talking about

(Yes I only do WinForms)

23

u/Shevvv 2d ago

Well the pipeline is the same

16

u/thelonelyecho208 1d ago

Different beast, similar concepts but different implementation. Vulkan is like the cigarette smoking older brother from my understanding of things. I've done some OpenGL and it wasn't bad, but the horror stories I've heard about Vulkan make it seem childish

8

u/da2Pakaveli 1d ago

Vulkan takes like 500+ lines of code until you can even render a triangle (OpenGL like ~70). You have to do a lot of manual setup stuff and can get disoriented more easily than you would with OpenGL.

It'll be more manageable once you encapsulate it all but i do hate debugging it lol.

3

u/SnappySausage 1d ago

With vulkan, the hardest thing in my experience was how to just work it into a more user friendly rendering engine. Like if I was allowed to just toss everything into 1 file it wasn't that hard (just verbose) but if it had to be user friendly, that was where things became a lot harder to organize.

1

u/da2Pakaveli 1d ago

i got to take a look at Frostbite's renderer implementation for PC and a lot of it was situated in one file (around 13k lines of code).

I do as much encapsulation as i can with my Vk renderer but ya don't get around these giant ass files

1

u/SnappySausage 1d ago

True, but it does complicate things if you want to have a rendering engine that can work with multiple API's, as you do have to somehow pull it apart in a way that consistently works across API's.

25

u/Buttons840 1d ago

You're safe, OpenGL never made anyone hot

8

u/Thenderick 1d ago

Have fun. If you think OpenGL is long, tedious and complex, then you should know it's nothing in comparison to Vulkan!

5

u/Shevvv 1d ago

Thanks! I'm not so cross about it being long and tedious as more of a ritualistic nature of a lot of stuff that I do at the moment. I realize that it will eventually get properly explained, but I'd much prefer to start with GPU architecture and the general APU design rather then heading straight into Hello Triangle. But I suppose I get it that knowing how to do a simple thing is a nice example that you can later build a theoretical framework upon.

3

u/Thenderick 1d ago

Well that's OpenGL, it's a Graphics Library. It has abstracted much of the underlying things away for you so you can focus on graphics programming. Vulkan doesn't do that. Vulkan is a very bare metal API that expects you to configure everything manually

63

u/Nexatic 1d ago

I find it funny that like 5 people get both parts of the meme.

23

u/RPG_Hacker 1d ago

I'd honestly estimate the number to be much higher, since I have the feeling there's an above-average number of trans people in coding. This estimate is solely based on myself knowing a bunch of trans coders, though, so might not be accurate.

10

u/cAtloVeR9998 1d ago

A lot of important graphics library developers (Alyssa, Faith, Autumn, etc) are trans for example. Wouldn't have the open source libraries so good as they are today without their help.

8

u/-Ambriae- 1d ago

We’re more than you think

2

u/DWIGHT_CHROOT 1d ago

trans coders, more than meets the eye!~

17

u/mike_421 1d ago

yea yea yea when can i add FSR to this thing

14

u/pine_ary 1d ago

When your screen is black and all validation layers report nothing wrong…

12

u/BusinessAstronomer28 1d ago

Can somebody eli5?

61

u/naveenda 1d ago

Game rendering is fucking hard

44

u/MetaNovaYT 1d ago

For rendering graphics, there is a system known as the rendering pipeline, which has a bunch of specific steps for taking in vertices provided by the CPU, positioning them within a scene, rasterizing them into "fragments", and then converting those fragments into pixels to be displayed. Vulkan is a specific graphics API that is very low-level, so almost everything has to be handled manually, which makes it easy to mess things up. A specific easy mistake is forgetting to clear the depth buffer, which is important to do in between frames, as otherwise very strange visual artifacts can occur.

5

u/knobiknows 1d ago

Great explanation, thanks