diff options
author | Chad Versace <[email protected]> | 2016-10-06 15:21:49 -0700 |
---|---|---|
committer | Nanley Chery <[email protected]> | 2016-10-07 12:54:18 -0700 |
commit | 917814dccd4354db09a1b7bf977ef2352b74c917 (patch) | |
tree | fcc5628593a7ed85de5d52e5ecabe460616b6c5f /src/intel/vulkan | |
parent | 3aec432ed3306ffb62e2a703f5b419d5ae012afa (diff) |
anv: Allocate hiz surface
Nanley Chery:
(rebase)
- Use isl_surf_get_hiz_surf()
(amend)
- Only add a HiZ surface onto a depth/stencil attachment
- Add comment above HiZ surface addition
- Hide HiZ behind INTEL_VK_HIZ prior to BDW
- Disable HiZ for untested cases
- Remove DISABLE_AUX_BIT instead of preventing it from being added
Signed-off-by: Nanley Chery <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index f6e86725f9f..77dcd46236e 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -28,6 +28,7 @@ #include <fcntl.h> #include "anv_private.h" +#include "util/debug.h" #include "vk_format_info.h" @@ -60,6 +61,7 @@ choose_isl_surf_usage(VkImageUsageFlags vk_usage, default: unreachable("bad VkImageAspect"); case VK_IMAGE_ASPECT_DEPTH_BIT: + isl_usage &= ~ISL_SURF_USAGE_DISABLE_AUX_BIT; isl_usage |= ISL_SURF_USAGE_DEPTH_BIT; break; case VK_IMAGE_ASPECT_STENCIL_BIT: @@ -99,6 +101,16 @@ get_surface(struct anv_image *image, VkImageAspectFlags aspect) } } +static void +add_surface(struct anv_image *image, struct anv_surface *surf) +{ + assert(surf->isl.size > 0); /* isl surface must be initialized */ + + surf->offset = align_u32(image->size, surf->isl.alignment); + image->size = surf->offset + surf->isl.size; + image->alignment = MAX(image->alignment, surf->isl.alignment); +} + /** * Initialize the anv_image::*_surface selected by \a aspect. Then update the * image's memory requirements (that is, the image's size and alignment). @@ -160,9 +172,28 @@ make_surface(const struct anv_device *dev, */ assert(ok); - 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); + } + } return VK_SUCCESS; } |