[Vulkan] Check each device capabilities before selecting it.

Split instance and physical device selection function and move device selection to window creation, to reject devices without present capability.
Add device preferred type check in discrete > integrated > virtual > cpu > other order.
Add device list printout.
Add command line argument to override device selection.
This commit is contained in:
bruvzg 2021-11-15 14:55:41 +02:00
parent f2beac49bb
commit b11e619b19
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
5 changed files with 219 additions and 124 deletions

View file

@ -323,6 +323,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print("].\n");
OS::get_singleton()->print(" --rendering-driver <driver> Rendering driver (depends on display driver).\n");
OS::get_singleton()->print(" --gpu-index <device_index> Use a specific GPU (run with --verbose to get available device list).\n");
OS::get_singleton()->print(" --text-driver <driver> Text driver (Fonts, BiDi, shaping)\n");
@ -789,6 +790,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
init_windowed = true;
} else if (I->get() == "--gpu-index") {
if (I->next()) {
Engine::singleton->gpu_idx = I->next()->get().to_int();
N = I->next()->next();
} else {
OS::get_singleton()->print("Missing gpu index argument, aborting.\n");
goto error;
}
} else if (I->get() == "--vk-layers") {
Engine::singleton->use_validation_layers = true;
#ifdef DEBUG_ENABLED