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
uint64_t
FFVulkanExtensions
;
30
31
#define FF_VK_EXT_EXTERNAL_DMABUF_MEMORY (1ULL << 0)
/* VK_EXT_external_memory_dma_buf */
32
#define FF_VK_EXT_DRM_MODIFIER_FLAGS (1ULL << 1)
/* VK_EXT_image_drm_format_modifier */
33
#define FF_VK_EXT_EXTERNAL_FD_MEMORY (1ULL << 2)
/* VK_KHR_external_memory_fd */
34
#define FF_VK_EXT_EXTERNAL_FD_SEM (1ULL << 3)
/* VK_KHR_external_semaphore_fd */
35
#define FF_VK_EXT_EXTERNAL_HOST_MEMORY (1ULL << 4)
/* VK_EXT_external_memory_host */
36
#define FF_VK_EXT_DEBUG_UTILS (1ULL << 5)
/* VK_EXT_debug_utils */
37
38
#ifdef _WIN32
39
#define FF_VK_EXT_EXTERNAL_WIN32_MEMORY (1ULL << 6)
/* VK_KHR_external_memory_win32 */
40
#define FF_VK_EXT_EXTERNAL_WIN32_SEM (1ULL << 7)
/* VK_KHR_external_semaphore_win32 */
41
#endif
42
43
#define FF_VK_EXT_DESCRIPTOR_BUFFER (1ULL << 8)
/* VK_EXT_descriptor_buffer */
44
#define FF_VK_EXT_DEVICE_DRM (1ULL << 9)
/* VK_EXT_physical_device_drm */
45
#define FF_VK_EXT_ATOMIC_FLOAT (1ULL << 10)
/* VK_EXT_shader_atomic_float */
46
#define FF_VK_EXT_COOP_MATRIX (1ULL << 11)
/* VK_KHR_cooperative_matrix */
47
#define FF_VK_EXT_OPTICAL_FLOW (1ULL << 12)
/* VK_NV_optical_flow */
48
#define FF_VK_EXT_SHADER_OBJECT (1ULL << 13)
/* VK_EXT_shader_object */
49
#define FF_VK_EXT_PUSH_DESCRIPTOR (1ULL << 14)
/* VK_KHR_push_descriptor */
50
#define FF_VK_EXT_RELAXED_EXTENDED_INSTR (1ULL << 15)
/* VK_KHR_shader_relaxed_extended_instruction */
51
52
/* Video extensions */
53
#define FF_VK_EXT_VIDEO_QUEUE (1ULL << 36)
/* VK_KHR_video_queue */
54
#define FF_VK_EXT_VIDEO_MAINTENANCE_1 (1ULL << 37)
/* VK_KHR_video_maintenance1 */
55
56
#define FF_VK_EXT_VIDEO_DECODE_QUEUE (1ULL << 40)
/* VK_KHR_video_decode_queue */
57
#define FF_VK_EXT_VIDEO_DECODE_H264 (1ULL << 41)
/* VK_KHR_video_decode_h264 */
58
#define FF_VK_EXT_VIDEO_DECODE_H265 (1ULL << 42)
/* VK_KHR_video_decode_h265 */
59
#define FF_VK_EXT_VIDEO_DECODE_AV1 (1ULL << 43)
/* VK_KHR_video_decode_av1 */
60
61
#define FF_VK_EXT_VIDEO_ENCODE_QUEUE (1ULL << 50)
/* VK_KHR_video_encode_queue */
62
#define FF_VK_EXT_VIDEO_ENCODE_H264 (1ULL << 51)
/* VK_KHR_video_encode_h264 */
63
#define FF_VK_EXT_VIDEO_ENCODE_H265 (1ULL << 52)
/* VK_KHR_video_encode_h265 */
64
65
#define FF_VK_EXT_PORTABILITY_SUBSET (1ULL << 62)
66
#define FF_VK_EXT_NO_FLAG (1ULL << 63)
67
68
/* Macro containing every function that we utilize in our codebase */
69
#define FN_LIST(MACRO) \
70
/* Instance */
\
71
MACRO(0, 0, FF_VK_EXT_NO_FLAG, EnumerateInstanceExtensionProperties) \
72
MACRO(0, 0, FF_VK_EXT_NO_FLAG, EnumerateInstanceLayerProperties) \
73
MACRO(0, 0, FF_VK_EXT_NO_FLAG, CreateInstance) \
74
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DestroyInstance) \
75
\
76
/* Debug */
\
77
MACRO(1, 0, FF_VK_EXT_NO_FLAG, CreateDebugUtilsMessengerEXT) \
78
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DestroyDebugUtilsMessengerEXT) \
79
\
80
/* Device */
\
81
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetDeviceProcAddr) \
82
MACRO(1, 0, FF_VK_EXT_NO_FLAG, CreateDevice) \
83
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceFeatures2) \
84
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceProperties) \
85
MACRO(1, 0, FF_VK_EXT_VIDEO_QUEUE, GetPhysicalDeviceVideoCapabilitiesKHR) \
86
MACRO(1, 0, FF_VK_EXT_VIDEO_QUEUE, GetPhysicalDeviceVideoFormatPropertiesKHR) \
87
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DeviceWaitIdle) \
88
MACRO(1, 0, FF_VK_EXT_NO_FLAG, DestroyDevice) \
89
\
90
MACRO(1, 0, FF_VK_EXT_NO_FLAG, EnumeratePhysicalDevices) \
91
MACRO(1, 0, FF_VK_EXT_NO_FLAG, EnumerateDeviceExtensionProperties) \
92
\
93
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceProperties2) \
94
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceMemoryProperties) \
95
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceFormatProperties2) \
96
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceImageFormatProperties2) \
97
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceQueueFamilyProperties) \
98
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceQueueFamilyProperties2) \
99
MACRO(1, 0, FF_VK_EXT_COOP_MATRIX, GetPhysicalDeviceCooperativeMatrixPropertiesKHR) \
100
\
101
/* Command pool */
\
102
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateCommandPool) \
103
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyCommandPool) \
104
\
105
/* Command buffer */
\
106
MACRO(1, 1, FF_VK_EXT_NO_FLAG, AllocateCommandBuffers) \
107
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BeginCommandBuffer) \
108
MACRO(1, 1, FF_VK_EXT_NO_FLAG, EndCommandBuffer) \
109
MACRO(1, 1, FF_VK_EXT_NO_FLAG, FreeCommandBuffers) \
110
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdDispatch) \
111
\
112
/* Queue */
\
113
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetDeviceQueue) \
114
MACRO(1, 1, FF_VK_EXT_NO_FLAG, QueueSubmit) \
115
MACRO(1, 1, FF_VK_EXT_NO_FLAG, QueueSubmit2) \
116
\
117
/* Fences */
\
118
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateFence) \
119
MACRO(1, 1, FF_VK_EXT_NO_FLAG, WaitForFences) \
120
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetFenceStatus) \
121
MACRO(1, 1, FF_VK_EXT_NO_FLAG, ResetFences) \
122
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyFence) \
123
\
124
/* Semaphores */
\
125
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_SEM, GetSemaphoreFdKHR) \
126
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_SEM, ImportSemaphoreFdKHR) \
127
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateSemaphore) \
128
MACRO(1, 1, FF_VK_EXT_NO_FLAG, WaitSemaphores) \
129
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroySemaphore) \
130
\
131
/* Memory */
\
132
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_MEMORY, GetMemoryFdKHR) \
133
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetMemoryFdPropertiesKHR) \
134
MACRO(1, 1, FF_VK_EXT_EXTERNAL_HOST_MEMORY, GetMemoryHostPointerPropertiesEXT) \
135
MACRO(1, 1, FF_VK_EXT_NO_FLAG, AllocateMemory) \
136
MACRO(1, 1, FF_VK_EXT_NO_FLAG, MapMemory) \
137
MACRO(1, 1, FF_VK_EXT_NO_FLAG, FlushMappedMemoryRanges) \
138
MACRO(1, 1, FF_VK_EXT_NO_FLAG, InvalidateMappedMemoryRanges) \
139
MACRO(1, 1, FF_VK_EXT_NO_FLAG, UnmapMemory) \
140
MACRO(1, 1, FF_VK_EXT_NO_FLAG, FreeMemory) \
141
\
142
/* Commands */
\
143
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdBindDescriptorSets) \
144
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdPushConstants) \
145
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdBindPipeline) \
146
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdPipelineBarrier) \
147
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdCopyBufferToImage) \
148
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdCopyImageToBuffer) \
149
\
150
/* Buffer */
\
151
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetBufferMemoryRequirements2) \
152
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateBuffer) \
153
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BindBufferMemory) \
154
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetBufferDeviceAddress) \
155
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdFillBuffer) \
156
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyBuffer) \
157
\
158
/* Image */
\
159
MACRO(1, 1, FF_VK_EXT_DRM_MODIFIER_FLAGS, GetImageDrmFormatModifierPropertiesEXT) \
160
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetImageMemoryRequirements2) \
161
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateImage) \
162
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BindImageMemory2) \
163
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetImageSubresourceLayout) \
164
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyImage) \
165
\
166
/* ImageView */
\
167
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateImageView) \
168
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyImageView) \
169
\
170
/* DescriptorSet */
\
171
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorSetLayout) \
172
MACRO(1, 1, FF_VK_EXT_NO_FLAG, AllocateDescriptorSets) \
173
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorPool) \
174
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorPool) \
175
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorSetLayout) \
176
\
177
/* Descriptor buffers */
\
178
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, GetDescriptorSetLayoutSizeEXT) \
179
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, GetDescriptorSetLayoutBindingOffsetEXT) \
180
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, GetDescriptorEXT) \
181
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, CmdBindDescriptorBuffersEXT) \
182
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, CmdSetDescriptorBufferOffsetsEXT) \
183
\
184
/* DescriptorUpdateTemplate */
\
185
MACRO(1, 1, FF_VK_EXT_NO_FLAG, UpdateDescriptorSetWithTemplate) \
186
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorUpdateTemplate) \
187
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorUpdateTemplate) \
188
\
189
/* Descriptors */
\
190
MACRO(1, 1, FF_VK_EXT_NO_FLAG, UpdateDescriptorSets) \
191
MACRO(1, 1, FF_VK_EXT_PUSH_DESCRIPTOR, CmdPushDescriptorSetKHR) \
192
\
193
/* Queries */
\
194
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateQueryPool) \
195
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetQueryPoolResults) \
196
MACRO(1, 1, FF_VK_EXT_NO_FLAG, ResetQueryPool) \
197
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdBeginQuery) \
198
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdEndQuery) \
199
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdResetQueryPool) \
200
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyQueryPool) \
201
\
202
/* sync2 */
\
203
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CmdPipelineBarrier2) \
204
\
205
/* Video queue */
\
206
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, CreateVideoSessionKHR) \
207
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, CreateVideoSessionParametersKHR) \
208
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, GetVideoSessionMemoryRequirementsKHR) \
209
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, BindVideoSessionMemoryKHR) \
210
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, CmdBeginVideoCodingKHR) \
211
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, CmdControlVideoCodingKHR) \
212
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, CmdEndVideoCodingKHR) \
213
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, DestroyVideoSessionParametersKHR) \
214
MACRO(1, 1, FF_VK_EXT_VIDEO_QUEUE, DestroyVideoSessionKHR) \
215
\
216
/* Video decoding */
\
217
MACRO(1, 1, FF_VK_EXT_VIDEO_DECODE_QUEUE, CmdDecodeVideoKHR) \
218
\
219
/* Video encoding */
\
220
MACRO(1, 1, FF_VK_EXT_VIDEO_ENCODE_QUEUE, CmdEncodeVideoKHR) \
221
MACRO(1, 1, FF_VK_EXT_VIDEO_ENCODE_QUEUE, GetEncodedVideoSessionParametersKHR) \
222
MACRO(1, 0, FF_VK_EXT_VIDEO_ENCODE_QUEUE, GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR) \
223
\
224
/* Pipeline */
\
225
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreatePipelineLayout) \
226
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyPipelineLayout) \
227
\
228
/* PipelineLayout */
\
229
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateComputePipelines) \
230
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyPipeline) \
231
\
232
/* Sampler */
\
233
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateSamplerYcbcrConversion) \
234
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroySamplerYcbcrConversion) \
235
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateSampler) \
236
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroySampler) \
237
\
238
/* Optical flow */
\
239
MACRO(1, 1, FF_VK_EXT_OPTICAL_FLOW, BindOpticalFlowSessionImageNV) \
240
MACRO(1, 1, FF_VK_EXT_OPTICAL_FLOW, CmdOpticalFlowExecuteNV) \
241
MACRO(1, 1, FF_VK_EXT_OPTICAL_FLOW, CreateOpticalFlowSessionNV) \
242
MACRO(1, 1, FF_VK_EXT_OPTICAL_FLOW, DestroyOpticalFlowSessionNV) \
243
MACRO(1, 0, FF_VK_EXT_OPTICAL_FLOW, GetPhysicalDeviceOpticalFlowImageFormatsNV)\
244
\
245
/* Shaders */
\
246
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateShaderModule) \
247
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyShaderModule) \
248
MACRO(1, 1, FF_VK_EXT_SHADER_OBJECT, CmdBindShadersEXT) \
249
MACRO(1, 1, FF_VK_EXT_SHADER_OBJECT, CreateShadersEXT) \
250
MACRO(1, 1, FF_VK_EXT_SHADER_OBJECT, DestroyShaderEXT) \
251
MACRO(1, 1, FF_VK_EXT_SHADER_OBJECT, GetShaderBinaryDataEXT)
252
253
/* Macro containing every win32 specific function that we utilize in our codebase */
254
#define FN_LIST_WIN32(MACRO) \
255
MACRO(1, 1, FF_VK_EXT_EXTERNAL_WIN32_SEM, GetSemaphoreWin32HandleKHR) \
256
MACRO(1, 1, FF_VK_EXT_EXTERNAL_WIN32_MEMORY, GetMemoryWin32HandleKHR)
257
258
/* Macro to turn a function name into a definition */
259
#define PFN_DEF(req_inst, req_dev, ext_flag, name) \
260
PFN_vk##name name;
261
262
/* Structure with the definition of all listed functions */
263
typedef
struct
FFVulkanFunctions
{
264
FN_LIST
(
PFN_DEF
)
265
#ifdef _WIN32
266
FN_LIST_WIN32
(
PFN_DEF
)
267
#endif
268
}
FFVulkanFunctions
;
269
270
#endif
/* AVUTIL_VULKAN_FUNCTIONS_H */
FFVulkanExtensions
uint64_t FFVulkanExtensions
Definition:
vulkan_functions.h:29
FN_LIST_WIN32
#define FN_LIST_WIN32(MACRO)
Definition:
vulkan_functions.h:254
FN_LIST
#define FN_LIST(MACRO)
Definition:
vulkan_functions.h:69
hwcontext_vulkan.h
PFN_DEF
#define PFN_DEF(req_inst, req_dev, ext_flag, name)
Definition:
vulkan_functions.h:259
hwcontext.h
FFVulkanFunctions
Definition:
vulkan_functions.h:263
Generated on Fri Nov 8 2024 19:23:06 for FFmpeg by
1.8.17