diff --git a/include/9on12Registry.h b/include/9on12Registry.h index 27f0da3..d12ed3b 100644 --- a/include/9on12Registry.h +++ b/include/9on12Registry.h @@ -28,6 +28,7 @@ namespace D3D9on12 static const LPCSTR g_cPSOCacheTrimLimitAge = "PSOCacheTrimLimitAge"; static const LPCSTR g_cMaxAllocatedUploadHeapSpacePerCommandList = "MaxAllocatedUploadHeapSpacePerCommandList"; static const LPCSTR g_cMaxSRVHeapSize = "MaxSRVHeapSize"; + static const LPCSTR g_cBufferPoolTrimThreshold = "BufferPoolTrimThreshold"; // Must be in the range 5-100 to be used by the translation layer. If there is a compat shim, will take the lesser of the two values static const LPCSTR g_cLockDiscardOptimization = "LockDiscardOptimization"; }; @@ -103,6 +104,7 @@ namespace D3D9on12 static const DWORD g_cPSOCacheTrimLimitAge = CheckRegistryKeyDWORD(RegistryKeys::g_cPSOCacheTrimLimitAge, MAXDWORD); static const DWORD g_cMaxAllocatedUploadHeapSpacePerCommandList = CheckRegistryKeyDWORD(RegistryKeys::g_cMaxAllocatedUploadHeapSpacePerCommandList, MAXDWORD); static const DWORD g_cMaxSRVHeapSize = CheckRegistryKeyDWORD(RegistryKeys::g_cMaxSRVHeapSize, MAXDWORD); + static const DWORD g_cBufferPoolTrimThreshold = CheckRegistryKeyDWORD(RegistryKeys::g_cBufferPoolTrimThreshold, MAXDWORD); static const bool g_cLockDiscardOptimization = CheckRegistryKeyDWORD(RegistryKeys::g_cLockDiscardOptimization, 1); }; }; \ No newline at end of file diff --git a/interface/d3d9on12ddi.h b/interface/d3d9on12ddi.h index 3b4f904..4e4b814 100644 --- a/interface/d3d9on12ddi.h +++ b/interface/d3d9on12ddi.h @@ -286,6 +286,7 @@ typedef struct _D3D9ON12_APP_COMPAT_INFO DWORD PSOCacheTrimLimitAge; // We will only trim PSOs that are older then this age (age in command list age) DWORD MaxAllocatedUploadHeapSpacePerCommandList; // Maximum amount of storage allocated for upload operations per command list before flush DWORD MaxSRVHeapSize; // Maximum number of entries in the sharer resource view decriptor heap + DWORD BufferPoolTrimThreshold; // How many fences (roughly translates to frames) a buffer in the buffer pool is allowed to exist before it is eleigible for being reclaimed. Must be in the range 5-100 to have an effect } D3D9ON12_APP_COMPAT_INFO; typedef void (APIENTRY *PFND3D9ON12_SETAPPCOMPATDATA)( diff --git a/src/9on12AppCompat.cpp b/src/9on12AppCompat.cpp index 709f0aa..d1b2862 100644 --- a/src/9on12AppCompat.cpp +++ b/src/9on12AppCompat.cpp @@ -11,6 +11,7 @@ namespace D3D9on12 MAXDWORD, // PSOCacheTrimLimitAge MAXDWORD, // MaxAllocatedUploadHeapSpacePerCommandList MAXDWORD, // MaxSRVHeapSize + MAXDWORD, // BufferPoolTrimThreshold }; void APIENTRY SetAppCompatData(const D3D9ON12_APP_COMPAT_INFO *pAppCompatData) diff --git a/src/9on12Device.cpp b/src/9on12Device.cpp index 202e258..9bbb943 100644 --- a/src/9on12Device.cpp +++ b/src/9on12Device.cpp @@ -484,6 +484,7 @@ namespace D3D9on12 g_AppCompatInfo.MaxAllocatedUploadHeapSpacePerCommandList); args.MaxSRVHeapSize = min(RegistryConstants::g_cMaxSRVHeapSize, g_AppCompatInfo.MaxSRVHeapSize); + args.BufferPoolTrimThreshold = min(RegistryConstants::g_cBufferPoolTrimThreshold, g_AppCompatInfo.BufferPoolTrimThreshold); if (!RegistryConstants::g_cSingleThread) {