Free shader debugger in replay driver so it's proxied correctly

This commit is contained in:
baldurk
2020-05-15 02:52:07 +01:00
parent d332c985e0
commit 5a0134ed4b
13 changed files with 60 additions and 1 deletions
+1
View File
@@ -272,6 +272,7 @@ public:
return new ShaderDebugTrace();
}
rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger) { return {}; }
void FreeDebugger(ShaderDebugger *debugger) { delete debugger; }
void BuildTargetShader(ShaderEncoding sourceEncoding, const bytebuf &source, const rdcstr &entry,
const ShaderCompileFlags &compileFlags, ShaderStage type, ResourceId &id,
rdcstr &errors)
+31
View File
@@ -95,6 +95,7 @@ rdcstr DoStringise(const ReplayProxyPacket &el)
STRINGISE_ENUM_NAMED(eReplayProxy_GetDriverInfo, "GetDriverInfo");
STRINGISE_ENUM_NAMED(eReplayProxy_ContinueDebug, "ContinueDebug");
STRINGISE_ENUM_NAMED(eReplayProxy_FreeDebugger, "FreeDebugger");
}
END_ENUM_STRINGISE();
}
@@ -1601,6 +1602,35 @@ rdcarray<ShaderDebugState> ReplayProxy::ContinueDebug(ShaderDebugger *debugger)
PROXY_FUNCTION(ContinueDebug, debugger);
}
template <typename ParamSerialiser, typename ReturnSerialiser>
void ReplayProxy::Proxied_FreeDebugger(ParamSerialiser &paramser, ReturnSerialiser &retser,
ShaderDebugger *debugger)
{
const ReplayProxyPacket expectedPacket = eReplayProxy_FreeDebugger;
ReplayProxyPacket packet = eReplayProxy_FreeDebugger;
{
BEGIN_PARAMS();
uint64_t debugger_ptr = (uint64_t)(uintptr_t)debugger;
SERIALISE_ELEMENT(debugger_ptr);
debugger = (ShaderDebugger *)(uintptr_t)debugger_ptr;
END_PARAMS();
}
{
REMOTE_EXECUTION();
if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored)
m_Remote->FreeDebugger(debugger);
}
CheckError(packet, expectedPacket);
}
void ReplayProxy::FreeDebugger(ShaderDebugger *debugger)
{
PROXY_FUNCTION(FreeDebugger, debugger);
}
template <typename ParamSerialiser, typename ReturnSerialiser>
void ReplayProxy::Proxied_SavePipelineState(ParamSerialiser &paramser, ReturnSerialiser &retser,
uint32_t eventId)
@@ -2790,6 +2820,7 @@ bool ReplayProxy::Tick(int type)
break;
}
case eReplayProxy_ContinueDebug: ContinueDebug(NULL); break;
case eReplayProxy_FreeDebugger: FreeDebugger(NULL); break;
case eReplayProxy_RenderOverlay:
RenderOverlay(ResourceId(), Subresource(), CompType::Typeless, FloatVector(),
DebugOverlay::NoOverlay, 0, rdcarray<uint32_t>());
+2
View File
@@ -102,6 +102,7 @@ enum ReplayProxyPacket
eReplayProxy_GetAvailableGPUs,
eReplayProxy_ContinueDebug,
eReplayProxy_FreeDebugger,
};
DECLARE_REFLECTION_ENUM(ReplayProxyPacket);
@@ -529,6 +530,7 @@ public:
IMPLEMENT_FUNCTION_PROXIED(ShaderDebugTrace *, DebugThread, uint32_t eventId,
const uint32_t groupid[3], const uint32_t threadid[3]);
IMPLEMENT_FUNCTION_PROXIED(rdcarray<ShaderDebugState>, ContinueDebug, ShaderDebugger *debugger);
IMPLEMENT_FUNCTION_PROXIED(void, FreeDebugger, ShaderDebugger *debugger);
IMPLEMENT_FUNCTION_PROXIED(rdcarray<ShaderEncoding>, GetTargetShaderEncodings);
IMPLEMENT_FUNCTION_PROXIED(void, BuildTargetShader, ShaderEncoding sourceEncoding,
+1
View File
@@ -237,6 +237,7 @@ public:
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
const uint32_t threadid[3]);
rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger);
void FreeDebugger(ShaderDebugger *debugger);
uint32_t PickVertex(uint32_t eventId, int32_t width, int32_t height, const MeshDisplay &cfg,
uint32_t x, uint32_t y);
@@ -2995,3 +2995,8 @@ rdcarray<ShaderDebugState> D3D11Replay::ContinueDebug(ShaderDebugger *debugger)
return interpreter->ContinueDebug(&apiWrapper);
}
void D3D11Replay::FreeDebugger(ShaderDebugger *debugger)
{
delete debugger;
}
+1
View File
@@ -192,6 +192,7 @@ public:
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
const uint32_t threadid[3]);
rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger);
void FreeDebugger(ShaderDebugger *debugger);
uint32_t PickVertex(uint32_t eventId, int32_t width, int32_t height, const MeshDisplay &cfg,
uint32_t x, uint32_t y);
@@ -2964,3 +2964,8 @@ rdcarray<ShaderDebugState> D3D12Replay::ContinueDebug(ShaderDebugger *debugger)
return interpreter->ContinueDebug(&apiWrapper);
}
void D3D12Replay::FreeDebugger(ShaderDebugger *debugger)
{
delete debugger;
}
+5
View File
@@ -3476,6 +3476,11 @@ rdcarray<ShaderDebugState> GLReplay::ContinueDebug(ShaderDebugger *debugger)
return {};
}
void GLReplay::FreeDebugger(ShaderDebugger *debugger)
{
delete debugger;
}
void GLReplay::MakeCurrentReplayContext(GLWindowingData *ctx)
{
static GLWindowingData *prev = NULL;
+1
View File
@@ -223,6 +223,7 @@ public:
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
const uint32_t threadid[3]);
rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger);
void FreeDebugger(ShaderDebugger *debugger);
uint32_t PickVertex(uint32_t eventId, int32_t width, int32_t height, const MeshDisplay &cfg,
uint32_t x, uint32_t y);
+1
View File
@@ -378,6 +378,7 @@ public:
ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
const uint32_t threadid[3]);
rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger);
void FreeDebugger(ShaderDebugger *debugger);
uint32_t PickVertex(uint32_t eventId, int32_t width, int32_t height, const MeshDisplay &cfg,
uint32_t x, uint32_t y);
@@ -4263,3 +4263,8 @@ rdcarray<ShaderDebugState> VulkanReplay::ContinueDebug(ShaderDebugger *debugger)
return ret;
}
void VulkanReplay::FreeDebugger(ShaderDebugger *debugger)
{
delete debugger;
}
+1 -1
View File
@@ -1625,7 +1625,7 @@ void ReplayController::FreeTrace(ShaderDebugTrace *trace)
if(trace)
{
SAFE_DELETE(trace->debugger);
m_pDevice->FreeDebugger(trace->debugger);
delete trace;
}
}
+1
View File
@@ -188,6 +188,7 @@ public:
virtual ShaderDebugTrace *DebugThread(uint32_t eventId, const uint32_t groupid[3],
const uint32_t threadid[3]) = 0;
virtual rdcarray<ShaderDebugState> ContinueDebug(ShaderDebugger *debugger) = 0;
virtual void FreeDebugger(ShaderDebugger *debugger) = 0;
virtual ResourceId RenderOverlay(ResourceId texid, const Subresource &sub, CompType typeCast,
FloatVector clearCol, DebugOverlay overlay, uint32_t eventId,