config: option to select gpu for vk device

This commit is contained in:
psucien 2024-04-28 01:19:04 +02:00
parent 249373bf0d
commit 453b24eb20
3 changed files with 12 additions and 3 deletions

View File

@ -12,6 +12,7 @@ namespace Config {
bool isNeo = false;
u32 screenWidth = 1280;
u32 screenHeight = 720;
u32 gpuId = 0; // Vulkan physical device no
std::string logFilter;
std::string logType = "sync";
bool isDebugDump = false;
@ -32,6 +33,10 @@ u32 getScreenHeight() {
return screenHeight;
}
u32 getGpuId() {
return gpuId;
}
std::string getLogFilter() {
return logFilter;
}
@ -76,8 +81,9 @@ void load(const std::filesystem::path& path) {
if (generalResult.is_ok()) {
auto general = generalResult.unwrap();
screenWidth = toml::find_or<toml::integer>(general, "screenWidth", false);
screenHeight = toml::find_or<toml::integer>(general, "screenHeight", false);
screenWidth = toml::find_or<toml::integer>(general, "screenWidth", screenWidth);
screenHeight = toml::find_or<toml::integer>(general, "screenHeight", screenHeight);
gpuId = toml::find_or<toml::integer>(general, "gpuId", 0);
}
}
if (data.contains("Debug")) {
@ -119,6 +125,7 @@ void save(const std::filesystem::path& path) {
data["General"]["isPS4Pro"] = isNeo;
data["General"]["logFilter"] = logFilter;
data["General"]["logType"] = logType;
data["GPU"]["gpuId"] = gpuId;
data["GPU"]["screenWidth"] = screenWidth;
data["GPU"]["screenHeight"] = screenHeight;
data["Debug"]["DebugDump"] = isDebugDump;

View File

@ -16,6 +16,7 @@ std::string getLogType();
u32 getScreenWidth();
u32 getScreenHeight();
u32 getGpuId();
bool debugDump();
bool isLleLibc();

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "sdl_window.h"
#include "common/config.h"
#include "video_core/renderer_vulkan/renderer_vulkan.h"
#include <vk_mem_alloc.h>
@ -57,7 +58,7 @@ bool CanBlitToSwapchain(const vk::PhysicalDevice physical_device, vk::Format for
}
RendererVulkan::RendererVulkan(Frontend::WindowSDL& window_)
: window{window_}, instance{window, 0}, scheduler{instance}, swapchain{instance, window},
: window{window_}, instance{window, Config::getGpuId()}, scheduler{instance}, swapchain{instance, window},
texture_cache{instance, scheduler} {
const u32 num_images = swapchain.GetImageCount();
const vk::Device device = instance.GetDevice();