Coverity: When possible, pass big params by const ref instead of by val

This commit is contained in:
baldurk
2016-06-09 11:55:36 -07:00
parent d5b04583dd
commit 0afc7ea6c3
22 changed files with 121 additions and 110 deletions
+6 -4
View File
@@ -113,7 +113,7 @@ public:
{
m_Proxy->PickPixel(m_TextureID, x, y, sliceFace, mip, sample, pixel);
}
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y)
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y)
{
return m_Proxy->PickVertex(eventID, cfg, x, y);
}
@@ -142,7 +142,9 @@ public:
D3D11PipelineState GetD3D11PipelineState() { return m_PipelineState; }
// other operations are dropped/ignored, to avoid confusion
void ReadLogInitialisation() {}
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg) {}
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg)
{
}
vector<ResourceId> GetBuffers() { return vector<ResourceId>(); }
vector<DebugMessage> GetDebugMessages() { return vector<DebugMessage>(); }
FetchBuffer GetBuffer(ResourceId id)
@@ -225,7 +227,7 @@ public:
void ReplaceResource(ResourceId from, ResourceId to) {}
void RemoveReplacement(ResourceId id) {}
// these are proxy functions, and will never be used
ResourceId CreateProxyTexture(FetchTexture templateTex)
ResourceId CreateProxyTexture(const FetchTexture &templateTex)
{
RDCERR("Calling proxy-render functions on an image viewer");
return ResourceId();
@@ -237,7 +239,7 @@ public:
RDCERR("Calling proxy-render functions on an image viewer");
}
ResourceId CreateProxyBuffer(FetchBuffer templateBuf)
ResourceId CreateProxyBuffer(const FetchBuffer &templateBuf)
{
RDCERR("Calling proxy-render functions on an image viewer");
return ResourceId();
+26 -22
View File
@@ -222,23 +222,25 @@ public:
}
}
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg)
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg)
{
if(m_Proxy && cfg.position.buf != ResourceId())
{
EnsureBufCached(cfg.position.buf);
cfg.position.buf = m_ProxyBufferIds[cfg.position.buf];
MeshDisplay proxiedCfg = cfg;
if(cfg.second.buf != ResourceId())
EnsureBufCached(proxiedCfg.position.buf);
proxiedCfg.position.buf = m_ProxyBufferIds[proxiedCfg.position.buf];
if(proxiedCfg.second.buf != ResourceId())
{
EnsureBufCached(cfg.second.buf);
cfg.second.buf = m_ProxyBufferIds[cfg.second.buf];
EnsureBufCached(proxiedCfg.second.buf);
proxiedCfg.second.buf = m_ProxyBufferIds[proxiedCfg.second.buf];
}
if(cfg.position.idxbuf != ResourceId())
if(proxiedCfg.position.idxbuf != ResourceId())
{
EnsureBufCached(cfg.position.idxbuf);
cfg.position.idxbuf = m_ProxyBufferIds[cfg.position.idxbuf];
EnsureBufCached(proxiedCfg.position.idxbuf);
proxiedCfg.position.idxbuf = m_ProxyBufferIds[proxiedCfg.position.idxbuf];
}
vector<MeshFormat> secDraws = secondaryDraws;
@@ -257,30 +259,32 @@ public:
}
}
m_Proxy->RenderMesh(eventID, secDraws, cfg);
m_Proxy->RenderMesh(eventID, secDraws, proxiedCfg);
}
}
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y)
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y)
{
if(m_Proxy && cfg.position.buf != ResourceId())
{
EnsureBufCached(cfg.position.buf);
cfg.position.buf = m_ProxyBufferIds[cfg.position.buf];
MeshDisplay proxiedCfg = cfg;
if(cfg.second.buf != ResourceId())
EnsureBufCached(proxiedCfg.position.buf);
proxiedCfg.position.buf = m_ProxyBufferIds[proxiedCfg.position.buf];
if(proxiedCfg.second.buf != ResourceId())
{
EnsureBufCached(cfg.second.buf);
cfg.second.buf = m_ProxyBufferIds[cfg.second.buf];
EnsureBufCached(proxiedCfg.second.buf);
proxiedCfg.second.buf = m_ProxyBufferIds[proxiedCfg.second.buf];
}
if(cfg.position.idxbuf != ResourceId())
if(proxiedCfg.position.idxbuf != ResourceId())
{
EnsureBufCached(cfg.position.idxbuf);
cfg.position.idxbuf = m_ProxyBufferIds[cfg.position.idxbuf];
EnsureBufCached(proxiedCfg.position.idxbuf);
proxiedCfg.position.idxbuf = m_ProxyBufferIds[proxiedCfg.position.idxbuf];
}
return m_Proxy->PickVertex(eventID, cfg, x, y);
return m_Proxy->PickVertex(eventID, proxiedCfg, x, y);
}
return ~0U;
@@ -395,7 +399,7 @@ public:
void FileChanged() {}
// will never be used
ResourceId CreateProxyTexture(FetchTexture templateTex)
ResourceId CreateProxyTexture(const FetchTexture &templateTex)
{
RDCERR("Calling proxy-render functions on a proxy serialiser");
return ResourceId();
@@ -407,7 +411,7 @@ public:
RDCERR("Calling proxy-render functions on a proxy serialiser");
}
ResourceId CreateProxyBuffer(FetchBuffer templateBuf)
ResourceId CreateProxyBuffer(const FetchBuffer &templateBuf)
{
RDCERR("Calling proxy-render functions on a proxy serialiser");
return ResourceId();
+2 -1
View File
@@ -2077,7 +2077,8 @@ ShaderDebugTrace D3D11DebugManager::DebugThread(uint32_t eventID, uint32_t group
return ret;
}
uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y)
uint32_t D3D11DebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x,
uint32_t y)
{
if(cfg.position.numVerts == 0)
return ~0U;
+3 -3
View File
@@ -726,9 +726,9 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt)
return ret;
}
ShaderConstant MakeConstantBufferVariable(DXBC::CBufferVariable var, uint32_t &offset);
static ShaderConstant MakeConstantBufferVariable(const DXBC::CBufferVariable &var, uint32_t &offset);
ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, uint32_t &offset)
static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, uint32_t &offset)
{
ShaderVariableType ret;
@@ -782,7 +782,7 @@ ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type, uint32
return ret;
}
ShaderConstant MakeConstantBufferVariable(DXBC::CBufferVariable var, uint32_t &offset)
static ShaderConstant MakeConstantBufferVariable(const DXBC::CBufferVariable &var, uint32_t &offset)
{
ShaderConstant ret;
+8 -7
View File
@@ -804,7 +804,7 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch
context->m_State = state;
}
void WrappedID3D11DeviceContext::AddUsage(FetchDrawcall d)
void WrappedID3D11DeviceContext::AddUsage(const FetchDrawcall &d)
{
const D3D11RenderState *pipe = m_CurrentPipelineState;
uint32_t e = d.eventID;
@@ -899,11 +899,8 @@ void WrappedID3D11DeviceContext::RefreshDrawcallIDs(DrawcallTreeNode &node)
}
}
void WrappedID3D11DeviceContext::AddDrawcall(FetchDrawcall d, bool hasEvents)
void WrappedID3D11DeviceContext::AddDrawcall(const FetchDrawcall &d, bool hasEvents)
{
if(d.context == ResourceId())
d.context = m_pDevice->GetResourceManager()->GetOriginalID(m_ResourceID);
if(GetType() == D3D11_DEVICE_CONTEXT_DEFERRED)
{
m_pDevice->GetImmediateContext()->AddDrawcall(d, hasEvents);
@@ -912,12 +909,16 @@ void WrappedID3D11DeviceContext::AddDrawcall(FetchDrawcall d, bool hasEvents)
m_AddedDrawcall = true;
FetchDrawcall draw = d;
if(draw.context == ResourceId())
draw.context = m_pDevice->GetResourceManager()->GetOriginalID(m_ResourceID);
WrappedID3D11DeviceContext *context =
(WrappedID3D11DeviceContext *)m_pDevice->GetResourceManager()->GetLiveResource(d.context);
(WrappedID3D11DeviceContext *)m_pDevice->GetResourceManager()->GetLiveResource(draw.context);
RDCASSERT(context);
FetchDrawcall draw = d;
draw.eventID = m_CurEventID;
draw.drawcallID = m_CurDrawcallID;
+3 -3
View File
@@ -98,7 +98,7 @@ enum CaptureFailReason
struct DrawcallTreeNode
{
DrawcallTreeNode() {}
explicit DrawcallTreeNode(FetchDrawcall d) : draw(d) {}
explicit DrawcallTreeNode(const FetchDrawcall &d) : draw(d) {}
FetchDrawcall draw;
vector<DrawcallTreeNode> children;
@@ -241,10 +241,10 @@ private:
void DrainAnnotationQueue();
void AddUsage(FetchDrawcall draw);
void AddUsage(const FetchDrawcall &d);
void AddEvent(D3D11ChunkType type, string description, ResourceId ctx = ResourceId());
void AddDrawcall(FetchDrawcall draw, bool hasEvents);
void AddDrawcall(const FetchDrawcall &d, bool hasEvents);
void RefreshDrawcallIDs(DrawcallTreeNode &node);
void RecordIndexBindStats(ID3D11Buffer *Buffer);
+2 -2
View File
@@ -4531,7 +4531,7 @@ void D3D11DebugManager::InitPostVSBuffers(uint32_t eventID)
}
}
FloatVector D3D11DebugManager::InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg,
FloatVector D3D11DebugManager::InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg,
byte *end, bool useidx, bool &valid)
{
FloatVector ret(0.0f, 0.0f, 0.0f, 1.0f);
@@ -4614,7 +4614,7 @@ FloatVector D3D11DebugManager::InterpretVertex(byte *data, uint32_t vert, MeshDi
}
void D3D11DebugManager::RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws,
MeshDisplay cfg)
const MeshDisplay &cfg)
{
DebugVertexCBuffer vertexData;
+4 -4
View File
@@ -153,7 +153,7 @@ public:
vector<CounterResult> FetchCounters(const vector<uint32_t> &counters);
void RenderText(float x, float y, const char *textfmt, ...);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
ID3D11Buffer *MakeCBuffer(float *data, size_t size);
@@ -187,7 +187,7 @@ public:
ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip,
uint32_t sample, float pixel[4]);
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y);
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y);
ResourceId RenderOverlay(ResourceId texid, TextureDisplayOverlay overlay, uint32_t eventID,
const vector<uint32_t> &passEvents);
@@ -364,8 +364,8 @@ private:
ID3D11Buffer *m_FrustumHelper;
ID3D11Buffer *m_TriHighlightHelper;
FloatVector InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg, byte *end, bool useidx,
bool &valid);
FloatVector InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg, byte *end,
bool useidx, bool &valid);
bool InitStreamOut();
void ShutdownStreamOut();
+4 -4
View File
@@ -1453,7 +1453,7 @@ vector<CounterResult> D3D11Replay::FetchCounters(const vector<uint32_t> &counter
}
void D3D11Replay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws,
MeshDisplay cfg)
const MeshDisplay &cfg)
{
return m_pDevice->GetDebugManager()->RenderMesh(eventID, secondaryDraws, cfg);
}
@@ -1529,7 +1529,7 @@ ShaderDebugTrace D3D11Replay::DebugThread(uint32_t eventID, uint32_t groupid[3],
return m_pDevice->GetDebugManager()->DebugThread(eventID, groupid, threadid);
}
uint32_t D3D11Replay::PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y)
uint32_t D3D11Replay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y)
{
return m_pDevice->GetDebugManager()->PickVertex(eventID, cfg, x, y);
}
@@ -1582,7 +1582,7 @@ Callstack::StackResolver *D3D11Replay::GetCallstackResolver()
return m_pDevice->GetSerialiser()->GetCallstackResolver();
}
ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
ResourceId D3D11Replay::CreateProxyTexture(const FetchTexture &templateTex)
{
ResourceId ret;
@@ -1808,7 +1808,7 @@ void D3D11Replay::SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint3
}
}
ResourceId D3D11Replay::CreateProxyBuffer(FetchBuffer templateBuf)
ResourceId D3D11Replay::CreateProxyBuffer(const FetchBuffer &templateBuf)
{
ResourceId ret;
+4 -4
View File
@@ -110,14 +110,14 @@ public:
void DescribeCounter(uint32_t counterID, CounterDescription &desc);
vector<CounterResult> FetchCounters(const vector<uint32_t> &counters);
ResourceId CreateProxyTexture(FetchTexture templateTex);
ResourceId CreateProxyTexture(const FetchTexture &templateTex);
void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data,
size_t dataSize);
ResourceId CreateProxyBuffer(FetchBuffer templateBuf);
ResourceId CreateProxyBuffer(const FetchBuffer &templateBuf);
void SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSize);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
bool RenderTexture(TextureDisplay cfg);
@@ -138,7 +138,7 @@ public:
ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip,
uint32_t sample, float pixel[4]);
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y);
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y);
ResourceId RenderOverlay(ResourceId texid, TextureDisplayOverlay overlay, uint32_t eventID,
const vector<uint32_t> &passEvents);
+4 -3
View File
@@ -984,7 +984,7 @@ bool GLReplay::GetHistogram(ResourceId texid, uint32_t sliceFace, uint32_t mip,
return true;
}
uint32_t GLReplay::PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y)
uint32_t GLReplay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y)
{
WrappedOpenGL &gl = *m_pDriver;
@@ -3400,7 +3400,7 @@ MeshFormat GLReplay::GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDat
return ret;
}
FloatVector GLReplay::InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg, byte *end,
FloatVector GLReplay::InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg, byte *end,
bool useidx, bool &valid)
{
FloatVector ret(0.0f, 0.0f, 0.0f, 1.0f);
@@ -3482,7 +3482,8 @@ FloatVector GLReplay::InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg
return ret;
}
void GLReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg)
void GLReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws,
const MeshDisplay &cfg)
{
WrappedOpenGL &gl = *m_pDriver;
+5 -5
View File
@@ -3789,7 +3789,7 @@ void WrappedOpenGL::ContextProcessChunk(uint64_t offset, GLChunkType chunk, bool
context->m_State = state;
}
void WrappedOpenGL::AddUsage(FetchDrawcall d)
void WrappedOpenGL::AddUsage(const FetchDrawcall &d)
{
if((d.flags & (eDraw_Drawcall | eDraw_Dispatch)) == 0)
return;
@@ -4066,11 +4066,8 @@ void WrappedOpenGL::AddUsage(FetchDrawcall d)
}
}
void WrappedOpenGL::AddDrawcall(FetchDrawcall d, bool hasEvents)
void WrappedOpenGL::AddDrawcall(const FetchDrawcall &d, bool hasEvents)
{
if(d.context == ResourceId())
d.context = GetResourceManager()->GetOriginalID(m_ContextResourceID);
m_AddedDrawcall = true;
WrappedOpenGL *context = this;
@@ -4079,6 +4076,9 @@ void WrappedOpenGL::AddDrawcall(FetchDrawcall d, bool hasEvents)
draw.eventID = m_CurEventID;
draw.drawcallID = m_CurDrawcallID;
if(draw.context == ResourceId())
draw.context = GetResourceManager()->GetOriginalID(m_ContextResourceID);
GLuint curCol[8] = {0};
GLuint curDepth = 0;
+4 -4
View File
@@ -72,11 +72,11 @@ enum CaptureFailReason
struct DrawcallTreeNode
{
DrawcallTreeNode() {}
explicit DrawcallTreeNode(FetchDrawcall d) : draw(d) {}
explicit DrawcallTreeNode(const FetchDrawcall &d) : draw(d) {}
FetchDrawcall draw;
vector<DrawcallTreeNode> children;
DrawcallTreeNode &operator=(FetchDrawcall d)
DrawcallTreeNode &operator=(const FetchDrawcall &d)
{
*this = DrawcallTreeNode(d);
return *this;
@@ -331,8 +331,8 @@ private:
void ProcessChunk(uint64_t offset, GLChunkType context);
void ContextReplayLog(LogState readType, uint32_t startEventID, uint32_t endEventID, bool partial);
void ContextProcessChunk(uint64_t offset, GLChunkType chunk, bool forceExecute);
void AddUsage(FetchDrawcall draw);
void AddDrawcall(FetchDrawcall d, bool hasEvents);
void AddUsage(const FetchDrawcall &d);
void AddDrawcall(const FetchDrawcall &d, bool hasEvents);
void AddEvent(GLChunkType type, string description, ResourceId ctx = ResourceId());
void Serialise_CaptureScope(uint64_t offset);
+2 -2
View File
@@ -2746,7 +2746,7 @@ void GLReplay::FreeTargetResource(ResourceId id)
m_pDriver->FreeTargetResource(id);
}
ResourceId GLReplay::CreateProxyTexture(FetchTexture templateTex)
ResourceId GLReplay::CreateProxyTexture(const FetchTexture &templateTex)
{
WrappedOpenGL &gl = *m_pDriver;
@@ -2967,7 +2967,7 @@ void GLReplay::SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t
}
}
ResourceId GLReplay::CreateProxyBuffer(FetchBuffer templateBuf)
ResourceId GLReplay::CreateProxyBuffer(const FetchBuffer &templateBuf)
{
WrappedOpenGL &gl = *m_pDriver;
+6 -6
View File
@@ -148,7 +148,7 @@ public:
void DescribeCounter(uint32_t counterID, CounterDescription &desc);
vector<CounterResult> FetchCounters(const vector<uint32_t> &counters);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
void BuildTargetShader(string source, string entry, const uint32_t compileFlags,
ShaderStageType type, ResourceId *id, string *errors);
@@ -176,17 +176,17 @@ public:
ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip,
uint32_t sample, float pixel[4]);
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y);
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y);
ResourceId RenderOverlay(ResourceId cfg, TextureDisplayOverlay overlay, uint32_t eventID,
const vector<uint32_t> &passEvents);
ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip);
ResourceId CreateProxyTexture(FetchTexture templateTex);
ResourceId CreateProxyTexture(const FetchTexture &templateTex);
void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data,
size_t dataSize);
ResourceId CreateProxyBuffer(FetchBuffer templateBuf);
ResourceId CreateProxyBuffer(const FetchBuffer &templateBuf);
void SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSize);
bool IsRenderOutput(ResourceId id);
@@ -332,8 +332,8 @@ private:
GLuint emptyVAO;
} DebugData;
FloatVector InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg, byte *end, bool useidx,
bool &valid);
FloatVector InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg, byte *end,
bool useidx, bool &valid);
// simple cache for when we need buffer data for highlighting
// vertices, typical use will be lots of vertices in the same
+1 -1
View File
@@ -2436,7 +2436,7 @@ VkCommandBuffer WrappedVulkan::RerecordCmdBuf(ResourceId cmdid)
return m_PartialReplayData.resultPartialCmdBuffer;
}
void WrappedVulkan::AddDrawcall(FetchDrawcall d, bool hasEvents)
void WrappedVulkan::AddDrawcall(const FetchDrawcall &d, bool hasEvents)
{
m_AddedDrawcall = true;
+3 -3
View File
@@ -60,13 +60,13 @@ struct VkInitParams : public RDCInitParams
struct VulkanDrawcallTreeNode
{
VulkanDrawcallTreeNode() {}
explicit VulkanDrawcallTreeNode(FetchDrawcall d) : draw(d) {}
explicit VulkanDrawcallTreeNode(const FetchDrawcall &d) : draw(d) {}
FetchDrawcall draw;
vector<VulkanDrawcallTreeNode> children;
vector<pair<ResourceId, EventUsage> > resourceUsage;
VulkanDrawcallTreeNode &operator=(FetchDrawcall d)
VulkanDrawcallTreeNode &operator=(const FetchDrawcall &d)
{
*this = VulkanDrawcallTreeNode(d);
return *this;
@@ -545,7 +545,7 @@ private:
void ProcessChunk(uint64_t offset, VulkanChunkType context);
void ContextReplayLog(LogState readType, uint32_t startEventID, uint32_t endEventID, bool partial);
void ContextProcessChunk(uint64_t offset, VulkanChunkType chunk, bool forceExecute);
void AddDrawcall(FetchDrawcall d, bool hasEvents);
void AddDrawcall(const FetchDrawcall &d, bool hasEvents);
void AddEvent(VulkanChunkType type, string description);
void AddUsage(VulkanDrawcallTreeNode &drawNode, vector<DebugMessage> &debugMessages);
+3 -3
View File
@@ -2638,7 +2638,7 @@ void VulkanDebugManager::CreateCustomShaderPipeline(ResourceId shader)
RDCASSERTEQUAL(vkr, VK_SUCCESS);
}
FloatVector VulkanDebugManager::InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg,
FloatVector VulkanDebugManager::InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg,
byte *end, bool &valid)
{
FloatVector ret(0.0f, 0.0f, 0.0f, 1.0f);
@@ -2709,8 +2709,8 @@ FloatVector VulkanDebugManager::InterpretVertex(byte *data, uint32_t vert, MeshD
return ret;
}
uint32_t VulkanDebugManager::PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y,
uint32_t w, uint32_t h)
uint32_t VulkanDebugManager::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x,
uint32_t y, uint32_t w, uint32_t h)
{
VkDevice dev = m_pDriver->GetDev();
const VkLayerDispatchTable *vt = ObjDisp(dev);
+3 -2
View File
@@ -119,9 +119,10 @@ public:
MeshFormat GetPostVSBuffers(uint32_t eventID, uint32_t instID, MeshDataStage stage);
void GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, vector<byte> &ret);
FloatVector InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg, byte *end, bool &valid);
FloatVector InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg, byte *end,
bool &valid);
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y, uint32_t w,
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y, uint32_t w,
uint32_t h);
void CreateCustomShaderTex(uint32_t width, uint32_t height);
+18 -17
View File
@@ -1017,7 +1017,7 @@ void VulkanReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_
m_DebugHeight = oldH;
}
uint32_t VulkanReplay::PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y)
uint32_t VulkanReplay::PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y)
{
return GetDebugManager()->PickVertex(eventID, cfg, x, y, m_DebugWidth, m_DebugHeight);
}
@@ -1596,8 +1596,8 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, TextureDisplayOverlay o
return GetDebugManager()->RenderOverlay(texid, overlay, eventID, passEvents);
}
FloatVector VulkanReplay::InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg, byte *end,
bool useidx, bool &valid)
FloatVector VulkanReplay::InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg,
byte *end, bool useidx, bool &valid)
{
FloatVector ret(0.0f, 0.0f, 0.0f, 1.0f);
@@ -1616,7 +1616,7 @@ FloatVector VulkanReplay::InterpretVertex(byte *data, uint32_t vert, MeshDisplay
}
void VulkanReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws,
MeshDisplay cfg)
const MeshDisplay &cfg)
{
if(cfg.position.buf == ResourceId() || cfg.position.numVerts == 0)
return;
@@ -1797,11 +1797,13 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &second
vt->CmdBindVertexBuffers(Unwrap(cmd), 0, 1, UnwrapPtr(vb), &offs);
}
// can't support secondary shading without a buffer - no pipeline will have been created
if(cfg.solidShadeMode == eShade_Secondary && cfg.second.buf == ResourceId())
cfg.solidShadeMode = eShade_None;
SolidShadeMode solidShadeMode = cfg.solidShadeMode;
if(cfg.solidShadeMode == eShade_Secondary)
// can't support secondary shading without a buffer - no pipeline will have been created
if(solidShadeMode == eShade_Secondary && cfg.second.buf == ResourceId())
solidShadeMode = eShade_None;
if(solidShadeMode == eShade_Secondary)
{
VkBuffer vb = m_pDriver->GetResourceManager()->GetCurrentHandle<VkBuffer>(cfg.second.buf);
@@ -1810,10 +1812,10 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &second
}
// solid render
if(cfg.solidShadeMode != eShade_None && cfg.position.topo < eTopology_PatchList)
if(solidShadeMode != eShade_None && cfg.position.topo < eTopology_PatchList)
{
VkPipeline pipe = VK_NULL_HANDLE;
switch(cfg.solidShadeMode)
switch(solidShadeMode)
{
case eShade_Solid: pipe = cache.pipes[MeshDisplayPipelines::ePipe_SolidDepth]; break;
case eShade_Lit: pipe = cache.pipes[MeshDisplayPipelines::ePipe_Lit]; break;
@@ -1825,16 +1827,16 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &second
uint32_t uboOffs = 0;
MeshUBOData *data = (MeshUBOData *)GetDebugManager()->m_MeshUBO.Map(&uboOffs);
if(cfg.solidShadeMode == eShade_Lit)
if(solidShadeMode == eShade_Lit)
data->invProj = projMat.Inverse();
data->mvp = ModelViewProj;
data->color = Vec4f(0.8f, 0.8f, 0.0f, 1.0f);
data->homogenousInput = cfg.position.unproject;
data->pointSpriteSize = Vec2f(0.0f, 0.0f);
data->displayFormat = (uint32_t)cfg.solidShadeMode;
data->displayFormat = (uint32_t)solidShadeMode;
if(cfg.solidShadeMode == eShade_Secondary && cfg.second.showAlpha)
if(solidShadeMode == eShade_Secondary && cfg.second.showAlpha)
data->displayFormat = MESHDISPLAY_SECONDARY_ALPHA;
GetDebugManager()->m_MeshUBO.Unmap();
@@ -1867,8 +1869,7 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &second
}
// wireframe render
if(cfg.solidShadeMode == eShade_None || cfg.wireframeDraw ||
cfg.position.topo >= eTopology_PatchList)
if(solidShadeMode == eShade_None || cfg.wireframeDraw || cfg.position.topo >= eTopology_PatchList)
{
Vec4f wireCol =
Vec4f(cfg.position.meshColour.x, cfg.position.meshColour.y, cfg.position.meshColour.z, 1.0f);
@@ -5085,7 +5086,7 @@ ShaderDebugTrace VulkanReplay::DebugThread(uint32_t eventID, uint32_t groupid[3]
return ShaderDebugTrace();
}
ResourceId VulkanReplay::CreateProxyTexture(FetchTexture templateTex)
ResourceId VulkanReplay::CreateProxyTexture(const FetchTexture &templateTex)
{
VULKANNOTIMP("CreateProxyTexture");
return ResourceId();
@@ -5097,7 +5098,7 @@ void VulkanReplay::SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint
VULKANNOTIMP("SetProxyTextureData");
}
ResourceId VulkanReplay::CreateProxyBuffer(FetchBuffer templateBuf)
ResourceId VulkanReplay::CreateProxyBuffer(const FetchBuffer &templateBuf)
{
VULKANNOTIMP("CreateProxyBuffer");
return ResourceId();
+6 -6
View File
@@ -152,7 +152,7 @@ public:
void ReplaceResource(ResourceId from, ResourceId to);
void RemoveReplacement(ResourceId id);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, MeshDisplay cfg);
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
void BuildTargetShader(string source, string entry, const uint32_t compileFlags,
ShaderStageType type, ResourceId *id, string *errors);
@@ -179,17 +179,17 @@ public:
ShaderDebugTrace DebugThread(uint32_t eventID, uint32_t groupid[3], uint32_t threadid[3]);
void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip,
uint32_t sample, float pixel[4]);
uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y);
uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y);
ResourceId RenderOverlay(ResourceId cfg, TextureDisplayOverlay overlay, uint32_t eventID,
const vector<uint32_t> &passEvents);
ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip);
ResourceId CreateProxyTexture(FetchTexture templateTex);
ResourceId CreateProxyTexture(const FetchTexture &templateTex);
void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data,
size_t dataSize);
ResourceId CreateProxyBuffer(FetchBuffer templateBuf);
ResourceId CreateProxyBuffer(const FetchBuffer &templateBuf);
void SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSize);
bool IsRenderOutput(ResourceId id);
@@ -275,8 +275,8 @@ private:
vector<uint32_t> indices;
} m_HighlightCache;
FloatVector InterpretVertex(byte *data, uint32_t vert, MeshDisplay cfg, byte *end, bool useidx,
bool &valid);
FloatVector InterpretVertex(byte *data, uint32_t vert, const MeshDisplay &cfg, byte *end,
bool useidx, bool &valid);
bool m_Proxy;
+4 -4
View File
@@ -148,15 +148,15 @@ public:
float minval, float maxval, bool channels[4],
vector<uint32_t> &histogram) = 0;
virtual ResourceId CreateProxyTexture(FetchTexture templateTex) = 0;
virtual ResourceId CreateProxyTexture(const FetchTexture &templateTex) = 0;
virtual void SetProxyTextureData(ResourceId texid, uint32_t arrayIdx, uint32_t mip, byte *data,
size_t dataSize) = 0;
virtual ResourceId CreateProxyBuffer(FetchBuffer templateBuf) = 0;
virtual ResourceId CreateProxyBuffer(const FetchBuffer &templateBuf) = 0;
virtual void SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSize) = 0;
virtual void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws,
MeshDisplay cfg) = 0;
const MeshDisplay &cfg) = 0;
virtual bool RenderTexture(TextureDisplay cfg) = 0;
virtual void BuildCustomShader(string source, string entry, const uint32_t compileFlags,
@@ -170,7 +170,7 @@ public:
virtual void PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sliceFace,
uint32_t mip, uint32_t sample, float pixel[4]) = 0;
virtual uint32_t PickVertex(uint32_t eventID, MeshDisplay cfg, uint32_t x, uint32_t y) = 0;
virtual uint32_t PickVertex(uint32_t eventID, const MeshDisplay &cfg, uint32_t x, uint32_t y) = 0;
};
// utility function useful in any driver implementation