if (!isSupportedSamplableFormat(context.getInstanceInterface(), context.getPhysicalDevice(), imageFormat))
throw tcu::NotSupportedError(std::string("Unsupported format for sampling: ") + getFormatName(imageFormat));
+ if ((samplerParams.minFilter == VK_FILTER_LINEAR ||
+ samplerParams.magFilter == VK_FILTER_LINEAR ||
+ samplerParams.mipmapMode == VK_SAMPLER_MIPMAP_MODE_LINEAR) &&
+ !isLinearFilteringSupported(context.getInstanceInterface(), context.getPhysicalDevice(), imageFormat, VK_IMAGE_TILING_OPTIMAL))
+ throw tcu::NotSupportedError(std::string("Unsupported format for linear filtering: ") + getFormatName(imageFormat));
+
// Create texture image, view and sampler
{
VkImageCreateFlags imageFlags = 0u;
return (formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0u;
}
+// \todo [2016-01-21 pyry] Update this to just rely on vkDefs.hpp once
+// CTS has been updated to 1.0.2.
+enum
+{
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
+};
+
+bool isLinearFilteringSupported (const InstanceInterface& vki, VkPhysicalDevice physicalDevice, VkFormat format, VkImageTiling tiling)
+{
+ const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(vki, physicalDevice, format);
+ const VkFormatFeatureFlags formatFeatures = tiling == VK_IMAGE_TILING_LINEAR
+ ? formatProperties.linearTilingFeatures
+ : formatProperties.optimalTilingFeatures;
+
+ switch (format)
+ {
+ case VK_FORMAT_R32_SFLOAT:
+ case VK_FORMAT_R32G32_SFLOAT:
+ case VK_FORMAT_R32G32B32_SFLOAT:
+ case VK_FORMAT_R32G32B32A32_SFLOAT:
+ case VK_FORMAT_R64_SFLOAT:
+ case VK_FORMAT_R64G64_SFLOAT:
+ case VK_FORMAT_R64G64B64_SFLOAT:
+ case VK_FORMAT_R64G64B64A64_SFLOAT:
+ return (formatFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) != 0;
+
+ default:
+ // \todo [2016-01-21 pyry] Check for all formats once drivers have been updated to 1.0.2
+ // and we have tests to verify format properties.
+ return true;
+ }
+}
+
VkBorderColor getFormatBorderColor (BorderColor color, VkFormat format)
{
if (!isCompressedFormat(format) && (isIntFormat(format) || isUintFormat(format)))
BORDER_COLOR_COUNT
};
-bool isSupportedSamplableFormat (const vk::InstanceInterface& instanceInterface,
- vk::VkPhysicalDevice device,
- vk::VkFormat format);
+bool isSupportedSamplableFormat (const vk::InstanceInterface& instanceInterface,
+ vk::VkPhysicalDevice device,
+ vk::VkFormat format);
+bool isLinearFilteringSupported (const vk::InstanceInterface& instanceInterface,
+ vk::VkPhysicalDevice device,
+ vk::VkFormat format,
+ vk::VkImageTiling tiling);
vk::VkBorderColor getFormatBorderColor (BorderColor color, vk::VkFormat format);