From 51569944403bb047ac4fa28acbebd9944768714d Mon Sep 17 00:00:00 2001 From: Oleg Kuznetsov Date: Tue, 1 Feb 2022 02:49:01 -0800 Subject: [PATCH] [dxvk] Add a config option to enable debug utils in addition to DXVK_PERF_EVENTS=1 --- dxvk.conf | 10 ++++++++++ src/dxvk/dxvk_instance.cpp | 4 +++- src/dxvk/dxvk_options.cpp | 1 + src/dxvk/dxvk_options.h | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dxvk.conf b/dxvk.conf index 769e1f67..143e8920 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -557,3 +557,13 @@ # - True/False # d3d9.apitraceMode = False + +# Debug Utils +# +# Enables debug utils as this is off by default, this enables user annotations like BeginEvent()/EndEvent(). +# Alternatively could be enabled with DXVK_PERF_EVENTS=1 environment variable. +# +# Supported values: +# - True/False + +# dxvk.enableDebugUtils = True diff --git a/src/dxvk/dxvk_instance.cpp b/src/dxvk/dxvk_instance.cpp index 8949b3a2..68938cb6 100644 --- a/src/dxvk/dxvk_instance.cpp +++ b/src/dxvk/dxvk_instance.cpp @@ -94,8 +94,10 @@ namespace dxvk { // Hide VK_EXT_debug_utils behind an environment variable. This extension // adds additional overhead to winevulkan - if (env::getEnvVar("DXVK_PERF_EVENTS") == "1") { + if ((env::getEnvVar("DXVK_PERF_EVENTS") == "1") || + (m_options.enableDebugUtils)) { insExtensionList.push_back(&insExtensions.extDebugUtils); + Logger::warn("DXVK: Debug Utils are enabled, perf events are ON. May affect performance!"); } DxvkNameSet extensionsEnabled; diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index 39e9a820..ea82eedc 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -3,6 +3,7 @@ namespace dxvk { DxvkOptions::DxvkOptions(const Config& config) { + enableDebugUtils = config.getOption ("dxvk.enableDebugUtils", false); enableStateCache = config.getOption ("dxvk.enableStateCache", true); numCompilerThreads = config.getOption ("dxvk.numCompilerThreads", 0); useRawSsbo = config.getOption("dxvk.useRawSsbo", Tristate::Auto); diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index 2fb0163a..992ec764 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -8,6 +8,9 @@ namespace dxvk { DxvkOptions() { } DxvkOptions(const Config& config); + /// Enable debug utils (alternative to DXVK_PERF_EVENTS=1) + bool enableDebugUtils; + /// Enable state cache bool enableStateCache;