nngn
Loading...
Searching...
No Matches
nngn::Instance Class Reference

Owning wrapper for a Vulkan instance. More...

#include <instance.h>

Public Types

using ErrorFn = void(void*)
 

Public Member Functions

 Instance (void)=default
 
 ~Instance (void)
 Destroys the VkInstance and debug objects.
 
bool init (Graphics::Version version, std::span< const char *const > extensions)
 Initializes an instance with no debug capabilities.
 
bool init_debug (Graphics::Version version, std::span< const char *const > extensions, std::span< const char *const > layers, ErrorFn error_fn, void *error_data, Graphics::LogLevel log_level)
 Initializes an instance in debug mode.
 
VkInstance id () const
 Provides access to the underlying Vulkan handle.
 
void set_error ()
 Called by the debug callback when an error is received.
 
template<typename R >
get_proc_addr (const char *name) const
 Retrieves a function pointer by name, cast to R.
 
template<typename T >
bool set_obj_name (VkDevice dev, T obj, std::string_view name) const
 Sets the debug name of an object.
 
template<typename T >
bool set_obj_name (VkDevice d, T obj, std::string_view name, std::size_t n, std::string *buf) const
 Sets the debug name of an object.
 
template<typename T >
bool set_obj_name (VkDevice d, std::span< T > v, std::string_view name) const
 Sets the debug name of a range of objects.
 
template<typename T >
bool set_obj_name (VkDevice d, T obj, std::string_view name, std::size_t n) const
 Sets the debug name of a range of objects.
 

Private Member Functions

bool set_obj_name (VkDevice d, VkObjectType t, std::uint64_t obj, std::string_view name) const
 
bool set_obj_name (VkDevice d, VkObjectType t, std::uint64_t obj, std::string_view name, std::size_t n, std::string *buf) const
 

Static Private Member Functions

template<typename T >
static auto obj_handle (T o)
 

Private Attributes

VkInstance h = {}
 
VkDebugUtilsMessengerEXT messenger = {}
 
PFN_vkSetDebugUtilsObjectNameEXT set_obj_name_f = {}
 
ErrorFnerror_fn = {}
 
void * error_data = {}
 

Detailed Description

Owning wrapper for a Vulkan instance.

Member Typedef Documentation

◆ ErrorFn

using nngn::Instance::ErrorFn = void(void*)

Constructor & Destructor Documentation

◆ Instance()

nngn::Instance::Instance ( void )
default

◆ ~Instance()

nngn::Instance::~Instance ( void )

Destroys the VkInstance and debug objects.

Here is the call graph for this function:

Member Function Documentation

◆ get_proc_addr()

template<typename R >
R nngn::Instance::get_proc_addr ( const char * name) const

Retrieves a function pointer by name, cast to R.

Here is the call graph for this function:

◆ id()

VkInstance nngn::Instance::id ( ) const
inline

Provides access to the underlying Vulkan handle.

Here is the caller graph for this function:

◆ init()

bool nngn::Instance::init ( Graphics::Version version,
std::span< const char *const > extensions )

Initializes an instance with no debug capabilities.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_debug()

bool nngn::Instance::init_debug ( Graphics::Version version,
std::span< const char *const > extensions,
std::span< const char *const > layers,
ErrorFn error_fn,
void * error_data,
Graphics::LogLevel log_level )

Initializes an instance in debug mode.

extensions and layers must be supported by the implementation (see InstanceInfo).

Parameters
error_fnCalled when the debug callback reports an error.
error_dataArgument for error_fn.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ obj_handle()

template<typename T >
auto nngn::Instance::obj_handle ( T o)
staticprivate
Here is the caller graph for this function:

◆ set_error()

void nngn::Instance::set_error ( )
inline

Called by the debug callback when an error is received.

◆ set_obj_name() [1/6]

template<typename T >
bool nngn::Instance::set_obj_name ( VkDevice d,
std::span< T > v,
std::string_view name ) const
inline

Sets the debug name of a range of objects.

Here is the call graph for this function:

◆ set_obj_name() [2/6]

template<typename T >
bool nngn::Instance::set_obj_name ( VkDevice d,
T obj,
std::string_view name,
std::size_t n ) const
inline

Sets the debug name of a range of objects.

Here is the call graph for this function:

◆ set_obj_name() [3/6]

template<typename T >
bool nngn::Instance::set_obj_name ( VkDevice d,
T obj,
std::string_view name,
std::size_t n,
std::string * buf ) const
inline

Sets the debug name of an object.

Here is the call graph for this function:

◆ set_obj_name() [4/6]

bool nngn::Instance::set_obj_name ( VkDevice d,
VkObjectType t,
std::uint64_t obj,
std::string_view name ) const
private
Here is the call graph for this function:

◆ set_obj_name() [5/6]

bool nngn::Instance::set_obj_name ( VkDevice d,
VkObjectType t,
std::uint64_t obj,
std::string_view name,
std::size_t n,
std::string * buf ) const
private
Here is the call graph for this function:

◆ set_obj_name() [6/6]

template<typename T >
bool nngn::Instance::set_obj_name ( VkDevice dev,
T obj,
std::string_view name ) const
inline

Sets the debug name of an object.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ error_data

void* nngn::Instance::error_data = {}
private

◆ error_fn

ErrorFn* nngn::Instance::error_fn = {}
private

◆ h

VkInstance nngn::Instance::h = {}
private

◆ messenger

VkDebugUtilsMessengerEXT nngn::Instance::messenger = {}
private

◆ set_obj_name_f

PFN_vkSetDebugUtilsObjectNameEXT nngn::Instance::set_obj_name_f = {}
private

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