diff --git a/dxvk.conf b/dxvk.conf index 1cce94d8..dba45542 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -286,6 +286,20 @@ # dxvk.enableGraphicsPipelineLibrary = Auto +# Controls pipeline lifetime tracking +# +# If enabled, pipeline libraries will be freed aggressively in order +# save memory and address space. Has no effect if graphics pipeline +# libraries are not supported or disabled. +# +# Supported values: +# - Auto: Enable tracking for 32-bit applications only +# - True: Always enable tracking +# - False: Always disable tracking + +# dxvk.trackPipelineLifetime = Auto + + # Sets enabled HUD elements # # Behaves like the DXVK_HUD environment variable if the diff --git a/src/dxvk/dxvk_device.cpp b/src/dxvk/dxvk_device.cpp index 482e1d89..d8bd98a0 100644 --- a/src/dxvk/dxvk_device.cpp +++ b/src/dxvk/dxvk_device.cpp @@ -68,6 +68,13 @@ namespace dxvk { } + bool DxvkDevice::mustTrackPipelineLifetime() const { + bool result = env::is32BitHostPlatform(); + applyTristate(result, m_options.trackPipelineLifetime); + return result && canUseGraphicsPipelineLibrary(); + } + + DxvkFramebufferSize DxvkDevice::getDefaultFramebufferSize() const { return DxvkFramebufferSize { m_properties.core.properties.limits.maxFramebufferWidth, diff --git a/src/dxvk/dxvk_device.h b/src/dxvk/dxvk_device.h index d2096cdf..cbc04041 100644 --- a/src/dxvk/dxvk_device.h +++ b/src/dxvk/dxvk_device.h @@ -209,6 +209,12 @@ namespace dxvk { */ bool canUsePipelineCacheControl() const; + /** + * \brief Checks whether pipelines should be tracked + * \returns \c true if pipelines need to be tracked + */ + bool mustTrackPipelineLifetime() const; + /** * \brief Queries default framebuffer size * \returns Default framebuffer size diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index d251cbcf..652bcc40 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -7,6 +7,7 @@ namespace dxvk { enableStateCache = config.getOption ("dxvk.enableStateCache", true); numCompilerThreads = config.getOption ("dxvk.numCompilerThreads", 0); enableGraphicsPipelineLibrary = config.getOption("dxvk.enableGraphicsPipelineLibrary", Tristate::Auto); + trackPipelineLifetime = config.getOption("dxvk.trackPipelineLifetime", Tristate::Auto); useRawSsbo = config.getOption("dxvk.useRawSsbo", Tristate::Auto); shrinkNvidiaHvvHeap = config.getOption ("dxvk.shrinkNvidiaHvvHeap", false); hud = config.getOption("dxvk.hud", ""); diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index c2f7f11b..b3cd8a2d 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -21,6 +21,9 @@ namespace dxvk { /// Enable graphics pipeline library Tristate enableGraphicsPipelineLibrary; + /// Enables pipeline lifetime tracking + Tristate trackPipelineLifetime; + /// Shader-related options Tristate useRawSsbo;