ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
+ bool is_storage = (usage == VK_IMAGE_USAGE_STORAGE_BIT);
struct anv_surface *surface =
anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
.SurfaceType = anv_surftype(image, pCreateInfo->viewType,
usage == VK_IMAGE_USAGE_STORAGE_BIT),
.SurfaceArray = image->array_size > 1,
- .SurfaceFormat = (usage != VK_IMAGE_USAGE_STORAGE_BIT ? iview->format :
- isl_lower_storage_image_format(
- &device->isl_dev, iview->format)),
+ .SurfaceFormat = anv_surface_format(device, iview->format, is_storage),
.SurfaceVerticalAlignment = anv_valign[image_align_sa.height],
.SurfaceHorizontalAlignment = anv_halign[image_align_sa.width],
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
+ bool is_storage = (usage == VK_IMAGE_USAGE_STORAGE_BIT);
struct anv_surface *surface =
anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
get_halign_valign(&surface->isl, &halign, &valign);
struct GENX(RENDER_SURFACE_STATE) template = {
- .SurfaceType = anv_surftype(image, pCreateInfo->viewType,
- usage == VK_IMAGE_USAGE_STORAGE_BIT),
+ .SurfaceType = anv_surftype(image, pCreateInfo->viewType, is_storage),
.SurfaceArray = image->array_size > 1,
- .SurfaceFormat = (usage != VK_IMAGE_USAGE_STORAGE_BIT ? iview->format :
- isl_lower_storage_image_format(
- &device->isl_dev, iview->format)),
+ .SurfaceFormat = anv_surface_format(device, iview->format, is_storage),
.SurfaceVerticalAlignment = valign,
.SurfaceHorizontalAlignment = halign,
.TileMode = isl_to_gen_tiling[surface->isl.tiling],
}
}
+static enum isl_format
+anv_surface_format(const struct anv_device *device, enum isl_format format,
+ bool storage)
+{
+ if (storage) {
+ return isl_lower_storage_image_format(&device->isl_dev, format);
+ } else {
+ return format;
+ }
+}
+
#if ANV_GEN > 7 || ANV_IS_HASWELL
static const uint32_t vk_to_gen_swizzle_map[] = {
[VK_COMPONENT_SWIZZLE_ZERO] = SCS_ZERO,