memset(layer_properties, 0, sizeof(struct loader_layer_properties));
}
+VkResult loader_init_library_list(struct loader_layer_list *instance_layers, loader_platform_dl_handle **libs) {
+ if (instance_layers->count > 0) {
+ *libs = loader_calloc(NULL, sizeof(loader_platform_dl_handle) * instance_layers->count, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+ if (*libs == NULL) {
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ }
+ return VK_SUCCESS;
+}
+
// Combine path elements, separating each element with the platform-specific
// directory separator, and save the combined string to a destination buffer,
// not exceeding the given length. Path elements are given as variable args,
return res;
}
-VkResult loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers,
- loader_platform_dl_handle **libs) {
+VkResult loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers) {
struct loader_envvar_filter enable_filter;
struct loader_envvar_disable_layers_filter disable_filter;
char *file_str;
}
}
- // We'll need to save the dl handles so we can close them later
- if (instance_layers->count > 0 && NULL != libs) {
- *libs = loader_calloc(NULL, sizeof(loader_platform_dl_handle) * instance_layers->count, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
- if (*libs == NULL) {
- res = VK_ERROR_OUT_OF_HOST_MEMORY;
- goto out;
- }
- }
-
out:
loader_instance_heap_free(inst, override_paths);
loader_scanned_icd_clear(NULL, &icd_tramp_list);
// Append enabled implicit layers.
- res = loader_scan_for_implicit_layers(NULL, &instance_layers, NULL);
+ res = loader_scan_for_implicit_layers(NULL, &instance_layers);
if (VK_SUCCESS != res) {
goto out;
}
void loader_release(void);
void loader_preload_icds(void);
void loader_unload_preloaded_icds(void);
+VkResult loader_init_library_list(struct loader_layer_list *instance_layers, loader_platform_dl_handle **libs);
+
bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, const uint32_t count,
const VkExtensionProperties *ext_array);
bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, const struct loader_extension_list *ext_list);
void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term,
const VkAllocationCallbacks *pAllocator);
VkResult loader_scan_for_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers);
-VkResult loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers,
- loader_platform_dl_handle **libs);
+VkResult loader_scan_for_implicit_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers);
VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list,
struct loader_extension_list *inst_exts);
struct loader_icd_term *loader_get_icd_and_device(const void *device, struct loader_device **found_dev, uint32_t *icd_index);
size_t lib_count = 0;
memset(&layers, 0, sizeof(layers));
- res = loader_scan_for_implicit_layers(NULL, &layers, &libs);
+ res = loader_scan_for_implicit_layers(NULL, &layers);
+ if (VK_SUCCESS != res) {
+ return res;
+ }
+
+ res = loader_init_library_list(&layers, &libs);
if (VK_SUCCESS != res) {
return res;
}
size_t lib_count = 0;
memset(&layers, 0, sizeof(layers));
- res = loader_scan_for_implicit_layers(NULL, &layers, &libs);
+ res = loader_scan_for_implicit_layers(NULL, &layers);
+ if (VK_SUCCESS != res) {
+ return res;
+ }
+
+ res = loader_init_library_list(&layers, &libs);
if (VK_SUCCESS != res) {
return res;
}
size_t lib_count = 0;
memset(&layers, 0, sizeof(layers));
- res = loader_scan_for_implicit_layers(NULL, &layers, &libs);
+ res = loader_scan_for_implicit_layers(NULL, &layers);
+ if (VK_SUCCESS != res) {
+ return res;
+ }
+
+ res = loader_init_library_list(&layers, &libs);
if (VK_SUCCESS != res) {
return res;
}