cli: add --gpu <index> to select a Vulkan physical deviceFeature gpu select #417

Manually merged
github merged 3 commits from gh-pr/417/head into gh-pr/417/base 2026-11-26 09:19:47 +00:00
Owner

@⁠francoisatt on GitHub · 2026-08-30 18:00 UTC · original
francoisatt:feature-gpu-select → main · +14 −0 · 4 files · 3 commits · merged 2026-08-30 23:43 UTC

Problem

VulkanFindPhysicalDevice overwrites best_device for every discrete
GPU it encounters, so with more than one discrete GPU the last
enumerated
one wins, arbitrarily. There is no way to override it.

On my machine three devices are enumerated (RTX 5080, an integrated AMD
Radeon, RTX 4060 Ti) and the 4060 Ti is picked.

Change

Adds --gpu <index> to select a physical device by enumeration index.
The requested device still has to pass the same compatibility checks as
any other; if it is out of range or unsuitable, the emulator logs the
reason and falls back to automatic selection. Default behaviour is
unchanged.

Testing

  • Build: RC=0
  • ctest: 35/35
  • --help lists the new option
  • --gpu abc prints an error and exits 1 with usage, matching
    --user-id / --present-mode

Note

clang-format (pre-commit v22.1.3) realigned a few pre-existing lines in
the touched files; those changes are mechanical.

AI assistance

This change was written with AI assistance. I reviewed, built and tested
it myself.

**@⁠francoisatt** on GitHub · 2026-08-30 18:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/417) `francoisatt:feature-gpu-select` → `main` · +14 −0 · 4 files · 3 commits · merged 2026-08-30 23:43 UTC ## Problem `VulkanFindPhysicalDevice` overwrites `best_device` for every discrete GPU it encounters, so with more than one discrete GPU the **last enumerated** one wins, arbitrarily. There is no way to override it. On my machine three devices are enumerated (RTX 5080, an integrated AMD Radeon, RTX 4060 Ti) and the 4060 Ti is picked. ## Change Adds `--gpu <index>` to select a physical device by enumeration index. The requested device still has to pass the same compatibility checks as any other; if it is out of range or unsuitable, the emulator logs the reason and falls back to automatic selection. Default behaviour is unchanged. ## Testing - Build: RC=0 - ctest: 35/35 - `--help` lists the new option - `--gpu abc` prints an error and exits 1 with usage, matching `--user-id` / `--present-mode` ## Note clang-format (pre-commit v22.1.3) realigned a few pre-existing lines in the touched files; those changes are mechanical. ## AI assistance This change was written with AI assistance. I reviewed, built and tested it myself.
Select the Vulkan physical device by enumeration index, defaulting to
automatic selection (-1). Invalid or out-of-range indices fall back to
automatic selection with a clear message, and the selected device is
logged.

Co-Authored-By: Claude <[email protected]>
An invalid --gpu index now prints an error and exits with code 1 (usage),
matching --user-id / --present-mode / --console-language. The automatic
fallback is kept only for out-of-range indices detected at runtime.
Comments translated to English and the touched files brought in line
with clang-format (pre-commit v22.1.3).

Co-Authored-By: Claude <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:19:45 +00:00
github manually merged commit 6d466440d4 into gh-pr/417/base 2026-11-26 09:19:47 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.