Skip to content

Commit

Permalink
If descriptor heap fails to expand on tier 3 HW, fall back. Closes #3092
Browse files Browse the repository at this point in the history


* Descriptor heap tier limits are not very useful as even tier 3 might be as
  limited as tier 2. Previously expanding a small amount was safe but newer NV
  drivers or systems seem to have stricter limits than before.
  • Loading branch information
baldurk committed Oct 25, 2023
1 parent ea4c034 commit ecd47ca
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions renderdoc/driver/d3d12/d3d12_device_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ bool WrappedID3D12Device::Serialise_CreateDescriptorHeap(
if(IsReplayingAndReading())
{
D3D12_DESCRIPTOR_HEAP_DESC PatchedDesc = Descriptor;
bool patched = false;

// inflate the heap so we can insert our own descriptors at the end
// while patching, because DX12 has a stupid limitation to not be able
Expand All @@ -919,16 +920,31 @@ bool WrappedID3D12Device::Serialise_CreateDescriptorHeap(
{
if(m_D3D12Opts.ResourceBindingTier == D3D12_RESOURCE_BINDING_TIER_3 ||
PatchedDesc.NumDescriptors + 16 <= 1000000)
{
PatchedDesc.NumDescriptors += 16;
patched = true;
}
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(&PatchedDesc, guid, (void **)&ret);

if(patched && FAILED(hr))
{
RDCERR(
"RenderDoc needs extra descriptors for patching during analysis,"
"but heap failed to expand any further even at tier 3");
PatchedDesc.NumDescriptors = Descriptor.NumDescriptors;

hr = m_pDevice->CreateDescriptorHeap(&PatchedDesc, guid, (void **)&ret);
}

if(FAILED(hr))
{
SET_ERROR_RESULT(m_FailedReplayResult, ResultCode::APIReplayFailed,
Expand Down

0 comments on commit ecd47ca

Please sign in to comment.