1#ifndef NNGN_GRAPHICS_VULKAN_INSTANCE_H
2#define NNGN_GRAPHICS_VULKAN_INSTANCE_H
11#include "graphics/graphics.h"
29 std::span<const
char *const> extensions);
39 std::span<const
char *const> extensions,
40 std::span<const
char *const> layers,
43 VkInstance
id()
const {
return this->
h; }
54 VkDevice d,
T obj, std::string_view
name, std::size_t
n,
55 std::string *buf)
const;
59 VkDevice d, std::span<T>
v, std::string_view
name)
const;
63 VkDevice d,
T obj, std::string_view
name, std::size_t
n)
const;
67 VkDevice d, VkObjectType t,
68 std::uint64_t obj, std::string_view
name)
const;
70 VkDevice d, VkObjectType t,
71 std::uint64_t obj, std::string_view
name, std::size_t
n,
72 std::string *buf)
const;
84 std::vector<Graphics::Extension>
extensions = {};
85 std::vector<Graphics::Layer>
layers = {};
99 if constexpr(std::is_base_of_v<Handle, T>)
102 return reinterpret_cast<std::uintptr_t
>(obj);
107 VkDevice d,
T obj, std::string_view
name
115 VkDevice d,
T obj, std::string_view
name, std::size_t
n
123 VkDevice d,
T obj, std::string_view
name, std::size_t
n,
132 VkDevice d, std::span<T>
v, std::string_view
name
134 std::string buf = {};
135 constexpr auto t = vk_obj_type<std::decay_t<T>>;
136 for(std::size_t
i = 0,
n =
v.size();
i <
n; ++
i)
Owning wrapper for a Vulkan instance.
Definition: instance.h:19
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.
Definition: instance.cpp:116
void(void *) ErrorFn
Definition: instance.h:21
bool set_obj_name(VkDevice d, std::span< T > v, std::string_view name) const
Sets the debug name of a range of objects.
ErrorFn * error_fn
Definition: instance.h:76
void * error_data
Definition: instance.h:77
void set_error()
Called by the debug callback when an error is received.
Definition: instance.h:45
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.
bool set_obj_name(VkDevice dev, T obj, std::string_view name) const
Sets the debug name of an object.
VkInstance h
Definition: instance.h:73
VkDebugUtilsMessengerEXT messenger
Definition: instance.h:74
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 auto obj_handle(T o)
Definition: instance.h:98
PFN_vkSetDebugUtilsObjectNameEXT set_obj_name_f
Definition: instance.h:75
R get_proc_addr(const char *name) const
Retrieves a function pointer by name, cast to R.
static auto obj_handle(T o)
bool set_obj_name(VkDevice d, VkObjectType t, std::uint64_t obj, std::string_view name) const
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.
init
Definition: img_common.lua:34
for i
Definition: font.lua:5
name
Definition: cathedral.lua:11
n
Definition: dump_lights.lua:5
v[1]
Definition: math.lua:19
#define NNGN_MOVE_ONLY(x)
Definition: utils.h:39
Definition: graphics.h:155
Definition: graphics.h:138
void init_devices(VkInstance i)
Initializes device data.
std::vector< Graphics::Layer > layers
Definition: instance.h:85
std::vector< Graphics::Extension > extensions
Definition: instance.h:84
std::uint32_t version
Definition: instance.h:83
std::vector< VkPhysicalDevice > physical_devs
Definition: instance.h:86
bool init()
Initializes instance-independent data.
bool check_version(Graphics::Version v) const
Verifies that the given version is supported.