summaryrefslogtreecommitdiff
path: root/src/amd/vulkan/radv_device.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2021-02-07 16:01:50 +0100
committerMarge Bot <eric+marge@anholt.net>2021-02-12 01:56:00 +0000
commitc78b372dd06b7156d897e4493ac7bac7bdb3622a (patch)
tree0f38f34c1d3694248523cd3df24f9183467a81ac /src/amd/vulkan/radv_device.c
parent8331b7c8d51e577a8ca37a9532864d1b90c130b6 (diff)
radv: Define supported extensions in C.
One python generator less. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8900>
Diffstat (limited to 'src/amd/vulkan/radv_device.c')
-rw-r--r--src/amd/vulkan/radv_device.c193
1 files changed, 192 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index d7e9d9bc42c..6a11f8a2141 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -288,6 +288,197 @@ radv_get_compiler_string(struct radv_physical_device *pdevice)
return "LLVM " MESA_LLVM_VERSION_STRING;
}
+#if defined(VK_USE_PLATFORM_WAYLAND_KHR) || \
+ defined(VK_USE_PLATFORM_XCB_KHR) || \
+ defined(VK_USE_PLATFORM_XLIB_KHR) || \
+ defined(VK_USE_PLATFORM_DISPLAY_KHR)
+#define RADV_USE_WSI_PLATFORM
+#endif
+
+#ifdef ANDROID
+#define RADV_API_VERSION VK_MAKE_VERSION(1, 1, VK_HEADER_VERSION)
+#else
+#define RADV_API_VERSION VK_MAKE_VERSION(1, 2, VK_HEADER_VERSION)
+#endif
+
+VkResult radv_EnumerateInstanceVersion(uint32_t* pApiVersion)
+{
+ *pApiVersion = RADV_API_VERSION;
+ return VK_SUCCESS;
+}
+
+static const struct vk_instance_extension_table radv_instance_extensions_supported = {
+ .KHR_device_group_creation = true,
+ .KHR_external_fence_capabilities = true,
+ .KHR_external_memory_capabilities = true,
+ .KHR_external_semaphore_capabilities = true,
+ .KHR_get_physical_device_properties2 = true,
+ .EXT_debug_report = true,
+
+#ifdef RADV_USE_WSI_PLATFORM
+ .KHR_get_surface_capabilities2 = true,
+ .KHR_surface = true,
+ .KHR_surface_protected_capabilities = true,
+#endif
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+ .KHR_wayland_surface = true,
+#endif
+#ifdef VK_USE_PLATFORM_XCB_KHR
+ .KHR_xcb_surface = true,
+#endif
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+ .KHR_xlib_surface = true,
+#endif
+#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
+ .EXT_acquire_xlib_display = true,
+#endif
+#ifdef VK_USE_PLATFORM_DISPLAY_KHR
+ .KHR_display = true,
+ .KHR_get_display_properties2 = true,
+ .EXT_direct_mode_display = true,
+ .EXT_display_surface_counter = true,
+#endif
+};
+
+static void
+radv_physical_device_get_supported_extensions(const struct radv_physical_device *device,
+ struct vk_device_extension_table *ext)
+{
+ *ext = (struct vk_device_extension_table) {
+ .KHR_8bit_storage = true,
+ .KHR_16bit_storage = true,
+ .KHR_bind_memory2 = true,
+ .KHR_buffer_device_address = true,
+ .KHR_copy_commands2 = true,
+ .KHR_create_renderpass2 = true,
+ .KHR_dedicated_allocation = true,
+ .KHR_deferred_host_operations = true,
+ .KHR_depth_stencil_resolve = true,
+ .KHR_descriptor_update_template = true,
+ .KHR_device_group = true,
+ .KHR_draw_indirect_count = true,
+ .KHR_driver_properties = true,
+ .KHR_external_fence = device->rad_info.has_syncobj_wait_for_submit,
+ .KHR_external_fence_fd = device->rad_info.has_syncobj_wait_for_submit,
+ .KHR_external_memory = true,
+ .KHR_external_memory_fd = true,
+ .KHR_external_semaphore = device->rad_info.has_syncobj,
+ .KHR_external_semaphore_fd = device->rad_info.has_syncobj,
+ .KHR_fragment_shading_rate = device->rad_info.chip_class >= GFX10_3,
+ .KHR_get_memory_requirements2 = true,
+ .KHR_image_format_list = true,
+ .KHR_imageless_framebuffer = true,
+#ifdef RADV_USE_WSI_PLATFORM
+ .KHR_incremental_present = true,
+#endif
+ .KHR_maintenance1 = true,
+ .KHR_maintenance2 = true,
+ .KHR_maintenance3 = true,
+ .KHR_multiview = true,
+ .KHR_pipeline_executable_properties = true,
+ .KHR_push_descriptor = true,
+ .KHR_relaxed_block_layout = true,
+ .KHR_sampler_mirror_clamp_to_edge = true,
+ .KHR_sampler_ycbcr_conversion = true,
+ .KHR_separate_depth_stencil_layouts = true,
+ .KHR_shader_atomic_int64 = LLVM_VERSION_MAJOR >= 9 || !device->use_llvm,
+ .KHR_shader_clock = true,
+ .KHR_shader_draw_parameters = true,
+ .KHR_shader_float16_int8 = true,
+ .KHR_shader_float_controls = true,
+ .KHR_shader_non_semantic_info = true,
+ .KHR_shader_subgroup_extended_types = true,
+ .KHR_shader_terminate_invocation = true,
+ .KHR_spirv_1_4 = true,
+ .KHR_storage_buffer_storage_class = true,
+#ifdef RADV_USE_WSI_PLATFORM
+ .KHR_swapchain = true,
+ .KHR_swapchain_mutable_format = true,
+#endif
+ .KHR_timeline_semaphore = device->rad_info.has_syncobj_wait_for_submit,
+ .KHR_uniform_buffer_standard_layout = true,
+ .KHR_variable_pointers = true,
+ .KHR_vulkan_memory_model = true,
+ .KHR_workgroup_memory_explicit_layout = true,
+ .KHR_zero_initialize_workgroup_memory = true,
+ .EXT_4444_formats = true,
+ .EXT_buffer_device_address = true,
+ .EXT_calibrated_timestamps = RADV_SUPPORT_CALIBRATED_TIMESTAMPS,
+ .EXT_conditional_rendering = true,
+ .EXT_conservative_rasterization = device->rad_info.chip_class >= GFX9,
+ .EXT_custom_border_color = true,
+ .EXT_depth_clip_enable = true,
+ .EXT_depth_range_unrestricted = true,
+ .EXT_descriptor_indexing = true,
+ .EXT_discard_rectangles = true,
+#ifdef VK_USE_PLATFORM_DISPLAY_KHR
+ .EXT_display_control = device->rad_info.has_syncobj_wait_for_submit,
+#endif
+ .EXT_extended_dynamic_state = true,
+ .EXT_external_memory_dma_buf = true,
+ .EXT_external_memory_host = device->rad_info.has_userptr,
+ .EXT_global_priority = device->rad_info.has_ctx_priority,
+ .EXT_host_query_reset = true,
+ .EXT_image_drm_format_modifier = device->rad_info.chip_class >= GFX9,
+ .EXT_image_robustness = true,
+ .EXT_index_type_uint8 = device->rad_info.chip_class >= GFX8,
+ .EXT_inline_uniform_block = true,
+ .EXT_line_rasterization = true,
+ .EXT_memory_budget = true,
+ .EXT_memory_priority = true,
+ .EXT_pci_bus_info = true,
+ .EXT_pipeline_creation_cache_control = true,
+ .EXT_pipeline_creation_feedback = true,
+ .EXT_post_depth_coverage = device->rad_info.chip_class >= GFX10,
+ .EXT_private_data = true,
+ .EXT_queue_family_foreign = true,
+ .EXT_robustness2 = true,
+ .EXT_sample_locations = device->rad_info.chip_class < GFX10,
+ .EXT_sampler_filter_minmax = true,
+ .EXT_scalar_block_layout = device->rad_info.chip_class >= GFX7,
+ .EXT_shader_atomic_float = true,
+ .EXT_shader_demote_to_helper_invocation = LLVM_VERSION_MAJOR >= 9 || !device->use_llvm,
+ .EXT_shader_image_atomic_int64 = LLVM_VERSION_MAJOR >= 11 || !device->use_llvm,
+ .EXT_shader_stencil_export = true,
+ .EXT_shader_subgroup_ballot = true,
+ .EXT_shader_subgroup_vote = true,
+ .EXT_shader_viewport_index_layer = true,
+ .EXT_subgroup_size_control = true,
+ .EXT_texel_buffer_alignment = true,
+ .EXT_transform_feedback = true,
+ .EXT_vertex_attribute_divisor = true,
+ .EXT_ycbcr_image_arrays = true,
+ .AMD_buffer_marker = true,
+ .AMD_device_coherent_memory = true,
+ .AMD_draw_indirect_count = true,
+ .AMD_gcn_shader = true,
+ .AMD_gpu_shader_half_float = device->rad_info.has_packed_math_16bit,
+ .AMD_gpu_shader_int16 = device->rad_info.has_packed_math_16bit,
+ .AMD_memory_overallocation_behavior = true,
+ .AMD_mixed_attachment_samples = true,
+ .AMD_rasterization_order = device->rad_info.has_out_of_order_rast,
+ .AMD_shader_ballot = true,
+ .AMD_shader_core_properties = true,
+ .AMD_shader_core_properties2 = true,
+ .AMD_shader_explicit_vertex_parameter = true,
+ .AMD_shader_fragment_mask = true,
+ .AMD_shader_image_load_store_lod = true,
+ .AMD_shader_info = true,
+ .AMD_shader_trinary_minmax = true,
+ .AMD_texture_gather_bias_lod = true,
+#ifdef ANDROID
+ .ANDROID_external_memory_android_hardware_buffer = RADV_SUPPORT_ANDROID_HARDWARE_BUFFER &&
+ device->rad_info.has_syncobj_wait_for_submit,
+ .ANDROID_native_buffer = device->rad_info.has_syncobj_wait_for_submit,
+#endif
+ .GOOGLE_decorate_string = true,
+ .GOOGLE_hlsl_functionality1 = true,
+ .GOOGLE_user_type = true,
+ .NV_compute_shader_derivatives = true,
+ .VALVE_mutable_descriptor_type = true,
+ };
+}
+
static VkResult
radv_physical_device_try_create(struct radv_instance *instance,
drmDevicePtr drm_device,
@@ -1614,7 +1805,7 @@ void radv_GetPhysicalDeviceProperties(
};
*pProperties = (VkPhysicalDeviceProperties) {
- .apiVersion = radv_physical_device_api_version(pdevice),
+ .apiVersion = RADV_API_VERSION,
.driverVersion = vk_get_driver_version(),
.vendorID = ATI_VENDOR_ID,
.deviceID = pdevice->rad_info.pci_id,