mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-26 17:31:42 +00:00
When exporting struct buffers we must always allocate memory to readback
* If the external code has a NULL pointer and doesn't want to allocate but we are exporting buffer data, we still need to read the data somewhere so make a temporary allocation to read it into.
This commit is contained in:
@@ -234,6 +234,8 @@ public:
|
||||
obj.type.byteSize = byteSize;
|
||||
}
|
||||
|
||||
byte *tempAlloc = NULL;
|
||||
|
||||
{
|
||||
if(IsWriting())
|
||||
{
|
||||
@@ -261,6 +263,17 @@ public:
|
||||
else
|
||||
el = NULL;
|
||||
}
|
||||
|
||||
// if we're exporting the buffers, make sure to always alloc space to read the data, so we
|
||||
// can save it out, even if the external code has no use for it and has asked for no
|
||||
// allocation.
|
||||
if(el == NULL && ExportStructure() && m_ExportBuffers)
|
||||
{
|
||||
if(byteSize > 0)
|
||||
el = tempAlloc = AllocAlignedBuffer(byteSize);
|
||||
else
|
||||
el = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_Read->Read(el, byteSize);
|
||||
@@ -286,6 +299,12 @@ public:
|
||||
m_StructureStack.pop_back();
|
||||
}
|
||||
|
||||
if(tempAlloc)
|
||||
{
|
||||
FreeAlignedBuffer(tempAlloc);
|
||||
el = NULL;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user