So many samplers...!

Skip to first unread message

Mark Sibly

Feb 6, 2023, 10:01:37 PMFeb 6
to Dawn Graphics

Is it OK to freely create samplers?

I'm not really used to using them and it feels kind of overkillish having a sampler per texture when it's there's likely to ever be a handful of unique samplers.

There's no way to 'indirectly' select a group or binding (or IS there?!?) at shader execution time so I have to use texture/sampler pairs in bind groups AFAICT, at least when dealing with samplers I can't determine at compile time, eg: for materials loaded from file.

Should I be caching samplers myself then, using SamplerDescriptor as a key? It seems it would save a lot sampler instances, but perhaps dawn (or drivers) do something like this already and I'm just being paranoid?


Austin Eng

Feb 6, 2023, 10:42:19 PMFeb 6
to Mark Sibly, Dawn Graphics
Not sure what you mean by 'indirectly' select.

But anyway, Dawn does deduplicate identical samplers. Create fewer if you can easily avoid it, but otherwise, it'll all bottom out to the same backend object. We deduplicate everything that is immutable after creation: samplers, bind group layouts, pipeline layouts, shader modules, render pipelines, compute pipelines (potentially incomplete list; on a phone).

You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages