diff options
author | Kristian Høgsberg Kristensen <[email protected]> | 2016-02-17 12:21:46 -0800 |
---|---|---|
committer | Kristian Høgsberg Kristensen <[email protected]> | 2016-02-17 12:21:51 -0800 |
commit | 3b9b908054162055b203657d2971c28496aa6dfd (patch) | |
tree | 534ffc8e2a5c4190ca216aed290619888c17695f /src/vulkan | |
parent | b63e28c0e1275761f7effe4b0a8202735ff72291 (diff) |
anv: Ignore unused dimensions in vkCreateImage
We would assert on unused dimensions (eg extent.depth for
VK_IMAGE_TYPE_2D) not being 1, but the specification doesn't put any
constraints on those. For example, for VK_IMAGE_TYPE_1D:
"If imageType is VK_IMAGE_TYPE_1D, the value of extent.width must be
less than or equal to the value of
VkPhysicalDeviceLimits::maxImageDimension1D, or the value of
VkImageFormatProperties::maxExtent.width (as returned by
vkGetPhysicalDeviceImageFormatProperties with values of format,
type, tiling, usage and flags equal to those in this structure) -
whichever is higher"
We'll fix up the arguments to isl to keep isl strict in what it expects.
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/anv_image.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index 4ce997589c5..dfacced92ef 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -124,13 +124,28 @@ make_surface(const struct anv_device *dev, struct anv_surface *anv_surf = get_surface(image, aspect); + VkExtent3D extent; + switch (vk_info->imageType) { + case VK_IMAGE_TYPE_1D: + extent = (VkExtent3D) { vk_info->extent.width, 1, 1 }; + break; + case VK_IMAGE_TYPE_2D: + extent = (VkExtent3D) { vk_info->extent.width, vk_info->extent.height, 1 }; + break; + case VK_IMAGE_TYPE_3D: + extent = vk_info->extent; + break; + default: + unreachable("invalid image type"); + } + ok = isl_surf_init(&dev->isl_dev, &anv_surf->isl, .dim = vk_to_isl_surf_dim[vk_info->imageType], .format = anv_get_isl_format(vk_info->format, aspect, vk_info->tiling, NULL), - .width = vk_info->extent.width, - .height = vk_info->extent.height, - .depth = vk_info->extent.depth, + .width = extent.width, + .height = extent.height, + .depth = extent.depth, .levels = vk_info->mipLevels, .array_len = vk_info->arrayLayers, .samples = vk_info->samples, |