MCPcopy Create free account
hub / github.com/Ipotrick/Daxa / initialize_physical_devices

Method initialize_physical_devices

src/impl_instance.cpp:111–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111auto daxa_ImplInstance::initialize_physical_devices() -> daxa_Result
112{
113 u32 device_count = {};
114 daxa_Result result = static_cast<daxa_Result>(vkEnumeratePhysicalDevices(this->vk_instance, &device_count, nullptr));
115 _DAXA_RETURN_IF_ERROR(result, result);
116
117 std::vector<VkPhysicalDevice> vk_physical_devices = {};
118 this->device_internals.resize(device_count);
119 this->device_properties.resize(device_count);
120 vk_physical_devices.resize(device_count);
121 result = static_cast<daxa_Result>(vkEnumeratePhysicalDevices(this->vk_instance, &device_count, vk_physical_devices.data()));
122 _DAXA_RETURN_IF_ERROR(result, result);
123
124 for (u32 i = 0; i < device_count; ++i)
125 {
126 auto & internals = this->device_internals[i];
127 auto & properties = this->device_properties[i];
128 internals.vk_handle = vk_physical_devices[i];
129
130 // Init extensions:
131 result = internals.extensions.initialize(internals.vk_handle);
132 _DAXA_RETURN_IF_ERROR(result, result);
133
134 // Init features:
135 internals.features.initialize(internals.extensions);
136 vkGetPhysicalDeviceFeatures2(internals.vk_handle, &internals.features.physical_device_features_2);
137
138 // Init properties:
139 fill_daxa_device_properties(internals.extensions, internals.features, internals.vk_handle, &properties);
140 }
141
142 return DAXA_RESULT_SUCCESS;
143}
144
145void daxa_instance_list_devices_properties(daxa_Instance self, daxa_DeviceProperties const ** properties, daxa_u32 * property_count)
146{

Callers 1

daxa_create_instanceFunction · 0.80

Calls 4

resizeMethod · 0.45
dataMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected