Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vk: Refactor physical device selection #1671

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

Wunkolo
Copy link
Contributor

@Wunkolo Wunkolo commented Oct 8, 2024

Rather than electing the first physical device it finds, and falling back on the first-listed GPU: a series of stable-partitions are done so that the "least compromising" GPU is selected based on a series of criteria.

It will now maximally try to find a GPU that(in order of priority):

  • Is a discrete GPU
  • Supports R5G5B5/R5G6B5A1/R4G4B4A4
  • Supports fragmentStoresAndAtomics

In the case that a system has two dGPUs and one of them supports optimal-formats, the optimal-format one is selected

In the case that a system has an iGPU and the dGPU and they both support optimal formats, the dGPU is selected.

In the case that a system has an iGPU and the dGPU and the dGPU doesn't support optimal formats, the dGPU is still selected.

Rather than electing the first physical device it finds, and falling back on the first-listed GPU: a series of stable-partitions are done so that the "least compromising" GPU is selected based on a series of criteria.

It will now maximally try to find a GPU that(in order of priority):
* Is a discrete GPU
* Supports `R5G5B5`/`R5G6B5A1`/`R4G4B4A4`
* Supports `fragmentStoresAndAtomics`

In the case that a system has two dGPUs and one of them supports optimal-formats, the optimal-format one is selected

In the case that a system has an iGPU and the dGPU and they both support optimal formats, the dGPU is selected.

In the case that a system has an iGPU and the dGPU and the dGPU doesn't support optimal formats, the dGPU is still selected.
@flyinghead
Copy link
Owner

Thank you for your contribution.
I would change the priority order to: discrete GPU, fragmentStoresAndAtomics and Supports R5G6B5/R5G5B5A1/R4G4B4A4.
The reason being that fragmentStoresAndAtomics is required to implement per pixel transparent sorting (an important feature). Whereas if some texture format isn't supported, Flycast converts it to RGBA8888, which isn't a big deal (and quite frequent).

* Is a discrete GPU
* Supports fragmentStoresAndAtomics
* Supports R5G5B5/R5G6B5A1/R4G4B4A4
@Wunkolo Wunkolo force-pushed the vk-physical-device-selection branch from e061365 to f637b51 Compare October 8, 2024 14:47
@flyinghead flyinghead merged commit 556e2ea into flyinghead:master Oct 8, 2024
15 checks passed
@Wunkolo Wunkolo deleted the vk-physical-device-selection branch October 8, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants