mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Add clamp on extra descriptors in D3D12 for CBV/SRV/UAV heap. Refs #518
* We need extra descriptors during some analysis events for patching e.g shaders for overlays and things. This is because D3D12 only allows one heap of any given time bound at once. * D3D12 also limits the size of that heap, and the limit is not queryable so the application can make a heap of maximum size that it uses all of. * There's no solution for this, in this case we just can't add more descriptors and when we try to use the last one for our own purposes we stand a small chance of stomping an important descriptor.
This commit is contained in:
@@ -179,6 +179,10 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
m_DescriptorIncrements[i] =
|
||||
realDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE(i));
|
||||
|
||||
RDCEraseEl(m_D3D12Opts);
|
||||
|
||||
realDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_D3D12Opts, sizeof(m_D3D12Opts));
|
||||
|
||||
WrappedID3D12Resource::m_List = NULL;
|
||||
|
||||
// refcounters implicitly construct with one reference, but we don't start with any soft
|
||||
|
||||
@@ -333,6 +333,7 @@ private:
|
||||
|
||||
WrappedIDXGISwapChain4 *m_LastSwap;
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS m_D3D12Opts;
|
||||
UINT m_DescriptorIncrements[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES];
|
||||
|
||||
void Serialise_CaptureScope(uint64_t offset);
|
||||
|
||||
@@ -447,7 +447,15 @@ bool WrappedID3D12Device::Serialise_CreateDescriptorHeap(
|
||||
// while patching, because DX12 has a stupid limitation to not be able
|
||||
// to set multiple descriptor heaps at once of the same type
|
||||
if(Descriptor.Type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV)
|
||||
Descriptor.NumDescriptors += 16;
|
||||
{
|
||||
if(m_D3D12Opts.ResourceBindingTier == D3D12_RESOURCE_BINDING_TIER_3 ||
|
||||
Descriptor.NumDescriptors + 16 <= 1000000)
|
||||
Descriptor.NumDescriptors += 16;
|
||||
else
|
||||
RDCERR(
|
||||
"RenderDoc needs extra descriptors for patching during analysis,"
|
||||
"but heap is already at binding tier limit");
|
||||
}
|
||||
|
||||
ID3D12DescriptorHeap *ret = NULL;
|
||||
HRESULT hr = m_pDevice->CreateDescriptorHeap(&Descriptor, guid, (void **)&ret);
|
||||
|
||||
Reference in New Issue
Block a user