Lines Matching defs:instance
35 vk_instance_init(struct vk_instance *instance,
41 memset(instance, 0, sizeof(*instance));
42 vk_object_base_init(NULL, &instance->base, VK_OBJECT_TYPE_INSTANCE);
43 instance->alloc = *alloc;
50 list_inithead(&instance->debug_utils.instance_callbacks);
61 return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
73 &instance->debug_utils.instance_callbacks);
77 instance->app_info = (struct vk_app_info) { .api_version = 0 };
81 instance->app_info.app_name =
82 vk_strdup(&instance->alloc, app->pApplicationName,
84 instance->app_info.app_version = app->applicationVersion;
86 instance->app_info.engine_name =
87 vk_strdup(&instance->alloc, app->pEngineName,
89 instance->app_info.engine_version = app->engineVersion;
91 instance->app_info.api_version = app->apiVersion;
94 if (instance->app_info.api_version == 0)
95 instance->app_info.api_version = VK_API_VERSION_1_0;
106 return vk_errorf(instance, VK_ERROR_EXTENSION_NOT_PRESENT,
111 return vk_errorf(instance, VK_ERROR_EXTENSION_NOT_PRESENT,
117 return vk_errorf(instance, VK_ERROR_EXTENSION_NOT_PRESENT,
122 instance->enabled_extensions.extensions[idx] = true;
125 instance->dispatch_table = *dispatch_table;
129 &instance->dispatch_table, &vk_common_instance_entrypoints, false);
131 if (mtx_init(&instance->debug_report.callbacks_mutex, mtx_plain) != 0)
132 return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
134 list_inithead(&instance->debug_report.callbacks);
136 if (mtx_init(&instance->debug_utils.callbacks_mutex, mtx_plain) != 0) {
137 mtx_destroy(&instance->debug_report.callbacks_mutex);
138 return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
141 list_inithead(&instance->debug_utils.callbacks);
149 vk_instance_finish(struct vk_instance *instance)
152 if (unlikely(!list_is_empty(&instance->debug_utils.callbacks))) {
154 &instance->debug_utils.callbacks, link) {
157 vk_free2(&instance->alloc, &messenger->alloc, messenger);
160 if (unlikely(!list_is_empty(&instance->debug_utils.instance_callbacks))) {
162 &instance->debug_utils.instance_callbacks,
166 vk_free2(&instance->alloc, &messenger->alloc, messenger);
169 mtx_destroy(&instance->debug_report.callbacks_mutex);
170 mtx_destroy(&instance->debug_utils.callbacks_mutex);
171 vk_free(&instance->alloc, (char *)instance->app_info.app_name);
172 vk_free(&instance->alloc, (char *)instance->app_info.engine_name);
173 vk_object_base_finish(&instance->base);
202 vk_instance_get_proc_addr(const struct vk_instance *instance,
224 /* GetInstanceProcAddr() can also be called with a NULL instance.
231 if (instance == NULL)
234 func = vk_instance_dispatch_table_get_if_supported(&instance->dispatch_table,
236 instance->app_info.api_version,
237 &instance->enabled_extensions);
243 instance->app_info.api_version,
244 &instance->enabled_extensions);
250 instance->app_info.api_version,
251 &instance->enabled_extensions,
260 vk_instance_get_proc_addr_unchecked(const struct vk_instance *instance,
265 if (instance == NULL || name == NULL)
268 func = vk_instance_dispatch_table_get(&instance->dispatch_table, name);
285 vk_instance_get_physical_device_proc_addr(const struct vk_instance *instance,
288 if (instance == NULL || name == NULL)
293 instance->app_info.api_version,
294 &instance->enabled_extensions);