[dxvk] Add dxvk.deviceFilter config option

This commit is contained in:
Philip Rebohle 2024-06-05 00:43:38 +02:00
parent ee18aecb8a
commit fd978704fb
6 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,10 @@
# Device filter. Only exposes devices whose Vulkan device name contains
# the given string. May be useful to force an application to run on a
# specific GPU, but not applications launched by that application.
# dxvk.deviceFilter = ""
# Expose the HDR10 ColorSpace (DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020)
# to the application by default.
# This shows to the game that the global Windows 'HDR Mode' is enabled.
@ -10,6 +17,7 @@
# dxgi.enableHDR = True
# Create the VkSurface on the first call to IDXGISwapChain::Present,
# rather than when creating the swap chain. Some games that start
# rendering with a different graphics API may require this option,

View File

@ -2,11 +2,16 @@
namespace dxvk {
DxvkDeviceFilter::DxvkDeviceFilter(DxvkDeviceFilterFlags flags)
DxvkDeviceFilter::DxvkDeviceFilter(
DxvkDeviceFilterFlags flags,
const DxvkOptions& options)
: m_flags(flags) {
m_matchDeviceName = env::getEnvVar("DXVK_FILTER_DEVICE_NAME");
if (m_matchDeviceName.size() != 0)
if (m_matchDeviceName.empty())
m_matchDeviceName = options.deviceFilter;
if (!m_matchDeviceName.empty())
m_flags.set(DxvkDeviceFilterFlag::MatchDeviceName);
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "dxvk_adapter.h"
#include "dxvk_options.h"
namespace dxvk {
@ -31,7 +32,10 @@ namespace dxvk {
public:
DxvkDeviceFilter(DxvkDeviceFilterFlags flags);
DxvkDeviceFilter(
DxvkDeviceFilterFlags flags,
const DxvkOptions& options);
~DxvkDeviceFilter();
/**

View File

@ -256,7 +256,7 @@ namespace dxvk {
filterFlags.set(DxvkDeviceFilterFlag::SkipCpuDevices);
}
DxvkDeviceFilter filter(filterFlags);
DxvkDeviceFilter filter(filterFlags, m_options);
std::vector<Rc<DxvkAdapter>> result;
uint32_t numDGPU = 0;

View File

@ -13,6 +13,7 @@ namespace dxvk {
hud = config.getOption<std::string>("dxvk.hud", "");
tearFree = config.getOption<Tristate>("dxvk.tearFree", Tristate::Auto);
hideIntegratedGraphics = config.getOption<bool> ("dxvk.hideIntegratedGraphics", false);
deviceFilter = config.getOption<std::string>("dxvk.deviceFilter", "");
}
}

View File

@ -41,6 +41,9 @@ namespace dxvk {
// present. May be necessary for some games that
// incorrectly assume monitor layouts.
bool hideIntegratedGraphics;
// Device name
std::string deviceFilter;
};
}