diff --git a/docs/features.txt b/docs/features.txt index 806934c134d..2ef4bf5a690 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -509,7 +509,7 @@ Vulkan 1.3 -- all DONE: anv, lvp, nvk, radv, tu, vn, v3dv VK_EXT_tooling_info DONE (anv, hasvk, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_EXT_ycbcr_2plane_444_formats DONE (anv, lvp, nvk, panvk/v10+, vn) -Vulkan 1.4 -- all DONE: anv, lvp, nvk, radv/gfx8+, tu/a7xx+ +Vulkan 1.4 -- all DONE: anv, lvp, nvk, radv/gfx8+, tu/a7xx+, vn VK_KHR_dynamic_rendering_local_read DONE (anv, lvp, nvk, radv, tu, vn) VK_KHR_global_priority DONE (anv, lvp, nvk, panvk, radv, tu, vn) diff --git a/src/virtio/vulkan/vn_instance.h b/src/virtio/vulkan/vn_instance.h index 919c926e20c..7e758bceab1 100644 --- a/src/virtio/vulkan/vn_instance.h +++ b/src/virtio/vulkan/vn_instance.h @@ -20,10 +20,16 @@ #define VN_MIN_RENDERER_VERSION VK_API_VERSION_1_1 /* max advertised version at both instance and device levels */ -#if defined(ANDROID_STRICT) && ANDROID_API_LEVEL < 33 +#ifdef ANDROID_STRICT +#if ANDROID_API_LEVEL < 33 #define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 1, VK_HEADER_VERSION) -#else +#elif ANDROID_API_LEVEL < 36 #define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 3, VK_HEADER_VERSION) +#else /* ANDROID_API_LEVEL >= 36 */ +#define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 4, VK_HEADER_VERSION) +#endif +#else /* ANDROID_STRICT */ +#define VN_MAX_API_VERSION VK_MAKE_VERSION(1, 4, VK_HEADER_VERSION) #endif struct vn_instance { diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index abcd91eb0b6..54640687c5d 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -73,6 +73,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) VkPhysicalDeviceVulkan11Features vulkan_1_1; VkPhysicalDeviceVulkan12Features vulkan_1_2; VkPhysicalDeviceVulkan13Features vulkan_1_3; + VkPhysicalDeviceVulkan14Features vulkan_1_4; /* Vulkan 1.1 */ VkPhysicalDevice16BitStorageFeatures _16bit_storage; @@ -252,18 +253,25 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) VN_ADD_PNEXT_EXT(feats2, YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT, local_feats.ycbcr_2plane_444_formats, exts->EXT_ycbcr_2plane_444_formats); /* Vulkan 1.4 */ + if (renderer_version >= VK_API_VERSION_1_4) { + VN_ADD_PNEXT(feats2, VULKAN_1_4_FEATURES, local_feats.vulkan_1_4); + } else { + VN_ADD_PNEXT_EXT(feats2, GLOBAL_PRIORITY_QUERY_FEATURES, local_feats.global_priority_query, exts->KHR_global_priority || exts->EXT_global_priority_query); + VN_ADD_PNEXT_EXT(feats2, INDEX_TYPE_UINT8_FEATURES, local_feats.index_type_uint8, exts->KHR_index_type_uint8 || exts->EXT_index_type_uint8); + VN_ADD_PNEXT_EXT(feats2, LINE_RASTERIZATION_FEATURES, local_feats.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization); + VN_ADD_PNEXT_EXT(feats2, MAINTENANCE_5_FEATURES, local_feats.maintenance_5, exts->KHR_maintenance5); + VN_ADD_PNEXT_EXT(feats2, MAINTENANCE_6_FEATURES, local_feats.maintenance_6, exts->KHR_maintenance6); + VN_ADD_PNEXT_EXT(feats2, PIPELINE_PROTECTED_ACCESS_FEATURES, local_feats.pipeline_protected_access, exts->EXT_pipeline_protected_access); + VN_ADD_PNEXT_EXT(feats2, PIPELINE_ROBUSTNESS_FEATURES, local_feats.pipeline_robustness, exts->EXT_pipeline_robustness); + VN_ADD_PNEXT_EXT(feats2, SHADER_EXPECT_ASSUME_FEATURES, local_feats.shader_expect_assume, exts->KHR_shader_expect_assume); + VN_ADD_PNEXT_EXT(feats2, SHADER_FLOAT_CONTROLS_2_FEATURES, local_feats.shader_float_controls_2, exts->KHR_shader_float_controls2); + VN_ADD_PNEXT_EXT(feats2, SHADER_SUBGROUP_ROTATE_FEATURES, local_feats.shader_subgroup_rotate, exts->KHR_shader_subgroup_rotate); + VN_ADD_PNEXT_EXT(feats2, VERTEX_ATTRIBUTE_DIVISOR_FEATURES, local_feats.vertex_attribute_divisor, exts->KHR_vertex_attribute_divisor || exts->EXT_vertex_attribute_divisor); + } + + /* Vulkan 1.4: dynamicRenderingLocalRead feature is partially promoted + */ VN_ADD_PNEXT_EXT(feats2, DYNAMIC_RENDERING_LOCAL_READ_FEATURES, local_feats.dynamic_rendering_local_read, exts->KHR_dynamic_rendering_local_read); - VN_ADD_PNEXT_EXT(feats2, GLOBAL_PRIORITY_QUERY_FEATURES, local_feats.global_priority_query, exts->KHR_global_priority || exts->EXT_global_priority_query); - VN_ADD_PNEXT_EXT(feats2, INDEX_TYPE_UINT8_FEATURES, local_feats.index_type_uint8, exts->KHR_index_type_uint8 || exts->EXT_index_type_uint8); - VN_ADD_PNEXT_EXT(feats2, LINE_RASTERIZATION_FEATURES, local_feats.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization); - VN_ADD_PNEXT_EXT(feats2, MAINTENANCE_5_FEATURES, local_feats.maintenance_5, exts->KHR_maintenance5); - VN_ADD_PNEXT_EXT(feats2, MAINTENANCE_6_FEATURES, local_feats.maintenance_6, exts->KHR_maintenance6); - VN_ADD_PNEXT_EXT(feats2, PIPELINE_PROTECTED_ACCESS_FEATURES, local_feats.pipeline_protected_access, exts->EXT_pipeline_protected_access); - VN_ADD_PNEXT_EXT(feats2, PIPELINE_ROBUSTNESS_FEATURES, local_feats.pipeline_robustness, exts->EXT_pipeline_robustness); - VN_ADD_PNEXT_EXT(feats2, SHADER_EXPECT_ASSUME_FEATURES, local_feats.shader_expect_assume, exts->KHR_shader_expect_assume); - VN_ADD_PNEXT_EXT(feats2, SHADER_FLOAT_CONTROLS_2_FEATURES, local_feats.shader_float_controls_2, exts->KHR_shader_float_controls2); - VN_ADD_PNEXT_EXT(feats2, SHADER_SUBGROUP_ROTATE_FEATURES, local_feats.shader_subgroup_rotate, exts->KHR_shader_subgroup_rotate); - VN_ADD_PNEXT_EXT(feats2, VERTEX_ATTRIBUTE_DIVISOR_FEATURES, local_feats.vertex_attribute_divisor, exts->KHR_vertex_attribute_divisor || exts->EXT_vertex_attribute_divisor); /* KHR */ VN_ADD_PNEXT_EXT(feats2, FRAGMENT_SHADING_RATE_FEATURES_KHR, local_feats.fragment_shading_rate, exts->KHR_fragment_shading_rate); @@ -303,6 +311,10 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev) struct vk_features *feats = &physical_dev->base.base.supported_features; vk_set_physical_device_features(feats, &feats2); + if (renderer_version >= VK_API_VERSION_1_4 && + !physical_dev->base.base.supported_extensions.EXT_host_image_copy) + feats->hostImageCopy = false; + /* Enable features for extensions natively implemented in Venus driver. * See vn_physical_device_get_native_extensions. */ @@ -415,11 +427,22 @@ vn_physical_device_sanitize_properties(struct vn_physical_device *physical_dev) "Mesa " PACKAGE_VERSION MESA_GIT_SHA1); props->conformanceVersion.major = 1; - props->conformanceVersion.minor = 3; + props->conformanceVersion.minor = 4; props->conformanceVersion.subminor = 0; props->conformanceVersion.patch = 0; vn_physical_device_init_uuids(physical_dev); + + if (physical_dev->renderer_version >= VK_API_VERSION_1_4 && + !physical_dev->base.base.supported_extensions.EXT_host_image_copy) { + props->copySrcLayoutCount = 0; + props->pCopySrcLayouts = NULL; + props->copyDstLayoutCount = 0; + props->pCopyDstLayouts = NULL; + memset(props->optimalTilingLayoutUUID, 0, + sizeof(props->optimalTilingLayoutUUID)); + props->identicalMemoryTypeRequirements = false; + } } static void @@ -463,6 +486,7 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev) VkPhysicalDeviceTexelBufferAlignmentProperties texel_buffer_alignment; /* Vulkan 1.4 */ + VkPhysicalDeviceVulkan14Properties vulkan_1_4; VkPhysicalDeviceLineRasterizationProperties line_rasterization; VkPhysicalDeviceMaintenance5Properties maintenance_5; VkPhysicalDeviceMaintenance6Properties maintenance_6; @@ -533,12 +557,16 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev) } /* Vulkan 1.4 */ - VN_ADD_PNEXT_EXT(props2, LINE_RASTERIZATION_PROPERTIES, local_props.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization); - VN_ADD_PNEXT_EXT(props2, MAINTENANCE_5_PROPERTIES, local_props.maintenance_5, exts->KHR_maintenance5); - VN_ADD_PNEXT_EXT(props2, MAINTENANCE_6_PROPERTIES, local_props.maintenance_6, exts->KHR_maintenance6); - VN_ADD_PNEXT_EXT(props2, PIPELINE_ROBUSTNESS_PROPERTIES, local_props.pipeline_robustness, exts->EXT_pipeline_robustness); - VN_ADD_PNEXT_EXT(props2, PUSH_DESCRIPTOR_PROPERTIES, local_props.push_descriptor, exts->KHR_push_descriptor); - VN_ADD_PNEXT_EXT(props2, VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES, local_props.vertex_attribute_divisor, exts->KHR_vertex_attribute_divisor); + if (renderer_version >= VK_API_VERSION_1_4) { + VN_ADD_PNEXT(props2, VULKAN_1_4_PROPERTIES, local_props.vulkan_1_4); + } else { + VN_ADD_PNEXT_EXT(props2, LINE_RASTERIZATION_PROPERTIES, local_props.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization); + VN_ADD_PNEXT_EXT(props2, MAINTENANCE_5_PROPERTIES, local_props.maintenance_5, exts->KHR_maintenance5); + VN_ADD_PNEXT_EXT(props2, MAINTENANCE_6_PROPERTIES, local_props.maintenance_6, exts->KHR_maintenance6); + VN_ADD_PNEXT_EXT(props2, PIPELINE_ROBUSTNESS_PROPERTIES, local_props.pipeline_robustness, exts->EXT_pipeline_robustness); + VN_ADD_PNEXT_EXT(props2, PUSH_DESCRIPTOR_PROPERTIES, local_props.push_descriptor, exts->KHR_push_descriptor); + VN_ADD_PNEXT_EXT(props2, VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES, local_props.vertex_attribute_divisor, exts->KHR_vertex_attribute_divisor); + } /* KHR */ VN_ADD_PNEXT_EXT(props2, FRAGMENT_SHADING_RATE_PROPERTIES_KHR, local_props.fragment_shading_rate, exts->KHR_fragment_shading_rate); @@ -602,12 +630,16 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev) } /* Vulkan 1.4 */ - VN_SET_VK_PROPS_EXT(props, &local_props.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization); - VN_SET_VK_PROPS_EXT(props, &local_props.maintenance_5, exts->KHR_maintenance5); - VN_SET_VK_PROPS_EXT(props, &local_props.maintenance_6, exts->KHR_maintenance6); - VN_SET_VK_PROPS_EXT(props, &local_props.pipeline_robustness, exts->EXT_pipeline_robustness); - VN_SET_VK_PROPS_EXT(props, &local_props.push_descriptor, exts->KHR_push_descriptor); - VN_SET_VK_PROPS_EXT(props, &local_props.vertex_attribute_divisor, exts->KHR_vertex_attribute_divisor); + if (renderer_version >= VK_API_VERSION_1_4) { + VN_SET_VK_PROPS(props, &local_props.vulkan_1_4); + } else { + VN_SET_VK_PROPS_EXT(props, &local_props.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization); + VN_SET_VK_PROPS_EXT(props, &local_props.maintenance_5, exts->KHR_maintenance5); + VN_SET_VK_PROPS_EXT(props, &local_props.maintenance_6, exts->KHR_maintenance6); + VN_SET_VK_PROPS_EXT(props, &local_props.pipeline_robustness, exts->EXT_pipeline_robustness); + VN_SET_VK_PROPS_EXT(props, &local_props.push_descriptor, exts->KHR_push_descriptor); + VN_SET_VK_PROPS_EXT(props, &local_props.vertex_attribute_divisor, exts->KHR_vertex_attribute_divisor); + } /* KHR */ VN_SET_VK_PROPS_EXT(props, &local_props.fragment_shading_rate, exts->KHR_fragment_shading_rate);