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

View File

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

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "sdl_window.h" #include "sdl_window.h"
#include "common/config.h"
#include "video_core/renderer_vulkan/renderer_vulkan.h" #include "video_core/renderer_vulkan/renderer_vulkan.h"
#include <vk_mem_alloc.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_) 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} { texture_cache{instance, scheduler} {
const u32 num_images = swapchain.GetImageCount(); const u32 num_images = swapchain.GetImageCount();
const vk::Device device = instance.GetDevice(); const vk::Device device = instance.GetDevice();