Work around poor D3D12 behaviour to return unusable Desc. Closes #3728

* For some cases D3D12's GetDesc() returns a desc that is not usable for
  resource creation, and must instead be modified to work.
This commit is contained in:
baldurk
2025-11-10 11:10:57 +00:00
parent 0cf06344de
commit cf746cf0be
+9 -1
View File
@@ -1536,7 +1536,15 @@ public:
//////////////////////////////
// implement ID3D12Resource
virtual D3D12_RESOURCE_DESC STDMETHODCALLTYPE GetDesc() { return m_pReal->GetDesc(); }
virtual D3D12_RESOURCE_DESC STDMETHODCALLTYPE GetDesc()
{
D3D12_RESOURCE_DESC ret = m_pReal->GetDesc();
// normalise alignment - sometimes D3D12 returns an alignment that is invalid to use
if(ret.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER &&
ret.Alignment != D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT)
ret.Alignment = 0;
return ret;
}
virtual D3D12_GPU_VIRTUAL_ADDRESS STDMETHODCALLTYPE GetGPUVirtualAddress()
{
return m_pReal->GetGPUVirtualAddress();