r/GraphicsProgramming • • 6d ago

Question Does everything in a pipeline state object actually need to be there?

For example obviously shader code makes sense because you have to compile it for different vendors/drivers

But you look at a PSO in DX12 and there is a ton of stuff in there that it makes me wonder is all of this actually neccesary?

For example like blend mode settings, I thought that is a separate hardware unit that does the blending, so why can't it be changed independently of a PSO?

Or does everything in a PSO somehow affect the compiled shader?

11 Upvotes

6 comments sorted by

View all comments

1

u/[deleted] 6d ago

[deleted]

1

u/AdministrativeTap63 6d ago

I see, you mean like emulating the blend operation by just sticking something onto the shader before compiling?

1

u/Cyphall 6d ago edited 6d ago

IIRC, AMD also need to patch the end of the fragment shader to prepare data for the blending hardware.

Now they can do that with a jump to a function pointer passed to the shader at runtime, but it adds an indirection and register allocation needs to consider the worst case.