vk-bootstrap/tests/feature_config.cpp
Charles Giessen d6d63121e9 Add VulkanFeatureConfig, mechanism to select pre-made configs
This makes it easy to enable a set of features, extensions, and a Vulkan Version that are
pre-defined.
2021-09-02 09:19:59 -06:00

35 lines
1.2 KiB
C++

#include "common.h"
#include <catch2/catch.hpp>
TEST_CASE("TargetBaseVulkanDesktop", "[VkBootstrap.feature_config]") {
auto window = create_window_glfw("Instance with surface");
vkb::InstanceBuilder instance_builder;
auto instance_ret = instance_builder.use_default_debug_messenger().request_validation_layers().build();
REQUIRE(instance_ret);
vkb::Instance instance = instance_ret.value();
auto surface = create_surface_glfw(instance.instance, window);
GIVEN("A window and a vulkan instance") {
vkb::PhysicalDeviceSelector selector(instance);
auto phys_dev_ret = selector.set_surface(surface)
.set_vulkan_feature_config(vkb::get_feature_config_vulkan_1_0_desktop())
.select();
REQUIRE(phys_dev_ret);
GIVEN("A physical device created with the TargetBaseVulkanDesktop") {
vkb::DeviceBuilder device_builder(phys_dev_ret.value());
auto device_ret = device_builder.build();
REQUIRE(device_ret);
vkb::Device device = device_ret.value();
// possible swapchain creation...
vkb::destroy_device(device);
}
}
destroy_surface(*instance_ret, surface);
vkb::destroy_instance(instance);
destroy_window_glfw(window);
}