radv: only allocate HTILE if depth/stencil attachment usage is used

Submitted by Samuel Pitoiset on Nov. 23, 2018, 4:06 p.m.

Details

Message ID 20181123160657.15058-1-samuel.pitoiset@gmail.com
State New
Headers show
Series "radv: only allocate HTILE if depth/stencil attachment usage is used" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset Nov. 23, 2018, 4:06 p.m.
Apparently some games allocate depth buffers without rendering
to them, this will avoid wasting memory if that image usage
flag is not set.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/vulkan/radv_image.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 7492bf48b51..a293834c4c3 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -923,7 +923,8 @@  radv_image_can_enable_fmask(struct radv_image *image)
 static inline bool
 radv_image_can_enable_htile(struct radv_image *image)
 {
-	return image->info.levels == 1 &&
+	return image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT &&
+	       image->info.levels == 1 &&
 	       vk_format_is_depth(image->vk_format) &&
 	       image->info.width * image->info.height >= 8 * 8;
 }

Comments

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
On Fri, Nov 23, 2018 at 5:04 PM Samuel Pitoiset
<samuel.pitoiset@gmail.com> wrote:
>
> Apparently some games allocate depth buffers without rendering
> to them, this will avoid wasting memory if that image usage
> flag is not set.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> ---
>  src/amd/vulkan/radv_image.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index 7492bf48b51..a293834c4c3 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -923,7 +923,8 @@ radv_image_can_enable_fmask(struct radv_image *image)
>  static inline bool
>  radv_image_can_enable_htile(struct radv_image *image)
>  {
> -       return image->info.levels == 1 &&
> +       return image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT &&
> +              image->info.levels == 1 &&
>                vk_format_is_depth(image->vk_format) &&
>                image->info.width * image->info.height >= 8 * 8;
>  }
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev