Make sure to enable bufferDeviceAddressCaptureReplay on replay

* We used to get this 'for free' by serialising our patched device next chains,
  but we no longer do that so we need to enable this bit on replay as well.
This commit is contained in:
baldurk committed 2020-09-08 12:57:01 +01:00
1 parent 218ce2abf7
commit 3d5aabdd80
1 file changed
+42 -7
@@ -2922,14 +2922,25 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
}
else
{
// don't add a new VkPhysicalDeviceVulkan12Features to the pNext chain because if we do we
// have to remove any components etc. Instead just add the individual
// VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
bufAddrKHRFeatures.bufferDeviceAddress = VK_TRUE;
bufAddrKHRFeatures.bufferDeviceAddressMultiDevice = VK_FALSE;
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR *existingKHR =
(VkPhysicalDeviceBufferDeviceAddressFeaturesKHR *)FindNextStruct(
&createInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR);
VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *existingEXT =
(VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *)FindNextStruct(
&createInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT);
bufAddrKHRFeatures.pNext = (void *)createInfo.pNext;
createInfo.pNext = &bufAddrKHRFeatures;
if(!existingKHR && !existingEXT)
{
// don't add a new VkPhysicalDeviceVulkan12Features to the pNext chain because if we do
// we
// have to remove any components etc. Instead just add the individual
// VkPhysicalDeviceBufferDeviceAddressFeaturesKHR
bufAddrKHRFeatures.bufferDeviceAddress = VK_TRUE;
bufAddrKHRFeatures.bufferDeviceAddressMultiDevice = VK_FALSE;
bufAddrKHRFeatures.pNext = (void *)createInfo.pNext;
createInfo.pNext = &bufAddrKHRFeatures;
}
}
}
}
@@ -3008,6 +3019,30 @@ bool WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
}
}
{
VkPhysicalDeviceVulkan12Features *enabledFeaturesVK12 =
(VkPhysicalDeviceVulkan12Features *)FindNextStruct(
&createInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES);
VkPhysicalDeviceBufferDeviceAddressFeatures *bufferAddressFeaturesCoreKHR =
(VkPhysicalDeviceBufferDeviceAddressFeatures *)FindNextStruct(
&createInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES);
VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *bufferAddressFeaturesEXT =
(VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *)FindNextStruct(
&createInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT);
// turn on bufferDeviceAddressCaptureReplay if available, so that a capture that uses it is
// safe
// to replay. Enabling this without using it is fine.
if(enabledFeaturesVK12 && enabledFeaturesVK12->bufferDeviceAddress)
enabledFeaturesVK12->bufferDeviceAddressCaptureReplay = VK_TRUE;
if(bufferAddressFeaturesCoreKHR)
bufferAddressFeaturesCoreKHR->bufferDeviceAddressCaptureReplay = VK_TRUE;
if(bufferAddressFeaturesEXT)
bufferAddressFeaturesEXT->bufferDeviceAddressCaptureReplay = VK_TRUE;
}
rdcarray<const char *> layerArray(Layers.size());
for(size_t i = 0; i < Layers.size(); i++)
layerArray[i] = Layers[i].c_str();