From 03c09ce15f9f1e3ae4dd24dffb1e3f235127bcfc Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 27 Nov 2023 04:39:24 +0100 Subject: [PATCH] [dxvk] Add option to skip integrated GPU adapters --- dxvk.conf | 12 ++++++++++++ src/dxvk/dxvk_instance.cpp | 7 ++++++- src/dxvk/dxvk_options.cpp | 1 + src/dxvk/dxvk_options.h | 5 +++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dxvk.conf b/dxvk.conf index 13ffb6f49..ec3876cd3 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -634,3 +634,15 @@ # - True/False # dxgi.useMonitorFallback = False + + +# Hide integrated graphics from applications +# +# Only has an effect when dedicated GPUs are present on the system. It is +# not recommended to use this option at all unless absolutely necessary for +# a game to work; prefer using DXVK_FILTER_DEVICE_NAME whenever possible. +# +# Supported values: +# - True/False + +# dxvk.hideIntegratedGraphics = False diff --git a/src/dxvk/dxvk_instance.cpp b/src/dxvk/dxvk_instance.cpp index 016881825..55ba52458 100644 --- a/src/dxvk/dxvk_instance.cpp +++ b/src/dxvk/dxvk_instance.cpp @@ -286,7 +286,12 @@ namespace dxvk { return aRank < bRank; }); - + + if (m_options.hideIntegratedGraphics && numDGPU > 0 && numIGPU > 0) { + result.resize(numDGPU); + numIGPU = 0; + } + if (result.empty()) { Logger::warn("DXVK: No adapters found. Please check your " "device filter settings and Vulkan setup. " diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index 9c4a83554..47e24492d 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -12,6 +12,7 @@ namespace dxvk { maxChunkSize = config.getOption ("dxvk.maxChunkSize", 0); hud = config.getOption("dxvk.hud", ""); tearFree = config.getOption("dxvk.tearFree", Tristate::Auto); + hideIntegratedGraphics = config.getOption ("dxvk.hideIntegratedGraphics", false); } } diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index f367e5c6d..e7e6862f2 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -36,6 +36,11 @@ namespace dxvk { /// Forces swap chain into MAILBOX (if true) /// or FIFO_RELAXED (if false) present mode Tristate tearFree; + + // Hides integrated GPUs if dedicated GPUs are + // present. May be necessary for some games that + // incorrectly assume monitor layouts. + bool hideIntegratedGraphics; }; }