1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 14:52:10 +01:00

[dxvk] Add option to disable memory defragmentation

This commit is contained in:
Philip Rebohle 2024-10-24 12:15:44 +02:00 committed by Philip Rebohle
parent 9977313c32
commit ec62551412
4 changed files with 35 additions and 15 deletions

View File

@ -388,6 +388,20 @@
# dxvk.trackPipelineLifetime = Auto
# Controls memory defragmentation
#
# By default, DXVK will try to defragment video memory if there is a
# significant amount of memory wasted, or if the allocation budget of
# the application is exceeded. This option is provided solely for
# debug purposes.
#
# Supported values:
# - True: Enable defragmentation
# - False: Disable defragmentation
# dxvk.enableMemoryDefrag = True
# Sets enabled HUD elements
#
# Behaves like the DXVK_HUD environment variable if the

View File

@ -2283,13 +2283,15 @@ namespace dxvk {
m_memTypes[i].sharedCache->cleanupUnusedFromLockedAllocator(currentTime);
}
// Periodically defragment device-local memory types. We cannot
// do anything about mapped allocations since we rely on pointer
// stability there.
for (uint32_t i = 0; i < m_memTypeCount; i++) {
if (m_memTypes[i].properties.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
moveDefragChunk(m_memTypes[i]);
pickDefragChunk(m_memTypes[i]);
if (m_device->config().enableMemoryDefrag) {
// Periodically defragment device-local memory types. We cannot
// do anything about mapped allocations since we rely on pointer
// stability there.
for (uint32_t i = 0; i < m_memTypeCount; i++) {
if (m_memTypes[i].properties.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
moveDefragChunk(m_memTypes[i]);
pickDefragChunk(m_memTypes[i]);
}
}
}
}

View File

@ -5,6 +5,7 @@ namespace dxvk {
DxvkOptions::DxvkOptions(const Config& config) {
enableDebugUtils = config.getOption<bool> ("dxvk.enableDebugUtils", false);
enableStateCache = config.getOption<bool> ("dxvk.enableStateCache", true);
enableMemoryDefrag = config.getOption<bool> ("dxvk.enableMemoryDefrag", true);
numCompilerThreads = config.getOption<int32_t> ("dxvk.numCompilerThreads", 0);
enableGraphicsPipelineLibrary = config.getOption<Tristate>("dxvk.enableGraphicsPipelineLibrary", Tristate::Auto);
trackPipelineLifetime = config.getOption<Tristate>("dxvk.trackPipelineLifetime", Tristate::Auto);

View File

@ -9,35 +9,38 @@ namespace dxvk {
DxvkOptions(const Config& config);
/// Enable debug utils
bool enableDebugUtils;
bool enableDebugUtils = false;
/// Enable state cache
bool enableStateCache;
bool enableStateCache = true;
/// Enable memory defragmentation
bool enableMemoryDefrag = true;
/// Number of compiler threads
/// when using the state cache
int32_t numCompilerThreads;
int32_t numCompilerThreads = 0;
/// Enable graphics pipeline library
Tristate enableGraphicsPipelineLibrary;
Tristate enableGraphicsPipelineLibrary = Tristate::Auto;
/// Enables pipeline lifetime tracking
Tristate trackPipelineLifetime;
Tristate trackPipelineLifetime = Tristate::Auto;
/// Shader-related options
Tristate useRawSsbo;
Tristate useRawSsbo = Tristate::Auto;
/// HUD elements
std::string hud;
/// Forces swap chain into MAILBOX (if true)
/// or FIFO_RELAXED (if false) present mode
Tristate tearFree;
Tristate tearFree = Tristate::Auto;
// Hides integrated GPUs if dedicated GPUs are
// present. May be necessary for some games that
// incorrectly assume monitor layouts.
bool hideIntegratedGraphics;
bool hideIntegratedGraphics = false;
// Device name
std::string deviceFilter;