From ff309d8c545b258eccab124fbdbc451c28a9cece Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 20 Nov 2019 18:36:50 +0000 Subject: [PATCH] Add helpers for setting markers on D3D12 --- util/test/demos/d3d12/d3d12_test.cpp | 20 ++++++++++++++++++++ util/test/demos/d3d12/d3d12_test.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/util/test/demos/d3d12/d3d12_test.cpp b/util/test/demos/d3d12/d3d12_test.cpp index f05b7d5bd..fa28cb63a 100644 --- a/util/test/demos/d3d12/d3d12_test.cpp +++ b/util/test/demos/d3d12/d3d12_test.cpp @@ -743,6 +743,26 @@ void D3D12GraphicsTest::SetBufferData(ID3D12ResourcePtr buffer, D3D12_RESOURCE_S m_Alloc->Reset(); } +void D3D12GraphicsTest::pushMarker(ID3D12GraphicsCommandListPtr cmd, const std::string &name) +{ + // D3D debug layer spams un-mutable errors if we call this. Don't do anything unless renderdoc is + // attached + if(rdoc) + cmd->BeginEvent(1, name.data(), (UINT)name.size()); +} + +void D3D12GraphicsTest::setMarker(ID3D12GraphicsCommandListPtr cmd, const std::string &name) +{ + if(rdoc) + cmd->SetMarker(1, name.data(), (UINT)name.size()); +} + +void D3D12GraphicsTest::popMarker(ID3D12GraphicsCommandListPtr cmd) +{ + if(rdoc) + cmd->EndEvent(); +} + void D3D12GraphicsTest::ResourceBarrier(ID3D12GraphicsCommandListPtr cmd, ID3D12ResourcePtr res, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after) { diff --git a/util/test/demos/d3d12/d3d12_test.h b/util/test/demos/d3d12/d3d12_test.h index 64bc2ba82..48cae6801 100644 --- a/util/test/demos/d3d12/d3d12_test.h +++ b/util/test/demos/d3d12/d3d12_test.h @@ -131,6 +131,10 @@ struct D3D12GraphicsTest : public GraphicsTest return ret; } + void pushMarker(ID3D12GraphicsCommandListPtr cmd, const std::string &name); + void setMarker(ID3D12GraphicsCommandListPtr cmd, const std::string &name); + void popMarker(ID3D12GraphicsCommandListPtr cmd); + void ResourceBarrier(ID3D12GraphicsCommandListPtr cmd, ID3D12ResourcePtr res, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after); void ResourceBarrier(ID3D12ResourcePtr res, D3D12_RESOURCE_STATES before,