Don't serialise size_t directly in VkDescriptorUpdateTemplateEntry

* This caused an incompatibility between 32-bit and 64-bit capture and replay.
This commit is contained in:
baldurk
2018-07-26 17:24:30 +01:00
parent 8704b555a6
commit 26ce9fcc0f
3 changed files with 24 additions and 3 deletions
+4
View File
@@ -240,6 +240,10 @@ bool VkInitParams::IsSupportedVersion(uint64_t ver)
if(ver == CurrentVersion)
return true;
// 0xD -> 0xE - fixed serialisation directly of size_t members in VkDescriptorUpdateTemplateEntry
if(ver == 0xD)
return true;
// 0xC -> 0xD - supported multiple queues. This didn't cause a large change to the serialisation
// but there were some slight inconsistencies that required a version bump
if(ver == 0xC)
+1 -1
View File
@@ -55,7 +55,7 @@ struct VkInitParams
uint32_t GetSerialiseSize();
// check if a frame capture section version is supported
static const uint64_t CurrentVersion = 0xD;
static const uint64_t CurrentVersion = 0xE;
static bool IsSupportedVersion(uint64_t ver);
};
+19 -2
View File
@@ -2235,8 +2235,25 @@ void DoSerialise(SerialiserType &ser, VkDescriptorUpdateTemplateEntry &el)
SERIALISE_MEMBER(dstArrayElement);
SERIALISE_MEMBER(descriptorCount);
SERIALISE_MEMBER(descriptorType);
SERIALISE_MEMBER(offset);
SERIALISE_MEMBER(stride);
// these fields are size_t and should not be serialised as-is. They're not used so we can just
// serialise them as uint64_t. Unfortunately this wasn't correct initially and they were
// serialised as-is making a 32-bit/64-bit incompatibility, so for older versions all we can do is
// continue to serialise them as size_t as it's impossible to know which one was used.
if(ser.VersionAtLeast(0xE))
{
uint64_t offset = el.offset;
uint64_t stride = el.stride;
ser.Serialise("offset", offset);
ser.Serialise("stride", stride);
el.offset = (size_t)offset;
el.stride = (size_t)stride;
}
else
{
SERIALISE_MEMBER(offset);
SERIALISE_MEMBER(stride);
}
}
template <typename SerialiserType>