mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
Re-jig loading progress bar calculation to be smoother/more informative
This commit is contained in:
@@ -746,8 +746,9 @@ void RenderDoc::SetProgress(LoadProgressSection section, float delta)
|
||||
float weights[NumSections];
|
||||
|
||||
// must sum to 1.0
|
||||
weights[DebugManagerInit] = 0.4f;
|
||||
weights[FileInitialRead] = 0.6f;
|
||||
weights[DebugManagerInit] = 0.1f;
|
||||
weights[FileInitialRead] = 0.75f;
|
||||
weights[FrameEventsRead] = 0.15f;
|
||||
|
||||
float progress = 0.0f;
|
||||
for(int i=0; i < section; i++)
|
||||
|
||||
@@ -146,6 +146,7 @@ enum LoadProgressSection
|
||||
{
|
||||
DebugManagerInit,
|
||||
FileInitialRead,
|
||||
FrameEventsRead,
|
||||
NumSections,
|
||||
};
|
||||
|
||||
|
||||
@@ -1217,6 +1217,8 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven
|
||||
|
||||
m_pDevice->GetResourceManager()->MarkInFrame(true);
|
||||
|
||||
uint64_t startOffset = m_pSerialiser->GetOffset();
|
||||
|
||||
while(1)
|
||||
{
|
||||
if(m_State == EXECUTING && m_CurEventID > endEventID)
|
||||
@@ -1231,7 +1233,7 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven
|
||||
|
||||
ProcessChunk(offset, chunktype, false);
|
||||
|
||||
RenderDoc::Inst().SetProgress(FileInitialRead, float(offset)/float(m_pSerialiser->GetSize()));
|
||||
RenderDoc::Inst().SetProgress(FrameEventsRead, float(offset - startOffset)/float(m_pSerialiser->GetSize()));
|
||||
|
||||
// for now just abort after capture scope. Really we'd need to support multiple frames
|
||||
// but for now this will do.
|
||||
|
||||
@@ -1006,9 +1006,11 @@ void WrappedID3D11Device::ReadLogInitialisation()
|
||||
|
||||
m_pSerialiser->Rewind();
|
||||
|
||||
uint32_t captureChunkIdx = 0;
|
||||
|
||||
while(!m_pSerialiser->AtEnd())
|
||||
{
|
||||
m_pSerialiser->SkipToChunk(CAPTURE_SCOPE);
|
||||
m_pSerialiser->SkipToChunk(CAPTURE_SCOPE, &captureChunkIdx);
|
||||
|
||||
// found a capture chunk
|
||||
if(!m_pSerialiser->AtEnd())
|
||||
@@ -1054,7 +1056,7 @@ void WrappedID3D11Device::ReadLogInitialisation()
|
||||
|
||||
m_pSerialiser->PopContext(NULL, context);
|
||||
|
||||
RenderDoc::Inst().SetProgress(FileInitialRead, float(m_pSerialiser->GetOffset())/float(m_pSerialiser->GetSize()));
|
||||
RenderDoc::Inst().SetProgress(FileInitialRead, float(chunkIdx)/float(captureChunkIdx));
|
||||
|
||||
if(context == CAPTURE_SCOPE)
|
||||
{
|
||||
|
||||
@@ -2830,9 +2830,11 @@ void WrappedOpenGL::ReadLogInitialisation()
|
||||
|
||||
m_pSerialiser->Rewind();
|
||||
|
||||
uint32_t captureChunkIdx = 0;
|
||||
|
||||
while(!m_pSerialiser->AtEnd())
|
||||
{
|
||||
m_pSerialiser->SkipToChunk(CAPTURE_SCOPE);
|
||||
m_pSerialiser->SkipToChunk(CAPTURE_SCOPE, &captureChunkIdx);
|
||||
|
||||
// found a capture chunk
|
||||
if(!m_pSerialiser->AtEnd())
|
||||
@@ -2878,7 +2880,7 @@ void WrappedOpenGL::ReadLogInitialisation()
|
||||
|
||||
m_pSerialiser->PopContext(NULL, context);
|
||||
|
||||
RenderDoc::Inst().SetProgress(FileInitialRead, float(m_pSerialiser->GetOffset())/float(m_pSerialiser->GetSize()));
|
||||
RenderDoc::Inst().SetProgress(FileInitialRead, float(chunkIdx)/float(captureChunkIdx));
|
||||
|
||||
if(context == CAPTURE_SCOPE)
|
||||
{
|
||||
@@ -3820,6 +3822,8 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u
|
||||
|
||||
GetResourceManager()->MarkInFrame(true);
|
||||
|
||||
uint64_t startOffset = m_pSerialiser->GetOffset();
|
||||
|
||||
while(1)
|
||||
{
|
||||
if(m_State == EXECUTING && m_CurEventID > endEventID)
|
||||
@@ -3834,7 +3838,7 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u
|
||||
|
||||
ContextProcessChunk(offset, chunktype, false);
|
||||
|
||||
RenderDoc::Inst().SetProgress(FileInitialRead, float(offset)/float(m_pSerialiser->GetSize()));
|
||||
RenderDoc::Inst().SetProgress(FrameEventsRead, float(offset - startOffset)/float(m_pSerialiser->GetSize()));
|
||||
|
||||
// for now just abort after capture scope. Really we'd need to support multiple frames
|
||||
// but for now this will do.
|
||||
|
||||
@@ -268,7 +268,7 @@ class Serialiser
|
||||
}
|
||||
|
||||
// assumes buffer head is sitting before a chunk (ie. pushcontext will be valid)
|
||||
void SkipToChunk(uint32_t chunkIdx)
|
||||
void SkipToChunk(uint32_t chunkIdx, uint32_t *idx = NULL)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -289,6 +289,8 @@ class Serialiser
|
||||
PopContext(NULL, 1);
|
||||
}
|
||||
|
||||
if(idx) (*idx)++;
|
||||
|
||||
} while(!AtEnd());
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace renderdocui.Code
|
||||
{
|
||||
Thread.Sleep(2);
|
||||
|
||||
float progress = 0.5f * m_Renderer.LoadProgress + 0.49f * postloadProgress + 0.01f;
|
||||
float progress = 0.8f * m_Renderer.LoadProgress + 0.19f * postloadProgress + 0.01f;
|
||||
|
||||
modal.LogfileProgress(progress);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user