Some small fixes to Hudfix and ResTrack

This commit is contained in:
cdozdil
2026-08-06 20:23:07 +03:00
parent ae0b732a5a
commit 6c8ef2106e
3 changed files with 26 additions and 54 deletions
+2 -24
View File
@@ -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)
-3
View File
@@ -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();
+24 -27
View File
@@ -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<ID3D12Resource*, ResourceInfo> val0;
{
@@ -1563,6 +1553,13 @@ void ResTrack_Dx12::hkDrawInstanced(ID3D12GraphicsCommandList* This, UINT Vertex
std::lock_guard<std::mutex> 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<ID3D12Resource*, ResourceInfo> val0;
{
@@ -1683,6 +1673,13 @@ void ResTrack_Dx12::hkDrawIndexedInstanced(ID3D12GraphicsCommandList* This, UINT
std::lock_guard<std::mutex> 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<ID3D12Resource*, ResourceInfo> val0;
{
@@ -1874,6 +1864,13 @@ void ResTrack_Dx12::hkDispatch(ID3D12GraphicsCommandList* This, UINT ThreadGroup
std::lock_guard<std::mutex> 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;