@@ -713,16 +713,29 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
713
713
Unwrap (*pMemory),
714
714
};
715
715
716
- memoryDeviceAddress.opaqueCaptureAddress =
716
+ VkMemoryOpaqueCaptureAddressAllocateInfo *addr =
717
+ (VkMemoryOpaqueCaptureAddressAllocateInfo *)FindNextStruct (
718
+ &serialisedInfo, VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO);
719
+
720
+ uint64_t opaque =
717
721
ObjDisp (device)->GetDeviceMemoryOpaqueCaptureAddress (Unwrap (device), &getInfo);
718
722
719
- // we explicitly DON'T assert on this, because some drivers will only need the device
720
- // address specified at allocate time.
721
- // RDCASSERT(memoryDeviceAddress.opaqueCaptureAddress);
723
+ if (addr)
724
+ {
725
+ RDCASSERT (addr->opaqueCaptureAddress == opaque, addr->opaqueCaptureAddress , opaque);
726
+ }
727
+ else
728
+ {
729
+ memoryDeviceAddress.opaqueCaptureAddress = opaque;
722
730
723
- // push this struct onto the start of the chain
724
- memoryDeviceAddress.pNext = serialisedInfo.pNext ;
725
- serialisedInfo.pNext = &memoryDeviceAddress;
731
+ // we explicitly DON'T assert on this, because some drivers will only need the device
732
+ // address specified at allocate time.
733
+ // RDCASSERT(memoryDeviceAddress.opaqueCaptureAddress);
734
+
735
+ // push this struct onto the start of the chain
736
+ memoryDeviceAddress.pNext = serialisedInfo.pNext ;
737
+ serialisedInfo.pNext = &memoryDeviceAddress;
738
+ }
726
739
727
740
memFlags->flags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
728
741
@@ -1877,16 +1890,30 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo
1877
1890
1878
1891
if (GetExtensions (GetRecord (device)).ext_KHR_buffer_device_address )
1879
1892
{
1880
- bufferDeviceAddressCoreOrKHR.opaqueCaptureAddress =
1881
- ObjDisp (device)->GetBufferOpaqueCaptureAddress (Unwrap (device), &getInfo);
1893
+ VkBufferOpaqueCaptureAddressCreateInfo *addr =
1894
+ (VkBufferOpaqueCaptureAddressCreateInfo *)FindNextStruct (
1895
+ &serialisedCreateInfo, VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO);
1882
1896
1883
- // we explicitly DON'T assert on this, because some drivers will only need the device
1884
- // address specified at allocate time.
1885
- // RDCASSERT(bufferDeviceAddressKHR.opaqueCaptureAddress);
1897
+ uint64_t opaque = ObjDisp (device)->GetBufferOpaqueCaptureAddress (Unwrap (device), &getInfo);
1886
1898
1887
- // push this struct onto the start of the chain
1888
- bufferDeviceAddressCoreOrKHR.pNext = serialisedCreateInfo.pNext ;
1889
- serialisedCreateInfo.pNext = &bufferDeviceAddressCoreOrKHR;
1899
+ if (addr)
1900
+ {
1901
+ RDCASSERT (opaque == addr->opaqueCaptureAddress , opaque, addr->opaqueCaptureAddress );
1902
+ }
1903
+ else
1904
+ {
1905
+ addr = &bufferDeviceAddressCoreOrKHR;
1906
+
1907
+ bufferDeviceAddressCoreOrKHR.opaqueCaptureAddress = opaque;
1908
+
1909
+ // we explicitly DON'T assert on this, because some drivers will only need the device
1910
+ // address specified at allocate time.
1911
+ // RDCASSERT(bufferDeviceAddressKHR.opaqueCaptureAddress);
1912
+
1913
+ // push this struct onto the start of the chain
1914
+ bufferDeviceAddressCoreOrKHR.pNext = serialisedCreateInfo.pNext ;
1915
+ serialisedCreateInfo.pNext = &bufferDeviceAddressCoreOrKHR;
1916
+ }
1890
1917
}
1891
1918
else if (GetExtensions (GetRecord (device)).ext_EXT_buffer_device_address )
1892
1919
{
0 commit comments