VPP  0.8
A high-level modern C++ API for Vulkan
vpp::createInstance Class Reference

Instance factory class. More...

#include <vppInstance.hpp>

Public Member Functions

 createInstance ()
 Constructs instance factory object with default options.
 
createInstancevulkan (const SVulkanVersion &v)
 Sets the target Vulkan version (default: 1.0.0). More...
 
createInstancevalidation (bool v)
 Sets the validation status (default: disabled).
 
createInstanceraw (bool v)
 If set, VPP will not add any extensions automatically (default: false). More...
 
createInstanceappName (const char *v)
 Sets the application name (default: null). More...
 
createInstanceengineName (const char *v)
 Sets the engine name (default: null). More...
 
createInstanceappVersion (unsigned int v)
 Sets the application version (default: 0). More...
 
createInstanceengineVersion (unsigned int v)
 Sets the engine version (default: 0). More...
 
createInstanceext (const std::string &v)
 Adds an instance extension to enable. More...
 
createInstancelayer (const std::string &v)
 Adds a layer to enable. More...
 
 operator Instance () const
 Creates actual instance with specified options.
 

Detailed Description

Instance factory class.

This class is meant to be used somewhat like a function. The syntax is as in the following examples:

// Most basic instance with default options.
Instance inst = createInstance();
// Instance with default options and validation turned on.
Instance inst = createInstance().validation ( true );
// Instance targeting specific version of Vulkan, with validation turned on and some extension enabled.
Instance inst = createInstance()
.vulkan ( { 1, 1, 0 } )
.validation ( true )
.ext ( "VK_KHR_device_group_creation" );

The createInstance actually construct proxy object that you can configure using chain of methods, and finally assign it to Instance variable. The last step creates the actual instance.

The default options (if you do not call any methods on the proxy object) are:

  • Vulkan 1.0.0 target,
  • no validation,
  • no application info,
  • no user-specified extensions (but VPP enables the swapchain and debug extensions by default),
  • no user-specified layers (but VPP enables validation layer automatically if validation is enabled).

Member Function Documentation

◆ appName()

createInstance& vpp::createInstance::appName ( const char *  v)

Sets the application name (default: null).

This is arbitrary name of your choice.

Providing information about your application in theory might enable Vulkan to include optimizations made for specific applications.

◆ appVersion()

createInstance& vpp::createInstance::appVersion ( unsigned int  v)

Sets the application version (default: 0).

This is arbitrary value of your choice.

Providing information about your application in theory might enable Vulkan to include optimizations made for specific applications.

◆ engineName()

createInstance& vpp::createInstance::engineName ( const char *  v)

Sets the engine name (default: null).

This is arbitrary name of your choice.

Providing information about your application in theory might enable Vulkan to include optimizations made for specific applications.

◆ engineVersion()

createInstance& vpp::createInstance::engineVersion ( unsigned int  v)

Sets the engine version (default: 0).

This is arbitrary value of your choice.

Providing information about your application in theory might enable Vulkan to include optimizations made for specific applications.

◆ ext()

createInstance& vpp::createInstance::ext ( const std::string &  v)

Adds an instance extension to enable.

Note that VPP enables some extensions automatically. Also, extensions that you supply here will be enabled only if supported by the system the application is being run on.

◆ layer()

createInstance& vpp::createInstance::layer ( const std::string &  v)

Adds a layer to enable.

Note that VPP enables some layers automatically and the system may also load additional layers without knowledge of the application.

◆ raw()

createInstance& vpp::createInstance::raw ( bool  v)

If set, VPP will not add any extensions automatically (default: false).

Only extensions you explicitly mention will be loaded (including surface, swapchain and debug extensions).

◆ vulkan()

createInstance& vpp::createInstance::vulkan ( const SVulkanVersion v)

Sets the target Vulkan version (default: 1.0.0).

Vulkan installations are backward-compatible. For example, if the system supports Vulkan 1.1, then it also supports Vulkan 1.0. However, there might exist systems not supporting Vulkan 1.1. It is your decision whether you require extended features of Vulkan 1.1 (or any further version). If not, then target earlier version. In general, it is reasonable to require minimum version that you actually need for features.

Only major and minor fields of the version structure are significant when matching the version. The patch field is ignored.

Specifying required version during instance construction must be followed by checking whether target physical device actually supports that version. There might be e.g. a system where new Vulkan driver is installed, but the device is an old graphic card with only Vulkan 1.0 support. You must manually check the device properties before using any features requiring newer version. Otherwise assume that capabilities and semantics are just as in older version.


The documentation for this class was generated from the following file: