mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 13:45:55 +00:00
Use 64-bit integer for chunk ID
* Using a 32-bit integer, signed, gives only 2 billion chunks before it wraps. With Vulkan/D3D12 creating new chunks even while in the background for recording commands this is feasible to hit.
This commit is contained in:
@@ -356,7 +356,7 @@ struct ResourceRecord
|
||||
}
|
||||
|
||||
void MarkDataUnwritten() { DataWritten = false; }
|
||||
void Insert(std::map<int32_t, Chunk *> &recordlist)
|
||||
void Insert(std::map<int64_t, Chunk *> &recordlist)
|
||||
{
|
||||
bool dataWritten = DataWritten;
|
||||
|
||||
@@ -385,11 +385,11 @@ struct ResourceRecord
|
||||
void RemoveChunk(Chunk *chunk)
|
||||
{
|
||||
LockChunks();
|
||||
m_Chunks.removeOneIf([chunk](const rdcpair<int32_t, Chunk *> &c) { return c.second == chunk; });
|
||||
m_Chunks.removeOneIf([chunk](const rdcpair<int64_t, Chunk *> &c) { return c.second == chunk; });
|
||||
UnlockChunks();
|
||||
}
|
||||
|
||||
void AddChunk(Chunk *chunk, int32_t ID = 0)
|
||||
void AddChunk(Chunk *chunk, int64_t ID = 0)
|
||||
{
|
||||
if(ID == 0)
|
||||
ID = GetID();
|
||||
@@ -451,7 +451,7 @@ struct ResourceRecord
|
||||
return m_Chunks.back().second;
|
||||
}
|
||||
|
||||
int32_t GetLastChunkID() const
|
||||
int64_t GetLastChunkID() const
|
||||
{
|
||||
RDCASSERT(HasChunks());
|
||||
return m_Chunks.back().first;
|
||||
@@ -501,14 +501,14 @@ protected:
|
||||
|
||||
std::set<ResourceRecord *> Parents;
|
||||
|
||||
int32_t GetID()
|
||||
int64_t GetID()
|
||||
{
|
||||
static volatile int32_t globalIDCounter = 10;
|
||||
static volatile int64_t globalIDCounter = 10;
|
||||
|
||||
return Atomic::Inc32(&globalIDCounter);
|
||||
return Atomic::Inc64(&globalIDCounter);
|
||||
}
|
||||
|
||||
rdcarray<rdcpair<int32_t, Chunk *>> m_Chunks;
|
||||
rdcarray<rdcpair<int64_t, Chunk *>> m_Chunks;
|
||||
Threading::CriticalSection *m_ChunkLock;
|
||||
|
||||
std::map<ResourceId, FrameRefType> m_FrameRefs;
|
||||
@@ -1138,7 +1138,7 @@ void ResourceManager<Configuration>::MarkUnwrittenResources()
|
||||
template <typename Configuration>
|
||||
void ResourceManager<Configuration>::InsertReferencedChunks(WriteSerialiser &ser)
|
||||
{
|
||||
std::map<int32_t, Chunk *> sortedChunks;
|
||||
std::map<int64_t, Chunk *> sortedChunks;
|
||||
|
||||
SCOPED_LOCK(m_Lock);
|
||||
|
||||
|
||||
@@ -1975,7 +1975,7 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd)
|
||||
|
||||
RDCDEBUG("Accumulating context resource list");
|
||||
|
||||
std::map<int32_t, Chunk *> recordlist;
|
||||
std::map<int64_t, Chunk *> recordlist;
|
||||
record->Insert(recordlist);
|
||||
|
||||
RDCDEBUG("Flushing %u records to file serialiser", (uint32_t)recordlist.size());
|
||||
|
||||
@@ -157,7 +157,7 @@ struct D3D11ResourceRecord : public ResourceRecord
|
||||
SubResources[i]->SetDataPtr(ptr);
|
||||
}
|
||||
|
||||
void Insert(std::map<int32_t, Chunk *> &recordlist)
|
||||
void Insert(std::map<int64_t, Chunk *> &recordlist)
|
||||
{
|
||||
bool dataWritten = DataWritten;
|
||||
|
||||
|
||||
@@ -2104,7 +2104,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
|
||||
// in capframe (the transition is thread-protected) so nothing will be
|
||||
// pushed to the vector
|
||||
|
||||
std::map<int32_t, Chunk *> recordlist;
|
||||
std::map<int64_t, Chunk *> recordlist;
|
||||
|
||||
for(auto it = queues.begin(); it != queues.end(); ++it)
|
||||
{
|
||||
|
||||
@@ -2324,7 +2324,7 @@ bool WrappedOpenGL::EndFrameCapture(void *dev, void *wnd)
|
||||
{
|
||||
RDCDEBUG("Accumulating context resource list");
|
||||
|
||||
std::map<int32_t, Chunk *> recordlist;
|
||||
std::map<int64_t, Chunk *> recordlist;
|
||||
m_ContextRecord->Insert(recordlist);
|
||||
|
||||
for(auto it = m_ContextData.begin(); it != m_ContextData.end(); ++it)
|
||||
|
||||
@@ -666,14 +666,14 @@ void WrappedOpenGL::glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const v
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int32_t id2 = record->GetLastChunkID();
|
||||
int64_t id2 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int32_t id1 = record->GetLastChunkID();
|
||||
int64_t id1 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
@@ -818,14 +818,14 @@ void WrappedOpenGL::glBufferData(GLenum target, GLsizeiptr size, const void *dat
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int32_t id2 = record->GetLastChunkID();
|
||||
int64_t id2 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
record->PopChunk();
|
||||
}
|
||||
|
||||
int32_t id1 = record->GetLastChunkID();
|
||||
int64_t id1 = record->GetLastChunkID();
|
||||
{
|
||||
Chunk *c = record->GetLastChunk();
|
||||
SAFE_DELETE(c);
|
||||
|
||||
@@ -1975,7 +1975,7 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd)
|
||||
RDCDEBUG("Flushing %u command buffer records to file serialiser",
|
||||
(uint32_t)m_CmdBufferRecords.size());
|
||||
|
||||
std::map<int32_t, Chunk *> recordlist;
|
||||
std::map<int64_t, Chunk *> recordlist;
|
||||
|
||||
// ensure all command buffer records within the frame evne if recorded before, but
|
||||
// otherwise order must be preserved (vs. queue submits and desc set updates)
|
||||
|
||||
Reference in New Issue
Block a user