dzn: Use core feature matching logic instead of rolling our own

This will print nice messages on unsupported features

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20801>
This commit is contained in:
Jesse Natalie
2023-01-19 13:31:12 -08:00
parent db083070f0
commit 81b5f6a3fd

View File

@@ -2064,27 +2064,6 @@ dzn_queue_init(struct dzn_queue *queue,
return VK_SUCCESS;
}
static VkResult
check_physical_device_features(VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceFeatures *features)
{
VK_FROM_HANDLE(dzn_physical_device, pdev, physicalDevice);
VkPhysicalDeviceFeatures supported_features;
pdev->vk.dispatch_table.GetPhysicalDeviceFeatures(physicalDevice, &supported_features);
VkBool32 *supported_feature = (VkBool32 *)&supported_features;
VkBool32 *enabled_feature = (VkBool32 *)features;
unsigned num_features = sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32);
for (uint32_t i = 0; i < num_features; i++) {
if (enabled_feature[i] && !supported_feature[i])
return VK_ERROR_FEATURE_NOT_PRESENT;
}
return VK_SUCCESS;
}
static VkResult
dzn_device_create_sync_for_memory(struct vk_device *device,
VkDeviceMemory memory,
@@ -2405,8 +2384,7 @@ dzn_CreateDevice(VkPhysicalDevice physicalDevice,
/* Check enabled features */
if (pCreateInfo->pEnabledFeatures) {
result = check_physical_device_features(physicalDevice,
pCreateInfo->pEnabledFeatures);
result = vk_physical_device_check_device_features(&physical_device->vk, pCreateInfo);
if (result != VK_SUCCESS)
return vk_error(physical_device, result);
}