Set debug names on objects during replay

* Any 'default' names that just use the ID will be overwritten by any
  proper name the capture gives them.
This commit is contained in:
baldurk
2017-06-28 10:58:59 +01:00
parent 78aca86902
commit d71df3810f
5 changed files with 63 additions and 0 deletions
@@ -841,6 +841,8 @@ void D3D12CommandData::GetIndirectBuffer(size_t size, ID3D12Resource **buf, uint
D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT, NULL,
__uuidof(ID3D12Resource), (void **)&argbuf);
SetObjName(argbuf, StringFormat::Fmt("Indirect Arg Buf (%llu bytes)", (uint64_t)size));
if(FAILED(hr))
RDCERR("Failed to create indirect buffer, HRESULT: 0x%08x", hr);
+5
View File
@@ -43,6 +43,11 @@ struct D3D12MarkerRegion
ID3D12GraphicsCommandList *list;
};
inline void SetObjName(ID3D12Object *obj, const std::string &utf8name)
{
obj->SetName(StringFormat::UTF82Wide(utf8name).c_str());
}
TextureDim MakeTextureDim(D3D12_SRV_DIMENSION dim);
TextureDim MakeTextureDim(D3D12_RTV_DIMENSION dim);
TextureDim MakeTextureDim(D3D12_DSV_DIMENSION dim);
+45
View File
@@ -200,6 +200,8 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
&heapProps, D3D12_HEAP_FLAG_NONE, &pickPixelDesc, D3D12_RESOURCE_STATE_RENDER_TARGET, NULL,
__uuidof(ID3D12Resource), (void **)&m_PickPixelTex);
m_PickPixelTex->SetName(L"m_PickPixelTex");
if(FAILED(hr))
{
RDCERR("Failed to create rendering texture for pixel picking, HRESULT: 0x%08x", hr);
@@ -243,6 +245,8 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
&heapProps, D3D12_HEAP_FLAG_NONE, &readbackDesc, D3D12_RESOURCE_STATE_COPY_DEST, NULL,
__uuidof(ID3D12Resource), (void **)&m_ReadbackBuffer);
m_ReadbackBuffer->SetName(L"m_ReadbackBuffer");
if(FAILED(hr))
{
RDCERR("Failed to create readback buffer, HRESULT: 0x%08x", hr);
@@ -826,6 +830,8 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
&heapProps, D3D12_HEAP_FLAG_NONE, &pickResultDesc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
NULL, __uuidof(ID3D12Resource), (void **)&m_PickResultBuf);
m_PickResultBuf->SetName(L"m_PickResultBuf");
if(FAILED(hr))
{
RDCERR("Failed to create tile buffer for min/max, HRESULT: 0x%08x", hr);
@@ -888,6 +894,8 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
&heapProps, D3D12_HEAP_FLAG_NONE, &minmaxDesc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
__uuidof(ID3D12Resource), (void **)&m_MinMaxTileBuffer);
m_MinMaxTileBuffer->SetName(L"m_MinMaxTileBuffer");
if(FAILED(hr))
{
RDCERR("Failed to create tile buffer for min/max, HRESULT: 0x%08x", hr);
@@ -948,6 +956,8 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
&heapProps, D3D12_HEAP_FLAG_NONE, &minmaxDesc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
__uuidof(ID3D12Resource), (void **)&m_MinMaxResultBuffer);
m_MinMaxResultBuffer->SetName(L"m_MinMaxResultBuffer");
if(FAILED(hr))
{
RDCERR("Failed to create result buffer for min/max, HRESULT: 0x%08x", hr);
@@ -1026,6 +1036,8 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
D3D12_RESOURCE_STATE_COPY_DEST, NULL,
__uuidof(ID3D12Resource), (void **)&m_Font.Tex);
m_Font.Tex->SetName(L"m_Font.Tex");
if(FAILED(hr))
RDCERR("Failed to create m_Font.Tex %08x", hr);
@@ -1383,6 +1395,8 @@ void D3D12DebugManager::CreateSOBuffers()
D3D12_RESOURCE_STATE_STREAM_OUT, NULL,
__uuidof(ID3D12Resource), (void **)&m_SOBuffer);
m_SOBuffer->SetName(L"m_SOBuffer");
if(FAILED(hr))
{
RDCERR("Failed to create SO output buffer, HRESULT: 0x%08x", hr);
@@ -1396,6 +1410,8 @@ void D3D12DebugManager::CreateSOBuffers()
&heapProps, D3D12_HEAP_FLAG_NONE, &soBufDesc, D3D12_RESOURCE_STATE_COPY_DEST, NULL,
__uuidof(ID3D12Resource), (void **)&m_SOStagingBuffer);
m_SOStagingBuffer->SetName(L"m_SOStagingBuffer");
if(FAILED(hr))
{
RDCERR("Failed to create readback buffer, HRESULT: 0x%08x", hr);
@@ -1411,6 +1427,8 @@ void D3D12DebugManager::CreateSOBuffers()
&heapProps, D3D12_HEAP_FLAG_NONE, &soBufDesc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
__uuidof(ID3D12Resource), (void **)&m_SOPatchedIndexBuffer);
m_SOPatchedIndexBuffer->SetName(L"m_SOPatchedIndexBuffer");
if(FAILED(hr))
{
RDCERR("Failed to create SO index buffer, HRESULT: 0x%08x", hr);
@@ -1871,6 +1889,8 @@ void D3D12DebugManager::OutputWindow::MakeRTV(bool multisampled)
D3D12_RESOURCE_STATE_RENDER_TARGET, NULL,
__uuidof(ID3D12Resource), (void **)&col);
col->SetName(L"Output Window RTV");
if(FAILED(hr))
{
RDCERR("Failed to create colour texture for window, HRESULT: 0x%08x", hr);
@@ -1887,6 +1907,8 @@ void D3D12DebugManager::OutputWindow::MakeRTV(bool multisampled)
D3D12_RESOURCE_STATE_RENDER_TARGET, NULL,
__uuidof(ID3D12Resource), (void **)&colResolve);
col->SetName(L"Output Window Resolve");
if(FAILED(hr))
{
RDCERR("Failed to create resolve texture for window, HRESULT: 0x%08x", hr);
@@ -1931,6 +1953,8 @@ void D3D12DebugManager::OutputWindow::MakeDSV()
D3D12_RESOURCE_STATE_DEPTH_WRITE, NULL,
__uuidof(ID3D12Resource), (void **)&depth);
col->SetName(L"Output Window Depth");
if(FAILED(hr))
{
RDCERR("Failed to create DSV texture for output window, HRESULT: 0x%08x", hr);
@@ -2637,6 +2661,8 @@ uint32_t D3D12DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg,
D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
__uuidof(ID3D12Resource), (void **)&m_PickVB);
m_PickVB->SetName(L"m_PickVB");
if(FAILED(hr))
{
RDCERR("Couldn't create pick vertex buffer: %08x", hr);
@@ -4164,6 +4190,8 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID)
__uuidof(ID3D12Resource), (void **)&idxBuf);
RDCASSERTEQUAL(hr, S_OK);
SetObjName(idxBuf, StringFormat::Fmt("PostVS idxBuf for %u", eventID));
FillBuffer(idxBuf, 0, &idxdata[0], idxdata.size());
}
}
@@ -4254,7 +4282,10 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID)
RDCASSERTEQUAL(hr, S_OK);
if(vsoutBuffer)
{
SetObjName(vsoutBuffer, StringFormat::Fmt("PostVS vsoutBuffer for %u", eventID));
FillBuffer(vsoutBuffer, 0, byteData, (size_t)numBytesWritten);
}
}
float nearp = 0.1f;
@@ -4783,7 +4814,10 @@ void D3D12DebugManager::InitPostVSBuffers(uint32_t eventID)
RDCASSERTEQUAL(hr, S_OK);
if(gsoutBuffer)
{
SetObjName(gsoutBuffer, StringFormat::Fmt("PostVS gsoutBuffer for %u", eventID));
FillBuffer(gsoutBuffer, 0, byteData, (size_t)numBytesWritten);
}
}
float nearp = 0.1f;
@@ -6161,6 +6195,8 @@ void D3D12DebugManager::PrepareTextureSampling(ID3D12Resource *resource, CompTyp
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,
NULL, __uuidof(ID3D12Resource), (void **)&m_TexResource);
RDCASSERTEQUAL(hr, S_OK);
m_TexResource->SetName(L"m_TexResource");
}
ID3D12GraphicsCommandList *list = m_WrappedDevice->GetNewList();
@@ -6816,9 +6852,14 @@ ResourceId D3D12DebugManager::ApplyCustomShader(ResourceId shader, ResourceId te
RDCASSERTEQUAL(hr, S_OK);
if(m_CustomShaderTex)
{
m_CustomShaderTex->SetName(L"m_CustomShaderTex");
m_CustomShaderResourceId = GetResID(m_CustomShaderTex);
}
else
{
m_CustomShaderResourceId = ResourceId();
}
}
if(m_CustomShaderResourceId == ResourceId())
@@ -6928,6 +6969,8 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, CompType typeHint,
}
wrappedCustomRenderTex = (WrappedID3D12Resource *)customRenderTex;
customRenderTex->SetName(L"customRenderTex");
m_OverlayRenderTex = wrappedCustomRenderTex;
m_OverlayResourceId = wrappedCustomRenderTex->GetResourceID();
}
@@ -6962,6 +7005,8 @@ ResourceId D3D12DebugManager::RenderOverlay(ResourceId texid, CompType typeHint,
return m_OverlayResourceId;
}
renderDepth->SetName(L"Overlay renderDepth");
ID3D12GraphicsCommandList *list = m_WrappedDevice->GetNewList();
const vector<D3D12_RESOURCE_STATES> &states =
+3
View File
@@ -912,6 +912,9 @@ bool WrappedID3D12Device::Serialise_MapDataWrite(Serialiser *localSerialiser,
ID3D12Resource *uploadBuf = GetUploadBuffer(cmd.m_CurChunkOffset, end - begin);
SetObjName(uploadBuf, StringFormat::Fmt("Map data write, %llu bytes for %llu/%u @ %llu",
(begin - end), res, sub, cmd.m_CurChunkOffset));
// during reading, fill out the buffer itself
if(m_State == READING)
{
@@ -55,6 +55,8 @@ bool WrappedID3D12Device::Serialise_CreateCommandQueue(Serialiser *localSerialis
}
else
{
SetObjName(ret, StringFormat::Fmt("Command Queue ID %llu", Queue));
ret = new WrappedID3D12CommandQueue(ret, this, m_pSerialiser, m_State);
GetResourceManager()->AddLiveResource(Queue, ret);
@@ -977,6 +979,9 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource(
}
else
{
SetObjName(ret, StringFormat::Fmt("Committed Resource %s ID %llu",
ToStr::Get(desc.Dimension).c_str(), Res));
ret = new WrappedID3D12Resource(ret, this);
GetResourceManager()->AddLiveResource(Res, ret);
@@ -1166,6 +1171,9 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource(
}
else
{
SetObjName(ret, StringFormat::Fmt("Placed Resource %s ID %llu",
ToStr::Get(desc.Dimension).c_str(), Res));
ret = new WrappedID3D12Resource(ret, this);
GetResourceManager()->AddLiveResource(Res, ret);