Added "DXBCContainerDebugger" to wrap DXBC or DXIL shader debugger

DXBC and DXIL Shader Debugger's inherit from "DXBCContainerDebugger : public ShaderDebugger".
"DXBCContainerDebugger" has member variable "isDXIL" to be able to choose if DXIL or DXBC ShaderDebugger is active and allow the correct cast from "ShaderDebugger" to be made.
Added stub of DXILDebug::Debugger in new files "drivers/shaders/dxil/dxil_debug.[h,cpp]"
This commit is contained in:
Jake Turner
2024-05-09 12:36:45 +01:00
parent 8ba66e92a7
commit c54299f63f
7 changed files with 96 additions and 8 deletions
+15 -7
View File
@@ -25,6 +25,7 @@
#include "driver/dx/official/d3dcompiler.h"
#include "driver/dxgi/dxgi_common.h"
#include "driver/shaders/dxbc/dxbc_debug.h"
#include "driver/shaders/dxil/dxil_debug.h"
#include "maths/formatpacking.h"
#include "strings/string_utils.h"
#include "d3d12_command_queue.h"
@@ -2804,17 +2805,24 @@ ShaderDebugTrace *D3D12Replay::DebugThread(uint32_t eventId,
rdcarray<ShaderDebugState> D3D12Replay::ContinueDebug(ShaderDebugger *debugger)
{
DXBCDebug::InterpretDebugger *interpreter = (DXBCDebug::InterpretDebugger *)debugger;
if(!interpreter)
if(!debugger)
return {};
D3D12DebugAPIWrapper apiWrapper(m_pDevice, interpreter->dxbc, interpreter->global,
interpreter->eventId);
if(((DXBCContainerDebugger *)debugger)->isDXIL)
{
return {};
}
else
{
DXBCDebug::InterpretDebugger *interpreter = (DXBCDebug::InterpretDebugger *)debugger;
D3D12MarkerRegion region(m_pDevice->GetQueue()->GetReal(), "ContinueDebug Simulation Loop");
D3D12DebugAPIWrapper apiWrapper(m_pDevice, interpreter->dxbc, interpreter->global,
interpreter->eventId);
return interpreter->ContinueDebug(&apiWrapper);
D3D12MarkerRegion region(m_pDevice->GetQueue()->GetReal(), "ContinueDebug Simulation Loop");
return interpreter->ContinueDebug(&apiWrapper);
}
}
void D3D12Replay::FreeDebugger(ShaderDebugger *debugger)
@@ -30,6 +30,12 @@
#include "api/replay/rdcstr.h"
#include "api/replay/shader_types.h"
struct DXBCContainerDebugger : public ShaderDebugger
{
DXBCContainerDebugger(bool dxil) : isDXIL(dxil){};
const bool isDXIL;
};
namespace DXBCBytecode
{
class Program;
+2 -1
View File
@@ -330,8 +330,9 @@ private:
rdcarray<ShaderBindIndex> m_accessedUAVs;
};
struct InterpretDebugger : public ShaderDebugger
struct InterpretDebugger : public DXBCContainerDebugger
{
InterpretDebugger() : DXBCContainerDebugger(false){};
ShaderDebugTrace *BeginDebug(const DXBC::DXBCContainer *dxbcContainer,
const ShaderReflection &refl, int activeIndex);
@@ -0,0 +1,31 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include "dxil_debug.h"
namespace DXILDebug
{
}; // namespace DXILDebug
@@ -0,0 +1,38 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2024 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include "common/common.h"
#include "driver/shaders/dxbc/dxbc_container.h"
#include "dxil_bytecode.h"
namespace DXILDebug
{
struct Debugger : public DXBCContainerDebugger
{
Debugger() : DXBCContainerDebugger(true){};
};
}; // namespace DXILDebug
@@ -104,6 +104,7 @@
<ClCompile Include="dxil_bytecode.cpp" />
<ClCompile Include="dxil_bytecode_editor.cpp" />
<ClCompile Include="dxil_common.cpp" />
<ClCompile Include="dxil_debug.cpp" />
<ClCompile Include="dxil_debuginfo.cpp" />
<ClCompile Include="dxil_disassemble.cpp" />
<ClCompile Include="dxil_reflect.cpp" />
@@ -117,6 +118,7 @@
<ClInclude Include="dxil_bytecode.h" />
<ClInclude Include="dxil_bytecode_editor.h" />
<ClInclude Include="dxil_common.h" />
<ClInclude Include="dxil_debug.h" />
<ClInclude Include="dxil_debuginfo.h" />
<ClInclude Include="llvm_bitreader.h" />
<ClInclude Include="llvm_bitwriter.h" />
@@ -12,6 +12,7 @@
<ClCompile Include="dxil_common.cpp" />
<ClCompile Include="dxil_bytecode_editor.cpp" />
<ClCompile Include="llvm_encoder.cpp" />
<ClCompile Include="dxil_debug.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="precompiled.h">
@@ -26,6 +27,7 @@
<ClInclude Include="llvm_bitwriter.h" />
<ClInclude Include="llvm_encoder.h" />
<ClInclude Include="llvm_common.h" />
<ClInclude Include="dxil_debug.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="PCH">