Fix order that InitialContents are applied for Vulkan.
This fixes a bug where the memory backing an image could be initialized after the image itself, causing corruptions. ApplyInitialContents was processing the resources in order of resource id. It is possible that a VkImage and the VkDeviceMemory it is bound to both have InitialContent (e.g. because the VkDeviceMemory also backs a buffer), and it is also possible that the VkImage has a lower resource id than the VkDeviceMemory. In this case, the VkImage's InitialContent is loaded, and then the VkDeviceMemory's InitialContent is loaded. This direct write of the backing memory causes the VkImage content to become undefined and, at least on my AMD card, causes image corruption. This is fixed by sorting the resource ids by type, which works because eResDeviceMemory < eResImage. This sorting is applied only for VulkanResourceManager.
Loading
Please register or sign in to comment