1 /*
2  * Copyright 2019 Google LLC
3  * SPDX-License-Identifier: MIT
4  *
5  * based in part on anv and radv which are:
6  * Copyright © 2015 Intel Corporation
7  * Copyright © 2016 Red Hat.
8  * Copyright © 2016 Bas Nieuwenhuizen
9  */
10 
11 #ifndef VN_PHYSICAL_DEVICE_H
12 #define VN_PHYSICAL_DEVICE_H
13 
14 #include "vn_common.h"
15 
16 #include "vn_wsi.h"
17 
18 struct vn_physical_device {
19    struct vn_physical_device_base base;
20 
21    struct vn_instance *instance;
22 
23    /* Between the driver and the app, properties.properties.apiVersion is what
24     * we advertise and is capped by VN_MAX_API_VERSION and others.
25     *
26     * Between the driver and the renderer, renderer_version is the device
27     * version we can use internally.
28     */
29    uint32_t renderer_version;
30 
31    /* Between the driver and the app, base.base.supported_extensions is what
32     * we advertise.
33     *
34     * Between the driver and the renderer, renderer_extensions is what we can
35     * use internally (after enabling).
36     */
37    struct vk_device_extension_table renderer_extensions;
38    uint32_t *extension_spec_versions;
39 
40    VkPhysicalDeviceFeatures2 features;
41    VkPhysicalDeviceVulkan11Features vulkan_1_1_features;
42    VkPhysicalDeviceVulkan12Features vulkan_1_2_features;
43    VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features;
44 
45    VkPhysicalDeviceProperties2 properties;
46    VkPhysicalDeviceVulkan11Properties vulkan_1_1_properties;
47    VkPhysicalDeviceVulkan12Properties vulkan_1_2_properties;
48    VkPhysicalDeviceTransformFeedbackPropertiesEXT
49       transform_feedback_properties;
50 
51    VkQueueFamilyProperties2 *queue_family_properties;
52    uint32_t queue_family_count;
53 
54    VkPhysicalDeviceMemoryProperties2 memory_properties;
55 
56    struct {
57       VkExternalMemoryHandleTypeFlagBits renderer_handle_type;
58       VkExternalMemoryHandleTypeFlags supported_handle_types;
59    } external_memory;
60 
61    VkExternalFenceHandleTypeFlags external_fence_handles;
62    VkExternalSemaphoreHandleTypeFlags external_binary_semaphore_handles;
63    VkExternalSemaphoreHandleTypeFlags external_timeline_semaphore_handles;
64 
65    struct wsi_device wsi_device;
66 };
67 VK_DEFINE_HANDLE_CASTS(vn_physical_device,
68                        base.base.base,
69                        VkPhysicalDevice,
70                        VK_OBJECT_TYPE_PHYSICAL_DEVICE)
71 
72 void
73 vn_physical_device_fini(struct vn_physical_device *physical_dev);
74 
75 #endif /* VN_PHYSICAL_DEVICE_H */
76