From c5bd152da9aebd7b3a073bddbdf78dcd7dce5a86 Mon Sep 17 00:00:00 2001 From: Mark Young Date: Thu, 4 May 2017 12:16:35 -0600 Subject: loader: Fix layer Enumerate bug This fixes a bug found by Timothee Besset regarding calling vkEnumerateDeviceLayerProperties when no layers are present. This resulted in a negative number being filled into a uint32_t which caused an invalid number of layers to be returned. Now that we have meta-layers implemented instead of hard-coded, I created two lists: an application provided list of layers, and an expanded list of layers (where meta-layers are broken up into their component layers). The former is used when working with the enumerate calls, but the later is used internally for final layer activation. Change-Id: If723fdfb5acb1dc57923282d2c641c582870ad1c --- loader/loader.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'loader/loader.h') diff --git a/loader/loader.h b/loader/loader.h index 28390753..2c65923d 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -180,7 +180,13 @@ struct loader_device { VkDevice icd_device; // device object from the icd struct loader_physical_device_term *phys_dev_term; - struct loader_layer_list activated_layer_list; + // List of activated layers. + // app_ is the version based on exactly what the application asked for. + // This is what must be returned to the application on Enumerate calls. + // expanded_ is the version based on expanding meta-layers into their + // individual component layers. This is what is used internally. + struct loader_layer_list app_activated_layer_list; + struct loader_layer_list expanded_activated_layer_list; VkAllocationCallbacks alloc_callbacks; @@ -250,7 +256,15 @@ struct loader_instance { struct loader_msg_callback_map_entry *icd_msg_callback_map; struct loader_layer_list instance_layer_list; - struct loader_layer_list activated_layer_list; + + // List of activated layers. + // app_ is the version based on exactly what the application asked for. + // This is what must be returned to the application on Enumerate calls. + // expanded_ is the version based on expanding meta-layers into their + // individual component layers. This is what is used internally. + struct loader_layer_list app_activated_layer_list; + struct loader_layer_list expanded_activated_layer_list; + VkInstance instance; // layers/ICD instance returned to trampoline struct loader_extension_list ext_list; // icds and loaders extensions @@ -420,7 +434,8 @@ bool loader_find_layer_name_array(const char *name, uint32_t layer_count, const VkResult loader_add_to_layer_list(const struct loader_instance *inst, struct loader_layer_list *list, uint32_t prop_list_count, const struct loader_layer_properties *props); void loader_find_layer_name_add_list(const struct loader_instance *inst, const char *name, const enum layer_type_flags type_flags, - const struct loader_layer_list *search_list, struct loader_layer_list *found_list); + const struct loader_layer_list *source_list, struct loader_layer_list *target_list, + struct loader_layer_list *expanded_target_list); void loader_scanned_icd_clear(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); void loader_layer_scan(const struct loader_instance *inst, struct loader_layer_list *instance_layers); -- cgit v1.2.3