diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index d43bdded3..cc65a3878 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -600,7 +600,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri ser.Rewind(); { - int chunkType = ser.PushContext(NULL, 1, false); + int chunkType = ser.PushContext(NULL, NULL, 1, false); if(chunkType != THUMBNAIL_DATA) { @@ -610,11 +610,11 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri ser.SkipCurrentChunk(); - ser.PopContext(NULL, 1); + ser.PopContext(1); } { - int chunkType = ser.PushContext(NULL, 1, false); + int chunkType = ser.PushContext(NULL, NULL, 1, false); if(chunkType != CREATE_PARAMS) { @@ -625,7 +625,7 @@ ReplayCreateStatus RenderDoc::FillInitParams(const char *logFile, RDCDriver &dri ser.Serialise("DriverType", driverType); ser.SerialiseString("DriverName", driverName); - chunkType = ser.PushContext(NULL, 1, false); + chunkType = ser.PushContext(NULL, NULL, 1, false); if(chunkType != DRIVER_INIT_PARAMS) { diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index cffa6c2c0..f6a80c590 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -580,14 +580,14 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch m_pDevice->GetResourceManager()->MarkInFrame(false); m_pDevice->ProcessChunk(offset, chunk); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); m_pDevice->GetResourceManager()->MarkInFrame(true); } else if(m_State == EXECUTING) { m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); } return; } @@ -611,7 +611,7 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch { m_pSerialiser->SetOffset(cOffs); m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); return; } } @@ -931,7 +931,7 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch break; } - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); if(context->m_State == READING && chunk == SET_MARKER) { @@ -1180,7 +1180,7 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven m_DoStateVerify = true; - D3D11ChunkType header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + D3D11ChunkType header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); RDCASSERT(header == CONTEXT_CAPTURE_HEADER); ResourceId id; @@ -1192,7 +1192,7 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven Serialise_BeginCaptureFrame(!partial); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); m_CurEvents.clear(); @@ -1231,7 +1231,7 @@ void WrappedID3D11DeviceContext::ReplayLog(LogState readType, uint32_t startEven uint64_t offset = m_pSerialiser->GetOffset(); - D3D11ChunkType chunktype = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + D3D11ChunkType chunktype = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); ProcessChunk(offset, chunktype, false); diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 84caabd45..c92e9a02f 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -1030,7 +1030,7 @@ void WrappedID3D11Device::ReadLogInitialisation() uint64_t offset = m_pSerialiser->GetOffset(); - D3D11ChunkType context = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + D3D11ChunkType context = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); if(context == CAPTURE_SCOPE) { @@ -1042,7 +1042,7 @@ void WrappedID3D11Device::ReadLogInitialisation() ProcessChunk(offset, context); - m_pSerialiser->PopContext(NULL, context); + m_pSerialiser->PopContext(context); RenderDoc::Inst().SetProgress(FileInitialRead, float(offset)/float(m_pSerialiser->GetSize())); @@ -2253,13 +2253,13 @@ void WrappedID3D11Device::ReplayLog(uint32_t frameID, uint32_t startEventID, uin partial = false; } - D3D11ChunkType header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + D3D11ChunkType header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); RDCASSERT(header == CAPTURE_SCOPE); m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); if(!partial) { @@ -2289,9 +2289,9 @@ void WrappedID3D11Device::ReplayLog(uint32_t frameID, uint32_t startEventID, uin m_pSerialiser->SetOffset(offs); - header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, 1, false); + header = (D3D11ChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); m_pImmediateContext->ReplayFakeContext(m_ReplayDefCtx); diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index dd46c01ee..b4a20c33e 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -2999,7 +2999,7 @@ void WrappedOpenGL::ReadLogInitialisation() uint64_t offset = m_pSerialiser->GetOffset(); - GLChunkType context = (GLChunkType)m_pSerialiser->PushContext(NULL, 1, false); + GLChunkType context = (GLChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); if(context == CAPTURE_SCOPE) { @@ -3011,7 +3011,7 @@ void WrappedOpenGL::ReadLogInitialisation() ProcessChunk(offset, context); - m_pSerialiser->PopContext(NULL, context); + m_pSerialiser->PopContext(context); RenderDoc::Inst().SetProgress(FileInitialRead, float(offset)/float(m_pSerialiser->GetSize())); @@ -3891,7 +3891,7 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u m_DoStateVerify = true; - GLChunkType header = (GLChunkType)m_pSerialiser->PushContext(NULL, 1, false); + GLChunkType header = (GLChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); RDCASSERT(header == CONTEXT_CAPTURE_HEADER); WrappedOpenGL *context = this; @@ -3928,7 +3928,7 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u Serialise_BeginCaptureFrame(!partial); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); m_CurEvents.clear(); @@ -3962,7 +3962,7 @@ void WrappedOpenGL::ContextReplayLog(LogState readType, uint32_t startEventID, u uint64_t offset = m_pSerialiser->GetOffset(); - GLChunkType chunktype = (GLChunkType)m_pSerialiser->PushContext(NULL, 1, false); + GLChunkType chunktype = (GLChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); ContextProcessChunk(offset, chunktype, false); @@ -4009,14 +4009,14 @@ void WrappedOpenGL::ContextProcessChunk(uint64_t offset, GLChunkType chunk, bool GetResourceManager()->MarkInFrame(false); ProcessChunk(offset, chunk); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); GetResourceManager()->MarkInFrame(true); } else if(m_State == EXECUTING) { m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); } return; }*/ @@ -4038,7 +4038,7 @@ void WrappedOpenGL::ContextProcessChunk(uint64_t offset, GLChunkType chunk, bool ProcessChunk(offset, chunk); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); if(context->m_State == READING && chunk == SET_MARKER) { @@ -4494,13 +4494,13 @@ void WrappedOpenGL::ReplayLog(uint32_t frameID, uint32_t startEventID, uint32_t partial = false; } - GLChunkType header = (GLChunkType)m_pSerialiser->PushContext(NULL, 1, false); + GLChunkType header = (GLChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); RDCASSERT(header == CAPTURE_SCOPE); m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); if(!partial) { diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index f3dba4f61..94732e506 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -567,9 +567,9 @@ void WrappedVulkan::ReadLogInitialisation() firstFrame = m_pSerialiser->GetOffset(); // skip this chunk - m_pSerialiser->PushContext(NULL, CAPTURE_SCOPE, false); + m_pSerialiser->PushContext(NULL, NULL, CAPTURE_SCOPE, false); m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, CAPTURE_SCOPE); + m_pSerialiser->PopContext(CAPTURE_SCOPE); } } @@ -595,7 +595,7 @@ void WrappedVulkan::ReadLogInitialisation() uint64_t offset = m_pSerialiser->GetOffset(); - VulkanChunkType context = (VulkanChunkType)m_pSerialiser->PushContext(NULL, 1, false); + VulkanChunkType context = (VulkanChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); if(context == CAPTURE_SCOPE) { @@ -607,7 +607,7 @@ void WrappedVulkan::ReadLogInitialisation() ProcessChunk(offset, context); - m_pSerialiser->PopContext(NULL, context); + m_pSerialiser->PopContext(context); RenderDoc::Inst().SetProgress(FileInitialRead, float(m_pSerialiser->GetOffset())/float(m_pSerialiser->GetSize())); @@ -668,7 +668,7 @@ void WrappedVulkan::ContextReplayLog(LogState readType, uint32_t startEventID, u { m_State = readType; - VulkanChunkType header = (VulkanChunkType)m_pSerialiser->PushContext(NULL, 1, false); + VulkanChunkType header = (VulkanChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); RDCASSERT(header == CONTEXT_CAPTURE_HEADER); WrappedVulkan *context = this; @@ -677,7 +677,7 @@ void WrappedVulkan::ContextReplayLog(LogState readType, uint32_t startEventID, u ObjDisp(GetDev())->DeviceWaitIdle(Unwrap(GetDev())); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); m_RootEvents.clear(); @@ -727,7 +727,7 @@ void WrappedVulkan::ContextReplayLog(LogState readType, uint32_t startEventID, u uint64_t offset = m_pSerialiser->GetOffset(); - VulkanChunkType context = (VulkanChunkType)m_pSerialiser->PushContext(NULL, 1, false); + VulkanChunkType context = (VulkanChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); m_LastCmdBufferID = ResourceId(); @@ -795,7 +795,7 @@ void WrappedVulkan::ContextProcessChunk(uint64_t offset, VulkanChunkType chunk, ProcessChunk(offset, chunk); - m_pSerialiser->PopContext(NULL, chunk); + m_pSerialiser->PopContext(chunk); if(m_State == READING && chunk == SET_MARKER) { @@ -1172,13 +1172,13 @@ void WrappedVulkan::ReplayLog(uint32_t frameID, uint32_t startEventID, uint32_t partial = false; } - VulkanChunkType header = (VulkanChunkType)m_pSerialiser->PushContext(NULL, 1, false); + VulkanChunkType header = (VulkanChunkType)m_pSerialiser->PushContext(NULL, NULL, 1, false); RDCASSERT(header == CAPTURE_SCOPE); m_pSerialiser->SkipCurrentChunk(); - m_pSerialiser->PopContext(NULL, header); + m_pSerialiser->PopContext(header); if(!partial) { diff --git a/renderdoc/os/win32/win32_shellext.cpp b/renderdoc/os/win32/win32_shellext.cpp index fd53cef59..5457aa038 100644 --- a/renderdoc/os/win32/win32_shellext.cpp +++ b/renderdoc/os/win32/win32_shellext.cpp @@ -145,7 +145,7 @@ struct RDCThumbnailProvider : public IThumbnailProvider, IInitializeWithStream return E_NOTIMPL; } - int ctx = m_Ser->PushContext(NULL, 1, false); + int ctx = m_Ser->PushContext(NULL, NULL, 1, false); if(ctx != THUMBNAIL_DATA) { diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 1700dfb9e..1f196f06a 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -352,7 +352,7 @@ bool32 RENDERDOC_CC RENDERDOC_GetThumbnail(const char *filename, byte *buf, uint ser.Rewind(); - int chunkType = ser.PushContext(NULL, 1, false); + int chunkType = ser.PushContext(NULL, NULL, 1, false); if(chunkType != THUMBNAIL_DATA) return false; diff --git a/renderdoc/serialise/serialiser.cpp b/renderdoc/serialise/serialiser.cpp index 9b2fbdbf3..3f11d9730 100644 --- a/renderdoc/serialise/serialiser.cpp +++ b/renderdoc/serialise/serialiser.cpp @@ -1436,7 +1436,7 @@ void Serialiser::DebugPrint(const char *fmt, ...) m_DebugText += tmpBuf; } -uint32_t Serialiser::PushContext(const char *name, uint32_t chunkIdx, bool smallChunk) +uint32_t Serialiser::PushContext(const char *name, const char *typeName, uint32_t chunkIdx, bool smallChunk) { // if writing, and chunkidx isn't 0 (debug non-scope), then either we're nested // or we should be writing into the start of the serialiser. A serialiser should @@ -1505,7 +1505,10 @@ uint32_t Serialiser::PushContext(const char *name, uint32_t chunkIdx, bool small if(m_DebugTextWriting) { - DebugPrint("%s (%d)\n", name, chunkIdx); + if(typeName) + DebugPrint("%s = %s (%d)\n", name, typeName, chunkIdx); + else + DebugPrint("%s (%d)\n", name, chunkIdx); DebugPrint("{\n"); } } @@ -1593,7 +1596,10 @@ uint32_t Serialiser::PushContext(const char *name, uint32_t chunkIdx, bool small if(m_DebugTextWriting) { - DebugPrint("%s\n", name ? name : "Unknown"); + if(typeName) + DebugPrint("%s = %s\n", name ? name : "Unknown", typeName); + else + DebugPrint("%s\n", name ? name : "Unknown"); DebugPrint("{\n"); } } @@ -1603,7 +1609,7 @@ uint32_t Serialiser::PushContext(const char *name, uint32_t chunkIdx, bool small return chunkIdx; } -void Serialiser::PopContext(const char *name, uint32_t chunkIdx) +void Serialiser::PopContext(uint32_t chunkIdx) { m_Indent = RDCMAX(m_Indent-1, 0); @@ -1645,7 +1651,7 @@ void Serialiser::PopContext(const char *name, uint32_t chunkIdx) } if(m_DebugTextWriting) - DebugPrint("} // %s\n", name); + DebugPrint("}\n"); } else { diff --git a/renderdoc/serialise/serialiser.h b/renderdoc/serialise/serialiser.h index 126355e1c..0005c0ccc 100644 --- a/renderdoc/serialise/serialiser.h +++ b/renderdoc/serialise/serialiser.h @@ -265,7 +265,7 @@ class Serialiser { size_t offs = m_BufferHead-m_Buffer + (size_t)m_ReadOffset; - uint32_t c = PushContext(NULL, 1, false); + uint32_t c = PushContext(NULL, NULL, 1, false); // found if(c == chunkIdx) @@ -277,7 +277,7 @@ class Serialiser else { SkipCurrentChunk(); - PopContext(NULL, 1); + PopContext(1); } if(idx) (*idx)++; @@ -312,8 +312,8 @@ class Serialiser // Public serialisation interface int GetContextLevel() { return m_Indent; } - uint32_t PushContext(const char *name, uint32_t chunkIdx, bool smallChunk); - void PopContext(const char *name, uint32_t chunkIdx); + uint32_t PushContext(const char *name, const char *typeName, uint32_t chunkIdx, bool smallChunk); + void PopContext(uint32_t chunkIdx); // Write a chunk to disk void Insert(Chunk *el); @@ -722,14 +722,12 @@ class ScopedContext ScopedContext(Serialiser *s, const char *n, const char *t, uint32_t i, bool smallChunk) : m_Idx(i), m_Ser(s), m_Ended(false) { - m_Name = string(n) + " = " + t; - m_Ser->PushContext(m_Name.c_str(), m_Idx, smallChunk); + m_Ser->PushContext(n, t, m_Idx, smallChunk); } ScopedContext(Serialiser *s, const char *n, uint32_t i, bool smallChunk) : m_Idx(i), m_Ser(s), m_Ended(false) { - m_Name = n; - m_Ser->PushContext(m_Name.c_str(), m_Idx, smallChunk); + m_Ser->PushContext(n, NULL, m_Idx, smallChunk); } ~ScopedContext() { @@ -743,7 +741,6 @@ class ScopedContext return new Chunk(m_Ser, m_Idx, temporary); } private: - std::string m_Name; uint32_t m_Idx; Serialiser *m_Ser; @@ -753,7 +750,7 @@ class ScopedContext { RDCASSERT(!m_Ended); - m_Ser->PopContext(m_Name.c_str(), m_Idx); + m_Ser->PopContext(m_Idx); m_Ended = true; }