diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 35f2d0e5672..2031170cd4b 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -160,6 +160,76 @@ static void pvr_physical_device_get_supported_extensions( /* clang-format on */ } +static void pvr_physical_device_get_supported_features( + const struct pvr_device_info *const dev_info, + struct vk_features *const features) +{ + *features = (struct vk_features){ + /* Vulkan 1.0 */ + .robustBufferAccess = true, + .fullDrawIndexUint32 = true, + .imageCubeArray = true, + .independentBlend = false, + .geometryShader = false, + .tessellationShader = false, + .sampleRateShading = true, + .dualSrcBlend = false, + .logicOp = false, + .multiDrawIndirect = true, + .drawIndirectFirstInstance = true, + .depthClamp = true, + .depthBiasClamp = true, + .fillModeNonSolid = false, + .depthBounds = false, + .wideLines = true, + .largePoints = true, + .alphaToOne = false, + .multiViewport = false, + .samplerAnisotropy = false, + .textureCompressionETC2 = true, + .textureCompressionASTC_LDR = PVR_HAS_FEATURE(dev_info, astc), + .textureCompressionBC = false, + .occlusionQueryPrecise = false, + .pipelineStatisticsQuery = false, + .vertexPipelineStoresAndAtomics = true, + .fragmentStoresAndAtomics = true, + .shaderTessellationAndGeometryPointSize = false, + .shaderImageGatherExtended = false, + .shaderStorageImageExtendedFormats = true, + .shaderStorageImageMultisample = false, + .shaderStorageImageReadWithoutFormat = true, + .shaderStorageImageWriteWithoutFormat = false, + .shaderUniformBufferArrayDynamicIndexing = true, + .shaderSampledImageArrayDynamicIndexing = true, + .shaderStorageBufferArrayDynamicIndexing = true, + .shaderStorageImageArrayDynamicIndexing = true, + .shaderClipDistance = false, + .shaderCullDistance = false, + .shaderFloat64 = false, + .shaderInt64 = true, + .shaderInt16 = true, + .shaderResourceResidency = false, + .shaderResourceMinLod = false, + .sparseBinding = false, + .sparseResidencyBuffer = false, + .sparseResidencyImage2D = false, + .sparseResidencyImage3D = false, + .sparseResidency2Samples = false, + .sparseResidency4Samples = false, + .sparseResidency8Samples = false, + .sparseResidency16Samples = false, + .sparseResidencyAliased = false, + .variableMultisampleRate = false, + .inheritedQueries = false, + + /* VK_KHR_timeline_semaphore (promoted to Vulkan 1.2) */ + .timelineSemaphore = true, + + /* VK_EXT_private_data (promoted to Vulkan 1.3) */ + .privateData = true, + }; +} + VkResult pvr_EnumerateInstanceVersion(uint32_t *pApiVersion) { *pApiVersion = PVR_API_VERSION; @@ -282,6 +352,7 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, { struct vk_physical_device_dispatch_table dispatch_table; struct vk_device_extension_table supported_extensions; + struct vk_features supported_features; struct pvr_winsys *ws; char *display_path; char *render_path; @@ -321,7 +392,21 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, if (result != VK_SUCCESS) goto err_vk_free_display_path; + pdevice->instance = instance; + pdevice->render_path = render_path; + pdevice->display_path = display_path; + pdevice->ws = ws; + pdevice->vk.supported_sync_types = ws->sync_types; + + result = ws->ops->device_info_init(ws, + &pdevice->dev_info, + &pdevice->dev_runtime_info); + if (result != VK_SUCCESS) + goto err_pvr_winsys_destroy; + pvr_physical_device_get_supported_extensions(&supported_extensions); + pvr_physical_device_get_supported_features(&pdevice->dev_info, + &supported_features); vk_physical_device_dispatch_table_from_entrypoints( &dispatch_table, @@ -336,23 +421,11 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, result = vk_physical_device_init(&pdevice->vk, &instance->vk, &supported_extensions, - NULL, + &supported_features, &dispatch_table); if (result != VK_SUCCESS) goto err_pvr_winsys_destroy; - pdevice->instance = instance; - pdevice->render_path = render_path; - pdevice->display_path = display_path; - pdevice->ws = ws; - pdevice->vk.supported_sync_types = ws->sync_types; - - result = ws->ops->device_info_init(ws, - &pdevice->dev_info, - &pdevice->dev_runtime_info); - if (result != VK_SUCCESS) - goto err_vk_physical_device_finish; - result = pvr_physical_device_init_uuids(pdevice); if (result != VK_SUCCESS) goto err_vk_physical_device_finish; @@ -637,91 +710,6 @@ VkResult pvr_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, return VK_SUCCESS; } -void pvr_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures2 *pFeatures) -{ - PVR_FROM_HANDLE(pvr_physical_device, pdevice, physicalDevice); - - pFeatures->features = (VkPhysicalDeviceFeatures){ - .robustBufferAccess = true, - .fullDrawIndexUint32 = true, - .imageCubeArray = true, - .independentBlend = false, - .geometryShader = false, - .tessellationShader = false, - .sampleRateShading = true, - .dualSrcBlend = false, - .logicOp = false, - .multiDrawIndirect = true, - .drawIndirectFirstInstance = true, - .depthClamp = true, - .depthBiasClamp = true, - .fillModeNonSolid = false, - .depthBounds = false, - .wideLines = true, - .largePoints = true, - .alphaToOne = false, - .multiViewport = false, - .samplerAnisotropy = false, - .textureCompressionETC2 = true, - .textureCompressionASTC_LDR = PVR_HAS_FEATURE(&pdevice->dev_info, astc), - .textureCompressionBC = false, - .occlusionQueryPrecise = false, - .pipelineStatisticsQuery = false, - .vertexPipelineStoresAndAtomics = true, - .fragmentStoresAndAtomics = true, - .shaderTessellationAndGeometryPointSize = false, - .shaderImageGatherExtended = false, - .shaderStorageImageExtendedFormats = true, - .shaderStorageImageMultisample = false, - .shaderStorageImageReadWithoutFormat = true, - .shaderStorageImageWriteWithoutFormat = false, - .shaderUniformBufferArrayDynamicIndexing = true, - .shaderSampledImageArrayDynamicIndexing = true, - .shaderStorageBufferArrayDynamicIndexing = true, - .shaderStorageImageArrayDynamicIndexing = true, - .shaderClipDistance = false, - .shaderCullDistance = false, - .shaderFloat64 = false, - .shaderInt64 = true, - .shaderInt16 = true, - .shaderResourceResidency = false, - .shaderResourceMinLod = false, - .sparseBinding = false, - .sparseResidencyBuffer = false, - .sparseResidencyImage2D = false, - .sparseResidencyImage3D = false, - .sparseResidency2Samples = false, - .sparseResidency4Samples = false, - .sparseResidency8Samples = false, - .sparseResidency16Samples = false, - .sparseResidencyAliased = false, - .variableMultisampleRate = false, - .inheritedQueries = false, - }; - - vk_foreach_struct (ext, pFeatures->pNext) { - switch (ext->sType) { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES: { - VkPhysicalDevicePrivateDataFeatures *pFeature = - (VkPhysicalDevicePrivateDataFeatures *)ext; - pFeature->privateData = VK_TRUE; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: { - VkPhysicalDeviceTimelineSemaphoreFeatures *pFeature = - (VkPhysicalDeviceTimelineSemaphoreFeatures *)ext; - pFeature->timelineSemaphore = VK_TRUE; - break; - } - default: { - pvr_debug_ignored_stype(ext->sType); - break; - } - } - } -} - static uint32_t pvr_get_simultanous_num_allocs(const struct pvr_physical_device *pdevice) {