From 9f0bfbed11f5fc4f3b899b1eb90570dbeeef45c0 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Mon, 17 Dec 2018 09:59:49 +0100 Subject: radv: Work around non-renderable 128bpp compressed 3d textures on GFX9. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exactly what title says, the new addrlib does not allow the above with certain dimensions that the CTS seems to hit. Work around it by not allowing the app to render to it via compat with other 128bpp formats and do not render to it ourselves during copies. Fixes: 776b9113656 "amd/addrlib: update Mesa's copy of addrlib" Reviewed-by: Nicolai Hähnle Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/radv_meta_copy.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/amd/vulkan/radv_meta_copy.c') diff --git a/src/amd/vulkan/radv_meta_copy.c b/src/amd/vulkan/radv_meta_copy.c index ddfb5c54673..647a167ab4c 100644 --- a/src/amd/vulkan/radv_meta_copy.c +++ b/src/amd/vulkan/radv_meta_copy.c @@ -107,6 +107,22 @@ blit_surf_for_image_level_layer(struct radv_image *image, }; } +static bool +image_is_renderable(struct radv_device *device, struct radv_image *image) +{ + if (image->vk_format == VK_FORMAT_R32G32B32_UINT || + image->vk_format == VK_FORMAT_R32G32B32_SINT || + image->vk_format == VK_FORMAT_R32G32B32_SFLOAT) + return false; + + if (device->physical_device->rad_info.chip_class >= GFX9 && + image->type == VK_IMAGE_TYPE_3D && + vk_format_get_blocksizebits(image->vk_format == 128) && + vk_format_is_compressed(image->vk_format)) + return false; + return true; +} + static void meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer, struct radv_buffer* buffer, @@ -196,9 +212,7 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer, /* Perform Blit */ if (cs || - (img_bsurf.image->vk_format == VK_FORMAT_R32G32B32_UINT || - img_bsurf.image->vk_format == VK_FORMAT_R32G32B32_SINT || - img_bsurf.image->vk_format == VK_FORMAT_R32G32B32_SFLOAT)) { + !image_is_renderable(cmd_buffer->device, img_bsurf.image)) { radv_meta_buffer_to_image_cs(cmd_buffer, &buf_bsurf, &img_bsurf, 1, &rect); } else { radv_meta_blit2d(cmd_buffer, NULL, &buf_bsurf, &img_bsurf, 1, &rect); @@ -483,9 +497,7 @@ meta_copy_image(struct radv_cmd_buffer *cmd_buffer, /* Perform Blit */ if (cs || - (b_src.format == VK_FORMAT_R32G32B32_UINT || - b_src.format == VK_FORMAT_R32G32B32_SINT || - b_src.format == VK_FORMAT_R32G32B32_SFLOAT)) { + !image_is_renderable(cmd_buffer->device, b_dst.image)) { radv_meta_image_to_image_cs(cmd_buffer, &b_src, &b_dst, 1, &rect); } else { radv_meta_blit2d(cmd_buffer, &b_src, NULL, &b_dst, 1, &rect); -- cgit v1.2.3