Use resource class as part of key for caching resource info

This commit is contained in:
baldurk
2026-07-17 16:50:08 +01:00
parent f933241381
commit a9534bcc69
4 changed files with 14 additions and 8 deletions
+4 -3
View File
@@ -1947,10 +1947,11 @@ bool D3D12APIWrapper::QueuedOpsHasSpace() const
}
// Called from any thread
bool D3D12APIWrapper::IsResourceInfoCached(const DXDebug::BindingSlot &slot, uint32_t mipLevel)
bool D3D12APIWrapper::IsResourceInfoCached(DXIL::ResourceClass resClass,
const DXDebug::BindingSlot &slot, uint32_t mipLevel)
{
SCOPED_READLOCK(m_ResourceInfosLock);
ResourceInfoMiplevel resInfoMip = {slot, mipLevel};
ResourceInfoMiplevel resInfoMip = {resClass, slot, mipLevel};
return m_ResourceInfos.find(resInfoMip) != m_ResourceInfos.end();
}
@@ -1959,7 +1960,7 @@ bool D3D12APIWrapper::IsResourceInfoCached(const DXDebug::BindingSlot &slot, uin
ShaderVariable D3D12APIWrapper::GetResourceInfo(DXIL::ResourceClass resClass,
const DXDebug::BindingSlot &slot, uint32_t mipLevel)
{
ResourceInfoMiplevel resInfoMip = {slot, mipLevel};
ResourceInfoMiplevel resInfoMip = {resClass, slot, mipLevel};
{
SCOPED_READLOCK(m_ResourceInfosLock);
auto it = m_ResourceInfos.find(resInfoMip);
+7 -3
View File
@@ -80,7 +80,8 @@ public:
bool IsCBVCached(const DXDebug::BindingSlot &slot) const override;
bool IsSRVCached(const DXDebug::BindingSlot &slot) const override;
bool IsUAVCached(const DXDebug::BindingSlot &slot) const override;
bool IsResourceInfoCached(const DXDebug::BindingSlot &slot, uint32_t mipLevel) override;
bool IsResourceInfoCached(DXIL::ResourceClass resClass, const DXDebug::BindingSlot &slot,
uint32_t mipLevel) override;
bool IsSampleInfoCached(const DXDebug::BindingSlot &slot) override;
bool IsRenderTargetSampleInfoCached() override;
bool IsResourceReferenceInfoCached(const DXDebug::BindingSlot &slot) override;
@@ -166,19 +167,22 @@ private:
struct ResourceInfoMiplevel
{
DXIL::ResourceClass resClass;
BindingSlot slot;
uint32_t mipLevel;
bool operator<(const ResourceInfoMiplevel &o) const
{
if(mipLevel == o.mipLevel)
if(resClass != o.resClass)
return resClass < o.resClass;
if(!(slot == o.slot))
return slot < o.slot;
return mipLevel < o.mipLevel;
}
bool operator==(const ResourceInfoMiplevel &o) const
{
return slot == o.slot && mipLevel == o.mipLevel;
return resClass == o.resClass && slot == o.slot && mipLevel == o.mipLevel;
}
};
+1 -1
View File
@@ -10600,7 +10600,7 @@ DeviceOpResult Debugger::GetResourceInfo(DXIL::ResourceClass resClass,
const DXDebug::BindingSlot &slot, uint32_t mipLevel,
ShaderVariable &result) const
{
if(!IsDeviceThread() && !m_ApiWrapper->IsResourceInfoCached(slot, mipLevel))
if(!IsDeviceThread() && !m_ApiWrapper->IsResourceInfoCached(resClass, slot, mipLevel))
return DeviceOpResult::NeedsDevice;
result = m_ApiWrapper->GetResourceInfo(resClass, slot, mipLevel);
+2 -1
View File
@@ -343,7 +343,8 @@ public:
virtual bool IsCBVCached(const DXDebug::BindingSlot &slot) const = 0;
virtual bool IsSRVCached(const DXDebug::BindingSlot &slot) const = 0;
virtual bool IsUAVCached(const DXDebug::BindingSlot &slot) const = 0;
virtual bool IsResourceInfoCached(const DXDebug::BindingSlot &slot, uint32_t mipLevel) = 0;
virtual bool IsResourceInfoCached(DXIL::ResourceClass resClass, const DXDebug::BindingSlot &slot,
uint32_t mipLevel) = 0;
virtual bool IsSampleInfoCached(const DXDebug::BindingSlot &slot) = 0;
virtual bool IsRenderTargetSampleInfoCached() = 0;
virtual bool IsResourceReferenceInfoCached(const DXDebug::BindingSlot &slot) = 0;