Rename device choice config options as requested.

This commit is contained in:
Henrik Rydgård 2018-06-06 10:24:16 +02:00
parent 8ee3cd52e8
commit 238521a297
5 changed files with 11 additions and 10 deletions

View File

@ -507,9 +507,9 @@ static ConfigSetting graphicsSettings[] = {
ConfigSetting("CardboardYShift", &g_Config.iCardboardXShift, 0, true, true),
ConfigSetting("ShowFPSCounter", &g_Config.iShowFPSCounter, 0, true, true),
ReportedConfigSetting("GraphicsBackend", &g_Config.iGPUBackend, &DefaultGPUBackend),
ConfigSetting("VulkanDevice", &g_Config.VulkanDevice, "", true, false),
ConfigSetting("VulkanDevice", &g_Config.sVulkanDevice, "", true, false),
#ifdef _WIN32
ConfigSetting("D3D11Device", &g_Config.D3D11Device, "", true, false),
ConfigSetting("D3D11Device", &g_Config.sD3D11Device, "", true, false),
#endif
ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, &DefaultRenderingMode, true, true),
ConfigSetting("SoftwareRenderer", &g_Config.bSoftwareRendering, false, true, true),

View File

@ -155,9 +155,9 @@ public:
int iGPUBackend;
// We have separate device parameters for each backend so it doesn't get erased if you switch backends.
// If not set, will use the "best" device.
std::string VulkanDevice;
std::string sVulkanDevice;
#ifdef _WIN32
std::string D3D11Device;
std::string sD3D11Device;
#endif
bool bSoftwareRendering;
bool bHardwareTransform; // only used in the GLES backend

View File

@ -203,15 +203,16 @@ void GameSettingsScreen::CreateViews() {
}
#endif
Draw::DrawContext *draw = screenManager()->getDrawContext();
// Backends that don't allow a device choice will only expose one device.
if (draw->GetDeviceList().size() > 1) {
// Some backends don't support switching so no point in showing multiple devices.
std::string *deviceNameSetting = nullptr;
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN) {
deviceNameSetting = &g_Config.VulkanDevice;
deviceNameSetting = &g_Config.sVulkanDevice;
}
#ifdef _WIN32
if (g_Config.iGPUBackend == (int)GPUBackend::DIRECT3D11) {
deviceNameSetting = &g_Config.D3D11Device;
deviceNameSetting = &g_Config.sD3D11Device;
}
#endif
if (deviceNameSetting) {

View File

@ -115,7 +115,7 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
pAdapter->GetDesc(&desc);
std::string str = ConvertWStringToUTF8(desc.Description);
adapterNames.push_back(str);
if (str == g_Config.D3D11Device) {
if (str == g_Config.sD3D11Device) {
chosenAdapter = i;
}
}

View File

@ -109,10 +109,10 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
g_Vulkan = nullptr;
return false;
}
int deviceNum = g_Vulkan->GetPhysicalDeviceByName(g_Config.VulkanDevice);
int deviceNum = g_Vulkan->GetPhysicalDeviceByName(g_Config.sVulkanDevice);
if (deviceNum < 0) {
deviceNum = g_Vulkan->GetBestPhysicalDevice();
g_Config.VulkanDevice = g_Vulkan->GetPhysicalDeviceProperties(deviceNum).deviceName;
g_Config.sVulkanDevice = g_Vulkan->GetPhysicalDeviceProperties(deviceNum).deviceName;
}
g_Vulkan->ChooseDevice(deviceNum);
if (g_Vulkan->EnableDeviceExtension(VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME)) {