From f3d7dc774f2e79c41bec715b4dd450945d8ae692 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 20 Mar 2017 21:20:15 +0000 Subject: [PATCH] Add a D3D12MarkerRegion for future use * Not used yet, as I need to figure out how to apply list markers when we record multiple individual lists. Doing open/close of a list just for the marker seems wasteful. It could be fired directly at the queue --- renderdoc/driver/d3d12/d3d12_common.cpp | 26 +++++++++++++++++++++++++ renderdoc/driver/d3d12/d3d12_common.h | 10 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_common.cpp b/renderdoc/driver/d3d12/d3d12_common.cpp index 0c20b89e0..ebf118e2c 100644 --- a/renderdoc/driver/d3d12/d3d12_common.cpp +++ b/renderdoc/driver/d3d12/d3d12_common.cpp @@ -28,6 +28,32 @@ #include "d3d12_manager.h" #include "d3d12_resources.h" +D3D12MarkerRegion::D3D12MarkerRegion(ID3D12GraphicsCommandList *l, const std::string &marker) +{ + list = l; + + if(list) + { + std::wstring text = StringFormat::UTF82Wide(marker); + list->BeginEvent(0, text.c_str(), (UINT)text.size()); + } +} + +void D3D12MarkerRegion::Set(ID3D12GraphicsCommandList *list, const std::string &marker) +{ + if(list) + { + std::wstring text = StringFormat::UTF82Wide(marker); + list->SetMarker(0, text.c_str(), (UINT)text.size()); + } +} + +D3D12MarkerRegion::~D3D12MarkerRegion() +{ + if(list) + list->EndEvent(); +} + static ShaderConstant MakeConstantBufferVariable(const DXBC::CBufferVariable &var, uint32_t &offset); static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, uint32_t &offset) diff --git a/renderdoc/driver/d3d12/d3d12_common.h b/renderdoc/driver/d3d12/d3d12_common.h index 4f7b50ef4..d4930118b 100644 --- a/renderdoc/driver/d3d12/d3d12_common.h +++ b/renderdoc/driver/d3d12/d3d12_common.h @@ -33,6 +33,16 @@ #include "driver/shaders/dxbc/dxbc_compile.h" #include "serialise/serialiser.h" +// replay only class for handling marker regions +struct D3D12MarkerRegion +{ + D3D12MarkerRegion(ID3D12GraphicsCommandList *list, const std::string &marker); + ~D3D12MarkerRegion(); + static void Set(ID3D12GraphicsCommandList *list, const std::string &marker); + + ID3D12GraphicsCommandList *list; +}; + void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl, ShaderBindpointMapping *mapping);