Combined image samplers vs seprate sampled image and sampler

I want to access multiple textures with the same sampling parameters from a fragment shader (For instance, texture and normal map). Moreover, images change frequently whilst sampler stays stationary (suppose the texture is a video). I've found contradictory information about how it can be done. Vulkan Cookbook states that using combined image samplers might have a performance benefit on some platforms, but this Reddit answer states that combined image samplers don't make any sense.

My question is: Is there any reason to not use separate sampled images and one sampler (for both images) considering it makes the program's logic more simple?

Upvotes: 4

Views: 4172

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 474126

Odds are good that which one you pick will not be the primary limiting factor in your application's performance. It's speed is more likely to be determined by the user factors: how efficient you are at building CBs, walking through your data structures, and so forth.

So use whichever works best for your needs and move on.


this Reddit answer states that combined image samplers don't make any sense.

Considering that said "answer" claims that this statement from the specification:

On some implementations, it may be more efficient to sample from an image using a combination of sampler and sampled image that are stored together in the descriptor set in a combined descriptor.

"warns you that [combined image samplers] may not be as efficient on some platforms", it's best to just ignore whatever they said and move on.

Upvotes: 8

Related Questions