Ensure that swapchain is not passed to the ICD when creating images

Ensures that all images created from a headless swapchain use the
same vkImageCreate info.

This ensures that when calling vkCreateImage with a swapchain that
is owned by the layer the VkImageSwapchainCreateInfoKHR is not
passed further down the chain to ICD on headless implementation.

Change-Id: I1bd723589e52577b98fd53ec1ec769e5594a0838
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
This commit is contained in:
Normunds Rieksts 2021-10-27 15:47:08 +01:00 committed by Rosen Zhelev
parent 080d5d2bf7
commit 5bf469a278
2 changed files with 9 additions and 1 deletions

View file

@ -49,6 +49,7 @@ struct image_data
swapchain::swapchain(layer::device_private_data &dev_data, const VkAllocationCallbacks *pAllocator)
: wsi::swapchain_base(dev_data, pAllocator)
, m_image_create_info()
{
}
@ -60,7 +61,7 @@ swapchain::~swapchain()
VkResult swapchain::create_aliased_image_handle(const VkImageCreateInfo *image_create_info, VkImage *image)
{
return m_device_data.disp.CreateImage(m_device, image_create_info, get_allocation_callbacks(), image);
return m_device_data.disp.CreateImage(m_device, &m_image_create_info, get_allocation_callbacks(), image);
}
VkResult swapchain::create_and_bind_swapchain_image(VkImageCreateInfo image_create, wsi::swapchain_image &image)
@ -68,6 +69,7 @@ VkResult swapchain::create_and_bind_swapchain_image(VkImageCreateInfo image_crea
VkResult res = VK_SUCCESS;
const std::lock_guard<std::recursive_mutex> lock(m_image_status_mutex);
m_image_create_info = image_create;
res = m_device_data.disp.CreateImage(m_device, &image_create, get_allocation_callbacks(), &image.image);
if (res != VK_SUCCESS)
{

View file

@ -119,6 +119,12 @@ protected:
*/
VkResult bind_swapchain_image(VkDevice &device, const VkBindImageMemoryInfo *bind_image_mem_info,
const VkBindImageMemorySwapchainInfoKHR *bind_sc_info) override;
private:
/**
* @brief Image creation info used for all swapchain images.
*/
VkImageCreateInfo m_image_create_info;
};
} /* namespace headless */