Core creation

The Core is the main object in the VkCV framework to manage and utilize resources of the application. Each application creates such a Core instance initially providing the application's name, its version, the required types of queues, Vulkan extensions and features. Make sure to include the header defining the Core class though.

#include <vkcv/Core.hpp>
const std::string applicationName = "My application";

vkcv::Core core = vkcv::Core::create(
  applicationName,          // application name: "My application"
  VK_MAKE_VERSION(0, 0, 1), // application version: 0.0.1
  {
    vk::QueueFlagBits::eTransfer, // queue flag required to transfer data to the GPU
    vk::QueueFlagBits::eGraphics, // queue flag required to make draw calls
    vk::QueueFlagBits::eCompute   // queue flag required to make compute calls
  },
  {
    VK_KHR_SWAPCHAIN_EXTENSION_NAME // extension required to draw into a window
  }
);

In this code example initializer lists are used to create a description of required queue flags or features/extensions.

The extensions and features are described in the next step Feature management. But what about those QueueFlagBits?

These flags describe the types of queues the application needs. Vulkan requires applications to specify those initially and the VkCV framework will let you do that as well. Here's a simplified overview of the different queue types and their capabilities:

  • Graphics: Allows you to use a graphics pipeline with its shaders for rasterization. You will need at least one graphics queue in any application to present something on a window.
  • Compute: Allows you to use a compute pipeline with its compute shaders. This might be optional for typical rendering but keep in mind that some modules for upscaling and other post-processing might use compute pipelines.
  • Transfer: Allows to transfer memory between resources and devices (your GPU for example) or the host (CPU side of the application). This can be necessary as soon as you use any buffer or image resource.

In our case of rendering a simple triangle, it will be fine to only request a graphics queue.

Previous

Next

Popular posts from this blog

Introduction

Application development

First setup