mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-06 13:55:37 +00:00
Moved SPIRV Shader Debugger control flow class to renderdoc/shaders
Renamed files from: spirv_controlflow -> controlflow Preparation for sharing the shader debugger control flow code between SPIRV and DXIL debuggers
This commit is contained in:
@@ -214,6 +214,8 @@ set(sources
|
||||
serialise/comp_io_tests.cpp
|
||||
serialise/serialiser_tests.cpp
|
||||
serialise/streamio_tests.cpp
|
||||
shaders/controlflow.cpp
|
||||
shaders/controlflow.h
|
||||
strings/grisu2.cpp
|
||||
strings/string_utils.cpp
|
||||
strings/string_utils.h
|
||||
|
||||
@@ -99,7 +99,6 @@ set(sources
|
||||
glslang_compile.h
|
||||
spirv_common.cpp
|
||||
spirv_common.h
|
||||
spirv_controlflow.cpp
|
||||
spirv_editor.cpp
|
||||
spirv_editor.h
|
||||
spirv_gen.cpp
|
||||
|
||||
@@ -155,12 +155,6 @@
|
||||
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
|
||||
<ForcedIncludeFiles>precompiled.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ClCompile Include="spirv_controlflow.cpp">
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
|
||||
<ForcedIncludeFiles>precompiled.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ClCompile Include="spirv_debug.cpp">
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
@@ -273,7 +267,6 @@
|
||||
<ClInclude Include="precompiled.h" />
|
||||
<ClInclude Include="spirv_common.h" />
|
||||
<ClInclude Include="spirv_compile.h" />
|
||||
<ClInclude Include="spirv_controlflow.h" />
|
||||
<ClInclude Include="spirv_debug.h" />
|
||||
<ClInclude Include="spirv_editor.h" />
|
||||
<ClInclude Include="spirv_gen.h" />
|
||||
|
||||
@@ -137,7 +137,6 @@
|
||||
<ClCompile Include="spirv_gen.cpp">
|
||||
<Filter>JSON-Generated helpers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="spirv_controlflow.cpp" />
|
||||
<ClCompile Include="spirv_reflect.cpp" />
|
||||
<ClCompile Include="glslang_compile.cpp" />
|
||||
<ClCompile Include="spirv_processor.cpp" />
|
||||
@@ -298,7 +297,6 @@
|
||||
<ClInclude Include="spirv_op_helpers.h">
|
||||
<Filter>JSON-Generated helpers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="spirv_controlflow.h" />
|
||||
<ClInclude Include="spirv_processor.h" />
|
||||
<ClInclude Include="spirv_debug.h" />
|
||||
<ClInclude Include="..\..\..\3rdparty\glslang\SPIRV\GLSL.ext.ARM.h">
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "replay/common/var_dispatch_helpers.h"
|
||||
#include "spirv_op_helpers.h"
|
||||
|
||||
using namespace rdcshaders;
|
||||
|
||||
static bool ContainsNaNInf(const ShaderVariable &var)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#include "api/replay/rdcarray.h"
|
||||
#include "maths/vec.h"
|
||||
#include "shaders/controlflow.h"
|
||||
#include "spirv_common.h"
|
||||
#include "spirv_controlflow.h"
|
||||
#include "spirv_processor.h"
|
||||
|
||||
struct SPIRVInterfaceAccess;
|
||||
@@ -536,7 +536,7 @@ private:
|
||||
rdcarray<LocalMapping> activeLocalMappings;
|
||||
} m_DebugInfo;
|
||||
|
||||
rdcspv::ControlFlow controlFlow;
|
||||
rdcshaders::ControlFlow controlFlow;
|
||||
|
||||
const ScopeData *GetScope(size_t offset) const;
|
||||
};
|
||||
|
||||
@@ -36,6 +36,8 @@ RDOC_DEBUG_CONFIG(
|
||||
bool, Vulkan_Hack_EnableGroupCaps, false,
|
||||
"Work in progress allow shaders to be debugged with subgroup/workgroup requirements.");
|
||||
|
||||
using namespace rdcshaders;
|
||||
|
||||
// this could be cleaner if ShaderVariable wasn't a very public struct, but it's not worth it so
|
||||
// we just reserve value slots that we know won't be used in opaque variables.
|
||||
// there's significant wasted space to keep things simple with one property = one slot
|
||||
@@ -1561,7 +1563,7 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *api, const ShaderStage s
|
||||
|
||||
std::sort(liveGlobals.begin(), liveGlobals.end());
|
||||
|
||||
rdcarray<rdcspv::ThreadIndex> threadIds;
|
||||
rdcarray<ThreadIndex> threadIds;
|
||||
for(uint32_t i = 0; i < threadsInWorkgroup; i++)
|
||||
{
|
||||
ThreadState &lane = workgroup[i];
|
||||
@@ -2547,7 +2549,7 @@ rdcarray<ShaderDebugState> Debugger::ContinueDebug()
|
||||
if(!tangle.IsAliveActive())
|
||||
continue;
|
||||
|
||||
rdcarray<rdcspv::ThreadReference> threadRefs = tangle.GetThreadRefs();
|
||||
rdcarray<ThreadReference> threadRefs = tangle.GetThreadRefs();
|
||||
// calculate the current active thread mask from the threads in the tangle
|
||||
{
|
||||
// one bool per workgroup thread
|
||||
@@ -2558,7 +2560,7 @@ rdcarray<ShaderDebugState> Debugger::ContinueDebug()
|
||||
activeMask[i] = false;
|
||||
|
||||
// activate the threads in the tangle
|
||||
for(const rdcspv::ThreadReference &ref : threadRefs)
|
||||
for(const ThreadReference &ref : threadRefs)
|
||||
{
|
||||
uint32_t idx = ref.id;
|
||||
RDCASSERT(idx < workgroup.size(), idx, workgroup.size());
|
||||
|
||||
@@ -251,6 +251,7 @@
|
||||
<ClInclude Include="serialise\serialiser.h" />
|
||||
<ClInclude Include="serialise\streamio.h" />
|
||||
<ClInclude Include="serialise\zstdio.h" />
|
||||
<ClInclude Include="shaders\controlflow.h" />
|
||||
<ClInclude Include="strings\string_utils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -655,6 +656,7 @@
|
||||
<ClCompile Include="serialise\streamio.cpp" />
|
||||
<ClCompile Include="serialise\streamio_tests.cpp" />
|
||||
<ClCompile Include="serialise\zstdio.cpp" />
|
||||
<ClCompile Include="shaders\controlflow.cpp" />
|
||||
<ClCompile Include="strings\grisu2.cpp" />
|
||||
<ClCompile Include="strings\string_utils.cpp" />
|
||||
<ClCompile Include="strings\utf8printf.cpp" />
|
||||
|
||||
@@ -142,6 +142,9 @@
|
||||
<Filter Include="Replay\Common">
|
||||
<UniqueIdentifier>{02773850-117a-47d9-b238-d5d4b96468b3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Shaders">
|
||||
<UniqueIdentifier>{d8130624-7075-486d-91fc-b5ab8cd2b811}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="maths\camera.h">
|
||||
@@ -573,6 +576,9 @@
|
||||
<ClInclude Include="common\tex_data.h">
|
||||
<Filter>Common\File Formats</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="shaders\controlflow.h">
|
||||
<Filter>Shaders</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="maths\camera.cpp">
|
||||
@@ -977,6 +983,9 @@
|
||||
<ClCompile Include="common\jobsystem_tests.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="shaders\controlflow.cpp">
|
||||
<Filter>Shaders</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="os\win32\comexport.def">
|
||||
|
||||
+13
-13
@@ -22,7 +22,7 @@
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "spirv_controlflow.h"
|
||||
#include "controlflow.h"
|
||||
#include "api/replay/rdcstr.h"
|
||||
#include "api/replay/stringise.h"
|
||||
#include "common/common.h"
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
RDOC_CONFIG(bool, Vulkan_Debug_ControlFlow_Logging, false,
|
||||
RDOC_CONFIG(bool, Shader_Debug_ControlFlow_Logging, false,
|
||||
"Debug logging for shader debugger controlflow");
|
||||
|
||||
/*
|
||||
@@ -112,7 +112,7 @@ UpdateState():
|
||||
* Prune deactivated tangles from the TangleGroup
|
||||
*/
|
||||
|
||||
namespace rdcspv
|
||||
namespace rdcshaders
|
||||
{
|
||||
int32_t ControlFlow::s_NextTangleId = 0;
|
||||
|
||||
@@ -258,7 +258,7 @@ TangleGroup ControlFlow::DivergeTangle(Tangle &tangle)
|
||||
tangle.SetAlive(false);
|
||||
RDCASSERTEQUAL(tangle.GetThreadCount(), 0U);
|
||||
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG("Tangle:%u ThreadCount:%u diverged", tangle.GetId(), tangle.GetThreadCount());
|
||||
for(Tangle &newTangle : newTangles)
|
||||
@@ -342,7 +342,7 @@ void ControlFlow::ActivateIndependentTangles()
|
||||
RDCASSERTNOTEQUAL(tangle.GetMergePoint(), INVALID_EXECUTION_POINT);
|
||||
tangle.PopMergePoint();
|
||||
tangle.SetStateChanged(true);
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG("Tangle:%u ThreadCount:%u at ExecPoint:%u activated new MergePoint:%u", tangle.GetId(),
|
||||
tangle.GetThreadCount(), tangle.GetExecutionPoint(), tangle.GetMergePoint());
|
||||
@@ -377,7 +377,7 @@ void ControlFlow::ProcessTangleConvergence()
|
||||
// if the tangle converged to a function return point
|
||||
if(tangle.GetExecutionPoint() == tangle.GetFunctionReturnPoint())
|
||||
{
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG(
|
||||
"Tangle:%u ThreadCount:%u is converged at ExecPoint:%u FunctionReturnPoint:%u "
|
||||
@@ -404,7 +404,7 @@ void ControlFlow::MergeConvergedTangles()
|
||||
if(!tangle.IsConverged())
|
||||
continue;
|
||||
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG("Tangle:%u ThreadCount:%u is converged at ExecPoint:%u Next MergePoint:%u",
|
||||
tangle.GetId(), tangle.GetThreadCount(), tangle.GetExecutionPoint(),
|
||||
@@ -435,7 +435,7 @@ void ControlFlow::MergeConvergedTangles()
|
||||
convTangle.SetConverged(false);
|
||||
convTangle.SetDiverged(false);
|
||||
convTangle.SetAlive(false);
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG(
|
||||
"Tangle:%u ThreadCount:%u converged with Tangle:%u ThreadCount:%u ExecPoint:%u at "
|
||||
@@ -543,7 +543,7 @@ void ControlFlow::UpdateState(const ThreadExecutionStates &threadExecutionStates
|
||||
tangle.PruneMergePoints(tangle.GetFunctionReturnPoint());
|
||||
tangle.PopFunctionReturnPoint();
|
||||
tangle.SetStateChanged(true);
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG(
|
||||
"Tangle:%u ThreadCount:% at ExecPoint:%u auto-activated FunctionReturnPoint:%u "
|
||||
@@ -560,7 +560,7 @@ void ControlFlow::UpdateState(const ThreadExecutionStates &threadExecutionStates
|
||||
tangle.SetConverged(true);
|
||||
tangle.SetDiverged(false);
|
||||
tangle.SetStateChanged(true);
|
||||
if(Vulkan_Debug_ControlFlow_Logging())
|
||||
if(Shader_Debug_ControlFlow_Logging())
|
||||
{
|
||||
RDCLOG("Tangle:%u ThreadCount:%u at ExecPoint:%u auto-activated new MergePoint:%u",
|
||||
tangle.GetId(), tangle.GetThreadCount(), tangle.GetExecutionPoint(),
|
||||
@@ -626,14 +626,14 @@ void ControlFlow::Construct(const rdcarray<ThreadIndex> &threadIds)
|
||||
m_Tangles.clear();
|
||||
m_Tangles.push_back(rootTangle);
|
||||
}
|
||||
}; // namespace rdcspv
|
||||
}; // namespace rdcshaders
|
||||
|
||||
#if ENABLED(ENABLE_UNIT_TESTS)
|
||||
|
||||
#include <limits>
|
||||
#include "catch/catch.hpp"
|
||||
|
||||
using namespace rdcspv;
|
||||
using namespace rdcshaders;
|
||||
|
||||
const ExecutionPoint EXEC_POINT_1 = 1;
|
||||
const ExecutionPoint EXEC_POINT_2 = 2;
|
||||
@@ -843,7 +843,7 @@ void RunTest(const Program &program, const rdcarray<TestTangles> &expected)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SPIRV Control Flow", "[spirv][controlflow]")
|
||||
TEST_CASE("Shader Control Flow", "[shader][controlflow]")
|
||||
{
|
||||
SECTION("Maximal Reconvergence")
|
||||
{
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
#include "api/replay/rdcflatmap.h"
|
||||
#include "os/os_specific.h"
|
||||
|
||||
namespace rdcspv
|
||||
namespace rdcshaders
|
||||
{
|
||||
class Tangle;
|
||||
class ControlFlow;
|
||||
@@ -211,4 +211,4 @@ private:
|
||||
static int32_t s_NextTangleId;
|
||||
};
|
||||
|
||||
}; // namespace rdcspv
|
||||
}; // namespace rdcshaders
|
||||
Reference in New Issue
Block a user