From 0939555719cf25b17ac128626ab348bedef36506 Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Tue, 17 May 2016 08:43:38 -0600 Subject: [PATCH] loader: Treat GLOBAL layers same as INSTANCE layers Also change validation layers type to be GLOBAL so they work with old loaders prior to device layer deprecation. Change-Id: I32788cb7788c8ad840ced15236c5ed792edfbbff --- layers/linux/VkLayer_core_validation.json | 2 +- layers/linux/VkLayer_device_limits.json | 2 +- layers/linux/VkLayer_image.json | 2 +- layers/linux/VkLayer_object_tracker.json | 2 +- layers/linux/VkLayer_parameter_validation.json | 2 +- layers/linux/VkLayer_swapchain.json | 2 +- layers/linux/VkLayer_threading.json | 2 +- layers/linux/VkLayer_unique_objects.json | 2 +- layers/windows/VkLayer_core_validation.json | 2 +- layers/windows/VkLayer_device_limits.json | 2 +- layers/windows/VkLayer_image.json | 2 +- layers/windows/VkLayer_object_tracker.json | 2 +- layers/windows/VkLayer_parameter_validation.json | 2 +- layers/windows/VkLayer_swapchain.json | 2 +- layers/windows/VkLayer_threading.json | 2 +- layers/windows/VkLayer_unique_objects.json | 2 +- loader/loader.c | 15 +++------------ 17 files changed, 19 insertions(+), 28 deletions(-) diff --git a/layers/linux/VkLayer_core_validation.json b/layers/linux/VkLayer_core_validation.json index 66b7660..1d8d305 100644 --- a/layers/linux/VkLayer_core_validation.json +++ b/layers/linux/VkLayer_core_validation.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_core_validation", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_core_validation.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_device_limits.json b/layers/linux/VkLayer_device_limits.json index f114c6c..6aab8a2 100644 --- a/layers/linux/VkLayer_device_limits.json +++ b/layers/linux/VkLayer_device_limits.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_device_limits", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_device_limits.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_image.json b/layers/linux/VkLayer_image.json index bfa4ea1..125e3fc 100644 --- a/layers/linux/VkLayer_image.json +++ b/layers/linux/VkLayer_image.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_image", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_image.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_object_tracker.json b/layers/linux/VkLayer_object_tracker.json index 4a4e7df..e778c64 100644 --- a/layers/linux/VkLayer_object_tracker.json +++ b/layers/linux/VkLayer_object_tracker.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_object_tracker", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_object_tracker.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_parameter_validation.json b/layers/linux/VkLayer_parameter_validation.json index 2372b71..ba1f151 100644 --- a/layers/linux/VkLayer_parameter_validation.json +++ b/layers/linux/VkLayer_parameter_validation.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_parameter_validation", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_parameter_validation.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_swapchain.json b/layers/linux/VkLayer_swapchain.json index 896611a..059c028 100644 --- a/layers/linux/VkLayer_swapchain.json +++ b/layers/linux/VkLayer_swapchain.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_swapchain", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_swapchain.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_threading.json b/layers/linux/VkLayer_threading.json index 450f780..6b7ba32 100644 --- a/layers/linux/VkLayer_threading.json +++ b/layers/linux/VkLayer_threading.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_GOOGLE_threading", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_threading.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/linux/VkLayer_unique_objects.json b/layers/linux/VkLayer_unique_objects.json index f5f1399..8901ebd 100644 --- a/layers/linux/VkLayer_unique_objects.json +++ b/layers/linux/VkLayer_unique_objects.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_GOOGLE_unique_objects", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": "./libVkLayer_unique_objects.so", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_core_validation.json b/layers/windows/VkLayer_core_validation.json index 7d2090d..e58dc0a 100644 --- a/layers/windows/VkLayer_core_validation.json +++ b/layers/windows/VkLayer_core_validation.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_core_validation", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_core_validation.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_device_limits.json b/layers/windows/VkLayer_device_limits.json index 26d3cae..18e5212 100644 --- a/layers/windows/VkLayer_device_limits.json +++ b/layers/windows/VkLayer_device_limits.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_device_limits", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_device_limits.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_image.json b/layers/windows/VkLayer_image.json index e597f5e..a898317 100644 --- a/layers/windows/VkLayer_image.json +++ b/layers/windows/VkLayer_image.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_image", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_image.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_object_tracker.json b/layers/windows/VkLayer_object_tracker.json index 398d06b..afe36bb 100644 --- a/layers/windows/VkLayer_object_tracker.json +++ b/layers/windows/VkLayer_object_tracker.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_object_tracker", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_object_tracker.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_parameter_validation.json b/layers/windows/VkLayer_parameter_validation.json index 8e600ca..b946ba2 100644 --- a/layers/windows/VkLayer_parameter_validation.json +++ b/layers/windows/VkLayer_parameter_validation.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_parameter_validation", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_parameter_validation.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_swapchain.json b/layers/windows/VkLayer_swapchain.json index 346d0e4..415146a 100644 --- a/layers/windows/VkLayer_swapchain.json +++ b/layers/windows/VkLayer_swapchain.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_LUNARG_swapchain", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_swapchain.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_threading.json b/layers/windows/VkLayer_threading.json index ba48671..206a246 100644 --- a/layers/windows/VkLayer_threading.json +++ b/layers/windows/VkLayer_threading.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_GOOGLE_threading", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_threading.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/layers/windows/VkLayer_unique_objects.json b/layers/windows/VkLayer_unique_objects.json index 1dd7276..3e0c47a 100644 --- a/layers/windows/VkLayer_unique_objects.json +++ b/layers/windows/VkLayer_unique_objects.json @@ -2,7 +2,7 @@ "file_format_version" : "1.0.0", "layer" : { "name": "VK_LAYER_GOOGLE_unique_objects", - "type": "INSTANCE", + "type": "GLOBAL", "library_path": ".\\VkLayer_unique_objects.dll", "api_version": "1.0.13", "implementation_version": "1", diff --git a/loader/loader.c b/loader/loader.c index cff4353..151c7d7 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1907,18 +1907,9 @@ loader_add_layer_properties(const struct loader_instance *inst, continue; } - if (!strcmp(type, "INSTANCE")) { - if (layer_instance_list == NULL) { - layer_node = layer_node->next; - continue; - } - props = loader_get_next_layer_property(inst, layer_instance_list); - props->type = (is_implicit) ? VK_LAYER_TYPE_INSTANCE_IMPLICIT - : VK_LAYER_TYPE_INSTANCE_EXPLICIT; - } - if (!strcmp(type, "GLOBAL")) { - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Global layers are treated the same as instance layers"); + // Allow either GLOBAL or INSTANCE type interchangeably to handle + // layers that must work with older loaders + if (!strcmp(type, "INSTANCE") || !strcmp(type, "GLOBAL")) { if (layer_instance_list == NULL) { layer_node = layer_node->next; continue; -- 2.7.4