So many samplers...!

14 views
Skip to first unread message

Mark Sibly

unread,
Feb 6, 2023, 10:01:37 PM2/6/23
to Dawn Graphics
Hi,

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?

Bye!
Mark

Austin Eng

unread,
Feb 6, 2023, 10:42:19 PM2/6/23
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 dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/d0df9fdf-f6fd-4487-919c-3fdf2e7dd031n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages