FFmpeg
libavutil
vulkan_functions.h
Go to the documentation of this file.
1
/*
2
* This file is part of FFmpeg.
3
*
4
* FFmpeg is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* FFmpeg is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with FFmpeg; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#ifndef AVUTIL_VULKAN_FUNCTIONS_H
20
#define AVUTIL_VULKAN_FUNCTIONS_H
21
22
#define VK_NO_PROTOTYPES
23
#define VK_ENABLE_BETA_EXTENSIONS
24
25
#include "
hwcontext.h
"
26
#include "
hwcontext_vulkan.h
"
27
28
/* An enum of bitflags for every optional extension we need */
29
typedef
enum
FFVulkanExtensions
{
30
FF_VK_EXT_EXTERNAL_DMABUF_MEMORY
= 1ULL << 0,
/* VK_EXT_external_memory_dma_buf */
31
FF_VK_EXT_DRM_MODIFIER_FLAGS
= 1ULL << 1,
/* VK_EXT_image_drm_format_modifier */
32
FF_VK_EXT_EXTERNAL_FD_MEMORY
= 1ULL << 2,
/* VK_KHR_external_memory_fd */
33
FF_VK_EXT_EXTERNAL_FD_SEM
= 1ULL << 3,
/* VK_KHR_external_semaphore_fd */
34
FF_VK_EXT_EXTERNAL_HOST_MEMORY
= 1ULL << 4,
/* VK_EXT_external_memory_host */
35
FF_VK_EXT_DEBUG_UTILS
= 1ULL << 5,
/* VK_EXT_debug_utils */
36
#ifdef _WIN32
37
FF_VK_EXT_EXTERNAL_WIN32_MEMORY = 1ULL << 6,
/* VK_KHR_external_memory_win32 */
38
FF_VK_EXT_EXTERNAL_WIN32_SEM = 1ULL << 7,
/* VK_KHR_external_semaphore_win32 */
39
#endif
40
41
FF_VK_EXT_NO_FLAG
= 1ULL << 31,
42
}
FFVulkanExtensions
;
43
44
/* Macro containing every function that we utilize in our codebase */
45
#define FN_LIST(MACRO) \
46
/* Instance */
\
47
MACRO(0, 0, FF_VK_EXT_NO_FLAG, EnumerateInstanceExtensionProperties) \
48
MACRO(0, 0, FF_VK_EXT_NO_FLAG, EnumerateInstanceLayerProperties) \
49
MACRO(0, 0, FF_VK_EXT_NO_FLAG, CreateInstance) \
50
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DestroyInstance) \
51
\
52
/* Debug */
\
53
MACRO(1, 0, FF_VK_EXT_NO_FLAG, CreateDebugUtilsMessengerEXT) \
54
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DestroyDebugUtilsMessengerEXT) \
55
\
56
/* Device */
\
57
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetDeviceProcAddr) \
58
MACRO(1, 0, FF_VK_EXT_NO_FLAG, CreateDevice) \
59
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceFeatures2) \
60
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceProperties) \
61
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DeviceWaitIdle) \
62
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DestroyDevice) \
63
\
64
MACRO(1, 0, FF_VK_EXT_NO_FLAG, EnumeratePhysicalDevices) \
65
MACRO(1, 0, FF_VK_EXT_NO_FLAG, EnumerateDeviceExtensionProperties) \
66
\
67
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceProperties2) \
68
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceMemoryProperties) \
69
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceFormatProperties2) \
70
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceImageFormatProperties2) \
71
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceQueueFamilyProperties) \
72
\
73
/* Command pool */
\
74
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateCommandPool) \
75
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyCommandPool) \
76
\
77
/* Command buffer */
\
78
MACRO(1, 1, FF_VK_EXT_NO_FLAG, AllocateCommandBuffers) \
79
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BeginCommandBuffer) \
80
MACRO(1, 1, FF_VK_EXT_NO_FLAG, EndCommandBuffer) \
81
MACRO(1, 1, FF_VK_EXT_NO_FLAG, FreeCommandBuffers) \
82
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdDispatch) \
83
\
84
/* Queue */
\
85
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetDeviceQueue) \
86
MACRO(1, 1, FF_VK_EXT_NO_FLAG, QueueSubmit) \
87
\
88
/* Fences */
\
89
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateFence) \
90
MACRO(1, 1, FF_VK_EXT_NO_FLAG, WaitForFences) \
91
MACRO(1, 1, FF_VK_EXT_NO_FLAG, ResetFences) \
92
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyFence) \
93
\
94
/* Semaphores */
\
95
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_SEM, GetSemaphoreFdKHR) \
96
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateSemaphore) \
97
MACRO(1, 1, FF_VK_EXT_NO_FLAG, WaitSemaphores) \
98
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroySemaphore) \
99
\
100
/* Memory */
\
101
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_MEMORY, GetMemoryFdKHR) \
102
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetMemoryFdPropertiesKHR) \
103
MACRO(1, 1, FF_VK_EXT_EXTERNAL_HOST_MEMORY, GetMemoryHostPointerPropertiesEXT) \
104
MACRO(1, 1, FF_VK_EXT_NO_FLAG, AllocateMemory) \
105
MACRO(1, 1, FF_VK_EXT_NO_FLAG, MapMemory) \
106
MACRO(1, 1, FF_VK_EXT_NO_FLAG, FlushMappedMemoryRanges) \
107
MACRO(1, 1, FF_VK_EXT_NO_FLAG, InvalidateMappedMemoryRanges) \
108
MACRO(1, 1, FF_VK_EXT_NO_FLAG, UnmapMemory) \
109
MACRO(1, 1, FF_VK_EXT_NO_FLAG, FreeMemory) \
110
\
111
/* Commands */
\
112
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdBindDescriptorSets) \
113
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdPushConstants) \
114
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdBindPipeline) \
115
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdPipelineBarrier) \
116
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdCopyBufferToImage) \
117
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdCopyImageToBuffer) \
118
\
119
/* Buffer */
\
120
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetBufferMemoryRequirements2) \
121
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateBuffer) \
122
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BindBufferMemory) \
123
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyBuffer) \
124
\
125
/* Image */
\
126
MACRO(1, 1, FF_VK_EXT_DRM_MODIFIER_FLAGS, GetImageDrmFormatModifierPropertiesEXT) \
127
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetImageMemoryRequirements2) \
128
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateImage) \
129
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BindImageMemory2) \
130
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetImageSubresourceLayout) \
131
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyImage) \
132
\
133
/* ImageView */
\
134
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateImageView) \
135
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyImageView) \
136
\
137
/* DescriptorSet */
\
138
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorSetLayout) \
139
MACRO(1, 1, FF_VK_EXT_NO_FLAG, AllocateDescriptorSets) \
140
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorPool) \
141
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorPool) \
142
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorSetLayout) \
143
\
144
/* DescriptorUpdateTemplate */
\
145
MACRO(1, 1, FF_VK_EXT_NO_FLAG, UpdateDescriptorSetWithTemplate) \
146
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorUpdateTemplate) \
147
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorUpdateTemplate) \
148
\
149
/* Pipeline */
\
150
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreatePipelineLayout) \
151
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyPipelineLayout) \
152
\
153
/* PipelineLayout */
\
154
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateComputePipelines) \
155
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyPipeline) \
156
\
157
/* Sampler */
\
158
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateSampler) \
159
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroySampler) \
160
\
161
/* Shaders */
\
162
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateShaderModule) \
163
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyShaderModule)
164
165
/* Macro containing every win32 specific function that we utilize in our codebase */
166
#define FN_LIST_WIN32(MACRO) \
167
MACRO(1, 1, FF_VK_EXT_EXTERNAL_WIN32_SEM, GetSemaphoreWin32HandleKHR) \
168
MACRO(1, 1, FF_VK_EXT_EXTERNAL_WIN32_MEMORY, GetMemoryWin32HandleKHR)
169
170
/* Macro to turn a function name into a definition */
171
#define PFN_DEF(req_inst, req_dev, ext_flag, name) \
172
PFN_vk##name name;
173
174
/* Structure with the definition of all listed functions */
175
typedef
struct
FFVulkanFunctions
{
176
FN_LIST
(
PFN_DEF
)
177
#ifdef _WIN32
178
FN_LIST_WIN32
(
PFN_DEF
)
179
#endif
180
}
FFVulkanFunctions
;
181
182
#endif
/* AVUTIL_VULKAN_FUNCTIONS_H */
FF_VK_EXT_NO_FLAG
@ FF_VK_EXT_NO_FLAG
Definition:
vulkan_functions.h:41
FN_LIST_WIN32
#define FN_LIST_WIN32(MACRO)
Definition:
vulkan_functions.h:166
FN_LIST
#define FN_LIST(MACRO)
Definition:
vulkan_functions.h:45
FF_VK_EXT_EXTERNAL_HOST_MEMORY
@ FF_VK_EXT_EXTERNAL_HOST_MEMORY
Definition:
vulkan_functions.h:34
hwcontext_vulkan.h
FF_VK_EXT_DRM_MODIFIER_FLAGS
@ FF_VK_EXT_DRM_MODIFIER_FLAGS
Definition:
vulkan_functions.h:31
FF_VK_EXT_EXTERNAL_DMABUF_MEMORY
@ FF_VK_EXT_EXTERNAL_DMABUF_MEMORY
Definition:
vulkan_functions.h:30
FF_VK_EXT_EXTERNAL_FD_MEMORY
@ FF_VK_EXT_EXTERNAL_FD_MEMORY
Definition:
vulkan_functions.h:32
PFN_DEF
#define PFN_DEF(req_inst, req_dev, ext_flag, name)
Definition:
vulkan_functions.h:171
FF_VK_EXT_DEBUG_UTILS
@ FF_VK_EXT_DEBUG_UTILS
Definition:
vulkan_functions.h:35
FFVulkanExtensions
FFVulkanExtensions
Definition:
vulkan_functions.h:29
FF_VK_EXT_EXTERNAL_FD_SEM
@ FF_VK_EXT_EXTERNAL_FD_SEM
Definition:
vulkan_functions.h:33
hwcontext.h
FFVulkanFunctions
Definition:
vulkan_functions.h:175
Generated on Tue Feb 28 2023 21:34:14 for FFmpeg by
1.8.17