summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_image.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-10-25 10:59:03 -0700
committerJason Ekstrand <[email protected]>2016-11-17 12:03:24 -0800
commit4e91f158e66af03d754231736346839d3cdd638f (patch)
treef517321568cba14009c37dc4b64d4b0bd16942da /src/intel/vulkan/anv_image.c
parent2b5644e94d4f3394bbbb19498c259f45c748ea76 (diff)
anv: Enable "permanent" compression for immutable format images
This commit extends our support of color compression to surfaces without the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT set. These images will never have an image view created with a different format then the one set at image creation time so it's safe to always use compression. We still bail if the image is used as a storage image because that sometimes ends up using a different format. Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_image.c')
-rw-r--r--src/intel/vulkan/anv_image.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 1ba4c51f2f8..ed221a7730e 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -199,8 +199,30 @@ make_surface(const struct anv_device *dev,
assert(image->aux_surface.isl.size == 0);
ok = isl_surf_get_ccs_surf(&dev->isl_dev, &anv_surf->isl,
&image->aux_surface.isl);
- if (ok)
+ if (ok) {
add_surface(image, &image->aux_surface);
+
+ /* For images created without MUTABLE_FORMAT_BIT set, we know that
+ * they will always be used with the original format. In
+ * particular, they will always be used with a format that
+ * supports color compression. This means that it's safe to just
+ * leave compression on at all times for these formats.
+ */
+ if (!(vk_info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) &&
+ isl_format_supports_lossless_compression(&dev->info, format)) {
+ if (vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) {
+ /*
+ * For now, we leave compression off for anything that may
+ * be used as a storage image. This is because accessing
+ * storage images may involve ccs-incompatible views or even
+ * untyped messages which don't support compression at all.
+ */
+ anv_finishme("Enable CCS for storage images");
+ } else {
+ image->aux_usage = ISL_AUX_USAGE_CCS_E;
+ }
+ }
+ }
}
}