Don't serialise anything in between serialising buffer & fetching offset

This commit is contained in:
baldurk committed 2018-02-16 13:15:22 +00:00
1 parent f3f688fd48
commit 41ba4be01e
2 files changed
+6 -3

No files matched your search

@@ -201,7 +201,6 @@ bool WrappedID3D11DeviceContext::Serialise_UpdateSubresource1(
Contents = new byte[(size_t)ContentsLength];
SERIALISE_ELEMENT_ARRAY(Contents, ContentsLength);
SERIALISE_ELEMENT(ContentsLength);
// the automatic deserialisation only happens when reading, when writing we need to
// free this data
@@ -213,6 +212,8 @@ bool WrappedID3D11DeviceContext::Serialise_UpdateSubresource1(
record->SetDataOffset(ser.GetWriter()->GetOffset() - ContentsLength);
}
SERIALISE_ELEMENT(ContentsLength);
// nothing more to do here during write - the parent function will handle setting the record's
// data pointer and either marking the resource as dirty or updating the backing store with
// pSrcData passed in
+4 -2
View File
@@ -71,7 +71,6 @@ bool WrappedID3D11Device::Serialise_CreateBuffer(SerialiserType &ser, const D3D1
}
SERIALISE_ELEMENT_ARRAY(InitialData, InitialDataLength);
SERIALISE_ELEMENT(InitialDataLength);
if(ser.IsWriting())
{
@@ -87,6 +86,8 @@ bool WrappedID3D11Device::Serialise_CreateBuffer(SerialiserType &ser, const D3D1
record->Length = Descriptor.ByteWidth;
}
SERIALISE_ELEMENT(InitialDataLength);
SERIALISE_CHECK_READ_ERRORS();
if(IsReplayingAndReading())
@@ -330,7 +331,6 @@ std::vector<D3D11_SUBRESOURCE_DATA> WrappedID3D11Device::Serialise_CreateTexture
}
SERIALISE_ELEMENT_ARRAY(SubresourceContents, SubresourceContentsLength);
SERIALISE_ELEMENT(SubresourceContentsLength);
if(ser.IsWriting())
{
@@ -339,6 +339,8 @@ std::vector<D3D11_SUBRESOURCE_DATA> WrappedID3D11Device::Serialise_CreateTexture
record->SubResources[i]->SetDataOffset(ser.GetWriter()->GetOffset() - SubresourceContentsLength);
}
SERIALISE_ELEMENT(SubresourceContentsLength);
if(IsReplayingAndReading())
{
// we 'steal' the SubresourceContents buffer so it doesn't get de-serialised and free'd