1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 11:52:12 +01:00

[d3d9] Add d3d9.allowImplicitDiscard option

This commit is contained in:
Joshua Ashton 2021-02-27 20:08:57 +00:00
parent 50d223e614
commit e8fc7ea23a
No known key found for this signature in database
GPG Key ID: C85A08669126BE8D
3 changed files with 9 additions and 2 deletions

View File

@ -4067,7 +4067,8 @@ namespace dxvk {
if (alloced)
std::memset(physSlice.mapPtr, 0, physSlice.length);
else if ((managed || (systemmem && !dirty)) && !(Flags & D3DLOCK_DONOTWAIT) && !skipWait) {
else if ((managed || (systemmem && !dirty)) && !(Flags & D3DLOCK_DONOTWAIT) && !skipWait
&& m_d3d9Options.allowImplicitDiscard) {
if (!WaitForResource(mappedBuffer, D3DLOCK_DONOTWAIT)) {
// if the mapped buffer is currently being copied to image
// we can just avoid a stall by allocating a new slice and copying the existing contents
@ -4413,7 +4414,8 @@ namespace dxvk {
quickRead ||
(boundsCheck && !pResource->DirtyRange().Overlaps(pResource->LockRange()));
if (!skipWait) {
if ((IsPoolManaged(desc.Pool) || desc.Pool == D3DPOOL_SYSTEMMEM) && !(Flags & D3DLOCK_DONOTWAIT) && pResource->GetLockCount() == 0) {
if ((IsPoolManaged(desc.Pool) || desc.Pool == D3DPOOL_SYSTEMMEM) && !(Flags & D3DLOCK_DONOTWAIT) && pResource->GetLockCount() == 0
&& m_d3d9Options.allowImplicitDiscard) {
if (!WaitForResource(mappingBuffer, D3DLOCK_DONOTWAIT)) {
// if the mapped buffer is currently being copied to the primary buffer
// we can just avoid a stall by allocating a new slice and copying the existing contents

View File

@ -76,6 +76,7 @@ namespace dxvk {
this->apitraceMode = config.getOption<bool>("d3d9.apitraceMode", false);
this->deviceLocalConstantBuffers = config.getOption<bool>("d3d9.deviceLocalConstantBuffers", false);
this->allowImplicitDiscard = config.getOption<bool>("d3d9.allowImplicitDiscard", true);
// If we are not Nvidia, enable general hazards.
this->generalHazards = adapter == nullptr || !adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);

View File

@ -157,6 +157,10 @@ namespace dxvk {
/// Use device local memory for constant buffers.
bool deviceLocalConstantBuffers;
/// Allow implicit discard of resources in contested situations.
/// Some naughty apps write to pointers outside of lock boundaries.
bool allowImplicitDiscard;
};
}