Add config option to hide command buffer boundary markers

This commit is contained in:
baldurk
2021-01-05 18:26:28 +00:00
parent 3e4cac4985
commit ecb1ba7804
3 changed files with 109 additions and 43 deletions
@@ -23,9 +23,13 @@
******************************************************************************/
#include "d3d12_command_queue.h"
#include "core/settings.h"
#include "d3d12_command_list.h"
#include "d3d12_resources.h"
RDOC_CONFIG(bool, D3D12_HideCommandBoundaries, false,
"Hides the auto-generated submitted command list boundaries.");
template <typename SerialiserType>
bool WrappedID3D12CommandQueue::Serialise_UpdateTileMappings(
SerialiserType &ser, ID3D12Resource *pResource, UINT NumResourceRegions,
@@ -181,16 +185,19 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
// add a fake marker
DrawcallDescription draw;
draw.name =
StringFormat::Fmt("=> %s[%u]: Reset(%s)", basename.c_str(), c, ToStr(cmd).c_str());
draw.flags = DrawFlags::PassBoundary | DrawFlags::BeginPass;
m_Cmd.AddEvent();
if(!D3D12_HideCommandBoundaries())
{
draw.name =
StringFormat::Fmt("=> %s[%u]: Reset(%s)", basename.c_str(), c, ToStr(cmd).c_str());
draw.flags = DrawFlags::PassBoundary | DrawFlags::BeginPass;
m_Cmd.AddEvent();
m_Cmd.m_RootEvents.back().chunkIndex = cmdListInfo.beginChunk;
m_Cmd.m_Events.back().chunkIndex = cmdListInfo.beginChunk;
m_Cmd.m_RootEvents.back().chunkIndex = cmdListInfo.beginChunk;
m_Cmd.m_Events.back().chunkIndex = cmdListInfo.beginChunk;
m_Cmd.AddDrawcall(draw, true);
m_Cmd.m_RootEventID++;
m_Cmd.AddDrawcall(draw, true);
m_Cmd.m_RootEventID++;
}
// insert the baked command list in-line into this list of notes, assigning new event and
// drawIDs
@@ -218,16 +225,19 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
m_Cmd.m_RootEventID += cmdListInfo.eventCount;
m_Cmd.m_RootDrawcallID += cmdListInfo.drawCount;
draw.name =
StringFormat::Fmt("=> %s[%u]: Close(%s)", basename.c_str(), c, ToStr(cmd).c_str());
draw.flags = DrawFlags::PassBoundary | DrawFlags::EndPass;
m_Cmd.AddEvent();
if(!D3D12_HideCommandBoundaries())
{
draw.name =
StringFormat::Fmt("=> %s[%u]: Close(%s)", basename.c_str(), c, ToStr(cmd).c_str());
draw.flags = DrawFlags::PassBoundary | DrawFlags::EndPass;
m_Cmd.AddEvent();
m_Cmd.m_RootEvents.back().chunkIndex = cmdListInfo.endChunk;
m_Cmd.m_Events.back().chunkIndex = cmdListInfo.endChunk;
m_Cmd.m_RootEvents.back().chunkIndex = cmdListInfo.endChunk;
m_Cmd.m_Events.back().chunkIndex = cmdListInfo.endChunk;
m_Cmd.AddDrawcall(draw, true);
m_Cmd.m_RootEventID++;
m_Cmd.AddDrawcall(draw, true);
m_Cmd.m_RootEventID++;
}
}
// account for the outer loop thinking we've added one event and incrementing,
@@ -246,9 +256,15 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
{
ResourceId cmd = GetResourceManager()->GetOriginalID(GetResID(ppCommandLists[c]));
m_Cmd.m_RootEventID += m_Cmd.m_BakedCmdListInfo[cmd].eventCount;
m_Cmd.m_RootDrawcallID += m_Cmd.m_BakedCmdListInfo[cmd].drawCount;
// 2 extra for the virtual labels around the command list
m_Cmd.m_RootEventID += 2 + m_Cmd.m_BakedCmdListInfo[cmd].eventCount;
m_Cmd.m_RootDrawcallID += 2 + m_Cmd.m_BakedCmdListInfo[cmd].drawCount;
if(!D3D12_HideCommandBoundaries())
{
m_Cmd.m_RootEventID += 2;
m_Cmd.m_RootDrawcallID += 2;
}
}
// same accounting for the outer loop as above
@@ -280,7 +296,10 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
// account for the virtual label at the start of the events here
// so it matches up to baseEvent
eid++;
if(!D3D12_HideCommandBoundaries())
{
eid++;
}
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
uint32_t end = eid + m_Cmd.m_BakedCmdListInfo[cmdId].eventCount;
@@ -305,9 +324,14 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se
#endif
}
eid += m_Cmd.m_BakedCmdListInfo[cmdId].eventCount;
// 1 extra to account for the virtual end command list label (begin is accounted for
// above)
eid += 1 + m_Cmd.m_BakedCmdListInfo[cmdId].eventCount;
if(!D3D12_HideCommandBoundaries())
{
eid++;
}
}
#if ENABLED(SINGLE_FLUSH_VALIDATE)
@@ -1185,7 +1185,7 @@ bool WrappedVulkan::Serialise_vkEndCommandBuffer(SerialiserType &ser, VkCommandB
ObjDisp(commandBuffer)->EndCommandBuffer(Unwrap(commandBuffer));
if(!m_BakedCmdBufferInfo[BakedCommandBuffer].curEvents.empty())
if(HasNonMarkerEvents(BakedCommandBuffer))
{
DrawcallDescription draw;
draw.name = "API Calls";
@@ -5213,7 +5213,7 @@ bool WrappedVulkan::Serialise_vkCmdEndDebugUtilsLabelEXT(SerialiserType &ser,
if(ObjDisp(commandBuffer)->CmdEndDebugUtilsLabelEXT)
ObjDisp(commandBuffer)->CmdEndDebugUtilsLabelEXT(Unwrap(commandBuffer));
if(!m_BakedCmdBufferInfo[m_LastCmdBufferID].curEvents.empty())
if(HasNonMarkerEvents(m_LastCmdBufferID))
{
DrawcallDescription draw;
draw.name = "API Calls";
@@ -25,6 +25,10 @@
#include <algorithm>
#include "../vk_core.h"
#include "../vk_debug.h"
#include "core/settings.h"
RDOC_CONFIG(bool, Vulkan_HideCommandBoundaries, false,
"Hides the auto-generated submitted command buffer boundaries.");
template <typename SerialiserType>
bool WrappedVulkan::Serialise_vkGetDeviceQueue(SerialiserType &ser, VkDevice device,
@@ -273,17 +277,20 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(SerialiserType &ser, VkQueue queue,
rdcstr name = StringFormat::Fmt("=> %s[%u]: vkBeginCommandBuffer(%s)", basename.c_str(),
c, ToStr(cmd).c_str());
// add a fake marker
DrawcallDescription draw;
draw.name = name;
draw.flags |= DrawFlags::PassBoundary | DrawFlags::BeginPass;
AddEvent();
if(!Vulkan_HideCommandBoundaries())
{
// add a fake marker
draw.name = name;
draw.flags |= DrawFlags::PassBoundary | DrawFlags::BeginPass;
AddEvent();
m_RootEvents.back().chunkIndex = cmdBufInfo.beginChunk;
m_Events.back().chunkIndex = cmdBufInfo.beginChunk;
m_RootEvents.back().chunkIndex = cmdBufInfo.beginChunk;
m_Events.back().chunkIndex = cmdBufInfo.beginChunk;
AddDrawcall(draw, true);
m_RootEventID++;
AddDrawcall(draw, true);
m_RootEventID++;
}
// insert the baked command buffer in-line into this list of notes, assigning new event
// and drawIDs
@@ -316,17 +323,38 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(SerialiserType &ser, VkQueue queue,
m_RootEventID += cmdBufInfo.eventCount;
m_RootDrawcallID += cmdBufInfo.drawCount;
name = StringFormat::Fmt("=> %s[%u]: vkEndCommandBuffer(%s)", basename.c_str(), c,
ToStr(cmd).c_str());
draw.name = name;
draw.flags = DrawFlags::PassBoundary | DrawFlags::EndPass;
AddEvent();
if(!Vulkan_HideCommandBoundaries())
{
// non-marker events would have been gathered into an APICalls draw, but markers can
// still
// be dangling. Add them here.
uint32_t i = 0;
for(APIEvent &apievent : cmdBufInfo.curEvents)
{
apievent.eventId = m_RootEventID - cmdBufInfo.curEvents.count() + i;
cmdBufInfo.eventCount++;
m_RootEvents.back().chunkIndex = cmdBufInfo.endChunk;
m_Events.back().chunkIndex = cmdBufInfo.endChunk;
m_RootEvents.push_back(apievent);
m_Events.resize(apievent.eventId + 1);
m_Events[apievent.eventId] = apievent;
AddDrawcall(draw, true);
m_RootEventID++;
i++;
}
cmdBufInfo.curEvents.clear();
name = StringFormat::Fmt("=> %s[%u]: vkEndCommandBuffer(%s)", basename.c_str(), c,
ToStr(cmd).c_str());
draw.name = name;
draw.flags = DrawFlags::PassBoundary | DrawFlags::EndPass;
AddEvent();
m_RootEvents.back().chunkIndex = cmdBufInfo.endChunk;
m_Events.back().chunkIndex = cmdBufInfo.endChunk;
AddDrawcall(draw, true);
m_RootEventID++;
}
}
// account for the outer loop thinking we've added one event and incrementing,
@@ -346,9 +374,15 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(SerialiserType &ser, VkQueue queue,
ResourceId cmd =
GetResourceManager()->GetOriginalID(GetResID(submitInfo.pCommandBuffers[c]));
m_RootEventID += m_BakedCmdBufferInfo[cmd].eventCount;
m_RootDrawcallID += m_BakedCmdBufferInfo[cmd].drawCount;
// 2 extra for the virtual labels around the command buffer
m_RootEventID += 2 + m_BakedCmdBufferInfo[cmd].eventCount;
m_RootDrawcallID += 2 + m_BakedCmdBufferInfo[cmd].drawCount;
if(!Vulkan_HideCommandBoundaries())
{
m_RootEventID += 2;
m_RootDrawcallID += 2;
}
}
// same accounting for the outer loop as above
@@ -382,7 +416,10 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(SerialiserType &ser, VkQueue queue,
// account for the virtual vkBeginCommandBuffer label at the start of the events here
// so it matches up to baseEvent
eid++;
if(!Vulkan_HideCommandBoundaries())
{
eid++;
}
#if ENABLED(VERBOSE_PARTIAL_REPLAY)
uint32_t end = eid + m_BakedCmdBufferInfo[cmdId].eventCount;
@@ -407,9 +444,14 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(SerialiserType &ser, VkQueue queue,
#endif
}
eid += m_BakedCmdBufferInfo[cmdId].eventCount;
// 1 extra to account for the virtual end command buffer label (begin is accounted for
// above)
eid += 1 + m_BakedCmdBufferInfo[cmdId].eventCount;
if(!Vulkan_HideCommandBoundaries())
{
eid++;
}
}
VkSubmitInfo rerecordedSubmit = submitInfo;