diff --git a/OptiScaler/hudfix/Hudfix_Dx12.cpp b/OptiScaler/hudfix/Hudfix_Dx12.cpp index 1ef2dfd3..4c6d4fd3 100644 --- a/OptiScaler/hudfix/Hudfix_Dx12.cpp +++ b/OptiScaler/hudfix/Hudfix_Dx12.cpp @@ -164,6 +164,8 @@ bool Hudfix_Dx12::CreateBufferResource(ID3D12Device* InDevice, ResourceInfo* InS if (bufDesc.Width != (UINT64) (InSource->width) || bufDesc.Height != (UINT) (InSource->height) || bufDesc.Format != InSource->format) { + // Maybe need to add a fence here + // To be sure it's not used anymore (*OutResource)->Release(); (*OutResource) = nullptr; LOG_WARN("Release {}x{}, new one: {}x{}", bufDesc.Width, bufDesc.Height, InSource->width, InSource->height); @@ -458,30 +460,6 @@ void Hudfix_Dx12::HudlessFound(ID3D12GraphicsCommandList* cmdList) _skipHudlessChecks = false; } -bool Hudfix_Dx12::CheckForRealObject(std::string functionName, IUnknown* pObject, IUnknown** ppRealObject) -{ - // return false; - - if (streamlineRiid.Data1 == 0) - { - auto iidResult = IIDFromString(L"{ADEC44E2-61F0-45C3-AD9F-1B37379284FF}", &streamlineRiid); - - if (iidResult != S_OK) - return false; - } - - auto qResult = pObject->QueryInterface(streamlineRiid, (void**) ppRealObject); - - if (qResult == S_OK && *ppRealObject != nullptr) - { - LOG_INFO("{} Streamline proxy found!", functionName); - (*ppRealObject)->Release(); - return true; - } - - return false; -} - void Hudfix_Dx12::UpscaleStart() { if (State::Instance().FGresetCapturedResources) diff --git a/OptiScaler/hudfix/Hudfix_Dx12.h b/OptiScaler/hudfix/Hudfix_Dx12.h index c272b7cd..56f9c4b2 100644 --- a/OptiScaler/hudfix/Hudfix_Dx12.h +++ b/OptiScaler/hudfix/Hudfix_Dx12.h @@ -112,9 +112,6 @@ class Hudfix_Dx12 static int GetIndex(); - inline static IID streamlineRiid {}; - static bool CheckForRealObject(std::string functionName, IUnknown* pObject, IUnknown** ppRealObject); - public: // Trig for upscaling start static void UpscaleStart(); diff --git a/OptiScaler/resource_tracking/ResTrack_dx12.cpp b/OptiScaler/resource_tracking/ResTrack_dx12.cpp index c96bc39c..bb36c852 100644 --- a/OptiScaler/resource_tracking/ResTrack_dx12.cpp +++ b/OptiScaler/resource_tracking/ResTrack_dx12.cpp @@ -596,8 +596,7 @@ void ResTrack_Dx12::hkCreateRenderTargetView(ID3D12Device* This, ID3D12Resource* if (Config::Instance()->FGHudfixDisableRTV.value_or_default()) return; - if (pResource == nullptr || pDesc == nullptr || pDesc->ViewDimension != D3D12_RTV_DIMENSION_TEXTURE2D || - !CheckResource(pResource)) + if (pResource == nullptr || !CheckResource(pResource)) { auto heap = GetHeapByCpuHandleRTV(DestDescriptor.ptr); @@ -651,8 +650,7 @@ void ResTrack_Dx12::hkCreateShaderResourceView(ID3D12Device* This, ID3D12Resourc if (Config::Instance()->FGHudfixDisableSRV.value_or_default()) return; - if (pResource == nullptr || pDesc == nullptr || pDesc->ViewDimension != D3D12_SRV_DIMENSION_TEXTURE2D || - !CheckResource(pResource)) + if (pResource == nullptr || !CheckResource(pResource)) { auto heap = GetHeapByCpuHandleSRV(DestDescriptor.ptr); @@ -706,8 +704,7 @@ void ResTrack_Dx12::hkCreateUnorderedAccessView(ID3D12Device* This, ID3D12Resour if (Config::Instance()->FGHudfixDisableUAV.value_or_default()) return; - if (pResource == nullptr || pDesc == nullptr || pDesc->ViewDimension != D3D12_UAV_DIMENSION_TEXTURE2D || - !CheckResource(pResource)) + if (pResource == nullptr || !CheckResource(pResource)) { auto heap = GetHeapByCpuHandleUAV(DestDescriptor.ptr); @@ -1547,13 +1544,6 @@ void ResTrack_Dx12::hkDrawInstanced(ID3D12GraphicsCommandList* This, UINT Vertex return; } - // if can't find output skip - if (shard.map.size() == 0) - { - LOG_DEBUG_ONLY("Early exit"); - return; - } - ankerl::unordered_dense::map val0; { @@ -1563,6 +1553,13 @@ void ResTrack_Dx12::hkDrawInstanced(ID3D12GraphicsCommandList* This, UINT Vertex std::lock_guard lock(shard.mutex); #endif + // if can't find output skip + if (shard.map.size() == 0) + { + LOG_DEBUG_ONLY("Early exit"); + return; + } + if (!shard.map.contains(This)) return; @@ -1667,13 +1664,6 @@ void ResTrack_Dx12::hkDrawIndexedInstanced(ID3D12GraphicsCommandList* This, UINT return; } - // if can't find output skip - if (shard.map.size() == 0) - { - LOG_DEBUG_ONLY("Early exit"); - return; - } - ankerl::unordered_dense::map val0; { @@ -1683,6 +1673,13 @@ void ResTrack_Dx12::hkDrawIndexedInstanced(ID3D12GraphicsCommandList* This, UINT std::lock_guard lock(shard.mutex); #endif + // if can't find output skip + if (shard.map.size() == 0) + { + LOG_DEBUG_ONLY("Early exit"); + return; + } + if (!shard.map.contains(This)) return; @@ -1858,13 +1855,6 @@ void ResTrack_Dx12::hkDispatch(ID3D12GraphicsCommandList* This, UINT ThreadGroup return; } - // if can't find output skip - if (shard.map.size() == 0) - { - LOG_DEBUG_ONLY("Early exit"); - return; - } - ankerl::unordered_dense::map val0; { @@ -1874,6 +1864,13 @@ void ResTrack_Dx12::hkDispatch(ID3D12GraphicsCommandList* This, UINT ThreadGroup std::lock_guard lock(shard.mutex); #endif + // if can't find output skip + if (shard.map.size() == 0) + { + LOG_DEBUG_ONLY("Early exit"); + return; + } + if (!shard.map.contains(This)) return;