diff --git a/dxvk.conf b/dxvk.conf index 3543876a..0fa96f21 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -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, diff --git a/src/dxvk/dxvk_device_filter.cpp b/src/dxvk/dxvk_device_filter.cpp index a7546d4b..0bd0e5ca 100644 --- a/src/dxvk/dxvk_device_filter.cpp +++ b/src/dxvk/dxvk_device_filter.cpp @@ -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); } diff --git a/src/dxvk/dxvk_device_filter.h b/src/dxvk/dxvk_device_filter.h index 7b411e6a..79a6db1f 100644 --- a/src/dxvk/dxvk_device_filter.h +++ b/src/dxvk/dxvk_device_filter.h @@ -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(); /** diff --git a/src/dxvk/dxvk_instance.cpp b/src/dxvk/dxvk_instance.cpp index d23a3561..e8e7783e 100644 --- a/src/dxvk/dxvk_instance.cpp +++ b/src/dxvk/dxvk_instance.cpp @@ -256,7 +256,7 @@ namespace dxvk { filterFlags.set(DxvkDeviceFilterFlag::SkipCpuDevices); } - DxvkDeviceFilter filter(filterFlags); + DxvkDeviceFilter filter(filterFlags, m_options); std::vector> result; uint32_t numDGPU = 0; diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index 47e24492..d84f08a6 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -13,6 +13,7 @@ namespace dxvk { hud = config.getOption("dxvk.hud", ""); tearFree = config.getOption("dxvk.tearFree", Tristate::Auto); hideIntegratedGraphics = config.getOption ("dxvk.hideIntegratedGraphics", false); + deviceFilter = config.getOption("dxvk.deviceFilter", ""); } } diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index e7e6862f..ac63bc10 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -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; }; }