Add some profile markers in common hotspots

This commit is contained in:
baldurk
2020-09-21 15:52:49 +01:00
parent d0bf0f6eab
commit 1dc1b4d167
8 changed files with 51 additions and 0 deletions
+6
View File
@@ -66,6 +66,8 @@
CaptureContext::CaptureContext(PersistantConfig &cfg) : m_Config(cfg)
{
RENDERDOC_PROFILEFUNCTION();
m_CaptureLoaded = false;
m_LoadInProgress = false;
@@ -699,6 +701,8 @@ void CaptureContext::CleanMenu(QAction *action)
void CaptureContext::LoadCapture(const rdcstr &captureFile, const ReplayOptions &opts,
const rdcstr &origFilename, bool temporary, bool local)
{
RENDERDOC_PROFILEFUNCTION();
CloseCapture();
PointerTypeRegistry::Init();
@@ -1458,6 +1462,8 @@ void CaptureContext::ExportCapture(const CaptureFileFormat &fmt, const rdcstr &e
void CaptureContext::SetEventID(const rdcarray<ICaptureViewer *> &exclude, uint32_t selectedEventID,
uint32_t eventId, bool force)
{
RENDERDOC_PROFILEFUNCTION();
if(!IsCaptureLoaded())
return;
@@ -131,6 +131,8 @@ void PipelineStateViewer::OnCaptureClosed()
void PipelineStateViewer::OnEventChanged(uint32_t eventId)
{
RENDERDOC_PROFILEFUNCTION();
if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D11)
setToD3D11();
else if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D12)
+1
View File
@@ -1489,6 +1489,7 @@ void WrappedID3D11Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
if(!partial)
{
RENDERDOC_PROFILEREGION("ApplyInitialContents");
D3D11MarkerRegion apply("!!!!RenderDoc Internal: ApplyInitialContents");
GetResourceManager()->ApplyInitialContents();
}
+2
View File
@@ -1271,6 +1271,8 @@ ID3D12Resource *WrappedID3D12Device::GetUploadBuffer(uint64_t chunkOffset, uint6
void WrappedID3D12Device::ApplyInitialContents()
{
RENDERDOC_PROFILEFUNCTION();
initStateCurBatch = 0;
initStateCurList = NULL;
+1
View File
@@ -5636,6 +5636,7 @@ void WrappedOpenGL::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
if(!partial)
{
RENDERDOC_PROFILEREGION("ApplyInitialContents");
GLMarkerRegion apply("!!!!RenderDoc Internal: ApplyInitialContents");
GetResourceManager()->ApplyInitialContents();
+3
View File
@@ -254,6 +254,7 @@ void WrappedVulkan::AddFreeCommandBuffer(VkCommandBuffer cmd)
void WrappedVulkan::SubmitCmds(VkSemaphore *unwrappedWaitSemaphores,
VkPipelineStageFlags *waitStageMask, uint32_t waitSemaphoreCount)
{
RENDERDOC_PROFILEFUNCTION();
// nothing to do
if(m_InternalCmds.pendingcmds.empty())
return;
@@ -333,6 +334,7 @@ void WrappedVulkan::SubmitSemaphores()
void WrappedVulkan::FlushQ()
{
RENDERDOC_PROFILEFUNCTION();
// VKTODOLOW could do away with the need for this function by keeping
// commands until N presents later, or something, or checking on fences.
// If we do so, then check each use for FlushQ to see if it needs a
@@ -2695,6 +2697,7 @@ ReplayStatus WrappedVulkan::ContextReplayLog(CaptureState readType, uint32_t sta
void WrappedVulkan::ApplyInitialContents()
{
RENDERDOC_PROFILEFUNCTION();
VkMarkerRegion region("ApplyInitialContents");
// check that we have all external queues necessary
+28
View File
@@ -91,6 +91,7 @@ ReplayController::~ReplayController()
void ReplayController::SetFrameEvent(uint32_t eventId, bool force)
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
if(eventId != m_EventID || force)
{
@@ -165,6 +166,8 @@ rdcstr ReplayController::DisassembleShader(ResourceId pipeline, const ShaderRefl
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
if(refl == NULL)
return "; Error: No shader specified";
@@ -419,6 +422,8 @@ rdcarray<CounterResult> ReplayController::FetchCounters(const rdcarray<GPUCounte
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
return m_pDevice->FetchCounters(counters);
}
@@ -533,6 +538,7 @@ bytebuf ReplayController::GetBufferData(ResourceId buff, uint64_t offset, uint64
bytebuf ReplayController::GetTextureData(ResourceId tex, const Subresource &sub)
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
bytebuf ret;
@@ -552,6 +558,7 @@ bytebuf ReplayController::GetTextureData(ResourceId tex, const Subresource &sub)
bool ReplayController::SaveTexture(const TextureSave &saveData, const char *path)
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
TextureSave sd = saveData; // mutable copy
ResourceId liveid = m_pDevice->GetLiveID(sd.resourceId);
@@ -1414,6 +1421,8 @@ rdcarray<PixelModification> ReplayController::PixelHistory(ResourceId target, ui
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
rdcarray<PixelModification> ret;
Subresource subresource = sub;
@@ -1541,6 +1550,7 @@ PixelValue ReplayController::PickPixel(ResourceId tex, uint32_t x, uint32_t y,
const Subresource &sub, CompType typeCast)
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
PixelValue ret;
@@ -1587,6 +1597,8 @@ ShaderDebugTrace *ReplayController::DebugVertex(uint32_t vertid, uint32_t instid
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
ShaderDebugTrace *ret = m_pDevice->DebugVertex(m_EventID, vertid, instid, idx, view);
SetFrameEvent(m_EventID, true);
@@ -1599,6 +1611,8 @@ ShaderDebugTrace *ReplayController::DebugPixel(uint32_t x, uint32_t y, uint32_t
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
ShaderDebugTrace *ret = m_pDevice->DebugPixel(m_EventID, x, y, sample, primitive);
SetFrameEvent(m_EventID, true);
@@ -1610,6 +1624,8 @@ ShaderDebugTrace *ReplayController::DebugThread(const uint32_t groupid[3], const
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
ShaderDebugTrace *ret = m_pDevice->DebugThread(m_EventID, groupid, threadid);
SetFrameEvent(m_EventID, true);
@@ -1621,6 +1637,8 @@ rdcarray<ShaderDebugState> ReplayController::ContinueDebug(ShaderDebugger *debug
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
rdcarray<ShaderDebugState> ret = m_pDevice->ContinueDebug(debugger);
return ret;
@@ -1643,6 +1661,8 @@ rdcarray<ShaderVariable> ReplayController::GetCBufferVariableContents(
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
bytebuf data;
if(buffer != ResourceId())
{
@@ -1857,6 +1877,8 @@ rdcpair<ResourceId, rdcstr> ReplayController::BuildTargetShader(
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
if(source.empty())
return rdcpair<ResourceId, rdcstr>(ResourceId(), "0-byte shader is not valid");
@@ -1975,6 +1997,8 @@ ReplayStatus ReplayController::CreateDevice(RDCFile *rdc, const ReplayOptions &o
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
IReplayDriver *driver = NULL;
ReplayStatus status = RenderDoc::Inst().CreateReplayDriver(rdc, opts, &driver);
@@ -2006,6 +2030,8 @@ ReplayStatus ReplayController::PostCreateInit(IReplayDriver *device, RDCFile *rd
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
m_pDevice = device;
m_APIProps = m_pDevice->GetAPIProperties();
@@ -2054,6 +2080,8 @@ void ReplayController::FetchPipelineState(uint32_t eventId)
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
m_pDevice->SavePipelineState(eventId);
m_D3D11PipelineState = m_pDevice->GetD3D11PipelineState();
+8
View File
@@ -389,6 +389,8 @@ rdcpair<uint32_t, uint32_t> ReplayOutput::PickVertex(uint32_t x, uint32_t y)
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
DrawcallDescription *draw = m_pRenderer->GetDrawcallByEID(m_EventID);
const rdcpair<uint32_t, uint32_t> errorReturn = {~0U, ~0U};
@@ -566,6 +568,8 @@ void ReplayOutput::Display()
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
if(m_pDevice->CheckResizeOutputWindow(m_MainOutput.outputID))
{
m_pDevice->GetOutputWindowDimensions(m_MainOutput.outputID, m_Width, m_Height);
@@ -680,6 +684,8 @@ void ReplayOutput::DisplayTex()
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
DrawcallDescription *draw = m_pRenderer->GetDrawcallByEID(m_EventID);
if(m_MainOutput.outputID == 0)
@@ -767,6 +773,8 @@ void ReplayOutput::DisplayMesh()
{
CHECK_REPLAY_THREAD();
RENDERDOC_PROFILEFUNCTION();
DrawcallDescription *draw = m_pRenderer->GetDrawcallByEID(m_EventID);
if(draw == NULL || m_MainOutput.outputID == 0 || m_Width <= 0 || m_Height <= 0 ||