nngn
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1#ifndef NNGN_GRAPHICS_VULKAN_TYPES_H
2#define NNGN_GRAPHICS_VULKAN_TYPES_H
3
4#include "os/platform.h"
5
6#ifdef NNGN_PLATFORM_HAS_VULKAN
7#include "utils/macros.h"
8#include "utils/utils.h"
9
10#include "vulkan.h"
11
12namespace nngn {
13
18#define NNGN_VK_TYPES(f) \
19 f(VkBuffer, BUFFER, NNGN_APPLY2) \
20 f(VkCommandBuffer, COMMAND_BUFFER, NNGN_IGNORE2) \
21 f(VkCommandPool, COMMAND_POOL, NNGN_APPLY2) \
22 f(VkDescriptorPool, DESCRIPTOR_POOL, NNGN_APPLY2) \
23 f(VkDescriptorSet, DESCRIPTOR_SET, NNGN_IGNORE2) \
24 f(VkDescriptorSetLayout, DESCRIPTOR_SET_LAYOUT, NNGN_APPLY2) \
25 f(VkDeviceMemory, DEVICE_MEMORY, NNGN_IGNORE2) \
26 f(VkFence, FENCE, NNGN_APPLY2) \
27 f(VkFramebuffer, FRAMEBUFFER, NNGN_APPLY2) \
28 f(VkImage, IMAGE, NNGN_APPLY2) \
29 f(VkImageView, IMAGE_VIEW, NNGN_APPLY2) \
30 f(VkPipeline, PIPELINE, NNGN_IGNORE2) \
31 f(VkQueue, QUEUE, NNGN_IGNORE2) \
32 f(VkPipelineCache, PIPELINE_CACHE, NNGN_APPLY2) \
33 f(VkPipelineLayout, PIPELINE_LAYOUT, NNGN_APPLY2) \
34 f(VkRenderPass, RENDER_PASS, NNGN_APPLY2) \
35 f(VkSampler, SAMPLER, NNGN_APPLY2) \
36 f(VkSemaphore, SEMAPHORE, NNGN_APPLY2) \
37 f(VkShaderModule, SHADER_MODULE, NNGN_APPLY2)
38
39namespace detail {
40
41/* Implements \ref vk_create_info_type. */
42template<typename T> struct vk_create_info_type_impl;
43
44}
45
47template<typename T> using vk_create_info_type =
49
51template<typename T> inline constexpr empty vk_struct_type = {};
52
54template<typename T> inline constexpr empty vk_obj_type = {};
55
56namespace detail {
57
58#define C(x, _) \
59 template<> struct vk_create_info_type_impl<x> \
60 { using type = x ## CreateInfo; };
61#define X(x, n, c) c(C, x, n)
63#undef X
64#undef C
65
66}
67
68#define C(x, n) \
69 template<> inline constexpr auto vk_struct_type<x> = \
70 VK_STRUCTURE_TYPE_ ## n ## _CREATE_INFO;
71#define X(x, n, c) c(C, x, n)
73#undef X
74#undef C
75
76#define X(x, n, _) \
77 template<> inline constexpr auto vk_obj_type<x> = \
78 VK_OBJECT_TYPE_ ## n;
80#undef X
81
82}
83
84#undef NNGN_VK_TYPES
85
86#endif
87
88#endif
#define X(x, n, c)
Definition types.h:61
#define NNGN_VK_TYPES(f)
X-macro that operates on Vulkan types.
Definition types.h:18
Definition audio.cpp:7
typename detail::vk_create_info_type_impl< T >::type vk_create_info_type
Maps types to *CretaeInfo structures.
Definition types.h:47
constexpr empty vk_obj_type
Maps types to VkObjectType values.
Definition types.h:54
constexpr empty vk_struct_type
Maps types to VkStructureType values.
Definition types.h:51
empty
Definition utils.h:89