mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Corrected procedure to collect proper size of image from VkImageCreateInfo (#2289)
Fixes #2155 according to issue description Additional remark: The image size was previously calculated based on the memory size, which seems unusual. Due to Vulkan's configuration capabilities, the size of memory allocated for a specific texture may differ from what would be expected based on the texture dimensions. Thus, calculating the image dimensions back from the memory size of a Vulkan texture can be challenging.
This commit is contained in:
@@ -1839,7 +1839,13 @@ VulkanImage::VulkanImage(
|
||||
vkImageCreateInfo.pNext = &vkExternalMemoryImageCreateInfo;
|
||||
}
|
||||
|
||||
vkCreateImage(m_device, &vkImageCreateInfo, NULL, &m_vkImage);
|
||||
VkResult vkStatus =
|
||||
vkCreateImage(m_device, &vkImageCreateInfo, NULL, &m_vkImage);
|
||||
if (vkStatus != VK_SUCCESS)
|
||||
{
|
||||
throw std::runtime_error("Error: Failed create image.");
|
||||
}
|
||||
|
||||
VulkanImageCreateInfo = vkImageCreateInfo;
|
||||
|
||||
VkMemoryDedicatedRequirements vkMemoryDedicatedRequirements = {};
|
||||
@@ -1968,7 +1974,7 @@ VulkanExtent3D VulkanImage2D::getExtent3D(uint32_t mipLevel) const
|
||||
return VulkanExtent3D(width, height, depth);
|
||||
}
|
||||
|
||||
VkSubresourceLayout VulkanImage2D::getSubresourceLayout() const
|
||||
VkSubresourceLayout VulkanImage::getSubresourceLayout() const
|
||||
{
|
||||
VkImageSubresource subresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user