Fix some D3D12 debug warnings

This commit is contained in:
baldurk
2022-08-01 20:40:03 +01:00
parent 65581ca322
commit f78570dcb3
6 changed files with 34 additions and 18 deletions
+5 -5
View File
@@ -198,7 +198,7 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
sampDesc.MinLOD = 0;
sampDesc.MaxLOD = FLT_MAX;
sampDesc.MipLODBias = 0.0f;
sampDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
sampDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
m_pDevice->CreateSampler(&sampDesc, samp);
@@ -596,7 +596,7 @@ bool D3D12DebugManager::CreateShaderDebugResources()
heapProps.VisibleNodeMask = 1;
hr = m_pDevice->CreateCommittedResource(
&heapProps, D3D12_HEAP_FLAG_NONE, &rdesc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
&heapProps, D3D12_HEAP_FLAG_NONE, &rdesc, D3D12_RESOURCE_STATE_COMMON, NULL,
__uuidof(ID3D12Resource), (void **)&m_ShaderDebugResultBuffer);
m_pDevice->InternalRef();
if(FAILED(hr))
@@ -2078,7 +2078,7 @@ void D3D12Replay::VertexPicking::Init(WrappedID3D12Device *device, D3D12DebugMan
heapProps.VisibleNodeMask = 1;
hr = device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &pickResultDesc,
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
D3D12_RESOURCE_STATE_COMMON, NULL,
__uuidof(ID3D12Resource), (void **)&ResultBuf);
ResultBuf->SetName(L"m_PickResultBuf");
@@ -2305,7 +2305,7 @@ void D3D12Replay::HistogramMinMax::Init(WrappedID3D12Device *device, D3D12DebugM
heapProps.VisibleNodeMask = 1;
hr = device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &minmaxDesc,
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
D3D12_RESOURCE_STATE_COMMON, NULL,
__uuidof(ID3D12Resource), (void **)&MinMaxTileBuffer);
MinMaxTileBuffer->SetName(L"m_MinMaxTileBuffer");
@@ -2367,7 +2367,7 @@ void D3D12Replay::HistogramMinMax::Init(WrappedID3D12Device *device, D3D12DebugM
minmaxDesc.Width = 2 * sizeof(Vec4f);
hr = device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &minmaxDesc,
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
D3D12_RESOURCE_STATE_COMMON, NULL,
__uuidof(ID3D12Resource), (void **)&MinMaxResultBuffer);
MinMaxResultBuffer->SetName(L"m_MinMaxResultBuffer");
+2
View File
@@ -2040,6 +2040,8 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De
m_pDevice->CreateUnorderedAccessView(overdrawTex, NULL, NULL,
GetDebugManager()->GetUAVClearHandle(OVERDRAW_UAV));
GetDebugManager()->SetDescriptorHeaps(list, true, false);
UINT zeroes[4] = {0, 0, 0, 0};
list->ClearUnorderedAccessViewUint(GetDebugManager()->GetGPUHandle(OVERDRAW_UAV),
GetDebugManager()->GetUAVClearHandle(OVERDRAW_UAV),
+8 -2
View File
@@ -86,7 +86,7 @@ bool D3D12Replay::CreateSOBuffers()
heapProps.VisibleNodeMask = 1;
hr = m_pDevice->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &soBufDesc,
D3D12_RESOURCE_STATE_STREAM_OUT, NULL,
D3D12_RESOURCE_STATE_COMMON, NULL,
__uuidof(ID3D12Resource), (void **)&m_SOBuffer);
if(FAILED(hr))
@@ -639,10 +639,12 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
// we're done with this after the copy, so we can discard it and reset
// the counter for the next stream-out
sobarr.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_SOURCE;
sobarr.Transition.StateAfter = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
sobarr.Transition.StateAfter = D3D12_RESOURCE_STATE_COMMON;
list->DiscardResource(m_SOBuffer, NULL);
list->ResourceBarrier(1, &sobarr);
GetDebugManager()->SetDescriptorHeaps(list, true, false);
UINT zeroes[4] = {0, 0, 0, 0};
list->ClearUnorderedAccessViewUint(GetDebugManager()->GetGPUHandle(STREAM_OUT_UAV),
GetDebugManager()->GetUAVClearHandle(STREAM_OUT_UAV),
@@ -1008,6 +1010,8 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
list->ResourceBarrier(1, &sobarr);
GetDebugManager()->SetDescriptorHeaps(list, true, false);
UINT zeroes[4] = {0, 0, 0, 0};
list->ClearUnorderedAccessViewUint(GetDebugManager()->GetGPUHandle(STREAM_OUT_UAV),
GetDebugManager()->GetUAVClearHandle(STREAM_OUT_UAV),
@@ -1198,6 +1202,8 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
list->DiscardResource(m_SOBuffer, NULL);
list->ResourceBarrier(1, &sobarr);
GetDebugManager()->SetDescriptorHeaps(list, true, false);
UINT zeroes[4] = {0, 0, 0, 0};
list->ClearUnorderedAccessViewUint(GetDebugManager()->GetGPUHandle(STREAM_OUT_UAV),
GetDebugManager()->GetUAVClearHandle(STREAM_OUT_UAV),
+2
View File
@@ -2482,6 +2482,8 @@ uint32_t D3D12Replay::PickVertex(uint32_t eventId, int32_t width, int32_t height
if(!list)
return ~0U;
GetDebugManager()->SetDescriptorHeaps(list, true, false);
UINT zeroes[4] = {0, 0, 0, 0};
list->ClearUnorderedAccessViewUint(GetDebugManager()->GetGPUHandle(PICK_RESULT_CLEAR_UAV),
GetDebugManager()->GetUAVClearHandle(PICK_RESULT_CLEAR_UAV),
@@ -1367,7 +1367,7 @@ void D3D12Replay::FetchShaderFeedback(uint32_t eventId)
heapProps.VisibleNodeMask = 1;
HRESULT hr = m_pDevice->CreateCommittedResource(
&heapProps, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, NULL,
&heapProps, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON, NULL,
__uuidof(ID3D12Resource), (void **)&m_BindlessFeedback.FeedbackBuffer);
if(m_BindlessFeedback.FeedbackBuffer == NULL || FAILED(hr))
@@ -1398,6 +1398,8 @@ void D3D12Replay::FetchShaderFeedback(uint32_t eventId)
if(!list)
return;
GetDebugManager()->SetDescriptorHeaps(list, true, false);
UINT zeroes[4] = {0, 0, 0, 0};
list->ClearUnorderedAccessViewUint(GetDebugManager()->GetGPUHandle(FEEDBACK_CLEAR_UAV),
GetDebugManager()->GetUAVClearHandle(FEEDBACK_CLEAR_UAV),
+14 -10
View File
@@ -2303,17 +2303,10 @@ void ExtractInputsPS(PSInput IN, float4 debug_pixelPos : SV_Position,
return new ShaderDebugTrace;
}
// Add the descriptor for our UAV, then clear it
std::set<ResourceId> copiedHeaps;
rdcarray<PortableHandle> debugHandles;
debugHandles.push_back(ToPortableHandle(GetDebugManager()->GetCPUHandle(SHADER_DEBUG_UAV)));
if(pMsaaEvalBuffer)
debugHandles.push_back(ToPortableHandle(GetDebugManager()->GetCPUHandle(SHADER_DEBUG_MSAA_UAV)));
AddDebugDescriptorsToRenderState(m_pDevice, rs, debugHandles,
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, sigElem, copiedHeaps);
ID3D12GraphicsCommandListX *cmdList = m_pDevice->GetDebugManager()->ResetDebugList();
rs.ApplyDescriptorHeaps(cmdList);
// clear our UAVs
m_pDevice->GetDebugManager()->SetDescriptorHeaps(cmdList, true, false);
D3D12_GPU_DESCRIPTOR_HANDLE gpuUav = m_pDevice->GetDebugManager()->GetGPUHandle(SHADER_DEBUG_UAV);
UINT zero[4] = {0, 0, 0, 0};
cmdList->ClearUnorderedAccessViewUint(gpuUav, clearUav, pInitialValuesBuffer, zero, 0, NULL);
@@ -2325,6 +2318,17 @@ void ExtractInputsPS(PSInput IN, float4 debug_pixelPos : SV_Position,
cmdList->ClearUnorderedAccessViewUint(gpuMsaaUav, msaaClearUav, pMsaaEvalBuffer, zero, 0, NULL);
}
// Add the descriptor for our UAV
std::set<ResourceId> copiedHeaps;
rdcarray<PortableHandle> debugHandles;
debugHandles.push_back(ToPortableHandle(GetDebugManager()->GetCPUHandle(SHADER_DEBUG_UAV)));
if(pMsaaEvalBuffer)
debugHandles.push_back(ToPortableHandle(GetDebugManager()->GetCPUHandle(SHADER_DEBUG_MSAA_UAV)));
AddDebugDescriptorsToRenderState(m_pDevice, rs, debugHandles,
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, sigElem, copiedHeaps);
rs.ApplyDescriptorHeaps(cmdList);
// Execute the command to ensure that UAV clear and resource creation occur before replay
hr = cmdList->Close();
if(FAILED(hr))