platform_shim->set_path(ManifestCategory::implicit_layer, implicit_layer_folder.location());
}
-void FrameworkEnvironment::AddICD(TestICDDetails icd_details, const std::string& json_name) noexcept {
- ManifestICD icd_manifest;
- icd_manifest.lib_path = fs::fixup_backslashes_in_path(icd_details.icd_path);
- icd_manifest.api_version = icd_details.api_version;
- auto driver_loc = icd_folder.write(json_name, icd_manifest);
- platform_shim->add_manifest(ManifestCategory::icd, driver_loc);
+void FrameworkEnvironment::add_icd(TestICDDetails icd_details) noexcept {
+ size_t cur_icd_index = icds.size();
+ if (!icd_details.is_fake) {
+ fs::path new_driver_name = fs::path(icd_details.icd_path).stem() + "_" + std::to_string(cur_icd_index) +
+ fs::path(icd_details.icd_path).extension();
+
+ auto new_driver_location = icd_folder.copy_file(icd_details.icd_path, new_driver_name.str());
+
+ icds.push_back(TestICDHandle(new_driver_location));
+ icds.back().reset_icd();
+ icd_details.icd_path = new_driver_location;
+ }
+ std::string full_json_name = icd_details.json_name + "_" + std::to_string(cur_icd_index) + ".json";
+
+ auto driver_loc = icd_folder.write(full_json_name, ManifestICD{}
+ .set_lib_path(fs::fixup_backslashes_in_path(icd_details.icd_path).str())
+ .set_api_version(icd_details.api_version));
+
+ if (icd_details.use_env_var_icd_filenames) {
+ if (!env_var_vk_icd_filenames.empty()) {
+ env_var_vk_icd_filenames += OS_ENV_VAR_LIST_SEPARATOR;
+ }
+ env_var_vk_icd_filenames += (icd_folder.location() / full_json_name).str();
+ set_env_var("VK_ICD_FILENAMES", env_var_vk_icd_filenames);
+ } else {
+ platform_shim->add_manifest(ManifestCategory::icd, driver_loc);
+ }
}
-void FrameworkEnvironment::AddImplicitLayer(ManifestLayer layer_manifest, const std::string& json_name) noexcept {
+void FrameworkEnvironment::add_implicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept {
for (auto& layer : layer_manifest.layers) {
if (!layer.lib_path.str().empty()) {
std::string new_layer_name = layer.name + "_" + layer.lib_path.filename().str();
auto layer_loc = implicit_layer_folder.write(json_name, layer_manifest);
platform_shim->add_manifest(ManifestCategory::implicit_layer, layer_loc);
}
-void FrameworkEnvironment::AddExplicitLayer(ManifestLayer layer_manifest, const std::string& json_name) noexcept {
+void FrameworkEnvironment::add_explicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept {
for (auto& layer : layer_manifest.layers) {
if (!layer.lib_path.str().empty()) {
std::string new_layer_name = layer.name + "_" + layer.lib_path.filename().str();
platform_shim->add_manifest(ManifestCategory::explicit_layer, layer_loc);
}
-EnvVarICDOverrideShim::EnvVarICDOverrideShim(DebugMode debug_mode) noexcept : FrameworkEnvironment(debug_mode) {}
-
-void EnvVarICDOverrideShim::SetEnvOverrideICD(const char* icd_path, const char* manifest_name) noexcept {
- ManifestICD icd_manifest;
- icd_manifest.lib_path = icd_path;
- icd_manifest.api_version = VK_MAKE_VERSION(1, 0, 0);
-
- icd_folder.write(manifest_name, icd_manifest);
- set_env_var("VK_ICD_FILENAMES", (icd_folder.location() / manifest_name).str());
-
- driver_wrapper = LibraryWrapper(fs::path(icd_path));
-
- reset_icd = driver_wrapper.get_symbol<GetNewTestICDFunc>(RESET_ICD_FUNC_STR);
-}
-
-SingleICDShim::SingleICDShim(TestICDDetails icd_details, DebugMode debug_mode) noexcept : FrameworkEnvironment(debug_mode) {
- icd_handle = TestICDHandle(icd_details.icd_path);
- icd_handle.reset_icd();
-
- AddICD(icd_details, "test_icd.json");
-}
-TestICD& SingleICDShim::get_test_icd() noexcept { return icd_handle.get_test_icd(); }
-TestICD& SingleICDShim::reset_icd() noexcept { return icd_handle.reset_icd(); }
-fs::path SingleICDShim::get_test_icd_path() noexcept { return icd_handle.get_icd_full_path(); }
+TestICD& FrameworkEnvironment::get_test_icd(int index) noexcept { return icds[index].get_test_icd(); }
+TestICD& FrameworkEnvironment::reset_icd(int index) noexcept { return icds[index].reset_icd(); }
+fs::path FrameworkEnvironment::get_test_icd_path(int index) noexcept { return icds[index].get_icd_full_path(); }
-MultipleICDShim::MultipleICDShim(std::vector<TestICDDetails> icd_details_vector, DebugMode debug_mode) noexcept
- : FrameworkEnvironment(debug_mode) {
- uint32_t i = 0;
- for (auto& test_icd_detail : icd_details_vector) {
- fs::path new_driver_name =
- fs::path(test_icd_detail.icd_path).stem() + "_" + std::to_string(i) + fs::path(test_icd_detail.icd_path).extension();
-
- auto new_driver_location = icd_folder.copy_file(test_icd_detail.icd_path, new_driver_name.str());
-
- icds.push_back(TestICDHandle(new_driver_location));
- icds.back().reset_icd();
- test_icd_detail.icd_path = new_driver_location.c_str();
- AddICD(test_icd_detail, std::string("test_icd_") + std::to_string(i) + ".json");
- i++;
- }
-}
-TestICD& MultipleICDShim::get_test_icd(int index) noexcept { return icds[index].get_test_icd(); }
-TestICD& MultipleICDShim::reset_icd(int index) noexcept { return icds[index].reset_icd(); }
-fs::path MultipleICDShim::get_test_icd_path(int index) noexcept { return icds[index].get_icd_full_path(); }
-
-FakeBinaryICDShim::FakeBinaryICDShim(TestICDDetails read_icd_details, TestICDDetails fake_icd_details,
- DebugMode debug_mode) noexcept
- : FrameworkEnvironment(debug_mode) {
- real_icd = TestICDHandle(read_icd_details.icd_path);
- real_icd.reset_icd();
-
- // Must use name that isn't a substring of eachother, otherwise loader removes the other ICD
- // EX test_icd.json is fully contained in fake_test_icd.json, causing test_icd.json to not be loaded
- AddICD(fake_icd_details, "test_fake_icd.json");
- AddICD(read_icd_details, "test_icd.json");
-}
-TestICD& FakeBinaryICDShim::get_test_icd() noexcept { return real_icd.get_test_icd(); }
-TestICD& FakeBinaryICDShim::reset_icd() noexcept { return real_icd.reset_icd(); }
-fs::path FakeBinaryICDShim::get_test_icd_path() noexcept { return real_icd.get_icd_full_path(); }
\ No newline at end of file
+TestLayer& FrameworkEnvironment::get_test_layer(int index) noexcept { return layers[index].get_test_layer(); }
+TestLayer& FrameworkEnvironment::reset_layer(int index) noexcept { return layers[index].reset_layer(); }
\ No newline at end of file
};
struct TestICDDetails {
- TestICDDetails(const char* icd_path, uint32_t api_version = VK_MAKE_VERSION(1, 0, 0)) noexcept
+ TestICDDetails(fs::path icd_path, uint32_t api_version = VK_MAKE_VERSION(1, 0, 0)) noexcept
: icd_path(icd_path), api_version(api_version) {}
- const char* icd_path = nullptr;
- uint32_t api_version = VK_MAKE_VERSION(1, 0, 0);
+ BUILDER_VALUE(TestICDDetails, fs::path, icd_path, {});
+ BUILDER_VALUE(TestICDDetails, uint32_t, api_version, VK_MAKE_VERSION(1, 0, 0));
+ BUILDER_VALUE(TestICDDetails, std::string, json_name, "test_icd");
+ BUILDER_VALUE(TestICDDetails, bool, use_env_var_icd_filenames, false);
+ BUILDER_VALUE(TestICDDetails, bool, is_fake, false);
};
struct TestLayerDetails {
- TestLayerDetails(const char* layer_path, uint32_t api_version = VK_MAKE_VERSION(1, 0, 0)) noexcept
+ TestLayerDetails(fs::path layer_path, uint32_t api_version = VK_MAKE_VERSION(1, 0, 0)) noexcept
: layer_path(layer_path), api_version(api_version) {}
- const char* layer_path = nullptr;
- uint32_t api_version = VK_MAKE_VERSION(1, 0, 0);
+ BUILDER_VALUE(TestLayerDetails, fs::path, layer_path, {});
+ BUILDER_VALUE(TestLayerDetails, uint32_t, api_version, VK_MAKE_VERSION(1, 0, 0));
};
struct FrameworkEnvironment {
FrameworkEnvironment(DebugMode debug_mode = DebugMode::none) noexcept;
- void AddICD(TestICDDetails icd_details, const std::string& json_name) noexcept;
- void AddImplicitLayer(ManifestLayer layer_manifest, const std::string& json_name) noexcept;
- void AddExplicitLayer(ManifestLayer layer_manifest, const std::string& json_name) noexcept;
+ void add_icd(TestICDDetails icd_details) noexcept;
+ void add_implicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept;
+ void add_explicit_layer(ManifestLayer layer_manifest, const std::string& json_name) noexcept;
+
+ TestICD& get_test_icd(int index = 0) noexcept;
+ TestICD& reset_icd(int index = 0) noexcept;
+ fs::path get_test_icd_path(int index = 0) noexcept;
+
+ TestLayer& get_test_layer(int index = 0) noexcept;
+ TestLayer& reset_layer(int index = 0) noexcept;
+ fs::path get_test_layer_path(int index = 0) noexcept;
PlatformShimWrapper platform_shim;
fs::FolderManager null_folder;
fs::FolderManager implicit_layer_folder;
DebugUtilsLogger debug_log;
VulkanFunctions vulkan_functions;
-};
-
-struct EnvVarICDOverrideShim : public FrameworkEnvironment {
- EnvVarICDOverrideShim(DebugMode debug_mode = DebugMode::none) noexcept;
-
- void SetEnvOverrideICD(const char* icd_path, const char* manifest_name) noexcept;
-
- LibraryWrapper driver_wrapper;
- GetNewTestICDFunc reset_icd;
-};
-
-struct SingleICDShim : public FrameworkEnvironment {
- SingleICDShim(TestICDDetails icd_details, DebugMode debug_mode = DebugMode::none) noexcept;
-
- TestICD& get_test_icd() noexcept;
- TestICD& reset_icd() noexcept;
-
- fs::path get_test_icd_path() noexcept;
-
- TestICDHandle icd_handle;
-};
-
-struct MultipleICDShim : public FrameworkEnvironment {
- MultipleICDShim(std::vector<TestICDDetails> icd_details_vector, DebugMode debug_mode = DebugMode::none) noexcept;
-
- TestICD& get_test_icd(int index) noexcept;
- TestICD& reset_icd(int index) noexcept;
- fs::path get_test_icd_path(int index) noexcept;
std::vector<TestICDHandle> icds;
-};
+ std::vector<TestLayerHandle> layers;
-struct FakeBinaryICDShim : public FrameworkEnvironment {
- FakeBinaryICDShim(TestICDDetails read_icd_details, TestICDDetails fake_icd_details,
- DebugMode debug_mode = DebugMode::none) noexcept;
-
- TestICD& get_test_icd() noexcept;
- TestICD& reset_icd() noexcept;
- fs::path get_test_icd_path() noexcept;
-
- TestICDHandle real_icd;
-};
\ No newline at end of file
+ std::string env_var_vk_icd_filenames;
+};
class Allocation : public ::testing::Test {
protected:
virtual void SetUp() {
- env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_MAKE_VERSION(1, 0, 0))));
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
}
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
// Test making sure the allocation functions are called to allocate and cleanup everything during
MemoryTracker tracker;
auto& driver = env->get_test_icd();
driver.physical_devices.emplace_back("physical_device_0");
- driver.physical_devices[0].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
{
InstWrapper inst{env->vulkan_functions, tracker.get()};
inst.CheckCreate();
{
auto& driver = env->get_test_icd();
driver.physical_devices.emplace_back("physical_device_0");
- driver.physical_devices[0].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
InstWrapper inst{env->vulkan_functions, tracker.get()};
inst.CheckCreate();
{
auto& driver = env->get_test_icd();
driver.physical_devices.emplace_back("physical_device_0");
- driver.physical_devices[0].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
InstWrapper inst{env->vulkan_functions};
inst.CheckCreate();
TEST_F(Allocation, CreateDeviceIntentionalAllocFail) {
auto& driver = env->get_test_icd();
driver.physical_devices.emplace_back("physical_device_0");
- driver.physical_devices[0].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
driver.physical_devices.emplace_back("physical_device_1");
- driver.physical_devices[1].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[1].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
InstWrapper inst{env->vulkan_functions};
inst.CheckCreate();
TEST_F(Allocation, CreateInstanceDeviceIntentionalAllocFail) {
auto& driver = env->get_test_icd();
driver.physical_devices.emplace_back("physical_device_0");
- driver.physical_devices[0].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[0].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
size_t fail_index = 0;
VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY;
// to make sure the loader uses the valid ICD and doesn't report incompatible driver just because
// an incompatible driver exists
TEST(TryLoadWrongBinaries, CreateInstanceIntentionalAllocFail) {
- FakeBinaryICDShim env(TestICDDetails(TEST_ICD_PATH_VERSION_2), TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY));
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ env.add_icd(TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY).set_is_fake(true));
size_t fail_index = 0;
VkResult result = VK_ERROR_OUT_OF_HOST_MEMORY;
while (result == VK_ERROR_OUT_OF_HOST_MEMORY && fail_index <= 10000) {
for (uint32_t i = 0; i < physical_dev_count; i++) {
driver.physical_devices.emplace_back(std::string("physical_device_") + std::to_string(i));
- driver.physical_devices[i].add_queue_family_properties({VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}});
+ driver.physical_devices[i].add_queue_family_properties({{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, false});
}
MemoryTracker tracker{MemoryTrackerSettings{false, 0, true, fail_index}};
InstanceCreateInfo inst_create_info;
// Load the global function pointers with and without a NULL vkInstance handle.
// Call the function to make sure it is callable, don't care about what is returned.
TEST(GetProcAddr, GlobalFunctions) {
- SingleICDShim env(TestICDDetails(TEST_ICD_PATH_VERSION_6));
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6));
env.get_test_icd().physical_devices.emplace_back("physical_device_0");
auto& gipa = env.vulkan_functions.vkGetInstanceProcAddr;
class LoaderHandleValidTests : public ::testing::Test {
protected:
- virtual void SetUp() { env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TEST_ICD_PATH_VERSION_2)); }
-
+ virtual void SetUp() {
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ }
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
// ---- Invalid Instance tests
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_headless_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_headless_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_android_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_directfb_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_FUCHSIA_imagepipe_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_GGP_stream_descriptor_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_MVK_ios_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_MVK_macos_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_metal_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_QNX_screen_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_NN_vi_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_wayland_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_win32_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_xcb_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_xlib_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_headless_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_headless_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_headless_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_headless_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_directfb_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_QNX_screen_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_wayland_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_win32_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_xcb_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_xlib_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_get_display_properties2"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_get_display_properties2"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_get_display_properties2"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_get_display_properties2"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_get_surface_capabilities2"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_get_surface_capabilities2"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_acquire_drm_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_acquire_drm_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_direct_mode_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_acquire_xlib_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_acquire_xlib_display"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
driver.physical_devices.emplace_back("physical_device_0");
InstWrapper instance(env->vulkan_functions);
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_android_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_directfb_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_FUCHSIA_imagepipe_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_GGP_stream_descriptor_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_MVK_ios_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_MVK_macos_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_EXT_metal_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_QNX_screen_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_NN_vi_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_wayland_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_win32_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
ManifestLayer wrap_objects_layer;
wrap_objects_layer.layers.push_back(wrap_objects_description);
- env->AddExplicitLayer(wrap_objects_layer, "wrap_objects_layer.json");
+ env->add_explicit_layer(wrap_objects_layer, "wrap_objects_layer.json");
driver.physical_devices.emplace_back("physical_device_0");
MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_xcb_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
Extension first_ext{"VK_KHR_surface"};
Extension second_ext{"VK_KHR_xlib_surface"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({first_ext, second_ext});
+ driver.add_instance_extensions({first_ext, second_ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
return VK_FALSE;
}
-#if 0 // Disable for now to get this commit in
+#if 0 // Disable for now to get this commit in
TEST_F(LoaderHandleValidTests, VerifyHandleWrappingDebugUtilsMessenger) {
Extension ext{"VK_EXT_debug_utils"};
auto& driver = env->get_test_icd();
- driver.AddInstanceExtensions({ext});
+ driver.add_instance_extensions({ext});
const char* wrap_objects_name = "WrapObjectsLayer";
ManifestLayer::LayerDescription wrap_objects_description{};
class LayerTests : public ::testing::Test {
protected:
virtual void SetUp() {
- env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TestICDDetails(TEST_ICD_PATH_VERSION_6, VK_MAKE_VERSION(1, 0, 0))));
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6));
}
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
// Subtyping for organization
class OverrideMetaLayer : public LayerTests {};
class LayerCreateInstance : public LayerTests {};
-void CheckLogForLayerString(SingleICDShim& env, const char* implicit_layer_name, bool check_for_enable) {
+void CheckLogForLayerString(FrameworkEnvironment& env, const char* implicit_layer_name, bool check_for_enable) {
{
InstWrapper inst{env.vulkan_functions};
FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
ManifestLayer implicit_layer;
implicit_layer.layers.push_back(description);
- env->AddImplicitLayer(implicit_layer, "implicit_test_layer.json");
+ env->add_implicit_layer(implicit_layer, "implicit_test_layer.json");
uint32_t count = 0;
ASSERT_EQ(VK_SUCCESS, env->vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr));
ManifestLayer implicit_layer;
implicit_layer.layers.push_back(description);
- env->AddImplicitLayer(implicit_layer, "implicit_test_layer.json");
+ env->add_implicit_layer(implicit_layer, "implicit_test_layer.json");
uint32_t count = 0;
ASSERT_EQ(VK_SUCCESS, env->vulkan_functions.vkEnumerateInstanceLayerProperties(&count, nullptr));
ManifestLayer meta_layer;
meta_layer.file_format_version = ManifestVersion(1, 1, 2);
meta_layer.layers.push_back(description);
- env->AddImplicitLayer(meta_layer, "meta_test_layer.json");
+ env->add_implicit_layer(meta_layer, "meta_test_layer.json");
const char* regular_layer_name = "TestLayer";
ManifestLayer::LayerDescription regular_description{};
ManifestLayer regular_layer;
regular_layer.layers.push_back(regular_description);
- env->AddExplicitLayer(regular_layer, "regular_test_layer.json");
+ env->add_explicit_layer(regular_layer, "regular_test_layer.json");
// should find 1, the 'regular' layer
uint32_t layer_count = 1;
ManifestLayer regular_layer;
regular_layer.layers.push_back(regular_description);
- env->AddExplicitLayer(regular_layer, "regular_test_layer.json");
+ env->add_explicit_layer(regular_layer, "regular_test_layer.json");
const char* lunarg_meta_layer_name = "VK_LAYER_LUNARG_override";
ManifestLayer::LayerDescription description{};
ManifestLayer lunarg_meta_layer;
lunarg_meta_layer.file_format_version = ManifestVersion(1, 1, 2);
lunarg_meta_layer.layers.push_back(description);
- env->AddImplicitLayer(lunarg_meta_layer, "meta_test_layer.json");
+ env->add_implicit_layer(lunarg_meta_layer, "meta_test_layer.json");
// should find 1, the 'regular' layer
uint32_t layer_count = 2;
ManifestLayer regular_layer;
regular_layer.file_format_version = ManifestVersion(1, 1, 2);
regular_layer.layers.push_back(regular_description);
- env->AddExplicitLayer(regular_layer, "regular_test_layer.json");
+ env->add_explicit_layer(regular_layer, "regular_test_layer.json");
TestLayerHandle layer_handle{regular_description.lib_path};
auto& layer = layer_handle.get_test_layer();
TEST_F(LayerCreateInstance, GetPhysicalDeviceProperties2KHR) {
env->get_test_icd().physical_devices.push_back({});
- env->get_test_icd().AddInstanceExtension({"VK_KHR_get_physical_device_properties2", 0});
+ env->get_test_icd().add_instance_extension({"VK_KHR_get_physical_device_properties2", 0});
const char* regular_layer_name = "TestLayer";
ManifestLayer::LayerDescription regular_description{};
regular_description.name = regular_layer_name;
ManifestLayer regular_layer;
regular_layer.layers.push_back(regular_description);
- env->AddExplicitLayer(regular_layer, "regular_test_layer.json");
+ env->add_explicit_layer(regular_layer, "regular_test_layer.json");
TestLayerHandle layer_handle{regular_description.lib_path};
auto& layer = layer_handle.reset_layer();
ManifestLayer wrap_objects_layer;
wrap_objects_layer.layers.push_back(wrap_objects_description);
- env->AddExplicitLayer(wrap_objects_layer, "wrap_objects_layer.json");
+ env->add_explicit_layer(wrap_objects_layer, "wrap_objects_layer.json");
const char* regular_layer_name_1 = "RegularLayer1";
ManifestLayer::LayerDescription regular_description_1{};
ManifestLayer regular_layer_1;
regular_layer_1.layers.push_back(regular_description_1);
- env->AddExplicitLayer(regular_layer_1, "regular_layer_1.json");
+ env->add_explicit_layer(regular_layer_1, "regular_layer_1.json");
const char* regular_layer_name_2 = "RegularLayer2";
ManifestLayer::LayerDescription regular_description_2{};
ManifestLayer regular_layer_2;
regular_layer_2.layers.push_back(regular_description_2);
- env->AddExplicitLayer(regular_layer_2, "regular_layer_2.json");
+ env->add_explicit_layer(regular_layer_2, "regular_layer_2.json");
MockQueueFamilyProperties family_props{{VK_QUEUE_GRAPHICS_BIT, 1, 0, {1, 1, 1}}, true};
class RegressionTests : public ::testing::Test {
protected:
virtual void SetUp() {
- env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_MAKE_VERSION(1, 0, 0))));
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
}
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
// Subtyping for organization
TEST_F(CreateInstance, BasicRun) {
auto& driver = env->get_test_icd();
- driver.SetMinICDInterfaceVersion(5);
+ driver.set_min_icd_interface_version(5);
InstWrapper inst{env->vulkan_functions};
inst.CheckCreate();
ManifestLayer layer;
layer.layers.push_back(description);
- env->AddExplicitLayer(layer, "test_layer.json");
+ env->add_explicit_layer(layer, "test_layer.json");
InstWrapper inst{env->vulkan_functions};
inst.create_info.add_layer(layer_name);
ManifestLayer layer1;
layer1.layers.push_back(description1);
- env->AddExplicitLayer(layer1, "test_layer_1.json");
+ env->add_explicit_layer(layer1, "test_layer_1.json");
ManifestLayer::LayerDescription description2{};
description2.name = layer_name_1;
ManifestLayer layer2;
layer2.layers.push_back(description2);
- env->AddExplicitLayer(layer2, "test_layer_2.json");
+ env->add_explicit_layer(layer2, "test_layer_2.json");
{ // OnePass
VkLayerProperties layer_props[2] = {};
TEST_F(EnumerateInstanceExtensionProperties, UsageChecks) {
Extension first_ext{"VK_EXT_validation_features"}; // known instance extensions
Extension second_ext{"VK_EXT_headless_surface"};
- env->reset_icd().AddInstanceExtensions({first_ext, second_ext});
+ env->reset_icd().add_instance_extensions({first_ext, second_ext});
{ // One Pass
uint32_t extension_count = 4;
TEST_F(EnumerateInstanceExtensionProperties, FilterUnkownInstanceExtensions) {
Extension first_ext{"FirstTestExtension"}; // unknown instance extensions
Extension second_ext{"SecondTestExtension"};
- env->reset_icd().AddInstanceExtensions({first_ext, second_ext});
+ env->reset_icd().add_instance_extensions({first_ext, second_ext});
{
uint32_t extension_count = 0;
ASSERT_EQ(VK_SUCCESS, env->vulkan_functions.vkEnumerateInstanceExtensionProperties("", &extension_count, nullptr));
ManifestLayer layer;
layer.layers.push_back(description);
- env->AddExplicitLayer(layer, "test_layer.json");
+ env->add_explicit_layer(layer, "test_layer.json");
InstWrapper inst{env->vulkan_functions};
inst.create_info.add_layer(layer_name);
}
TEST_F(EnumeratePhysicalDevices, OneCall) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
driver.physical_devices.emplace_back("physical_device_0");
driver.physical_devices.emplace_back("physical_device_1");
}
TEST_F(EnumeratePhysicalDevices, TwoCall) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
const uint32_t real_device_count = 2;
for (size_t i = 0; i < real_device_count; i++) {
TEST_F(EnumeratePhysicalDevices, MatchOneAndTwoCallNumbers) {
auto& driver = env->get_test_icd();
- driver.SetMinICDInterfaceVersion(5);
+ driver.set_min_icd_interface_version(5);
const uint32_t real_device_count = 3;
for (size_t i = 0; i < real_device_count; i++) {
}
TEST_F(EnumeratePhysicalDevices, TwoCallIncomplete) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
const uint32_t real_device_count = 2;
for (size_t i = 0; i < real_device_count; i++) {
}
TEST_F(EnumeratePhysicalDevices, ZeroPhysicalDevicesAfterCreateInstance) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
InstWrapper inst{env->vulkan_functions};
inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 1, 0));
inst.CheckCreate();
}
TEST(TryLoadWrongBinaries, WrongICD) {
- FakeBinaryICDShim env(TestICDDetails(TEST_ICD_PATH_VERSION_2), TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY));
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ env.add_icd(TestICDDetails(CURRENT_PLATFORM_DUMMY_BINARY).set_is_fake(true));
env.get_test_icd().physical_devices.emplace_back("physical_device_0");
DebugUtilsLogger log{VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT};
}
TEST(TryLoadWrongBinaries, WrongExplicitAndImplicit) {
- SingleICDShim env(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
env.get_test_icd().physical_devices.emplace_back("physical_device_0");
const char* layer_name_0 = "DummyLayerExplicit";
}
TEST_F(EnumeratePhysicalDeviceGroups, OneCall) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
// ICD contains 2 devices
driver.physical_devices.emplace_back("PhysicalDevice0");
driver.physical_devices.emplace_back("PhysicalDevice1");
handle_assert_equal(group_props.physicalDevices[0], physical_devices[0]);
handle_assert_equal(group_props.physicalDevices[1], physical_devices[1]);
}
- driver.AddInstanceExtension({"VK_KHR_device_group_creation"});
+ driver.add_instance_extension({"VK_KHR_device_group_creation"});
// Extension
{
InstWrapper inst{env->vulkan_functions};
}
TEST_F(EnumeratePhysicalDeviceGroups, TwoCall) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
// ICD contains 2 devices
driver.physical_devices.emplace_back("PhysicalDevice0");
driver.physical_devices.emplace_back("PhysicalDevice1");
handle_assert_equal(group_props.physicalDevices[0], physical_devices[0]);
handle_assert_equal(group_props.physicalDevices[1], physical_devices[1]);
}
- driver.AddInstanceExtension({"VK_KHR_device_group_creation"});
+ driver.add_instance_extension({"VK_KHR_device_group_creation"});
// Extension
{
InstWrapper inst{env->vulkan_functions};
}
TEST_F(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) {
- auto& driver = env->get_test_icd().SetMinICDInterfaceVersion(5);
+ auto& driver = env->get_test_icd().set_min_icd_interface_version(5);
// ICD contains 2 devices
driver.physical_devices.emplace_back("PhysicalDevice0");
driver.physical_devices.emplace_back("PhysicalDevice1");
ASSERT_EQ(0, returned_group_count);
handle_assert_no_values(returned_group_count, group_props.physicalDevices);
}
- driver.AddInstanceExtension({"VK_KHR_device_group_creation"});
+ driver.add_instance_extension({"VK_KHR_device_group_creation"});
// Extension
{
InstWrapper inst{env->vulkan_functions};
"This tool does not exist",
"No-Layer"};
{ // No support in driver
- SingleICDShim env{TestICDDetails{TEST_ICD_PATH_VERSION_6}};
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6));
env.get_test_icd().physical_devices.push_back({});
InstWrapper inst{env.vulkan_functions};
ASSERT_EQ(tool_count, 0);
}
{ // extension is supported in driver
- SingleICDShim env{TestICDDetails{TEST_ICD_PATH_VERSION_6}};
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6));
env.get_test_icd().physical_devices.push_back({});
env.get_test_icd().supports_tooling_info_ext = true;
env.get_test_icd().tooling_properties.push_back(icd_tool_props);
class ThreadingTests : public ::testing::Test {
protected:
virtual void SetUp() {
- env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TestICDDetails(TEST_ICD_PATH_VERSION_2, VK_MAKE_VERSION(1, 0, 0))));
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6));
}
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
void create_destroy_device_loop(uint32_t num_loops_create_destroy_device, uint32_t num_loops_try_get_proc_addr, InstWrapper* inst,
class UnknownExtension : public ::testing::Test {
protected:
virtual void SetUp() {
- env = std::unique_ptr<SingleICDShim>(
- new SingleICDShim(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA, VK_MAKE_VERSION(1, 0, 0))));
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA));
}
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
/*
class EnvVarICDOverrideSetup : public ::testing::Test {
protected:
- virtual void SetUp() { env = std::unique_ptr<EnvVarICDOverrideShim>(new EnvVarICDOverrideShim()); }
+ virtual void SetUp() { env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment()); }
virtual void TearDown() {
remove_env_var("VK_ICD_FILENAMES");
env.reset();
}
- std::unique_ptr<EnvVarICDOverrideShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
// Don't support vk_icdNegotiateLoaderICDInterfaceVersion
// does not support vk_icdGetInstanceProcAddr
// must export vkGetInstanceProcAddr, vkCreateInstance, vkEnumerateInstanceExtensionProperties
TEST_F(EnvVarICDOverrideSetup, version_0_none) {
- env->SetEnvOverrideICD(TEST_ICD_PATH_EXPORT_NONE, "test_icd_export_none.json");
- auto* driver = env->reset_icd();
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NONE).set_use_env_var_icd_filenames(true));
+ auto& driver = env->reset_icd();
InstWrapper inst{env->vulkan_functions};
inst.CheckCreate();
- ASSERT_EQ(driver->called_vk_icd_gipa, CalledICDGIPA::vk_gipa);
+ ASSERT_EQ(driver.called_vk_icd_gipa, CalledICDGIPA::vk_gipa);
}
// Don't support vk_icdNegotiateLoaderICDInterfaceVersion
// the loader calls vk_icdGetInstanceProcAddr first
TEST_F(EnvVarICDOverrideSetup, version_1_icd_gipa) {
- env->SetEnvOverrideICD(TEST_ICD_PATH_EXPORT_ICD_GIPA, "test_icd_export_icd_gipa.json");
- auto* driver = env->reset_icd();
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_ICD_GIPA).set_use_env_var_icd_filenames(true));
+ auto& driver = env->reset_icd();
InstWrapper inst{env->vulkan_functions};
inst.CheckCreate();
- ASSERT_EQ(driver->called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa);
+ ASSERT_EQ(driver.called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa);
}
// support vk_icdNegotiateLoaderICDInterfaceVersion but not vk_icdGetInstanceProcAddr
// should assert that `interface_vers == 0` due to version mismatch, only checkable in Debug Mode
TEST_F(EnvVarICDOverrideSetup, version_negotiate_interface_version_death_test) {
- env->SetEnvOverrideICD(TEST_ICD_PATH_EXPORT_NEGOTIATE_INTERFACE_VERSION, "test_icd_export_negotiate_interface_version.json");
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_NEGOTIATE_INTERFACE_VERSION).set_use_env_var_icd_filenames(true));
+ auto& driver = env->reset_icd();
InstWrapper inst{env->vulkan_functions};
// export vk_icdNegotiateLoaderICDInterfaceVersion and vk_icdGetInstanceProcAddr
TEST_F(EnvVarICDOverrideSetup, version_2_negotiate_interface_version_and_icd_gipa) {
- env->SetEnvOverrideICD(TEST_ICD_PATH_VERSION_2, "test_icd_version_2.json");
- auto* driver = env->reset_icd();
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2).set_use_env_var_icd_filenames(true));
+ auto& driver = env->reset_icd();
InstWrapper inst{env->vulkan_functions};
inst.CheckCreate();
- ASSERT_EQ(driver->called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa);
+ ASSERT_EQ(driver.called_vk_icd_gipa, CalledICDGIPA::vk_icd_gipa);
}
class ICDInterfaceVersion2Plus : public ::testing::Test {
protected:
- virtual void SetUp() { env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TEST_ICD_PATH_VERSION_2)); }
-
+ virtual void SetUp() {
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ }
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
TEST_F(ICDInterfaceVersion2Plus, vk_icdNegotiateLoaderICDInterfaceVersion) {
class ICDInterfaceVersion2PlusEnumerateAdapterPhysicalDevices : public ::testing::Test {
protected:
virtual void SetUp() {
- env = std::unique_ptr<SingleICDShim>(
- new SingleICDShim(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES));
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_ENUMERATE_ADAPTER_PHYSICAL_DEVICES));
}
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
};
// Need more work to shim dxgi for this test to work
#endif // defined(WIN32)
TEST(MultipleICDConfig, Basic) {
- MultipleICDShim env(
- {TestICDDetails(TEST_ICD_PATH_VERSION_2), TestICDDetails(TEST_ICD_PATH_VERSION_2), TestICDDetails(TEST_ICD_PATH_VERSION_2)},
- DebugMode::none);
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
env.get_test_icd(0).physical_devices.emplace_back("physical_device_0");
env.get_test_icd(1).physical_devices.emplace_back("physical_device_1");
}
TEST(MultipleDriverConfig, DifferentICDInterfaceVersions) {
- MultipleICDShim env({TestICDDetails(TEST_ICD_PATH_EXPORT_ICD_GIPA), TestICDDetails(TEST_ICD_PATH_VERSION_2),
- TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)},
- DebugMode::none);
+ FrameworkEnvironment env{};
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_EXPORT_ICD_GIPA));
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2));
+ env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA));
TestICD& icd0 = env.get_test_icd(0);
icd0.physical_devices.emplace_back("physical_device_0");
class RegressionTests : public ::testing::Test {
protected:
- virtual void SetUp() { env = std::unique_ptr<SingleICDShim>(new SingleICDShim(TestICDDetails(TEST_ICD_PATH_VERSION_2))); }
-
+ virtual void SetUp() {
+ env = std::unique_ptr<FrameworkEnvironment>(new FrameworkEnvironment());
+ env->add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6));
+ }
virtual void TearDown() { env.reset(); }
- std::unique_ptr<SingleICDShim> env;
+ std::unique_ptr<FrameworkEnvironment> env;
int width = 100;
int height = 100;
TEST_F(RegressionTests, CreateSurfaceWin32) {
auto& driver = env->get_test_icd();
- driver.SetICDAPIVersion(VK_MAKE_VERSION(1, 0, 0));
- driver.SetMinICDInterfaceVersion(5);
- driver.AddInstanceExtension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
- driver.AddInstanceExtension(Extension(VK_KHR_WIN32_SURFACE_EXTENSION_NAME));
+ driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+ driver.set_min_icd_interface_version(5);
+ driver.add_instance_extension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
+ driver.add_instance_extension(Extension(VK_KHR_WIN32_SURFACE_EXTENSION_NAME));
driver.enable_icd_wsi = true;
InstWrapper inst{env->vulkan_functions};
#if defined(VK_USE_PLATFORM_XCB_KHR)
TEST_F(RegressionTests, CreateSurfaceXCB) {
auto& driver = env->get_test_icd();
- driver.SetICDAPIVersion(VK_MAKE_VERSION(1, 0, 0));
- driver.SetMinICDInterfaceVersion(5);
- driver.AddInstanceExtension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
- driver.AddInstanceExtension(Extension(VK_KHR_XCB_SURFACE_EXTENSION_NAME));
+ driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+ driver.set_min_icd_interface_version(5);
+ driver.add_instance_extension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
+ driver.add_instance_extension(Extension(VK_KHR_XCB_SURFACE_EXTENSION_NAME));
driver.enable_icd_wsi = true;
InstWrapper inst{env->vulkan_functions};
#if defined(VK_USE_PLATFORM_XLIB_KHR)
TEST_F(RegressionTests, CreateSurfaceXLIB) {
auto& driver = env->get_test_icd();
- driver.SetICDAPIVersion(VK_MAKE_VERSION(1, 0, 0));
- driver.SetMinICDInterfaceVersion(5);
- driver.AddInstanceExtension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
- driver.AddInstanceExtension(Extension(VK_KHR_XLIB_SURFACE_EXTENSION_NAME));
+ driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+ driver.set_min_icd_interface_version(5);
+ driver.add_instance_extension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
+ driver.add_instance_extension(Extension(VK_KHR_XLIB_SURFACE_EXTENSION_NAME));
driver.enable_icd_wsi = true;
InstWrapper inst{env->vulkan_functions};
TEST_F(RegressionTests, CreateSurfaceWayland) {
auto& driver = env->get_test_icd();
- driver.SetICDAPIVersion(VK_MAKE_VERSION(1, 0, 0));
- driver.SetMinICDInterfaceVersion(5);
- driver.AddInstanceExtension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
- driver.AddInstanceExtension(Extension(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME));
+ driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+ driver.set_min_icd_interface_version(5);
+ driver.add_instance_extension(Extension(VK_KHR_SURFACE_EXTENSION_NAME));
+ driver.add_instance_extension(Extension(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME));
driver.enable_icd_wsi = true;
InstWrapper inst{env->vulkan_functions};