aboutsummaryrefslogtreecommitdiff
path: root/loader/loader.h
diff options
context:
space:
mode:
authorPiers Daniell <pdaniell@nvidia.com>2016-03-29 11:51:11 -0600
committerJon Ashburn <jon@lunarg.com>2016-04-01 11:24:31 -0600
commit8bc0c51ef3c01a3964f3bcf16ef639aaedf259f7 (patch)
tree0d5886ba11f8ded12654d170647a0a56b79845ee /loader/loader.h
parent62cef16bdf6155f136202daae711a80a1deb0351 (diff)
downloadusermoji-8bc0c51ef3c01a3964f3bcf16ef639aaedf259f7.tar.xz
loader: Remove trampoline/terminator dependency in vkEnumeratePhysicalDevices
There was a dependency between the trampoline vkEnumeratePhysicalDevices and the terminator vkEnumeratePhysicalDevices via the loader_instance.phys_devs_term array which may break layers that manipulate the enumerated VkPhysicalDevice list. This dependency assumed the devices in loader_instance.phys_devs_term and loader_instance.phys_devs were in the same order and that it could assume the index of one corresponding to the same VkPhysicalDevice of the other. Breaking this dependency allows layers to modify or reorder the VkPhysicalDevice list by intercepting the vkEnumeratePhysicalDevices function without causing the loader to crash. In general, there should never be a dependency between the trampoline code and the terminator code because it has the potential to break unknown layers between them. Conflicts: loader/loader.c loader/trampoline.c Change-Id: Iafefd6e8b7dd58d398a76533f957123242c01b56
Diffstat (limited to 'loader/loader.h')
-rw-r--r--loader/loader.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/loader/loader.h b/loader/loader.h
index 2c3240eb..244066c0 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -323,9 +323,7 @@ struct loader_instance {
* code must be able to get the struct loader_icd to call into the proper
* driver (multiple ICD/gpu case). This can be accomplished by wrapping the
* created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices().
- * Secondly, loader must be able to find the instance and icd in trampoline
- * code.
- * Thirdly, the loader must be able to handle wrapped by layer VkPhysicalDevice
+ * Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice
* in trampoline code. This implies, that the loader trampoline code must also
* wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to
* wrap the VkPhysicalDevice created object twice. In trampoline code it can't
@@ -337,9 +335,8 @@ struct loader_instance {
also same structure used to wrap in terminator code */
struct loader_physical_device_tramp {
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
- struct loader_icd *this_icd;
+ struct loader_instance *this_instance;
VkPhysicalDevice phys_dev; // object from layers/loader terminator
- VkPhysicalDevice icd_phys_dev; // object from icd
};
/* per enumerated PhysicalDevice structure, used to wrap in terminator code */
@@ -462,7 +459,7 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst,
uint32_t prop_list_count,
const VkExtensionProperties *props);
VkResult loader_add_device_extensions(const struct loader_instance *inst,
- struct loader_icd *icd,
+ PFN_vkEnumerateDeviceExtensionProperties fpEnumerateDeviceExtensionProperties,
VkPhysicalDevice physical_device,
const char *lib_name,
struct loader_extension_list *ext_list);
@@ -510,8 +507,10 @@ void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
void *loader_get_dev_ext_trampoline(uint32_t index);
struct loader_instance *loader_get_instance(const VkInstance instance);
struct loader_device *
-loader_add_logical_device(const struct loader_instance *inst,
- struct loader_device **device_list);
+loader_create_logical_device(const struct loader_instance *inst);
+void loader_add_logical_device(const struct loader_instance *inst,
+ struct loader_icd *icd,
+ struct loader_device *found_dev);
void loader_remove_logical_device(const struct loader_instance *inst,
struct loader_icd *icd,
struct loader_device *found_dev);
@@ -530,7 +529,6 @@ void loader_activate_instance_layer_extensions(struct loader_instance *inst,
VkInstance created_inst);
VkResult
loader_enable_device_layers(const struct loader_instance *inst,
- struct loader_icd *icd,
struct loader_layer_list *activated_layer_list,
const VkDeviceCreateInfo *pCreateInfo,
const struct loader_layer_list *device_layers);
@@ -539,7 +537,6 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
const struct loader_instance *inst,
- struct loader_icd *icd,
struct loader_device *dev);
VkResult loader_validate_device_extensions(
struct loader_physical_device_tramp *phys_dev,