Skip to content

Commit aad266e

Browse files
Silence warnings for wrong manifest type
If the loader happens upon a layer/ICD manifest while searching for manifests of the opposite type, do not emit warnings. These are spurious and only cause users to think something is wrong with the installation when it is actually fine.
1 parent 751f867 commit aad266e

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

loader/loader.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,9 +2891,13 @@ VkResult loader_add_layer_properties(const struct loader_instance *inst, struct
28912891
// Otherwise, try to read in individual layers
28922892
cJSON *layer_node = loader_cJSON_GetObjectItem(json, "layer");
28932893
if (layer_node == NULL) {
2894-
loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0,
2895-
"loader_add_layer_properties: Can not find 'layer' object in manifest JSON file %s. Skipping this file.",
2896-
filename);
2894+
// Don't warn if this happens to be an ICD manifest
2895+
if (loader_cJSON_GetObjectItem(json, "ICD") == NULL) {
2896+
loader_log(
2897+
inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0,
2898+
"loader_add_layer_properties: Can not find 'layer' object in manifest JSON file %s. Skipping this file.",
2899+
filename);
2900+
}
28972901
goto out;
28982902
}
28992903
// Loop through all "layer" objects in the file to get a count of them
@@ -3609,8 +3613,12 @@ VkResult loader_parse_icd_manifest(const struct loader_instance *inst, char *fil
36093613

36103614
cJSON *itemICD = loader_cJSON_GetObjectItem(icd_manifest_json, "ICD");
36113615
if (itemICD == NULL) {
3612-
loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
3613-
"loader_parse_icd_manifest: Can not find \'ICD\' object in ICD JSON file %s. Skipping ICD JSON", file_str);
3616+
// Don't warn if this happens to be a layer manifest file
3617+
if (loader_cJSON_GetObjectItem(icd_manifest_json, "layer") == NULL &&
3618+
loader_cJSON_GetObjectItem(icd_manifest_json, "layers") == NULL) {
3619+
loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
3620+
"loader_parse_icd_manifest: Can not find \'ICD\' object in ICD JSON file %s. Skipping ICD JSON", file_str);
3621+
}
36143622
res = VK_ERROR_INCOMPATIBLE_DRIVER;
36153623
goto out;
36163624
}

tests/framework/test_environment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ void FrameworkEnvironment::add_layer_impl(TestLayerDetails layer_details, Manife
697697
}
698698
#if defined(_WIN32)
699699
if (layer_details.discovery_type == ManifestDiscoveryType::windows_app_package) {
700-
platform_shim->set_app_package_path(layer_manifest_loc);
700+
platform_shim->set_app_package_path(folder.location());
701701
}
702702
#endif
703703
for (size_t i = new_layers_start; i < layers.size(); i++) {

tests/loader_regression_tests.cpp

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3813,9 +3813,9 @@ TEST(AppPackageDiscovery, AppPackageDrivers) {
38133813
}
38143814
TEST(AppPackageDiscovery, AppPackageLayers) {
38153815
FrameworkEnvironment env{};
3816-
env.add_icd(TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2)));
3816+
env.add_icd(TestICDDetails(ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2))).add_physical_device({});
38173817

3818-
const char* layer_name = "test_package_layer";
3818+
const char* layer_name = "VK_LAYER_test_package_layer";
38193819
env.add_implicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
38203820
.set_name(layer_name)
38213821
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
@@ -3826,14 +3826,30 @@ TEST(AppPackageDiscovery, AppPackageLayers) {
38263826
InstWrapper inst{env.vulkan_functions};
38273827
inst.CheckCreate();
38283828

3829-
{
3830-
VkLayerProperties layer_props{};
3831-
uint32_t layer_count = 0;
3832-
ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, NULL));
3833-
ASSERT_EQ(layer_count, 1);
3834-
ASSERT_EQ(VK_SUCCESS, env.vulkan_functions.vkEnumerateInstanceLayerProperties(&layer_count, &layer_props));
3835-
ASSERT_TRUE(string_eq(layer_name, layer_props.layerName));
3836-
}
3829+
auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1U);
3830+
ASSERT_EQ(layers.size(), 1);
3831+
ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name));
3832+
}
3833+
3834+
TEST(AppPackageDiscovery, AppPackageICDAndLayers) {
3835+
FrameworkEnvironment env{};
3836+
env.add_icd(TestICDDetails{TEST_ICD_PATH_VERSION_2}.set_discovery_type(ManifestDiscoveryType::windows_app_package))
3837+
.add_physical_device({});
3838+
3839+
const char* layer_name = "VK_LAYER_test_package_layer";
3840+
env.add_implicit_layer(TestLayerDetails(ManifestLayer{}.add_layer(ManifestLayer::LayerDescription{}
3841+
.set_name(layer_name)
3842+
.set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2)
3843+
.set_disable_environment("DISABLE_ME")),
3844+
"test_package_layer.json")
3845+
.set_discovery_type(ManifestDiscoveryType::windows_app_package));
3846+
3847+
InstWrapper inst{env.vulkan_functions};
3848+
inst.CheckCreate();
3849+
3850+
auto layers = inst.GetActiveLayers(inst.GetPhysDev(), 1U);
3851+
ASSERT_EQ(layers.size(), 1);
3852+
ASSERT_TRUE(string_eq(layers.at(0).layerName, layer_name));
38373853
}
38383854

38393855
// Make sure that stale layer manifests (path to nonexistant file) which have the same name as real manifests don't cause the real

0 commit comments

Comments
 (0)