I would like to represent creation for each 2D shape or bitmap effect as a pipeline. The only purpose of this to modularize algorithms because extendibility is a big deal for current project. However, is there any drawback for using that kind of strategy? If it’s too risky (in term of performance and stability), then any other alternatives?


1 Answer 1


Binding a Graphics Pipeline in Vulkan is considered to be an expensive operation. So performance can be an issue if a program wants to bind many pipelines for each frame. Binding hundreds or even a few thousand pipelines per a frame is reasonable, a high end system could support up into the tens of thousands (good luck getting anything else done though).


Vulkan allows some parts of the pipeline to be dynamic, the list of what can be dynamic was recently extended as well. Using dynamic pipelines is less efficient then using a "non" dynamic pipes, but much more efficient then constantly binding many different pipelines.

Even if there are only a few pipelines per a frame, a program can still get into trouble by constantly switching between pipelines. So, combine draw calls on a per pipe basis, meaning bind a pipe, do all the draws for that pipe, bind the next pipe, etc.

Finding ways to merge shaders is probably the best way to reduce the number of pipelines. The extreme on this is the so called uber shader where virtually all the shaders are merged into a single shader. Just merging groups of similar shaders can greatly reduce the number of pipelines though and is usually fairly easy to do.

There is a little hand waving for this next one, but I have seen some programs with hardcoded descriptor values inside shaders which causes pipeline count to explode, just switching to multiple descriptor sets helps resolve this. This creates a system where a pipeline is bound, then each draw for that pipeline binds a descriptor set. (often there is a single descriptor set that has all the generic info in it, and a per draw set that has per draw specific info) This has its own drawbacks but is better then many graphics pipelines.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.