|
wisdom
|
This page provides basic examples of how to use the Wisdom library in your project. The examples cover initialization and basic setup. Most of the examples are provided in the examples directory of the library.
In order to use the Wisdom library, you need to create the wis::Factory. The concept is similar to the IDXGIFactory in DirectX 12 and VkInstance in Vulkan.
First, you need to include the main header file:
To create the factory, you can use the wis::CreateFactory function. This function will create the factory and return it.
// or with RVO (Return Value Optimization)
Thats it! You have created the factory and can use it to create adapters and devices.
wis::CreateFactory function will create the factory with the default extensions. However there are some extensions that you can use to extend the factory functionality. One of such extensions is wis::DebugExtension, which provides debug functionality for the factory. It is extension, so you need to link it to your project and include the header file:
To use the extension, you need to pass it to the wis::CreateFactory function as an argument. The first argument for wis::CreateFactory is a debug flag, which must be set to true if you want to use the debug extension. Then all the extensions are passed as an array of pointers to the wis::FactoryExtension objects.
That code will create the factory with the debug extension enabled.
CreateFactory function. Before that point the extension is not initialized and cannot be used. This is also true for Device extensions.After the factory is created you can use factory to create adapters and devices. The debug extension can then be used to create debug messenger.
You can also use other extensions to extend the factory functionality.
List of factory extensions:
| Extension | Header | Capability |
|---|---|---|
wis::DebugExtension | <wisdom/wisdom_debug.hpp> | Debug functionality for the factory |
wis::WindowsExtension | <wisdom/wisdom_platform.hpp> or <wisdom/wisdom_windows.hpp> | Windows-specific functionality for factory and swapchain creation |
wis::X11Extension | <wisdom/wisdom_platform.hpp> or <wisdom/wisdom_x11.hpp> | X11-specific functionality for factory and swapchain creation |
wis::WaylandExtension | <wisdom/wisdom_platform.hpp> or <wisdom/wisdom_wayland.hpp> | Wayland-specific functionality for factory and swapchain creation |