nngn
Loading...
Searching...
No Matches
utils.h File Reference
#include <algorithm>
#include <cstdint>
#include <ranges>
#include <span>
#include <string>
#include <vector>
#include "graphics/graphics.h"
#include "utils/concepts.h"
#include "utils/fn.h"
#include "utils/log.h"
#include "types.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  nngn
 

Concepts

concept  nngn::VkNamedRange
 

Macros

#define LOG_RESULT(f, ...)   nngn::vk_check_result(#f, f(__VA_ARGS__))
 
#define CHECK_RESULT(f, ...)    do { if(!LOG_RESULT(f, __VA_ARGS__)) [[unlikely]] return false; } while(0);
 

Functions

const char * nngn::vk_strerror (VkResult result)
 
const char * nngn::vk_enum_str (VkDebugUtilsMessageSeverityFlagBitsEXT f)
 
const char * nngn::vk_enum_str (VkDebugUtilsMessageTypeFlagsEXT f)
 
std::string nngn::vk_version_str (std::uint32_t v)
 Unpacks a Vulkan version number into a character array.
 
std::string nngn::vk_version_str (Graphics::Version v)
 
Graphics::Version nngn::vk_parse_version (std::uint32_t v)
 Unpacks a Vulkan version number.
 
template<typename T >
vk_create_info_type< Tnngn::vk_create_info (vk_create_info_type< T > info)
 
nngn::uvec2 nngn::vk_extent_to_vec (VkExtent2D e)
 
VkExtent2D nngn::vk_vec_to_extent (nngn::uvec2 v)
 
bool nngn::vk_check_result (const char *func, VkResult r)
 Checks that r is VK_SUCCESS or emits a log message.
 
template<c_function_pointer auto f>
auto nngn::vk_enumerate (const auto &...args)
 Creates a vector from the result of calling f with args.
 
std::vector< Graphics::Extension > nngn::vk_parse_extensions (std::span< const VkExtensionProperties > s)
 Populates Graphics::Extension objects from their Vulkan equivalents.
 
Graphics::PresentMode nngn::vk_present_mode (VkPresentModeKHR m)
 Populates a Graphics::PresentMode from its Vulkan equivalent.
 
template<typename T , auto ... Ps>
constexpr auto nngn::vk_vertex_input (std::span< const VkVertexInputBindingDescription > bindings)
 
std::vector< const char * > nngn::vk_names (const VkNamedRange auto &r)
 Extracts the name character array from common objects.
 
template<standard_layout T, auto ... Ps>
auto nngn::vk_vertex_attrs ()
 
constexpr VkPipelineVertexInputStateCreateInfo nngn::vk_vertex_input (std::span< const VkVertexInputBindingDescription > bindings, std::span< const VkVertexInputAttributeDescription > attrs)
 

Macro Definition Documentation

◆ CHECK_RESULT

#define CHECK_RESULT (   f,
  ... 
)     do { if(!LOG_RESULT(f, __VA_ARGS__)) [[unlikely]] return false; } while(0);

◆ LOG_RESULT

#define LOG_RESULT (   f,
  ... 
)    nngn::vk_check_result(#f, f(__VA_ARGS__))