Remove no longer needed mutable DrawcallTreeNode structures

* The DrawcallDescription children is mutable, so we don't need a
  separate struct for that purpose in D3D11/GL where there's no side
  data to carry along with (where draws are late-bound when submitted).
This commit is contained in:
baldurk
2017-11-03 17:21:40 +00:00
parent 6073e8a8d4
commit 0edee7649d
8 changed files with 20 additions and 85 deletions
+2 -6
View File
@@ -997,11 +997,7 @@ void WrappedID3D11DeviceContext::AddDrawcall(const DrawcallDescription &d, bool
// should have at least the root drawcall here, push this drawcall
// onto the back's children list.
if(!m_DrawcallStack.empty())
{
DrawcallTreeNode node(draw);
node.children.insert(node.children.begin(), draw.children.begin(), draw.children.end());
m_DrawcallStack.back()->children.push_back(node);
}
m_DrawcallStack.back()->children.push_back(draw);
else
RDCERR("Somehow lost drawcall stack!");
}
@@ -1483,7 +1479,7 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven
if(m_State == READING)
{
m_pDevice->GetFrameRecord().drawcallList = m_ParentDrawcall.Bake();
m_pDevice->GetFrameRecord().drawcallList = m_ParentDrawcall.children;
m_pDevice->GetFrameRecord().frameInfo.debugMessages = m_pDevice->GetDebugMessages();
for(auto it = WrappedID3D11Buffer::m_BufferList.begin();
+4 -28
View File
@@ -98,30 +98,6 @@ enum CaptureFailReason
CaptureFailed_UncappedCmdlist,
};
struct DrawcallTreeNode
{
DrawcallTreeNode() {}
explicit DrawcallTreeNode(const DrawcallDescription &d) : draw(d) {}
DrawcallDescription draw;
vector<DrawcallTreeNode> children;
vector<DrawcallDescription> Bake()
{
vector<DrawcallDescription> ret;
if(children.empty())
return ret;
ret.resize(children.size());
for(size_t i = 0; i < children.size(); i++)
{
ret[i] = children[i].draw;
ret[i].children = children[i].Bake();
}
return ret;
}
};
class WrappedID3D11DeviceContext : public RefCounter, public ID3D11DeviceContext3
{
private:
@@ -218,10 +194,10 @@ private:
uint64_t m_CurChunkOffset;
uint32_t m_CurEventID, m_CurDrawcallID;
DrawcallTreeNode m_ParentDrawcall;
map<ResourceId, DrawcallTreeNode> m_CmdLists;
DrawcallDescription m_ParentDrawcall;
map<ResourceId, DrawcallDescription> m_CmdLists;
list<DrawcallTreeNode *> m_DrawcallStack;
list<DrawcallDescription *> m_DrawcallStack;
void FlattenLog();
@@ -318,7 +294,7 @@ public:
uint32_t GetEventID() { return m_CurEventID; }
const APIEvent &GetEvent(uint32_t eventID);
const DrawcallTreeNode &GetRootDraw() { return m_ParentDrawcall; }
const DrawcallDescription &GetRootDraw() { return m_ParentDrawcall; }
void ThreadSafe_SetMarker(uint32_t col, const wchar_t *name);
int ThreadSafe_BeginEvent(uint32_t col, const wchar_t *name);
int ThreadSafe_EndEvent();
+4 -4
View File
@@ -220,7 +220,7 @@ struct D3D11CounterContext
int reuseIdx;
};
void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallTreeNode &drawnode)
void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallDescription &drawnode)
{
const D3D11_QUERY_DESC qtimedesc = {D3D11_QUERY_TIMESTAMP, 0};
const D3D11_QUERY_DESC qstatsdesc = {D3D11_QUERY_PIPELINE_STATISTICS, 0};
@@ -231,7 +231,7 @@ void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallTreeN
for(size_t i = 0; i < drawnode.children.size(); i++)
{
const DrawcallDescription &d = drawnode.children[i].draw;
const DrawcallDescription &d = drawnode.children[i];
FillTimers(ctx, drawnode.children[i]);
if(d.events.empty())
@@ -288,14 +288,14 @@ void D3D11DebugManager::FillTimers(D3D11CounterContext &ctx, const DrawcallTreeN
}
void D3D11DebugManager::FillTimersAMD(uint32_t &eventStartID, uint32_t &sampleIndex,
vector<uint32_t> &eventIDs, const DrawcallTreeNode &drawnode)
vector<uint32_t> &eventIDs, const DrawcallDescription &drawnode)
{
if(drawnode.children.empty())
return;
for(size_t i = 0; i < drawnode.children.size(); i++)
{
const DrawcallDescription &d = drawnode.children[i].draw;
const DrawcallDescription &d = drawnode.children[i];
FillTimersAMD(eventStartID, sampleIndex, eventIDs, drawnode.children[i]);
+2 -4
View File
@@ -45,8 +45,6 @@ class WrappedID3D11DeviceContext;
class AMDCounters;
struct DrawcallTreeNode;
struct D3D11CounterContext;
class D3D11ResourceManager;
@@ -584,10 +582,10 @@ private:
// called before the device is shutdown, to shutdown any counters
void PreDeviceShutdownCounters();
void FillTimers(D3D11CounterContext &ctx, const DrawcallTreeNode &drawnode);
void FillTimers(D3D11CounterContext &ctx, const DrawcallDescription &drawnode);
void FillTimersAMD(uint32_t &eventStartID, uint32_t &sampleIndex, vector<uint32_t> &eventIDs,
const DrawcallTreeNode &drawnode);
const DrawcallDescription &drawnode);
void FillCBuffer(ID3D11Buffer *buf, const void *data, size_t size);
};
+2 -2
View File
@@ -206,7 +206,7 @@ GLenum glCounters[] = {
eGL_COMPUTE_SHADER_INVOCATIONS_ARB // GPUCounter::CSInvocations
};
void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnode,
void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallDescription &drawnode,
const vector<GPUCounter> &counters)
{
if(drawnode.children.empty())
@@ -214,7 +214,7 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnod
for(size_t i = 0; i < drawnode.children.size(); i++)
{
const DrawcallDescription &d = drawnode.children[i].draw;
const DrawcallDescription &d = drawnode.children[i];
FillTimers(ctx, drawnode.children[i], counters);
if(d.events.empty())
+2 -6
View File
@@ -4028,7 +4028,7 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u
if(m_State == READING)
{
GetFrameRecord().drawcallList = m_ParentDrawcall.Bake();
GetFrameRecord().drawcallList = m_ParentDrawcall.children;
GetFrameRecord().frameInfo.debugMessages = GetDebugMessages();
DrawcallDescription *previous = NULL;
@@ -4434,11 +4434,7 @@ void WrappedOpenGL::AddDrawcall(const DrawcallDescription &d, bool hasEvents)
// should have at least the root drawcall here, push this drawcall
// onto the back's children list.
if(!context->m_DrawcallStack.empty())
{
DrawcallTreeNode node(draw);
node.children.insert(node.children.begin(), draw.children.begin(), draw.children.end());
context->m_DrawcallStack.back()->children.push_back(node);
}
m_DrawcallStack.back()->children.push_back(draw);
else
RDCERR("Somehow lost drawcall stack!");
}
+3 -33
View File
@@ -69,36 +69,6 @@ enum CaptureFailReason
CaptureFailed_UncappedUnmap,
};
struct DrawcallTreeNode
{
DrawcallTreeNode() {}
explicit DrawcallTreeNode(const DrawcallDescription &d) : draw(d) {}
DrawcallDescription draw;
vector<DrawcallTreeNode> children;
DrawcallTreeNode &operator=(const DrawcallDescription &d)
{
*this = DrawcallTreeNode(d);
return *this;
}
vector<DrawcallDescription> Bake()
{
vector<DrawcallDescription> ret;
if(children.empty())
return ret;
ret.resize(children.size());
for(size_t i = 0; i < children.size(); i++)
{
ret[i] = children[i].draw;
ret[i].children = children[i].Bake();
}
return ret;
}
};
struct Replacement
{
Replacement(ResourceId i, GLResource r) : id(i), res(r) {}
@@ -229,9 +199,9 @@ private:
uint32_t m_FirstEventID;
uint32_t m_LastEventID;
DrawcallTreeNode m_ParentDrawcall;
DrawcallDescription m_ParentDrawcall;
list<DrawcallTreeNode *> m_DrawcallStack;
list<DrawcallDescription *> m_DrawcallStack;
map<ResourceId, vector<EventUsage> > m_ResourceUses;
@@ -578,7 +548,7 @@ public:
FrameRecord &GetFrameRecord() { return m_FrameRecord; }
const APIEvent &GetEvent(uint32_t eventID);
const DrawcallTreeNode &GetRootDraw() { return m_ParentDrawcall; }
const DrawcallDescription &GetRootDraw() { return m_ParentDrawcall; }
const DrawcallDescription *GetDrawcall(uint32_t eventID);
void SuppressDebugMessages(bool suppress) { m_SuppressDebugMessages = suppress; }
+1 -2
View File
@@ -35,7 +35,6 @@ using std::map;
class WrappedOpenGL;
struct GLCounterContext;
struct DrawcallTreeNode;
struct GLPostVSData
{
@@ -384,7 +383,7 @@ private:
// called before the context is destroyed, to shutdown any counters
void PreContextShutdownCounters();
void FillTimers(GLCounterContext &ctx, const DrawcallTreeNode &drawnode,
void FillTimers(GLCounterContext &ctx, const DrawcallDescription &drawnode,
const vector<GPUCounter> &counters);
GLuint CreateShaderProgram(const vector<string> &vs, const vector<string> &fs,