2020-01-30 08:15:10 +00:00
|
|
|
# Vk-Bootstrap
|
|
|
|
|
|
|
|
A Vulkan Utility library meant to jump start a Vulkan Application
|
|
|
|
|
|
|
|
This library simplifies the tedious process of:
|
|
|
|
|
|
|
|
* Instance Creation
|
|
|
|
* Physical Device Selection
|
|
|
|
* Device Creation
|
|
|
|
* Getting Queues
|
|
|
|
* Swapchain Creation
|
|
|
|
|
2020-02-04 03:34:46 +00:00
|
|
|
It also adds several convenience for:
|
|
|
|
|
|
|
|
* enabling validation layers
|
|
|
|
* setting up a debug callback
|
|
|
|
* automate getting a drawable surface
|
|
|
|
* selecting a gpu based on a small set of common criteria
|
|
|
|
|
2020-01-30 08:15:10 +00:00
|
|
|
## Example
|
|
|
|
|
|
|
|
```cpp
|
2020-01-31 22:23:22 +00:00
|
|
|
vkb::InstanceBuilder builder;
|
2020-01-30 08:15:10 +00:00
|
|
|
builder.setup_validation_layers()
|
|
|
|
.set_app_name ("example")
|
|
|
|
.set_default_debug_messenger ();
|
2020-02-04 03:34:46 +00:00
|
|
|
auto inst_ret = builder.build();
|
|
|
|
if (!inst_ret.has_value()) {
|
|
|
|
// error
|
2020-01-30 08:15:10 +00:00
|
|
|
}
|
2020-02-04 03:34:46 +00:00
|
|
|
vkb::Instance inst = inst_ret.value();
|
2020-01-30 08:15:10 +00:00
|
|
|
|
2020-02-04 03:34:46 +00:00
|
|
|
vkb::PhysicalDeviceSelector selector{ inst };
|
2020-01-30 09:01:49 +00:00
|
|
|
selector.set_surface (/* from user created window*/)
|
2020-02-04 03:34:46 +00:00
|
|
|
.set_minimum_version (1, 0)
|
|
|
|
.require_dedicated_transfer_queue();
|
2020-01-30 08:15:10 +00:00
|
|
|
auto phys_ret = selector.select ();
|
2020-02-04 03:34:46 +00:00
|
|
|
if (!phys_ret.has_value()) {
|
|
|
|
// error
|
2020-01-30 08:15:10 +00:00
|
|
|
}
|
2020-02-04 03:34:46 +00:00
|
|
|
vkb::PhysicalDevice physical_device = phys_ret.value();
|
2020-01-30 08:15:10 +00:00
|
|
|
|
2020-02-04 03:34:46 +00:00
|
|
|
vkb::DeviceBuilder device_builder{ physical_device };
|
2020-01-30 08:15:10 +00:00
|
|
|
auto dev_ret = device_builder.build ();
|
2020-02-04 03:34:46 +00:00
|
|
|
if (!dev_ret.has_value()){
|
|
|
|
// error
|
2020-01-30 08:15:10 +00:00
|
|
|
}
|
2020-02-04 03:34:46 +00:00
|
|
|
vkb::Device device = dev_ret.value();
|
|
|
|
|
|
|
|
VkQueue graphics_queue = get_queue_graphics(device).value();
|
|
|
|
VkQueue compute_queue = get_queue_compute(device).value();
|
|
|
|
VkQueue transfer_queue = get_queue_transfer(device).value();
|
|
|
|
|
2020-01-30 08:15:10 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Building
|
|
|
|
|
2020-01-30 09:01:49 +00:00
|
|
|
Requires CMake and Vulkan installed on your system.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone https://github.com/charles-lunarg/vk-bootstrap
|
|
|
|
cd vk-bootstrap
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake ..
|
|
|
|
```
|
|
|
|
|
|
|
|
To test, glfw and Catch2 are used and automatically included using git submodules.
|
|
|
|
|
|
|
|
In the project directory, run
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git submodule update --init
|
|
|
|
```
|
|
|
|
|
|
|
|
to get the required dependencies for testing setup.
|
|
|
|
|
|
|
|
Then return to the build directory and enable tests with `VK_BOOTSTRAP_TEST`
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cmake ../path/to/vk-bootstrap/ -DVK_BOOTSTRAP_TEST=ON
|
|
|
|
```
|
|
|
|
|
2020-02-04 03:34:46 +00:00
|
|
|
## Todo's
|
2020-01-30 09:01:49 +00:00
|
|
|
|
2020-02-04 03:34:46 +00:00
|
|
|
* Package library to be usable
|
|
|
|
* More examples
|
|
|
|
* Testing
|
|
|
|
* Documenting API
|
|
|
|
* Fleshing out device configuration
|