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 *)
 
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.
 
 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
 
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)
 
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 [1/2]

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

◆ ErrorFn [2/2]

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

Constructor & Destructor Documentation

◆ Instance() [1/2]

nngn::Instance::Instance ( void  )
default

◆ ~Instance() [1/2]

nngn::Instance::~Instance ( void  )

Destroys the VkInstance and debug objects.

Here is the call graph for this function:

◆ Instance() [2/2]

nngn::Instance::Instance ( void  )
default

◆ ~Instance() [2/2]

nngn::Instance::~Instance ( void  )

Destroys the VkInstance and debug objects.

Member Function Documentation

◆ get_proc_addr() [1/2]

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:

◆ get_proc_addr() [2/2]

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

Retrieves a function pointer by name, cast to R.

◆ id() [1/2]

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

Provides access to the underlying Vulkan handle.

Here is the caller graph for this function:

◆ id() [2/2]

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

Provides access to the underlying Vulkan handle.

◆ init() [1/2]

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() [2/2]

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

Initializes an instance with no debug capabilities.

◆ init_debug() [1/2]

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:

◆ init_debug() [2/2]

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.

◆ obj_handle() [1/2]

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

◆ obj_handle() [2/2]

template<typename T >
static auto nngn::Instance::obj_handle ( T  o)
staticprivate

◆ set_error() [1/2]

void nngn::Instance::set_error ( )
inline

Called by the debug callback when an error is received.

◆ set_error() [2/2]

void nngn::Instance::set_error ( )
inline

Called by the debug callback when an error is received.

◆ set_obj_name() [1/12]

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/12]

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

Sets the debug name of a range of objects.

◆ set_obj_name() [3/12]

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() [4/12]

template<typename T >
bool nngn::Instance::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.

◆ set_obj_name() [5/12]

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() [6/12]

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

Sets the debug name of an object.

◆ set_obj_name() [7/12]

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() [8/12]

bool nngn::Instance::set_obj_name ( VkDevice  d,
VkObjectType  t,
std::uint64_t  obj,
std::string_view  name 
) const
private

◆ set_obj_name() [9/12]

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() [10/12]

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

◆ set_obj_name() [11/12]

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:

◆ set_obj_name() [12/12]

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

Sets the debug name of an object.

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: