Skip to content

Commit

Permalink
Merge pull request #84 from microsoft/user/tvandewalle/bufferPoolTrim…
Browse files Browse the repository at this point in the history
…Shim

Add regkey and compat shim options for bufferPoolTrimThreshold
  • Loading branch information
vdwtanner authored Mar 18, 2024
2 parents 79a6807 + 720aaaa commit 64e80b0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/9on12Registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};

Expand Down Expand Up @@ -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);
};
};
1 change: 1 addition & 0 deletions interface/d3d9on12ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)(
Expand Down
1 change: 1 addition & 0 deletions src/9on12AppCompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace D3D9on12
MAXDWORD, // PSOCacheTrimLimitAge
MAXDWORD, // MaxAllocatedUploadHeapSpacePerCommandList
MAXDWORD, // MaxSRVHeapSize
MAXDWORD, // BufferPoolTrimThreshold
};

void APIENTRY SetAppCompatData(const D3D9ON12_APP_COMPAT_INFO *pAppCompatData)
Expand Down
1 change: 1 addition & 0 deletions src/9on12Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 64e80b0

Please sign in to comment.