From: Chad Versace Date: Sat, 23 Jan 2016 01:47:59 +0000 (-0800) Subject: anv/formats: Advertise multisample formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=149d5ba64d1ba8fce647c90ed9f9384d461919c2;p=mesa.git anv/formats: Advertise multisample formats Teach vkGetPhysicalDeviceImageFormatProperties() to advertise multisampled formats. --- diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c index d480ee7cb9d..8d634ca85f2 100644 --- a/src/vulkan/anv_formats.c +++ b/src/vulkan/anv_formats.c @@ -429,6 +429,7 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( VkExtent3D maxExtent; uint32_t maxMipLevels; uint32_t maxArraySize; + VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT; anv_physical_device_get_format_properties(physical_device, format, &format_props); @@ -453,6 +454,7 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( maxExtent.depth = 1; maxMipLevels = 15; /* log2(maxWidth) + 1 */ maxArraySize = 2048; + sampleCounts = VK_SAMPLE_COUNT_1_BIT; break; case VK_IMAGE_TYPE_2D: /* FINISHME: Does this really differ for cube maps? The documentation @@ -473,6 +475,15 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( break; } + if (tiling == VK_IMAGE_TILING_OPTIMAL && + type == VK_IMAGE_TYPE_2D && + (format_feature_flags & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) && + !(flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) && + !(usage & VK_IMAGE_USAGE_STORAGE_BIT)) { + sampleCounts = isl_device_get_sample_counts(&physical_device->isl_dev); + } + if (usage & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) { /* Meta implements transfers by sampling from the source image. */ if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) { @@ -529,9 +540,7 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( .maxExtent = maxExtent, .maxMipLevels = maxMipLevels, .maxArrayLayers = maxArraySize, - - /* FINISHME: Support multisampling */ - .sampleCounts = VK_SAMPLE_COUNT_1_BIT, + .sampleCounts = sampleCounts, /* FINISHME: Accurately calculate * VkImageFormatProperties::maxResourceSize.