Change serialisation to use GetSerialiser() instead of m_pSerialiser

This commit is contained in:
baldurk
2015-10-05 16:04:22 +02:00
parent 65011ebcfa
commit b1cf7d98db
5 changed files with 34 additions and 35 deletions
+10 -9
View File
@@ -162,16 +162,16 @@ ReplayCreateStatus VkInitParams::Serialise()
return eReplayCreate_APIIncompatibleVersion;
}
m_pSerialiser->Serialise("AppName", AppName);
m_pSerialiser->Serialise("EngineName", EngineName);
m_pSerialiser->Serialise("AppVersion", AppVersion);
m_pSerialiser->Serialise("EngineVersion", EngineVersion);
m_pSerialiser->Serialise("APIVersion", APIVersion);
GetSerialiser()->Serialise("AppName", AppName);
GetSerialiser()->Serialise("EngineName", EngineName);
GetSerialiser()->Serialise("AppVersion", AppVersion);
GetSerialiser()->Serialise("EngineVersion", EngineVersion);
GetSerialiser()->Serialise("APIVersion", APIVersion);
m_pSerialiser->Serialise("Layers", Layers);
m_pSerialiser->Serialise("Extensions", Extensions);
GetSerialiser()->Serialise("Layers", Layers);
GetSerialiser()->Serialise("Extensions", Extensions);
m_pSerialiser->Serialise("InstanceID", InstanceID);
GetSerialiser()->Serialise("InstanceID", InstanceID);
return eReplayCreate_Success;
}
@@ -410,7 +410,8 @@ const char * WrappedVulkan::GetChunkName(uint32_t idx)
void WrappedVulkan::Serialise_CaptureScope(uint64_t offset)
{
SERIALISE_ELEMENT(uint32_t, FrameNumber, m_FrameCounter);
uint32_t FrameNumber = m_FrameCounter;
m_pSerialiser->Serialise("FrameNumber", FrameNumber); // must use m_pSerialiser here to match resource manager below
if(m_State >= WRITING)
{
@@ -173,7 +173,7 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(
}
SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
m_pSerialiser->Serialise("createInfo", createInfo);
GetSerialiser()->Serialise("createInfo", createInfo);
if(m_State < WRITING)
device = GetResourceManager()->GetLiveHandle<VkDevice>(devId);
@@ -428,7 +428,7 @@ bool WrappedVulkan::Serialise_vkResetCommandBuffer(VkCmdBuffer cmdBuffer, VkCmdB
}
SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
m_pSerialiser->Serialise("createInfo", info);
GetSerialiser()->Serialise("createInfo", info);
if(m_State == EXECUTING)
{
@@ -532,7 +532,7 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(
ObjDisp(cmdBuffer)->CmdBeginRenderPass(Unwrap(cmdBuffer), &beginInfo, cont);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
// VKTODOMED change the name to show render pass load-op
AddEvent(BEGIN_RENDERPASS, desc);
@@ -709,7 +709,7 @@ bool WrappedVulkan::Serialise_vkCmdBindDescriptorSets(
for(uint32_t i=0; i < numSets; i++)
{
if(m_State >= WRITING) descriptorIDs[i] = GetResID(sets[i]);
m_pSerialiser->Serialise("DescriptorSet", descriptorIDs[i]);
GetSerialiser()->Serialise("DescriptorSet", descriptorIDs[i]);
if(m_State < WRITING) sets[i] = Unwrap(GetResourceManager()->GetLiveHandle<VkDescriptorSet>(descriptorIDs[i]));
}
@@ -1052,8 +1052,8 @@ bool WrappedVulkan::Serialise_vkCmdBindVertexBuffers(
o = pOffsets[i];
}
m_pSerialiser->Serialise("pBuffers[]", id);
m_pSerialiser->Serialise("pOffsets[]", o);
GetSerialiser()->Serialise("pBuffers[]", id);
GetSerialiser()->Serialise("pOffsets[]", o);
if(m_State < WRITING)
{
@@ -1505,10 +1505,8 @@ bool WrappedVulkan::Serialise_vkCmdDbgMarkerBegin(
VkCmdBuffer cmdBuffer,
const char* pMarker)
{
string name = pMarker ? string(pMarker) : "";
SERIALISE_ELEMENT(ResourceId, cmdid, GetResID(cmdBuffer));
m_pSerialiser->Serialise("Name", name);
SERIALISE_ELEMENT(string, name, pMarker ? string(pMarker) : "");
if(m_State < WRITING)
m_LastCmdBufferID = cmdid;
@@ -54,7 +54,7 @@ bool WrappedVulkan::Serialise_vkCmdDraw(
ObjDisp(cmdBuffer)->CmdDraw(Unwrap(cmdBuffer), firstVtx, vtxCount, firstInst, instCount);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
{
AddEvent(DRAW, desc);
@@ -371,7 +371,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyBufferToImage(
ObjDisp(cmdBuffer)->CmdCopyBufferToImage(Unwrap(cmdBuffer), Unwrap(srcBuffer), Unwrap(destImage), destImageLayout, count, regions);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
{
AddEvent(COPY_BUF2IMG, desc);
@@ -533,7 +533,7 @@ bool WrappedVulkan::Serialise_vkCmdCopyBuffer(
ObjDisp(cmdBuffer)->CmdCopyBuffer(Unwrap(cmdBuffer), Unwrap(srcBuffer), Unwrap(destBuffer), count, regions);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
{
AddEvent(COPY_BUF, desc);
@@ -746,7 +746,7 @@ bool WrappedVulkan::Serialise_vkCmdClearColorAttachment(
ObjDisp(cmdBuffer)->CmdClearColorAttachment(Unwrap(cmdBuffer), att, layout, &col, count, rects);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
{
AddEvent(CLEAR_COLOR_ATTACH, desc);
@@ -824,7 +824,7 @@ bool WrappedVulkan::Serialise_vkCmdClearDepthStencilAttachment(
ObjDisp(cmdBuffer)->CmdClearDepthStencilAttachment(Unwrap(cmdBuffer), asp, lay, d, s, count, rects);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
{
AddEvent(CLEAR_DEPTHSTENCIL_ATTACH, desc);
@@ -901,7 +901,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexed(
ObjDisp(cmdBuffer)->CmdDrawIndexed(Unwrap(cmdBuffer), firstIdx, idxCount, vtxOffs, firstInst, instCount);
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
{
AddEvent(DRAW_INDEXED, desc);
@@ -151,7 +151,7 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
fence = VK_NULL_HANDLE;
}
const string desc = m_pSerialiser->GetDebugStr();
const string desc = GetSerialiser()->GetDebugStr();
if(m_State == READING)
{
+10 -10
View File
@@ -756,17 +756,17 @@ class ScopedContext
}
};
#define SCOPED_SERIALISE_CONTEXT(n) ScopedContext scope(m_pSerialiser, GetChunkName(n), n, false);
#define SCOPED_SERIALISE_SMALL_CONTEXT(n) ScopedContext scope(m_pSerialiser, GetChunkName(n), n, true);
#define SCOPED_SERIALISE_CONTEXT(n) ScopedContext scope(GetSerialiser(), GetChunkName(n), n, false);
#define SCOPED_SERIALISE_SMALL_CONTEXT(n) ScopedContext scope(GetSerialiser(), GetChunkName(n), n, true);
#define SERIALISE_ELEMENT(type, name, inValue) type name; if(m_State >= WRITING) name = (inValue); m_pSerialiser->Serialise(#name, name);
#define SERIALISE_ELEMENT_OPT(type, name, inValue, Condition) type name = type(); if(Condition) { if(m_State >= WRITING) name = (inValue); m_pSerialiser->Serialise(#name, name); }
#define SERIALISE_ELEMENT_ARR(type, name, inValues, count) type *name = new type[count]; for(size_t serialiseIdx=0; serialiseIdx < count; serialiseIdx++) { if(m_State >= WRITING) name[serialiseIdx] = (inValues)[serialiseIdx]; m_pSerialiser->Serialise(#name, name[serialiseIdx]); }
#define SERIALISE_ELEMENT_ARR_OPT(type, name, inValues, count, Condition) type *name = NULL; if(Condition) { name = new type[count]; for(size_t serialiseIdx=0; serialiseIdx < count; serialiseIdx++) { if(m_State >= WRITING) name[serialiseIdx] = (inValues)[serialiseIdx]; m_pSerialiser->Serialise(#name, name[serialiseIdx]); } }
#define SERIALISE_ELEMENT_PTR(type, name, inValue) type name; if(inValue && m_State >= WRITING) name = *(inValue); m_pSerialiser->Serialise(#name, name);
#define SERIALISE_ELEMENT_PTR_OPT(type, name, inValue, Condition) type name; if(Condition) { if(inValue && m_State >= WRITING) name = *(inValue); m_pSerialiser->Serialise(#name, name); }
#define SERIALISE_ELEMENT_BUF(type, name, inBuf, Len) type name = (type)NULL; if(m_State >= WRITING) name = (type)(inBuf); size_t CONCAT(buflen, __LINE__) = Len; m_pSerialiser->SerialiseBuffer(#name, name, CONCAT(buflen, __LINE__));
#define SERIALISE_ELEMENT_BUF_OPT(type, name, inBuf, Len, Condition) type name = (type)NULL; if(Condition) { if(m_State >= WRITING) name = (type)(inBuf); size_t CONCAT(buflen, __LINE__) = Len; m_pSerialiser->SerialiseBuffer(#name, name, CONCAT(buflen, __LINE__)); }
#define SERIALISE_ELEMENT(type, name, inValue) type name; if(m_State >= WRITING) name = (inValue); GetSerialiser()->Serialise(#name, name);
#define SERIALISE_ELEMENT_OPT(type, name, inValue, Condition) type name = type(); if(Condition) { if(m_State >= WRITING) name = (inValue); GetSerialiser()->Serialise(#name, name); }
#define SERIALISE_ELEMENT_ARR(type, name, inValues, count) type *name = new type[count]; for(size_t serialiseIdx=0; serialiseIdx < count; serialiseIdx++) { if(m_State >= WRITING) name[serialiseIdx] = (inValues)[serialiseIdx]; GetSerialiser()->Serialise(#name, name[serialiseIdx]); }
#define SERIALISE_ELEMENT_ARR_OPT(type, name, inValues, count, Condition) type *name = NULL; if(Condition) { name = new type[count]; for(size_t serialiseIdx=0; serialiseIdx < count; serialiseIdx++) { if(m_State >= WRITING) name[serialiseIdx] = (inValues)[serialiseIdx]; GetSerialiser()->Serialise(#name, name[serialiseIdx]); } }
#define SERIALISE_ELEMENT_PTR(type, name, inValue) type name; if(inValue && m_State >= WRITING) name = *(inValue); GetSerialiser()->Serialise(#name, name);
#define SERIALISE_ELEMENT_PTR_OPT(type, name, inValue, Condition) type name; if(Condition) { if(inValue && m_State >= WRITING) name = *(inValue); GetSerialiser()->Serialise(#name, name); }
#define SERIALISE_ELEMENT_BUF(type, name, inBuf, Len) type name = (type)NULL; if(m_State >= WRITING) name = (type)(inBuf); size_t CONCAT(buflen, __LINE__) = Len; GetSerialiser()->SerialiseBuffer(#name, name, CONCAT(buflen, __LINE__));
#define SERIALISE_ELEMENT_BUF_OPT(type, name, inBuf, Len, Condition) type name = (type)NULL; if(Condition) { if(m_State >= WRITING) name = (type)(inBuf); size_t CONCAT(buflen, __LINE__) = Len; GetSerialiser()->SerialiseBuffer(#name, name, CONCAT(buflen, __LINE__)); }
// forward declare generic pointer version to void*
template<class T>