message: Fix initial state crashes for images in external queues. Closes
diff: @@ -105,10 +105,6 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
  return Prepare_SparseInitialState((WrappedVkImage *)res);
  }
  - VkDevice d = GetDev();
  - // INITSTATEBATCH
  - VkCommandBuffer cmd = GetNextCmd();
  -
  VkCommandBuffer extQCmd = VK_NULL_HANDLE;
  ImageLayouts *layout = NULL;
  @@ -125,6 +121,10 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
  return true;
  }
  + VkDevice d = GetDev();
  + // INITSTATEBATCH
  + VkCommandBuffer cmd = GetNextCmd();
  +
  if(layout->queueFamilyIndex != m_QueueFamilyIdx)
  {
  // get a command buffer for giving up ownership before the copy and acquiring it afterwards.
  @@ -1008,6 +1008,8 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
  // during writing, we already have the memory copied off - we just need to map it.
  if(ser.IsWriting())
  + {
  + if(initContents.mem.mem != VK_NULL_HANDLE)
  {
  mappedMem = initContents.mem;
  vkr = ObjDisp(d)->MapMemory(Unwrap(d), Unwrap(mappedMem.mem), initContents.mem.offs,
  @@ -1026,6 +1028,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
  vkr = ObjDisp(d)->InvalidateMappedMemoryRanges(Unwrap(d), 1, &range);
  RDCASSERTEQUAL(vkr, VK_SUCCESS);
  }
  + }
  else if(IsReplayingAndReading() && !ser.IsErrored())
  {
  // create a buffer with memory attached, which we will fill with the initial contents
  @@ -1081,7 +1084,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, W
  // if we're handling a device memory object, we're done - we note the memory object to delete at
  // the end of the program, and store the buffer to copy off in Apply
  - if(IsReplayingAndReading())
  + if(IsReplayingAndReading() && ContentsSize > 0)
  {
  ResourceId liveid = GetResourceManager()->GetLiveID(id);
  