Minor cleanup and gather all the global maps together, for refactoring

This commit is contained in:
baldurk
2015-10-21 13:26:42 +02:00
parent 04a2e2ad2a
commit d253335f3e
3 changed files with 24 additions and 25 deletions
+14 -17
View File
@@ -142,6 +142,7 @@ private:
// much easier to process (we will enforce/display ordering
// by queue submit order anyway, so it's OK to lose the record
// order).
Threading::CriticalSection m_CmdBufferRecordsLock;
vector<VkResourceRecord *> m_CmdBufferRecords;
VulkanResourceManager *m_ResourceManager;
@@ -150,8 +151,6 @@ private:
uint32_t m_FrameCounter;
uint64_t m_CurFileSize;
PerformanceTimer m_FrameTimer;
vector<double> m_FrameTimes;
double m_TotalTime, m_AvgFrametime, m_MinFrametime, m_MaxFrametime;
@@ -214,15 +213,6 @@ private:
ResourceId m_FakeBBImgId;
// VKTODO all these m_*Info things need to be locked and ensure we only access
// them in slow path functions like creation, or just moved elsewhere like inside
// the wrapped objects
// VKTODOHIGH all of these need to be locked
map<ResourceId, MemState> m_MemoryInfo;
map<ResourceId, ImgState> m_ImageInfo;
map<ResourceId, ResourceId> m_BufferMemBinds;
map<ResourceId, string> m_ObjectNames;
struct CmdBufferInfo
{
VkDevice device;
@@ -239,7 +229,6 @@ private:
uint32_t curEventID; // current event ID while reading or executing
uint32_t drawCount; // similar to above
};
map<ResourceId, CmdBufferInfo> m_CmdBufferInfo;
// on replay, the current command buffer for the last chunk we
// handled.
@@ -374,7 +363,6 @@ private:
};
vector<SwapImage> images;
};
map<ResourceId, SwapInfo> m_SwapChainInfo;
// this info is stored in the record on capture, but we
// need it on replay too
@@ -383,7 +371,6 @@ private:
ResourceId layout;
vector<VkDescriptorInfo *> currentBindings;
};
map<ResourceId, DescriptorSetInfo> m_DescriptorSetInfo;
struct ShaderModuleInfo
{
@@ -391,7 +378,6 @@ private:
ShaderReflection reflTemplate;
ShaderBindpointMapping mapping;
};
map<ResourceId, ShaderModuleInfo> m_ShaderModuleInfo;
struct ShaderInfo
{
@@ -399,11 +385,22 @@ private:
ShaderReflection refl;
ShaderBindpointMapping mapping;
};
// VKTODO all these m_*Info things need to be locked and ensure we only access
// them in slow path functions like creation, or just moved elsewhere like inside
// the wrapped objects
// VKTODOHIGH all of these need to be locked
map<ResourceId, MemState> m_MemoryInfo;
map<ResourceId, ImgState> m_ImageInfo;
map<ResourceId, ResourceId> m_BufferMemBinds;
map<ResourceId, string> m_ObjectNames;
map<ResourceId, CmdBufferInfo> m_CmdBufferInfo;
map<ResourceId, SwapInfo> m_SwapChainInfo;
map<ResourceId, DescriptorSetInfo> m_DescriptorSetInfo;
map<ResourceId, ShaderModuleInfo> m_ShaderModuleInfo;
map<ResourceId, ShaderInfo> m_ShaderInfo;
VulkanCreationInfo m_CreationInfo;
set<ResourceId> m_SubmittedFences;
static const char *GetChunkName(uint32_t idx);
@@ -159,8 +159,6 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
if(m_State == READING)
{
m_SubmittedFences.insert(fenceId);
ObjDisp(queue)->QueueSubmit(Unwrap(queue), numCmds, cmds, Unwrap(fence));
for(uint32_t i=0; i < numCmds; i++)
@@ -272,8 +270,6 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
RDCASSERT(trimmedCmds.size() > 0);
m_SubmittedFences.insert(fenceId);
ObjDisp(queue)->QueueSubmit(Unwrap(queue), (uint32_t)trimmedCmds.size(), &trimmedCmds[0], Unwrap(fence));
for(uint32_t i=0; i < numCmds; i++)
@@ -284,8 +280,6 @@ bool WrappedVulkan::Serialise_vkQueueSubmit(
}
else
{
m_SubmittedFences.insert(fenceId);
ObjDisp(queue)->QueueSubmit(Unwrap(queue), numCmds, cmds, Unwrap(fence));
for(uint32_t i=0; i < numCmds; i++)
@@ -387,7 +381,11 @@ VkResult WrappedVulkan::vkQueueSubmit(
if(fence != VK_NULL_HANDLE)
GetResourceManager()->MarkResourceFrameReferenced(GetResID(fence), eFrameRef_Read);
m_CmdBufferRecords.push_back(record->bakedCommands);
{
SCOPED_LOCK(m_CmdBufferRecordsLock);
m_CmdBufferRecords.push_back(record->bakedCommands);
}
record->bakedCommands->AddRef();
}
@@ -916,6 +916,10 @@ VkResult WrappedVulkan::vkQueuePresentKHR(
m_pFileSerialiser->Insert(m_HeaderChunk);
}
// don't need to lock access to m_CmdBufferRecords as we are no longer
// in capframe (the transition is thread-protected) so nothing will be
// pushed to the vector
{
RDCDEBUG("Flushing %u command buffer records to file serialiser", (uint32_t)m_CmdBufferRecords.size());
@@ -940,7 +944,7 @@ VkResult WrappedVulkan::vkQueuePresentKHR(
RDCDEBUG("Done");
}
m_CurFileSize += m_pFileSerialiser->FlushToDisk();
m_pFileSerialiser->FlushToDisk();
RenderDoc::Inst().SuccessfullyWrittenLog();