Don't cast command list/queue to TrackedResource - not inherited

This commit is contained in:
baldurk
2016-07-10 16:12:31 +03:00
parent b12dcbb869
commit 7ccd3fe98f
2 changed files with 19 additions and 13 deletions
+18 -7
View File
@@ -68,13 +68,6 @@ TrackedResource *GetTracked(ID3D12DeviceChild *ptr)
ALL_D3D12_TYPES;
if(WrappedID3D12GraphicsCommandList::IsAlloc(ptr))
return (TrackedResource *)(WrappedID3D12GraphicsCommandList *)ptr;
if(WrappedID3D12CommandQueue::IsAlloc(ptr))
return (TrackedResource *)(WrappedID3D12CommandQueue *)ptr;
RDCERR("Unknown type of ptr 0x%p", ptr);
return NULL;
}
@@ -109,7 +102,16 @@ ResourceId GetResID(ID3D12DeviceChild *ptr)
TrackedResource *res = GetTracked(ptr);
if(res == NULL)
{
if(WrappedID3D12GraphicsCommandList::IsAlloc(ptr))
return ((WrappedID3D12GraphicsCommandList *)ptr)->GetResourceID();
if(WrappedID3D12CommandQueue::IsAlloc(ptr))
return ((WrappedID3D12CommandQueue *)ptr)->GetResourceID();
RDCERR("Unknown type of ptr 0x%p", ptr);
return ResourceId();
}
return res->GetResourceID();
}
@@ -123,7 +125,16 @@ D3D12ResourceRecord *GetRecord(ID3D12DeviceChild *ptr)
TrackedResource *res = GetTracked(ptr);
if(res == NULL)
{
if(WrappedID3D12GraphicsCommandList::IsAlloc(ptr))
return ((WrappedID3D12GraphicsCommandList *)ptr)->GetResourceRecord();
if(WrappedID3D12CommandQueue::IsAlloc(ptr))
return ((WrappedID3D12CommandQueue *)ptr)->GetResourceRecord();
RDCERR("Unknown type of ptr 0x%p", ptr);
return NULL;
}
return res->GetResourceRecord();
}
+1 -6
View File
@@ -647,11 +647,6 @@ typename UnwrapHelper<iface>::Outer *GetWrapped(iface *obj)
return wrapped;
}
// this function identifies the type by IsAlloc() and returns
// the pointer to the TrackedResource interface for fetching ID
// or record
TrackedResource *GetTracked(ID3D12DeviceChild *ptr);
template <typename ifaceptr>
ifaceptr Unwrap(ifaceptr obj)
{
@@ -679,7 +674,7 @@ D3D12ResourceRecord *GetRecord(ifaceptr obj)
return GetWrapped(obj)->GetResourceRecord();
}
// specialisations that use the GetTracked() function to fetch the ID
// specialisations that use the IsAlloc() function to identify the real type
template <>
ResourceId GetResID(ID3D12DeviceChild *ptr);
template <>