diff --git a/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp index 73f45dbb1..0e95fee3a 100644 --- a/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp @@ -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 diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index ebdf89989..05e5e0820 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -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 WrappedID3D11Device::Serialise_CreateTexture } SERIALISE_ELEMENT_ARRAY(SubresourceContents, SubresourceContentsLength); - SERIALISE_ELEMENT(SubresourceContentsLength); if(ser.IsWriting()) { @@ -339,6 +339,8 @@ std::vector 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