Lines Matching refs:instance
39 vk_instance_init(struct vk_instance *instance,
45 memset(instance, 0, sizeof(*instance));
46 vk_object_base_init(NULL, &instance->base, VK_OBJECT_TYPE_INSTANCE);
47 instance->alloc = *alloc;
54 list_inithead(&instance->debug_utils.instance_callbacks);
65 return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
77 &instance->debug_utils.instance_callbacks);
85 instance->app_info = (struct vk_app_info) { .api_version = 0 };
89 instance->app_info.app_name =
90 vk_strdup(&instance->alloc, app->pApplicationName,
92 instance->app_info.app_version = app->applicationVersion;
94 instance->app_info.engine_name =
95 vk_strdup(&instance->alloc, app->pEngineName,
97 instance->app_info.engine_version = app->engineVersion;
99 instance->app_info.api_version = app->apiVersion;
110 if (instance->app_info.api_version == 0)
111 instance->app_info.api_version = VK_API_VERSION_1_0;
120 assert(instance->app_info.api_version >= VK_API_VERSION_1_0);
130 !VERSION_IS_1_0(instance->app_info.api_version))
142 return vk_errorf(instance, VK_ERROR_EXTENSION_NOT_PRESENT,
147 return vk_errorf(instance, VK_ERROR_EXTENSION_NOT_PRESENT,
153 return vk_errorf(instance, VK_ERROR_EXTENSION_NOT_PRESENT,
158 instance->enabled_extensions.extensions[idx] = true;
161 instance->dispatch_table = *dispatch_table;
165 &instance->dispatch_table, &vk_common_instance_entrypoints, false);
167 if (mtx_init(&instance->debug_report.callbacks_mutex, mtx_plain) != 0)
168 return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
170 list_inithead(&instance->debug_report.callbacks);
172 if (mtx_init(&instance->debug_utils.callbacks_mutex, mtx_plain) != 0) {
173 mtx_destroy(&instance->debug_report.callbacks_mutex);
174 return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
177 list_inithead(&instance->debug_utils.callbacks);
185 vk_instance_finish(struct vk_instance *instance)
188 if (unlikely(!list_is_empty(&instance->debug_utils.callbacks))) {
190 &instance->debug_utils.callbacks, link) {
193 vk_free2(&instance->alloc, &messenger->alloc, messenger);
196 if (unlikely(!list_is_empty(&instance->debug_utils.instance_callbacks))) {
198 &instance->debug_utils.instance_callbacks,
202 vk_free2(&instance->alloc, &messenger->alloc, messenger);
205 mtx_destroy(&instance->debug_report.callbacks_mutex);
206 mtx_destroy(&instance->debug_utils.callbacks_mutex);
207 vk_free(&instance->alloc, (char *)instance->app_info.app_name);
208 vk_free(&instance->alloc, (char *)instance->app_info.engine_name);
209 vk_object_base_finish(&instance->base);
238 vk_instance_get_proc_addr(const struct vk_instance *instance,
260 /* GetInstanceProcAddr() can also be called with a NULL instance.
267 if (instance == NULL)
270 func = vk_instance_dispatch_table_get_if_supported(&instance->dispatch_table,
272 instance->app_info.api_version,
273 &instance->enabled_extensions);
279 instance->app_info.api_version,
280 &instance->enabled_extensions);
286 instance->app_info.api_version,
287 &instance->enabled_extensions,
296 vk_instance_get_proc_addr_unchecked(const struct vk_instance *instance,
301 if (instance == NULL || name == NULL)
304 func = vk_instance_dispatch_table_get(&instance->dispatch_table, name);
321 vk_instance_get_physical_device_proc_addr(const struct vk_instance *instance,
324 if (instance == NULL || name == NULL)
329 instance->app_info.api_version,
330 &instance->enabled_extensions);