anv_assert(pCreateInfo->extent.height > 0);
anv_assert(pCreateInfo->extent.depth > 0);
- image = vk_zalloc2(&device->alloc, alloc, sizeof(*image), 8,
+ image = vk_zalloc2(&device->vk.alloc, alloc, sizeof(*image), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!image)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &image->base, VK_OBJECT_TYPE_IMAGE);
image->type = pCreateInfo->imageType;
image->extent = pCreateInfo->extent;
image->vk_format = pCreateInfo->format;
fail:
if (image)
- vk_free2(&device->alloc, alloc, image);
+ vk_free2(&device->vk.alloc, alloc, image);
return r;
}
}
}
- vk_free2(&device->alloc, pAllocator, image);
+ vk_object_base_finish(&image->base);
+ vk_free2(&device->vk.alloc, pAllocator, image);
}
static void anv_image_bind_memory_plane(struct anv_device *device,
assert(aspect == VK_IMAGE_ASPECT_COLOR_BIT);
return VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT;
- case VK_IMAGE_LAYOUT_RANGE_SIZE:
case VK_IMAGE_LAYOUT_MAX_ENUM:
unreachable("Invalid image layout.");
}
case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL:
return aspect == VK_IMAGE_ASPECT_STENCIL_BIT;
- case VK_IMAGE_LAYOUT_RANGE_SIZE:
case VK_IMAGE_LAYOUT_MAX_ENUM:
unreachable("Invalid image layout.");
}
/* Handle a few special cases */
switch (layout) {
/* Invalid layouts */
- case VK_IMAGE_LAYOUT_RANGE_SIZE:
case VK_IMAGE_LAYOUT_MAX_ENUM:
unreachable("Invalid image layout.");
return ANV_FAST_CLEAR_ANY;
} else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_MCS ||
image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E) {
- /* If the image has MCS or CCS_E enabled all the time then we can use
- * fast-clear as long as the clear color is the default value of zero
- * since this is the default value we program into every surface
- * state used for texturing.
- */
- return ANV_FAST_CLEAR_DEFAULT_VALUE;
+ if (devinfo->gen >= 11) {
+ /* On ICL and later, the sampler hardware uses a copy of the clear
+ * value that is encoded as a pixel value. Therefore, we can use
+ * any clear color we like for sampling.
+ */
+ return ANV_FAST_CLEAR_ANY;
+ } else {
+ /* If the image has MCS or CCS_E enabled all the time then we can
+ * use fast-clear as long as the clear color is the default value
+ * of zero since this is the default value we program into every
+ * surface state used for texturing.
+ */
+ return ANV_FAST_CLEAR_DEFAULT_VALUE;
+ }
} else {
return ANV_FAST_CLEAR_NONE;
}
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_image_view *iview;
- iview = vk_zalloc2(&device->alloc, pAllocator, sizeof(*iview), 8,
+ iview = vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*iview), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (iview == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &iview->base, VK_OBJECT_TYPE_IMAGE_VIEW);
+
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
assert(range->layerCount > 0);
}
}
- vk_free2(&device->alloc, pAllocator, iview);
+ vk_object_base_finish(&iview->base);
+ vk_free2(&device->vk.alloc, pAllocator, iview);
}
ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer);
struct anv_buffer_view *view;
- view = vk_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
+ view = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*view), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!view)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
/* TODO: Handle the format swizzle? */
+ vk_object_base_init(&device->vk, &view->base, VK_OBJECT_TYPE_BUFFER_VIEW);
view->format = anv_get_isl_format(&device->info, pCreateInfo->format,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_TILING_LINEAR);
anv_state_pool_free(&device->surface_state_pool,
view->writeonly_storage_surface_state);
- vk_free2(&device->alloc, pAllocator, view);
+ vk_object_base_finish(&view->base);
+ vk_free2(&device->vk.alloc, pAllocator, view);
}