phobos-rs icon indicating copy to clipboard operation
phobos-rs copied to clipboard

Custom PhysicalDevice Selection Logic

Open jedjoud10 opened this issue 2 years ago • 2 comments

'Tis my first feature request. Tell me if this is good or if I should add more detail.

Implement a proper interface to allow users to select their PhysicalDevice (with potential fallback if none are selected?).

Two ways this could be done: Allow users to fetch an iterator of PhysicalDevices somehow, and then force the user to pass a reference of one of those PhysicalDevice to AppSettings``. This forces the user to have a fallback ready when their own GPU selection impl fails.

Have a callback fn (F: Fn(&PhysicalDevice) -> bool) that will loop over all PhysicalDevices internally, and let user select their preferred physical device. This could be further extended by using a scoring system but I'd feel like that's a higher-level thing than what this lib wants to achieve, but I'm not sure. One problem with this method though is that we need to somehow select a fallback PhysicalDevice if the function returns false for all previous iterations.

jedjoud10 avatar Jul 11 '23 23:07 jedjoud10

Oh actually we could fix the latter by forcing the user to select a PhysicalDevice by using a F: Fn(&[&PhysicalDevice]) -> usize, which would force the user to pick a physical device (or could return 0 for a default physical device if needed)

jedjoud10 avatar Oct 07 '23 13:10 jedjoud10

I like the scoring approach yeah

NotAPenguin0 avatar Oct 07 '23 14:10 NotAPenguin0