Skip to content

Commit 346d437

Browse files
committed
Make debug sampler heap large enough and assert on sizes
1 parent 55d886a commit 346d437

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

renderdoc/driver/d3d12/d3d12_debug.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
146146
desc.NumDescriptors = rtvCount;
147147
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
148148

149-
RDCCOMPILE_ASSERT(LAST_WIN_RTV < rtvCount, "Increase size of RTV heap");
149+
RDCCOMPILE_ASSERT(MAX_RTV_SLOT < rtvCount, "Increase size of RTV heap");
150150

151151
hr = m_pDevice->CreateDescriptorHeap(&desc, __uuidof(ID3D12DescriptorHeap), (void **)&rtvHeap);
152152
m_pDevice->InternalRef();
@@ -163,7 +163,7 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
163163
desc.NumDescriptors = dsvCount;
164164
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
165165

166-
RDCCOMPILE_ASSERT(LAST_WIN_DSV < dsvCount, "Increase size of DSV heap");
166+
RDCCOMPILE_ASSERT(MAX_DSV_SLOT < dsvCount, "Increase size of DSV heap");
167167

168168
hr = m_pDevice->CreateDescriptorHeap(&desc, __uuidof(ID3D12DescriptorHeap), (void **)&dsvHeap);
169169
m_pDevice->InternalRef();
@@ -175,10 +175,12 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
175175

176176
rm->SetInternalResource(dsvHeap);
177177

178-
desc.NumDescriptors = 4096;
178+
const uint32_t srvCount = 4096;
179+
180+
desc.NumDescriptors = srvCount;
179181
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
180182

181-
RDCCOMPILE_ASSERT(MAX_SRV_SLOT < 4096, "Increase size of CBV/SRV/UAV heap");
183+
RDCCOMPILE_ASSERT(MAX_SRV_SLOT < srvCount, "Increase size of CBV/SRV/UAV heap");
182184

183185
hr = m_pDevice->CreateDescriptorHeap(&desc, __uuidof(ID3D12DescriptorHeap), (void **)&uavClearHeap);
184186
m_pDevice->InternalRef();
@@ -203,9 +205,13 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
203205

204206
rm->SetInternalResource(cbvsrvuavHeap);
205207

206-
desc.NumDescriptors = 16;
208+
const uint32_t samplerCount = 300;
209+
210+
desc.NumDescriptors = samplerCount;
207211
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER;
208212

213+
RDCCOMPILE_ASSERT(MAX_SAMPLER_SLOT < samplerCount, "Increase size of sampler heap");
214+
209215
hr = m_pDevice->CreateDescriptorHeap(&desc, __uuidof(ID3D12DescriptorHeap), (void **)&samplerHeap);
210216
m_pDevice->InternalRef();
211217

renderdoc/driver/d3d12/d3d12_debug.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ enum RTVSlot
118118
LAST_TMP_RTV = FIRST_TMP_RTV + 16,
119119
FIRST_WIN_RTV,
120120
LAST_WIN_RTV = FIRST_WIN_RTV + 768,
121+
122+
MAX_RTV_SLOT,
121123
};
122124

123125
enum SamplerSlot
@@ -128,6 +130,7 @@ enum SamplerSlot
128130
SHADDEBUG_SAMPLER0,
129131
LAST_SHADDEBUG_SAMPLER = SHADDEBUG_SAMPLER0 + ShaderDebugConstants::COUNT_SAMPLERS_PER_DEBUG *
130132
ShaderDebugConstants::MAX_SHADER_DEBUG_QUEUED_OPS,
133+
MAX_SAMPLER_SLOT,
131134
};
132135

133136
enum DSVSlot
@@ -138,6 +141,8 @@ enum DSVSlot
138141
TMP_DSV,
139142
FIRST_WIN_DSV,
140143
LAST_WIN_DSV = FIRST_WIN_DSV + 64,
144+
145+
MAX_DSV_SLOT
141146
};
142147

143148
struct MeshDisplayPipelines

0 commit comments

Comments
 (0)