Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Ideal number of samplers? 1 or 16?

Discussion in 'Shaders' started by perholmes, Jul 16, 2022.

  1. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    Hi,

    Some of my shaders are very beefy, and I'm running out of samplers with the standard texture+sampler mapping. But I can't work out whether you should try to maximize or minimize the number of samplers.

    Maximize: By this logic, each sampler might execute in parallel. Then it would seem that the ideal number of samplers in a beefy shader is as close as possible to 16, without going over.

    Minimize: By this logic, each physical sampler has a register or swap cost, and so that even if you can sample fewer things at the same time, you could imagine being done quicker because of less swapping. Then the ideal number of samplers would be low.

    Which is correct for a beefy shader? As close as possible to 16 or 1?

    Thanks,

    Per
     
  2. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296