message: Fix race in vulkan code if QueueSubmit overlaps start/end capture
diff: @@ -533,15 +533,24 @@ VkResult WrappedVulkan::vkQueueSubmit(VkQueue queue, uint32_t submitCount,
  // dirty.
  {
  SCOPED_LOCK(m_CapTransitionLock);
  - capframe = IsActiveCapturing(m_State);
  - }
  -
  - if(capframe)
  + if(IsActiveCapturing(m_State))
  {
  for(auto it = record->bakedCommands->cmdInfo->dirtied.begin();
  it != record->bakedCommands->cmdInfo->dirtied.end(); ++it)
  GetResourceManager()->MarkPendingDirty(*it);
  + capframe = true;
  + }
  + else
  + {
  + for(auto it = record->bakedCommands->cmdInfo->dirtied.begin();
  + it != record->bakedCommands->cmdInfo->dirtied.end(); ++it)
  + GetResourceManager()->MarkDirtyResource(*it);
  + }
  + }
  +
  + if(capframe)
  + {
  // for each bound descriptor set, mark it referenced as well as all resources currently
  // bound to it
  for(auto it = record->bakedCommands->cmdInfo->boundDescSets.begin();
  @@ -599,12 +608,6 @@ VkResult WrappedVulkan::vkQueueSubmit(VkQueue queue, uint32_t submitCount,
  record->bakedCommands->AddRef();
  }
  - else
  - {
  - for(auto it = record->bakedCommands->cmdInfo->dirtied.begin();
  - it != record->bakedCommands->cmdInfo->dirtied.end(); ++it)
  - GetResourceManager()->MarkDirtyResource(*it);
  - }
  record->cmdInfo->dirtied.clear();
  }
  