summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_formats.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-09-28 11:02:53 -0700
committerChad Versace <[email protected]>2015-09-28 11:53:39 -0700
commit9f3122db0e8e8c6ec1569633d3f6c673ba82d2b4 (patch)
treeb5fe782aef10e8e17146b697fbf8bfc62dafb00f /src/vulkan/anv_formats.c
parentc15ce5c8341251e02794d2cae7ac95e561398e9a (diff)
vk: Refactor anv_GetPhysicalDeviceFormatProperties()
Move the bulk of the function body to a new function anv_physical_device_get_format_properties(). This allows us to reuse the function when implementing anv_GetPhysicalDeviceImageFormatProperties() without calling into the public entry point.
Diffstat (limited to 'src/vulkan/anv_formats.c')
-rw-r--r--src/vulkan/anv_formats.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c
index 2c3487c18cc..937ef73c964 100644
--- a/src/vulkan/anv_formats.c
+++ b/src/vulkan/anv_formats.c
@@ -245,18 +245,16 @@ VkResult anv_validate_GetPhysicalDeviceFormatProperties(
return anv_GetPhysicalDeviceFormatProperties(physicalDevice, _format, pFormatProperties);
}
-VkResult anv_GetPhysicalDeviceFormatProperties(
- VkPhysicalDevice physicalDevice,
- VkFormat _format,
- VkFormatProperties* pFormatProperties)
+static VkResult
+anv_physical_device_get_format_properties(struct anv_physical_device *physical_device,
+ const struct anv_format *format,
+ VkFormatProperties *out_properties)
{
- ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
const struct surface_format_info *info;
int gen;
- const struct anv_format *format = anv_format_for_vk_format(_format);
if (format == NULL)
- return vk_error(VK_ERROR_INVALID_VALUE);
+ return VK_ERROR_INVALID_VALUE;
gen = physical_device->info->gen * 10;
if (physical_device->info->is_haswell)
@@ -292,14 +290,33 @@ VkResult anv_GetPhysicalDeviceFormatProperties(
}
}
- pFormatProperties->linearTilingFeatures = linear;
- pFormatProperties->optimalTilingFeatures = tiled;
+ out_properties->linearTilingFeatures = linear;
+ out_properties->optimalTilingFeatures = tiled;
return VK_SUCCESS;
unsupported:
- pFormatProperties->linearTilingFeatures = 0;
- pFormatProperties->optimalTilingFeatures = 0;
+ out_properties->linearTilingFeatures = 0;
+ out_properties->optimalTilingFeatures = 0;
+
+ return VK_SUCCESS;
+}
+
+
+VkResult anv_GetPhysicalDeviceFormatProperties(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkFormatProperties* pFormatProperties)
+{
+ ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
+ VkResult result;
+
+ result = anv_physical_device_get_format_properties(
+ physical_device,
+ anv_format_for_vk_format(format),
+ pFormatProperties);
+ if (result != VK_SUCCESS)
+ return vk_error(result);
return VK_SUCCESS;
}