- anv_surf->offset = align_u32(image->size, anv_surf->isl.alignment);
- image->size = anv_surf->offset + anv_surf->isl.size;
- image->alignment = MAX(image->alignment, anv_surf->isl.alignment);
+ add_surface(image, anv_surf);
+
+ /* Add a HiZ surface to a depth buffer that will be used for rendering.
+ */
+ if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT &&
+ (image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
+
+ /* Allow the user to control HiZ enabling. Disable by default on gen7
+ * because resolves are not currently implemented pre-BDW.
+ */
+ if (!env_var_as_boolean("INTEL_VK_HIZ", dev->info.gen >= 8)) {
+ anv_finishme("Implement gen7 HiZ");
+ } else if (vk_info->mipLevels > 1) {
+ anv_finishme("Test multi-LOD HiZ");
+ } else if (dev->info.gen == 8 && vk_info->samples > 1) {
+ anv_finishme("Test gen8 multisampled HiZ");
+ } else {
+ isl_surf_get_hiz_surf(&dev->isl_dev, &image->depth_surface.isl,
+ &image->hiz_surface.isl);
+ add_surface(image, &image->hiz_surface);
+ }
+ }