check image params against driver's returned limits to avoid
failing later
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16563>
} else
ret = VKSCR(GetPhysicalDeviceImageFormatProperties)(screen->pdev, ici->format, ici->imageType,
ici->tiling, ici->usage, ici->flags, &image_props);
- return ret == VK_SUCCESS;
+ if (ret != VK_SUCCESS)
+ return false;
+ if (ici->extent.depth > image_props.maxExtent.depth ||
+ ici->extent.height > image_props.maxExtent.height ||
+ ici->extent.width > image_props.maxExtent.width)
+ return false;
+ if (ici->mipLevels > image_props.maxMipLevels)
+ return false;
+ if (ici->arrayLayers > image_props.maxArrayLayers)
+ return false;
+ return true;
}
static VkImageUsageFlags