return isl_usage;
}
+static isl_tiling_flags_t
+choose_isl_tiling_flags(const struct anv_image_create_info *anv_info)
+{
+ const VkImageCreateInfo *base_info = anv_info->vk_info;
+ isl_tiling_flags_t flags = 0;
+
+ switch (base_info->tiling) {
+ default:
+ unreachable("bad VkImageTiling");
+ case VK_IMAGE_TILING_OPTIMAL:
+ flags = ISL_TILING_ANY_MASK;
+ break;
+ case VK_IMAGE_TILING_LINEAR:
+ flags = ISL_TILING_LINEAR_BIT;
+ break;
+ }
+
+ if (anv_info->isl_tiling_flags)
+ flags &= anv_info->isl_tiling_flags;
+
+ assert(flags);
+
+ return flags;
+}
+
static struct anv_surface *
get_surface(struct anv_image *image, VkImageAspectFlagBits aspect)
{
make_surface(const struct anv_device *dev,
struct anv_image *image,
const struct anv_image_create_info *anv_info,
+ isl_tiling_flags_t tiling_flags,
VkImageAspectFlagBits aspect)
{
const VkImageCreateInfo *vk_info = anv_info->vk_info;
[VK_IMAGE_TYPE_3D] = ISL_SURF_DIM_3D,
};
- /* Translate the Vulkan tiling to an equivalent ISL tiling, then filter the
- * result with an optionally provided ISL tiling argument.
- */
- isl_tiling_flags_t tiling_flags =
- (vk_info->tiling == VK_IMAGE_TILING_LINEAR) ?
- ISL_TILING_LINEAR_BIT : ISL_TILING_ANY_MASK;
-
- if (anv_info->isl_tiling_flags)
- tiling_flags &= anv_info->isl_tiling_flags;
-
- assert(tiling_flags);
-
image->extent = anv_sanitize_image_extent(vk_info->imageType,
vk_info->extent);
const struct anv_format *format = anv_get_format(image->vk_format);
assert(format != NULL);
+ const isl_tiling_flags_t isl_tiling_flags =
+ choose_isl_tiling_flags(create_info);
+
image->n_planes = format->n_planes;
uint32_t b;
for_each_bit(b, image->aspects) {
- r = make_surface(device, image, create_info, (1 << b));
+ r = make_surface(device, image, create_info, isl_tiling_flags,
+ (1 << b));
if (r != VK_SUCCESS)
goto fail;
}