This way a single generated Vulkan version can accept a variety of inputs without having the combinatoric explosion which would occur when creating a function for each container type. // application to fall back to the OpenGL implementation. Vulkan-Hpp declares a class for all handles to ensure full type safety and to add support for member functions on handles. Add the files vulkan-surface.hpp and vulkan-surface.cpp to the application/vulkan folder. For the latter case, add your favorite custom allocator as template argument to the function call like this: All over vulkan.hpp, there are a couple of calls to an assert function. Next edit the implementation with the following: Ok let’s dissect this new code starting with the Internal struct. #include "../../core/graphics-wrapper.hpp" I built the program successfully. The scoped enum feature adds type safety to the flags, but also prevents using the flag bits as input for bitwise operations like & and |. We will use the SDL_Vulkan_CreateSurface function to obtain the surface then hold it in a vk::UniqueSurfaceKHR object. For the next part of our implementation we are actually going to be moving the creation of the SDL window from the vulkan-application.cpp into the vulkan-context.cpp for the following reasons: We will begin by creating the new encapsulation class for an SDL window. Its already a little bit shorter than the original code: A nicer way to unpack the result is provided by the structured bindings of C++17. All Vulkan commands are sent through these queues during our rendering code with the graphics queue used for processing Vulkan commands and the presentation queue for displaying a rendered frame to the output display hardware. Note: You will find that each target platform will have its own SurfaceKHR variant that will be compiled in as the implementation during a build. #include "../../core/graphics-wrapper.hpp" #include "../../core/internal-ptr.hpp" template Vulkan-Hpp provides constructors for all CreateInfo objects which accept one parameter for each member variable. a vulkan handle. // We need to wait for the device to become idle before allowing it to be destroyed. To help us identify Vulkan problems we will update our Vulkan application configuration to include validation layers - but only if we are running a debug version of our program. The names have been changed to 'e' + CamelCase with the VK_ prefix and type infix removed. // Add a presentation queue if the presentation queue needs to be, // We also need to request the swapchain extension be activated as we will need to use a swapchain. Tutorial structure. limitations under the License. GitHub Gist: instantly share code, notes, and snippets.