test: Make MetaLayer test add extensions
authorCharles Giessen <charles@lunarg.com>
Wed, 4 Aug 2021 16:31:40 +0000 (10:31 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Fri, 6 Aug 2021 22:00:06 +0000 (16:00 -0600)
Needed to fixup more of the manifest writer in the process

tests/framework/test_util.cpp
tests/framework/test_util.h
tests/loader_layer_tests.cpp

index c4ac8194a0eca98aa53636b04acecede610ad3f5..faed08bdededa347b8264beda8a0e8083c93f6bf 100644 (file)
@@ -135,7 +135,7 @@ std::string ManifestLayer::LayerDescription::get_manifest_str() const {
     out += "\t\t\"implementation_version\":\"" + std::to_string(implementation_version) + "\",\n";
     out += "\t\t\"description\": \"" + description + "\"";
     if (functions.size() > 0) {
-        out += ",\n\t\t{";
+        out += ",\n\t\t\"functions\": {";
         for (size_t i = 0; i < functions.size(); i++) {
             if (i > 0) out += ",";
             out += "\n\t\t\t" + functions.at(i).get_manifest_str();
@@ -143,20 +143,20 @@ std::string ManifestLayer::LayerDescription::get_manifest_str() const {
         out += "\n\t\t}";
     }
     if (instance_extensions.size() > 0) {
-        out += ",\n\t\t{";
+        out += ",\n\t\t\"instance_extensions\": [";
         for (size_t i = 0; i < instance_extensions.size(); i++) {
             if (i > 0) out += ",";
             out += "\n\t\t\t" + instance_extensions.at(i).get_manifest_str();
         }
-        out += "\n\t\t}";
+        out += "\n\t\t]";
     }
     if (device_extensions.size() > 0) {
-        out += ",\n\t\t{";
+        out += ",\n\t\t\"device_extensions\": [";
         for (size_t i = 0; i < device_extensions.size(); i++) {
             if (i > 0) out += ",";
             out += "\n\t\t\t" + device_extensions.at(i).get_manifest_str();
         }
-        out += "\n\t\t}";
+        out += "\n\t\t]";
     }
     if (enable_environment.size() > 0) {
         out += ",\n\t\t\"enable_environment\": { \"" + enable_environment + "\": \"1\"";
index 8d0c507947c9fdb2c40707b8f90ef325e30c31f7..fef9c1a048d65446c90e3ab402386f789cac359e 100644 (file)
@@ -164,6 +164,9 @@ struct ManifestLayer {
             std::string get_manifest_str() const { return std::string("{ \"") + vk_func + "\":\"" + override_name + "\" }"; }
         };
         struct Extension {
+            Extension() noexcept {}
+            Extension(std::string name, uint32_t spec_version = 0, std::vector<std::string> entrypoints = {}) noexcept
+                : name(name), spec_version(spec_version), entrypoints(entrypoints) {}
             std::string name;
             uint32_t spec_version = 0;
             std::vector<std::string> entrypoints;
index 1d6351ba996a30e4606cddf7aef0af88009f86f6..deaeef7ab4a0e46a2f8c737b9ef91d3f60e1a231 100644 (file)
@@ -49,6 +49,8 @@ TEST_F(MetaLayers, InvalidComponentLayer) {
     description.name = meta_layer_name;
     description.component_layers = {"InvalidLayer1", "InvalidLayer2"};
     description.disable_environment = "NotGonnaWork";
+    description.instance_extensions.push_back({"NeverGonnaGiveYouUp"});
+    description.device_extensions.push_back({"NeverGonnaLetYouDown"});
 
     ManifestLayer meta_layer;
     meta_layer.file_format_version = ManifestVersion(1, 1, 2);