Move some common chunks into SystemChunk from API Chunks

* This makes API-agnostic processing over strucutred data a *little*
  easier. At least it's possible to differentiate initialisation from
  frame capture chunks.
This commit is contained in:
baldurk
2017-11-24 18:14:23 +00:00
parent 15ddb868e1
commit e08e5f0692
20 changed files with 154 additions and 145 deletions
+3
View File
@@ -161,6 +161,9 @@ std::string DoStringise(const SystemChunk &el)
STRINGISE_ENUM_CLASS_NAMED(DriverInit, "Driver Initialisation Parameters");
STRINGISE_ENUM_CLASS_NAMED(InitialContentsList, "List of Initial Contents Resources");
STRINGISE_ENUM_CLASS_NAMED(InitialContents, "Initial Contents");
STRINGISE_ENUM_CLASS_NAMED(CaptureBegin, "Beginning of Capture");
STRINGISE_ENUM_CLASS_NAMED(CaptureScope, "Frame Metadata");
STRINGISE_ENUM_CLASS_NAMED(CaptureEnd, "End of Capture");
}
END_ENUM_STRINGISE();
}
+3
View File
@@ -153,6 +153,9 @@ enum class SystemChunk : uint32_t
DriverInit = 1,
InitialContentsList,
InitialContents,
CaptureBegin,
CaptureScope,
CaptureEnd,
FirstDriverChunk = 1000,
};
-3
View File
@@ -266,9 +266,6 @@ public:
enum class D3D11Chunk : uint32_t
{
DeviceInitialisation = (uint32_t)SystemChunk::FirstDriverChunk,
CaptureBegin,
CaptureEnd,
CaptureScope,
SetResourceName,
ReleaseResource,
CreateSwapBuffer,
+26 -19
View File
@@ -426,7 +426,7 @@ void WrappedID3D11DeviceContext::VerifyState()
void WrappedID3D11DeviceContext::BeginCaptureFrame()
{
WriteSerialiser &ser = m_ScratchSerialiser;
SCOPED_SERIALISE_CHUNK(D3D11Chunk::CaptureBegin);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureBegin);
Serialise_BeginCaptureFrame(ser, false);
@@ -503,7 +503,7 @@ void WrappedID3D11DeviceContext::EndCaptureFrame()
{
WriteSerialiser &ser = m_ScratchSerialiser;
ser.SetDrawChunk();
SCOPED_SERIALISE_CHUNK(D3D11Chunk::CaptureEnd);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureEnd);
SERIALISE_ELEMENT(m_ResourceID).Named("Context ID");
@@ -837,27 +837,34 @@ bool WrappedID3D11DeviceContext::ProcessChunk(ReadSerialiser &ser, D3D11Chunk ch
m_PresentChunk = true;
break;
}
case D3D11Chunk::CaptureEnd:
default:
{
if(IsLoading(m_State))
SystemChunk system = (SystemChunk)chunk;
if(system == SystemChunk::CaptureEnd)
{
if(!m_PresentChunk)
AddEvent();
if(IsLoading(m_State))
{
if(!m_PresentChunk)
AddEvent();
DrawcallDescription draw;
draw.name = "End of Frame";
draw.flags |= DrawFlags::Present;
DrawcallDescription draw;
draw.name = "End of Frame";
draw.flags |= DrawFlags::Present;
draw.copyDestination = m_pDevice->GetBackbufferResourceID();
draw.copyDestination = m_pDevice->GetBackbufferResourceID();
AddDrawcall(draw, true);
AddDrawcall(draw, true);
}
ret = true;
}
ret = true;
else
{
RDCERR("Unrecognised Chunk type %d", chunk);
}
break;
}
break;
default: RDCERR("Unrecognised Chunk type %d", chunk); break;
}
if(IsLoading(m_State) && m_CurEventID > 0)
@@ -1115,8 +1122,8 @@ ReplayStatus WrappedID3D11DeviceContext::ReplayLog(CaptureState readType, uint32
m_DoStateVerify = true;
D3D11Chunk header = ser.ReadChunk<D3D11Chunk>();
RDCASSERTEQUAL(header, D3D11Chunk::CaptureBegin);
SystemChunk header = ser.ReadChunk<SystemChunk>();
RDCASSERTEQUAL(header, SystemChunk::CaptureBegin);
Serialise_BeginCaptureFrame(ser, !partial);
@@ -1180,7 +1187,7 @@ ReplayStatus WrappedID3D11DeviceContext::ReplayLog(CaptureState readType, uint32
RenderDoc::Inst().SetProgress(
FrameEventsRead, float(m_CurChunkOffset - startOffset) / float(ser.GetReader()->GetSize()));
if(chunktype == D3D11Chunk::CaptureEnd)
if((SystemChunk)chunktype == SystemChunk::CaptureEnd)
break;
m_CurEventID++;
+7 -4
View File
@@ -855,7 +855,6 @@ bool WrappedID3D11Device::ProcessChunk(ReadSerialiser &ser, D3D11Chunk context)
IID nul;
return Serialise_OpenSharedResource(ser, 0, nul, NULL);
}
case D3D11Chunk::CaptureScope: return Serialise_CaptureScope(ser);
case D3D11Chunk::SetShaderDebugPath: return Serialise_SetShaderDebugPath(ser, NULL, NULL);
default:
{
@@ -877,6 +876,10 @@ bool WrappedID3D11Device::ProcessChunk(ReadSerialiser &ser, D3D11Chunk context)
{
return Serialise_InitialState(ser, ResourceId(), NULL);
}
else if(system == SystemChunk::CaptureScope)
{
return Serialise_CaptureScope(ser);
}
else if(system < SystemChunk::FirstDriverChunk)
{
RDCERR("Unexpected system chunk in capture data: %u", system);
@@ -1009,7 +1012,7 @@ ReplayStatus WrappedID3D11Device::ReadLogInitialisation(RDCFile *rdc, bool store
RenderDoc::Inst().SetProgress(FileInitialRead, float(offsetEnd) / float(reader->GetSize()));
if(context == D3D11Chunk::CaptureScope)
if((SystemChunk)context == SystemChunk::CaptureScope)
{
m_FrameRecord.frameInfo.fileOffset = offsetStart;
@@ -1031,7 +1034,7 @@ ReplayStatus WrappedID3D11Device::ReadLogInitialisation(RDCFile *rdc, bool store
chunkInfos[context].totalsize += offsetEnd - offsetStart;
chunkInfos[context].count++;
if(context == D3D11Chunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
if((SystemChunk)context == SystemChunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
break;
}
@@ -1702,7 +1705,7 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd)
{
// remember to update this estimated chunk length if you add more parameters
SCOPED_SERIALISE_CHUNK(D3D11Chunk::CaptureScope, 16);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureScope, 16);
Serialise_CaptureScope(ser);
}
+1 -1
View File
@@ -62,7 +62,7 @@ struct D3D11InitParams
D3D_FEATURE_LEVEL FeatureLevels[16];
// check if a frame capture section version is supported
static const uint64_t CurrentVersion = 0xC;
static const uint64_t CurrentVersion = 0xD;
static bool IsSupportedVersion(uint64_t ver);
};
+1 -4
View File
@@ -59,7 +59,7 @@ std::string DoStringise(const D3D11ResourceType &el)
template <>
std::string DoStringise(const D3D11Chunk &el)
{
RDCCOMPILE_ASSERT((uint32_t)D3D11Chunk::Max == 1131, "Chunks changed without updating names");
RDCCOMPILE_ASSERT((uint32_t)D3D11Chunk::Max == 1128, "Chunks changed without updating names");
BEGIN_ENUM_STRINGISE(D3D11Chunk)
{
@@ -98,7 +98,6 @@ std::string DoStringise(const D3D11Chunk &el)
STRINGISE_ENUM_CLASS_NAMED(CreateDeferredContext, "ID3D11Device::CreateDeferredContext");
STRINGISE_ENUM_CLASS_NAMED(SetExceptionMode, "ID3D11Device::SetExceptionMode");
STRINGISE_ENUM_CLASS_NAMED(OpenSharedResource, "ID3D11Device::OpenSharedResource");
STRINGISE_ENUM_CLASS_NAMED(CaptureScope, "Frame Capture Metadata");
STRINGISE_ENUM_CLASS_NAMED(IASetInputLayout, "ID3D11DeviceContext::IASetInputLayout");
STRINGISE_ENUM_CLASS_NAMED(IASetVertexBuffers, "ID3D11DeviceContext::IASetVertexBuffers");
STRINGISE_ENUM_CLASS_NAMED(IASetIndexBuffer, "ID3D11DeviceContext::IASetIndexBuffer");
@@ -193,8 +192,6 @@ std::string DoStringise(const D3D11Chunk &el)
STRINGISE_ENUM_CLASS_NAMED(PushMarker, "Push Debug Region");
STRINGISE_ENUM_CLASS_NAMED(SetMarker, "Set Marker");
STRINGISE_ENUM_CLASS_NAMED(PopMarker, "Pop Debug Region");
STRINGISE_ENUM_CLASS_NAMED(CaptureBegin, "Beginning of Capture");
STRINGISE_ENUM_CLASS_NAMED(CaptureEnd, "End of Capture");
STRINGISE_ENUM_CLASS_NAMED(SetShaderDebugPath, "SetShaderDebugPath");
STRINGISE_ENUM_CLASS_NAMED(DiscardResource, "ID3D11DeviceContext1::DiscardResource");
STRINGISE_ENUM_CLASS_NAMED(DiscardView, "ID3D11DeviceContext1::DiscardView");
+28 -22
View File
@@ -456,31 +456,39 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu
case D3D12Chunk::Resource_WriteToSubresource:
ret = m_pDevice->Serialise_WriteToSubresource(ser, NULL, 0, NULL, NULL, 0, 0);
break;
case D3D12Chunk::CaptureEnd:
default:
{
SERIALISE_ELEMENT_LOCAL(PresentedImage, ResourceId());
SystemChunk system = (SystemChunk)chunk;
SERIALISE_CHECK_READ_ERRORS();
m_BackbufferID = PresentedImage;
if(IsLoading(m_State))
if(system == SystemChunk::CaptureEnd)
{
m_Cmd.AddEvent();
SERIALISE_ELEMENT_LOCAL(PresentedImage, ResourceId());
DrawcallDescription draw;
draw.name = "Present()";
draw.flags |= DrawFlags::Present;
SERIALISE_CHECK_READ_ERRORS();
draw.copyDestination = m_BackbufferID;
m_BackbufferID = PresentedImage;
m_Cmd.AddDrawcall(draw, true);
if(IsLoading(m_State))
{
m_Cmd.AddEvent();
DrawcallDescription draw;
draw.name = "Present()";
draw.flags |= DrawFlags::Present;
draw.copyDestination = m_BackbufferID;
m_Cmd.AddDrawcall(draw, true);
}
ret = true;
}
ret = true;
else
{
RDCERR("Unrecognised Chunk type %s", ToStr(chunk).c_str());
}
break;
}
default: RDCERR("Unrecognised Chunk type %s", ToStr(chunk).c_str()); break;
}
if(IsLoading(m_State))
@@ -538,8 +546,8 @@ ReplayStatus WrappedID3D12CommandQueue::ReplayLog(CaptureState readType, uint32_
m_Cmd.m_StructuredFile = m_StructuredFile;
D3D12Chunk header = ser.ReadChunk<D3D12Chunk>();
RDCASSERTEQUAL(header, D3D12Chunk::CaptureBegin);
SystemChunk header = ser.ReadChunk<SystemChunk>();
RDCASSERTEQUAL(header, SystemChunk::CaptureBegin);
m_pDevice->Serialise_BeginCaptureFrame(ser, !partial);
@@ -625,9 +633,7 @@ ReplayStatus WrappedID3D12CommandQueue::ReplayLog(CaptureState readType, uint32_
RenderDoc::Inst().SetProgress(FileInitialRead, float(m_Cmd.m_CurChunkOffset - startOffset) /
float(ser.GetReader()->GetSize()));
// for now just abort after capture scope. Really we'd need to support multiple frames
// but for now this will do.
if(context == D3D12Chunk::CaptureEnd)
if((SystemChunk)context == SystemChunk::CaptureEnd)
break;
// break out if we were only executing one event
+1 -4
View File
@@ -457,10 +457,7 @@ DECLARE_DESERIALISE_TYPE(D3D12_COMMAND_SIGNATURE_DESC);
enum class D3D12Chunk : uint32_t
{
CaptureBegin = (uint32_t)SystemChunk::FirstDriverChunk,
CaptureEnd,
CaptureScope,
SetName,
SetName = (uint32_t)SystemChunk::FirstDriverChunk,
PushMarker,
SetMarker,
PopMarker,
+9 -6
View File
@@ -1215,7 +1215,7 @@ void WrappedID3D12Device::EndCaptureFrame(ID3D12Resource *presentImage)
{
WriteSerialiser &ser = GetThreadSerialiser();
ser.SetDrawChunk();
SCOPED_SERIALISE_CHUNK(D3D12Chunk::CaptureEnd);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureEnd);
SERIALISE_ELEMENT_LOCAL(PresentedBackbuffer, GetResID(presentImage));
@@ -1275,7 +1275,7 @@ void WrappedID3D12Device::StartFrameCapture(void *dev, void *wnd)
{
CACHE_THREAD_SERIALISER();
SCOPED_SERIALISE_CHUNK(D3D12Chunk::CaptureBegin);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureBegin);
Serialise_BeginCaptureFrame(ser, false);
@@ -1609,7 +1609,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
GetResourceManager()->Serialise_InitialContentsNeeded(ser);
{
SCOPED_SERIALISE_CHUNK(D3D12Chunk::CaptureScope, 16);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureScope, 16);
Serialise_CaptureScope(ser);
}
@@ -2310,7 +2310,6 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context)
case D3D12Chunk::CreateSwapBuffer:
return Serialise_WrapSwapchainBuffer(ser, NULL, NULL, 0, NULL);
break;
case D3D12Chunk::CaptureScope: return Serialise_CaptureScope(ser); break;
default:
{
SystemChunk system = (SystemChunk)context;
@@ -2331,6 +2330,10 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context)
{
return GetResourceManager()->Serialise_InitialState(ser, ResourceId(), NULL);
}
else if(system == SystemChunk::CaptureScope)
{
return Serialise_CaptureScope(ser);
}
else if(system < SystemChunk::FirstDriverChunk)
{
RDCERR("Unexpected system chunk in capture data: %u", system);
@@ -2453,7 +2456,7 @@ ReplayStatus WrappedID3D12Device::ReadLogInitialisation(RDCFile *rdc, bool store
RenderDoc::Inst().SetProgress(FileInitialRead, float(offsetEnd) / float(reader->GetSize()));
if(context == D3D12Chunk::CaptureScope)
if((SystemChunk)context == SystemChunk::CaptureScope)
{
m_FrameRecord.frameInfo.fileOffset = offsetStart;
@@ -2475,7 +2478,7 @@ ReplayStatus WrappedID3D12Device::ReadLogInitialisation(RDCFile *rdc, bool store
chunkInfos[context].totalsize += offsetEnd - offsetStart;
chunkInfos[context].count++;
if(context == D3D12Chunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
if((SystemChunk)context == SystemChunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
break;
}
+1 -1
View File
@@ -47,7 +47,7 @@ struct D3D12InitParams
D3D_FEATURE_LEVEL MinimumFeatureLevel;
// check if a frame capture section version is supported
static const uint64_t CurrentVersion = 0x2;
static const uint64_t CurrentVersion = 0x3;
static bool IsSupportedVersion(uint64_t ver);
};
+1 -4
View File
@@ -28,13 +28,10 @@
template <>
std::string DoStringise(const D3D12Chunk &el)
{
RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1085, "Chunks changed without updating names");
RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1082, "Chunks changed without updating names");
BEGIN_ENUM_STRINGISE(D3D12Chunk)
{
STRINGISE_ENUM_CLASS_NAMED(CaptureBegin, "Beginning of Capture");
STRINGISE_ENUM_CLASS_NAMED(CaptureEnd, "End of Capture");
STRINGISE_ENUM_CLASS_NAMED(CaptureScope, "Frame Capture Metadata");
STRINGISE_ENUM_CLASS_NAMED(SetName, "ID3D12Resource::SetName");
STRINGISE_ENUM_CLASS_NAMED(PushMarker, "Push Debug Region");
STRINGISE_ENUM_CLASS_NAMED(SetMarker, "Set Marker");
+1 -3
View File
@@ -566,9 +566,7 @@ enum class GLChunk : uint32_t
{
DeviceInitialisation = (uint32_t)SystemChunk::FirstDriverChunk,
CaptureBegin,
CaptureEnd,
CaptureScope,
MakeContextCurrent,
vrapi_CreateTextureSwapChain,
vrapi_CreateTextureSwapChain2,
+34 -33
View File
@@ -1138,7 +1138,7 @@ void WrappedOpenGL::ActivateContext(GLWindowingData winData)
}
USE_SCRATCH_SERIALISER();
SCOPED_SERIALISE_CHUNK(GLChunk::CaptureBegin);
SCOPED_SERIALISE_CHUNK(GLChunk::MakeContextCurrent);
Serialise_BeginCaptureFrame(ser);
m_ContextRecord->AddChunk(scope.Get());
}
@@ -2466,7 +2466,7 @@ bool WrappedOpenGL::EndFrameCapture(void *dev, void *wnd)
GetResourceManager()->Serialise_InitialContentsNeeded(ser);
{
SCOPED_SERIALISE_CHUNK(GLChunk::CaptureScope, 16);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureScope, 16);
Serialise_CaptureScope(ser);
}
@@ -2773,7 +2773,7 @@ void WrappedOpenGL::ContextEndFrame()
{
USE_SCRATCH_SERIALISER();
ser.SetDrawChunk();
SCOPED_SERIALISE_CHUNK(GLChunk::CaptureEnd);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureEnd);
m_ContextRecord->AddChunk(scope.Get());
}
@@ -2869,7 +2869,7 @@ bool WrappedOpenGL::Serialise_BeginCaptureFrame(SerialiserType &ser)
void WrappedOpenGL::BeginCaptureFrame()
{
USE_SCRATCH_SERIALISER();
SCOPED_SERIALISE_CHUNK(GLChunk::CaptureBegin);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureBegin);
Serialise_BeginCaptureFrame(ser);
@@ -3131,7 +3131,7 @@ ReplayStatus WrappedOpenGL::ReadLogInitialisation(RDCFile *rdc, bool storeStruct
RenderDoc::Inst().SetProgress(FileInitialRead, float(offsetEnd) / float(reader->GetSize()));
if(context == GLChunk::CaptureScope)
if((SystemChunk)context == SystemChunk::CaptureScope)
{
m_FrameRecord.frameInfo.fileOffset = offsetStart;
@@ -3152,7 +3152,7 @@ ReplayStatus WrappedOpenGL::ReadLogInitialisation(RDCFile *rdc, bool storeStruct
chunkInfos[context].totalsize += offsetEnd - offsetStart;
chunkInfos[context].count++;
if(context == GLChunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
if((SystemChunk)context == SystemChunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
break;
}
@@ -3234,6 +3234,27 @@ bool WrappedOpenGL::ProcessChunk(ReadSerialiser &ser, GLChunk chunk)
return GetResourceManager()->Serialise_InitialState(ser, ResourceId(),
GLResource(MakeNullResource));
}
else if(system == SystemChunk::CaptureScope)
{
return Serialise_CaptureScope(ser);
}
else if(system == SystemChunk::CaptureEnd)
{
if(IsLoading(m_State))
{
AddEvent();
DrawcallDescription draw;
draw.name = "SwapBuffers()";
draw.flags |= DrawFlags::Present;
draw.copyDestination = GetResourceManager()->GetOriginalID(
GetResourceManager()->GetID(TextureRes(GetCtx(), m_FakeBB_Color)));
AddDrawcall(draw, true);
}
return true;
}
else if(system < SystemChunk::FirstDriverChunk)
{
RDCERR("Unexpected system chunk in capture data: %u", system);
@@ -4294,6 +4315,10 @@ bool WrappedOpenGL::ProcessChunk(ReadSerialiser &ser, GLChunk chunk)
// nothing to do, these chunks are just markers
return true;
case GLChunk::MakeContextCurrent:
// re-use the serialisation for beginning of the frame
return Serialise_BeginCaptureFrame(ser);
// these functions are not currently serialised - they do nothing on replay and are not
// serialised for information (it would be harmless and perhaps useful for the user to see
// where and how they're called).
@@ -4613,30 +4638,6 @@ bool WrappedOpenGL::ProcessChunk(ReadSerialiser &ser, GLChunk chunk)
RDCERR("Unexpected chunk, or missing case for processing! Skipping...");
ser.SkipCurrentChunk();
return false;
case GLChunk::CaptureScope: return Serialise_CaptureScope(ser);
case GLChunk::CaptureBegin:
// normally this would be handled as a special case when we start processing the frame,
// but it can be emitted mid-frame if MakeCurrent is called on a different context.
// when processed here, we always want to apply the contents
return Serialise_BeginCaptureFrame(ser);
case GLChunk::CaptureEnd:
{
if(IsLoading(m_State))
{
AddEvent();
DrawcallDescription draw;
draw.name = "SwapBuffers()";
draw.flags |= DrawFlags::Present;
draw.copyDestination = GetResourceManager()->GetOriginalID(
GetResourceManager()->GetID(TextureRes(GetCtx(), m_FakeBB_Color)));
AddDrawcall(draw, true);
}
return true;
}
}
return false;
@@ -4663,8 +4664,8 @@ ReplayStatus WrappedOpenGL::ContextReplayLog(CaptureState readType, uint32_t sta
m_StructuredFile = &ser.GetStructuredFile();
}
GLChunk header = ser.ReadChunk<GLChunk>();
RDCASSERTEQUAL(header, GLChunk::CaptureBegin);
SystemChunk header = ser.ReadChunk<SystemChunk>();
RDCASSERTEQUAL(header, SystemChunk::CaptureBegin);
if(IsActiveReplaying(m_State) && !partial)
{
@@ -4763,7 +4764,7 @@ ReplayStatus WrappedOpenGL::ContextReplayLog(CaptureState readType, uint32_t sta
RenderDoc::Inst().SetProgress(
FileInitialRead, float(m_CurChunkOffset - startOffset) / float(ser.GetReader()->GetSize()));
if(chunktype == GLChunk::CaptureEnd)
if((SystemChunk)chunktype == SystemChunk::CaptureEnd)
break;
m_CurEventID++;
+1 -1
View File
@@ -53,7 +53,7 @@ struct GLInitParams
uint32_t height;
// check if a frame capture section version is supported
static const uint64_t CurrentVersion = 0x17;
static const uint64_t CurrentVersion = 0x18;
static bool IsSupportedVersion(uint64_t ver);
};
+2 -3
View File
@@ -32,9 +32,8 @@ std::string DoStringise(const GLChunk &el)
BEGIN_ENUM_STRINGISE(GLChunk)
{
STRINGISE_ENUM_CLASS(DeviceInitialisation);
STRINGISE_ENUM_CLASS(CaptureBegin);
STRINGISE_ENUM_CLASS(CaptureEnd);
STRINGISE_ENUM_CLASS(CaptureScope);
STRINGISE_ENUM_CLASS_NAMED(MakeContextCurrent, "MakeContextCurrent");
STRINGISE_ENUM_CLASS(vrapi_CreateTextureSwapChain);
STRINGISE_ENUM_CLASS(vrapi_CreateTextureSwapChain2);
-3
View File
@@ -379,9 +379,6 @@ enum class VulkanChunk : uint32_t
SetShaderDebugPath,
vkRegisterDeviceEventEXT,
vkRegisterDisplayEventEXT,
CaptureScope,
CaptureBegin,
CaptureEnd,
Max,
};
+33 -29
View File
@@ -791,7 +791,7 @@ void WrappedVulkan::EndCaptureFrame(VkImage presentImage)
{
CACHE_THREAD_SERIALISER();
ser.SetDrawChunk();
SCOPED_SERIALISE_CHUNK(VulkanChunk::CaptureEnd);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureEnd);
SERIALISE_ELEMENT_LOCAL(PresentedImage, GetResID(presentImage));
@@ -910,7 +910,7 @@ void WrappedVulkan::StartFrameCapture(void *dev, void *wnd)
{
CACHE_THREAD_SERIALISER();
SCOPED_SERIALISE_CHUNK(VulkanChunk::CaptureBegin);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureBegin);
Serialise_BeginCaptureFrame(ser);
@@ -1338,7 +1338,7 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd)
GetResourceManager()->Serialise_InitialContentsNeeded(ser);
{
SCOPED_SERIALISE_CHUNK(VulkanChunk::CaptureScope, 16);
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureScope, 16);
Serialise_CaptureScope(ser);
}
@@ -1498,7 +1498,7 @@ ReplayStatus WrappedVulkan::ReadLogInitialisation(RDCFile *rdc, bool storeStruct
RenderDoc::Inst().SetProgress(FileInitialRead, float(offsetEnd) / float(reader->GetSize()));
if(context == VulkanChunk::CaptureScope)
if((SystemChunk)context == SystemChunk::CaptureScope)
{
m_FrameRecord.frameInfo.fileOffset = offsetStart;
@@ -1517,7 +1517,7 @@ ReplayStatus WrappedVulkan::ReadLogInitialisation(RDCFile *rdc, bool storeStruct
chunkInfos[context].totalsize += offsetEnd - offsetStart;
chunkInfos[context].count++;
if(context == VulkanChunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
if((SystemChunk)context == SystemChunk::CaptureScope || reader->IsErrored() || reader->AtEnd())
break;
}
@@ -1582,8 +1582,8 @@ ReplayStatus WrappedVulkan::ContextReplayLog(CaptureState readType, uint32_t sta
m_StructuredFile = &ser.GetStructuredFile();
}
VulkanChunk header = ser.ReadChunk<VulkanChunk>();
RDCASSERTEQUAL(header, VulkanChunk::CaptureBegin);
SystemChunk header = ser.ReadChunk<SystemChunk>();
RDCASSERTEQUAL(header, SystemChunk::CaptureBegin);
if(partial)
ser.SkipCurrentChunk();
@@ -1672,7 +1672,7 @@ ReplayStatus WrappedVulkan::ContextReplayLog(CaptureState readType, uint32_t sta
RenderDoc::Inst().SetProgress(
FileInitialRead, float(m_CurChunkOffset - startOffset) / float(ser.GetReader()->GetSize()));
if(chunktype == VulkanChunk::CaptureEnd)
if((SystemChunk)chunktype == SystemChunk::CaptureEnd)
break;
// break out if we were only executing one event
@@ -2159,27 +2159,6 @@ bool WrappedVulkan::ProcessChunk(ReadSerialiser &ser, VulkanChunk chunk)
return Serialise_vkCreateSwapchainKHR(ser, VK_NULL_HANDLE, NULL, NULL, NULL);
break;
case VulkanChunk::CaptureScope: return Serialise_CaptureScope(ser); break;
case VulkanChunk::CaptureEnd:
{
SERIALISE_ELEMENT_LOCAL(PresentedImage, ResourceId());
SERIALISE_CHECK_READ_ERRORS();
if(IsLoading(m_State))
{
AddEvent();
DrawcallDescription draw;
draw.name = "vkQueuePresentKHR()";
draw.flags |= DrawFlags::Present;
draw.copyDestination = PresentedImage;
AddDrawcall(draw, true);
}
break;
}
default:
{
SystemChunk system = (SystemChunk)chunk;
@@ -2202,6 +2181,31 @@ bool WrappedVulkan::ProcessChunk(ReadSerialiser &ser, VulkanChunk chunk)
{
return Serialise_InitialState(ser, ResourceId(), NULL);
}
else if(system == SystemChunk::CaptureScope)
{
return Serialise_CaptureScope(ser);
}
else if(system == SystemChunk::CaptureEnd)
{
SERIALISE_ELEMENT_LOCAL(PresentedImage, ResourceId());
SERIALISE_CHECK_READ_ERRORS();
if(IsLoading(m_State))
{
AddEvent();
DrawcallDescription draw;
draw.name = "vkQueuePresentKHR()";
draw.flags |= DrawFlags::Present;
draw.copyDestination = PresentedImage;
AddDrawcall(draw, true);
}
return true;
}
else if(system < SystemChunk::FirstDriverChunk)
{
RDCERR("Unexpected system chunk in capture data: %u", system);
+1 -1
View File
@@ -52,7 +52,7 @@ struct VkInitParams
uint32_t GetSerialiseSize();
// check if a frame capture section version is supported
static const uint64_t CurrentVersion = 0x8;
static const uint64_t CurrentVersion = 0x9;
static bool IsSupportedVersion(uint64_t ver);
};
+1 -4
View File
@@ -28,7 +28,7 @@
template <>
std::string DoStringise(const VulkanChunk &el)
{
RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1100, "Chunks changed without updating names");
RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1097, "Chunks changed without updating names");
BEGIN_ENUM_STRINGISE(VulkanChunk)
{
@@ -129,9 +129,6 @@ std::string DoStringise(const VulkanChunk &el)
STRINGISE_ENUM_CLASS(SetShaderDebugPath);
STRINGISE_ENUM_CLASS(vkRegisterDeviceEventEXT);
STRINGISE_ENUM_CLASS(vkRegisterDisplayEventEXT);
STRINGISE_ENUM_CLASS_NAMED(CaptureScope, "Frame Capture Metadata");
STRINGISE_ENUM_CLASS_NAMED(CaptureBegin, "Beginning of Capture");
STRINGISE_ENUM_CLASS_NAMED(CaptureEnd, "End of Capture");
STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk");
}
END_ENUM_STRINGISE()