From 0c4ea014bf289e8b0a8501c3e89c8bc4ecf9f0a4 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 27 Apr 2020 14:23:28 -0600 Subject: vulkaninfo: correct memory for linear tiled images Previously vulkaninfo would always add the VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT for linearly tiled images, which is not supported by the spec. Vulkaninfo will now not query support for linear tiled images that are of the color format and no longer adds the aformentioned image usage flag, instead using the VK_IMAGE_USAGE_TRANSFER_SRC_BIT. Change-Id: Ida71b738060e893b7e270005e358d51622ee0c4f --- vulkaninfo/vulkaninfo.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 5b5e0872..c83691b4 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -1454,12 +1454,23 @@ struct AppGpu { GetImageCreateInfo(format, tiling, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, 0); VkImageCreateInfo image_ci_sparse = GetImageCreateInfo(format, tiling, 0, VK_IMAGE_CREATE_SPARSE_BINDING_BIT); - if (format == color_format) { - image_ci_regular.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; - image_ci_transient.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + if (tiling == VK_IMAGE_TILING_LINEAR) { + if (format == color_format) { + image_ci_regular.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + image_ci_transient.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + } else { + // linear tiling is only applicable to color image types + continue; + } } else { - image_ci_regular.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; - image_ci_transient.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + if (format == color_format) { + image_ci_regular.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + image_ci_transient.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + + } else { + image_ci_regular.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + image_ci_transient.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + } } auto image_ts_regular = -- cgit v1.2.3