Commit 1bc7731e by Chris Forbes

Check sampling support in vkGetPhysicalDeviceImageFormatProperties

We're supposed to validate the request against what we can actually support, and return VK_ERROR_FORMAT_NOT_SUPPORTED if not supported. We had previously only considered total lack of support for the format. Test: dEQP-VK.texture.shadow.* Change-Id: Ic5aa81f232bf04583060e88334f7f38dd5f2b2e9 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31068Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 60f15eca
...@@ -240,18 +240,31 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysic ...@@ -240,18 +240,31 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysic
VkFormatProperties properties; VkFormatProperties properties;
vk::Cast(physicalDevice)->getFormatProperties(format, &properties); vk::Cast(physicalDevice)->getFormatProperties(format, &properties);
VkFormatFeatureFlags features;
switch (tiling) switch (tiling)
{ {
case VK_IMAGE_TILING_LINEAR: case VK_IMAGE_TILING_LINEAR:
if (properties.linearTilingFeatures == 0) return VK_ERROR_FORMAT_NOT_SUPPORTED; features = properties.linearTilingFeatures;
break; break;
case VK_IMAGE_TILING_OPTIMAL: case VK_IMAGE_TILING_OPTIMAL:
if (properties.optimalTilingFeatures == 0) return VK_ERROR_FORMAT_NOT_SUPPORTED; features = properties.optimalTilingFeatures;
break; break;
default: default:
UNIMPLEMENTED("tiling"); UNIMPLEMENTED("tiling");
features = 0;
}
if (features == 0)
{
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
// Check for usage conflict with features
if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) && !(features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
{
return VK_ERROR_FORMAT_NOT_SUPPORTED;
} }
vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties); vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment