mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Serialise AS initial contents before all others
* This will be important for replay-time reallocation, so their VAs can be remapped before any serialised descriptor heaps look them up.
This commit is contained in:
@@ -1392,7 +1392,7 @@ rdcarray<ResourceId> ResourceManager<Configuration>::InitialContentResources()
|
||||
{
|
||||
ResourceId id = it->first;
|
||||
|
||||
if(HasLiveResource(id))
|
||||
if(IsCaptureMode(m_State) || HasLiveResource(id))
|
||||
{
|
||||
resources.push_back(id);
|
||||
}
|
||||
@@ -1566,9 +1566,10 @@ void ResourceManager<Configuration>::InsertInitialContentsChunks(WriteSerialiser
|
||||
|
||||
End_PrepareInitialBatch();
|
||||
|
||||
for(auto it = m_InitialContents.begin(); it != m_InitialContents.end(); ++it)
|
||||
rdcarray<ResourceId> resources = InitialContentResources();
|
||||
for(auto it = resources.begin(); it != resources.end(); ++it)
|
||||
{
|
||||
ResourceId id = it->first;
|
||||
ResourceId id = *it;
|
||||
|
||||
RenderDoc::Inst().SetProgress(CaptureProgress::SerialiseInitialStates, idx / num);
|
||||
idx += 1.0f;
|
||||
@@ -1607,32 +1608,34 @@ void ResourceManager<Configuration>::InsertInitialContentsChunks(WriteSerialiser
|
||||
|
||||
dirty++;
|
||||
|
||||
if(!Need_InitialStateChunk(id, it->second.data))
|
||||
InitialContentStorage &data = m_InitialContents[id];
|
||||
|
||||
if(!Need_InitialStateChunk(id, data.data))
|
||||
{
|
||||
// this was handled in ApplyInitialContentsNonChunks(), do nothing as there's no point copying
|
||||
// the data again (it's already been serialised).
|
||||
continue;
|
||||
}
|
||||
|
||||
if(it->second.chunk)
|
||||
if(data.chunk)
|
||||
{
|
||||
it->second.chunk->Write(ser);
|
||||
data.chunk->Write(ser);
|
||||
}
|
||||
else if(!it->second.filename.empty())
|
||||
else if(!data.filename.empty())
|
||||
{
|
||||
FILE *f = FileIO::fopen(it->second.filename, FileIO::ReadBinary);
|
||||
FileIO::fseek64(f, it->second.fileStart, SEEK_SET);
|
||||
StreamReader reader(f, it->second.fileEnd - it->second.fileStart, Ownership::Stream);
|
||||
FILE *f = FileIO::fopen(data.filename, FileIO::ReadBinary);
|
||||
FileIO::fseek64(f, data.fileStart, SEEK_SET);
|
||||
StreamReader reader(f, data.fileEnd - data.fileStart, Ownership::Stream);
|
||||
|
||||
StreamTransfer(ser.GetWriter(), &reader, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t size = GetSize_InitialState(id, it->second.data);
|
||||
uint64_t size = GetSize_InitialState(id, data.data);
|
||||
|
||||
SCOPED_SERIALISE_CHUNK(SystemChunk::InitialContents, size);
|
||||
|
||||
Serialise_InitialState(ser, id, record, &it->second.data);
|
||||
Serialise_InitialState(ser, id, record, &data.data);
|
||||
}
|
||||
|
||||
// Reset back to empty contents, unloading the actual resource.
|
||||
|
||||
@@ -3437,6 +3437,13 @@ rdcarray<ResourceId> D3D12ResourceManager::InitialContentResources()
|
||||
if(aData.buildData && bData.buildData)
|
||||
return aData.buildData->Type > bData.buildData->Type;
|
||||
|
||||
// serialise ASs first to allow reallocation.
|
||||
// since the enum is serialised we couldn't change the order so we do this by hand
|
||||
int aASSort = aData.resourceType == Resource_AccelerationStructure ? 0 : 1;
|
||||
int bASSort = bData.resourceType == Resource_AccelerationStructure ? 0 : 1;
|
||||
if(aASSort != bASSort)
|
||||
return aASSort < bASSort;
|
||||
|
||||
return aData.resourceType < bData.resourceType;
|
||||
});
|
||||
return resources;
|
||||
|
||||
@@ -1054,6 +1054,13 @@ rdcarray<ResourceId> VulkanResourceManager::InitialContentResources()
|
||||
return true;
|
||||
}
|
||||
|
||||
// serialise ASs first to allow reallocation.
|
||||
// since the enum is serialised we couldn't change the order so we do this by hand
|
||||
int aASSort = aData.type == eResAccelerationStructureKHR ? 0 : 1;
|
||||
int bASSort = bData.type == eResAccelerationStructureKHR ? 0 : 1;
|
||||
if(aASSort != bASSort)
|
||||
return aASSort < bASSort;
|
||||
|
||||
return aData.type < bData.type;
|
||||
});
|
||||
return resources;
|
||||
|
||||
Reference in New Issue
Block a user