FFmpeg: libavutil/vulkan.h Source File

FFmpeg
vulkan.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_H
20 #define AVUTIL_VULKAN_H
21 
22  #define VK_NO_PROTOTYPES
23 
24 #include <stdatomic.h>
25 
26 #include "pixdesc.h"
27 #include "bprint.h"
28 #include "hwcontext.h"
29 #include "vulkan_functions.h"
30 #include "hwcontext_vulkan.h"
31 
32 /* GLSL management macros */
33  #define INDENT(N) INDENT_##N
34  #define INDENT_0
35  #define INDENT_1 INDENT_0 " "
36  #define INDENT_2 INDENT_1 INDENT_1
37  #define INDENT_3 INDENT_2 INDENT_1
38  #define INDENT_4 INDENT_3 INDENT_1
39  #define INDENT_5 INDENT_4 INDENT_1
40  #define INDENT_6 INDENT_5 INDENT_1
41  #define C(N, S) INDENT(N) #S "\n"
42 
43  #define GLSLC(N, S) \
44  do { \
45  av_bprintf(&shd->src, C(N, S)); \
46  } while (0)
47 
48  #define GLSLA(...) \
49  do { \
50  av_bprintf(&shd->src, __VA_ARGS__); \
51  } while (0)
52 
53  #define GLSLF(N, S, ...) \
54  do { \
55  av_bprintf(&shd->src, C(N, S), __VA_ARGS__); \
56  } while (0)
57 
58  #define GLSLD(D) \
59  do { \
60  av_bprintf(&shd->src, "\n"); \
61  av_bprint_append_data(&shd->src, D, strlen(D)); \
62  av_bprintf(&shd->src, "\n"); \
63  } while (0)
64 
65 /* Helper, pretty much every Vulkan return value needs to be checked */
66  #define RET(x) \
67  do { \
68  if ((err = (x)) < 0) \
69  goto fail; \
70  } while (0)
71 
72  #define DUP_SAMPLER(x) { x, x, x, x }
73 
74  typedef struct FFVulkanDescriptorSetBinding {
75   const char *name;
76   VkDescriptorType type;
77   const char *mem_layout; /* Storage images (rgba8, etc.) and buffers (std430, etc.) */
78   const char *mem_quali; /* readonly, writeonly, etc. */
79   const char *buf_content; /* For buffers */
80   uint32_t dimensions; /* Needed for e.g. sampler%iD */
81   uint32_t elems; /* 0 - scalar, 1 or more - vector */
82   VkShaderStageFlags stages;
83   uint32_t buf_elems; /* Appends [buf_elems] to the contents. Avoids manually printing to a string. */
84   VkSampler samplers[4]; /* Sampler to use for all elems */
85 } FFVulkanDescriptorSetBinding;
86 
87  typedef struct FFVkBuffer {
88   VkBuffer buf;
89   VkDeviceMemory mem;
90   VkMemoryPropertyFlagBits flags;
91   size_t size;
92   VkDeviceAddress address;
93 
94  /* Local use only */
95   VkPipelineStageFlags2 stage;
96   VkAccessFlags2 access;
97 
98  /* Only valid when allocated via ff_vk_get_pooled_buffer with HOST_VISIBLE or
99  * via ff_vk_host_map_buffer */
100   uint8_t *mapped_mem;
101 
102  /* Set by ff_vk_host_map_buffer. This is the offset at which the buffer data
103  * actually begins at.
104  * The address and mapped_mem fields will be offset by this amount. */
105   size_t virtual_offset;
106 
107  /* If host mapping, reference to the backing host memory buffer */
108   AVBufferRef *host_ref;
109 } FFVkBuffer;
110 
111  typedef struct FFVkExecContext {
112   uint32_t idx;
113   const struct FFVkExecPool *parent;
114   int had_submission;
115 
116  /* Queue for the execution context */
117   VkQueue queue;
118   int qf;
119   int qi;
120 
121  /* Command buffer for the context */
122   VkCommandBuffer buf;
123 
124  /* Fence for the command buffer */
125   VkFence fence;
126 
127  /* Opaque data, untouched, free to use by users */
128   void *opaque;
129 
130   void *query_data;
131   int query_idx;
132 
133  /* Buffer dependencies */
134   AVBufferRef **buf_deps;
135   int nb_buf_deps;
136   unsigned int buf_deps_alloc_size;
137 
138  /* Frame dependencies */
139   AVFrame **frame_deps;
140   unsigned int frame_deps_alloc_size;
141   int nb_frame_deps;
142 
143  /* Software frame dependencies */
144   AVFrame **sw_frame_deps;
145   unsigned int sw_frame_deps_alloc_size;
146   int nb_sw_frame_deps;
147 
148   VkSemaphoreSubmitInfo *sem_wait;
149   unsigned int sem_wait_alloc;
150   int sem_wait_cnt;
151 
152   VkSemaphoreSubmitInfo *sem_sig;
153   unsigned int sem_sig_alloc;
154   int sem_sig_cnt;
155 
156   uint64_t **sem_sig_val_dst;
157   unsigned int sem_sig_val_dst_alloc;
158   int sem_sig_val_dst_cnt;
159 
160   uint8_t *frame_locked;
161   unsigned int frame_locked_alloc_size;
162 
163   VkAccessFlagBits *access_dst;
164   unsigned int access_dst_alloc;
165 
166   VkImageLayout *layout_dst;
167   unsigned int layout_dst_alloc;
168 
169   uint32_t *queue_family_dst;
170   unsigned int queue_family_dst_alloc;
171 
172   uint8_t *frame_update;
173   unsigned int frame_update_alloc_size;
174 } FFVkExecContext;
175 
176  typedef struct FFVulkanDescriptorSet {
177  /* Descriptor buffer */
178   VkDeviceSize layout_size;
179   VkDeviceSize aligned_size; /* descriptorBufferOffsetAlignment */
180   VkBufferUsageFlags usage;
181 
182   VkDescriptorSetLayoutBinding *binding;
183   VkDeviceSize *binding_offset;
184   int nb_bindings;
185 
186  /* Descriptor set is shared between all submissions */
187   int singular;
188 } FFVulkanDescriptorSet;
189 
190  typedef struct FFVulkanShader {
191  /* Name for id/debugging purposes */
192   const char *name;
193 
194  /* Shader text */
195   AVBPrint src;
196 
197  /* Compute shader local group sizes */
198   int lg_size[3];
199 
200  /* Shader bind point/type */
201   VkPipelineStageFlags stage;
202   VkPipelineBindPoint bind_point;
203 
204  /* Creation info */
205   VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info;
206 
207  /* Base shader object */
208   VkShaderEXT object;
209   VkPipeline pipeline;
210 
211  /* Pipeline layout */
212   VkPipelineLayout pipeline_layout;
213 
214  /* Push consts */
215   VkPushConstantRange *push_consts;
216   int push_consts_num;
217 
218  /* Descriptor sets */
219   FFVulkanDescriptorSet *desc_set;
220   int nb_descriptor_sets;
221 
222  /* Descriptor buffer */
223   VkDescriptorSetLayout *desc_layout;
224   uint32_t *bound_buffer_indices;
225 
226  /* Descriptor pool */
227   int use_push;
228   VkDescriptorPoolSize *desc_pool_size;
229   int nb_desc_pool_size;
230 } FFVulkanShader;
231 
232  typedef struct FFVulkanDescriptorSetData {
233  /* Descriptor buffer */
234   FFVkBuffer buf;
235   uint8_t *desc_mem;
236 } FFVulkanDescriptorSetData;
237 
238  typedef struct FFVulkanShaderData {
239  /* Shader to which this data belongs to */
240   FFVulkanShader *shd;
241   int nb_descriptor_sets;
242 
243  /* Descriptor buffer */
244   FFVulkanDescriptorSetData *desc_set_buf;
245   VkDescriptorBufferBindingInfoEXT *desc_bind;
246 
247  /* Descriptor pools */
248   VkDescriptorSet *desc_sets;
249   VkDescriptorPool desc_pool;
250 } FFVulkanShaderData;
251 
252  typedef struct FFVkExecPool {
253   FFVkExecContext *contexts;
254   atomic_uint_least64_t idx;
255 
256   VkCommandPool *cmd_buf_pools;
257   VkCommandBuffer *cmd_bufs;
258   int pool_size;
259 
260   VkQueryPool query_pool;
261   void *query_data;
262   int query_results;
263   int query_statuses;
264   int query_64bit;
265   int query_status_stride;
266   int nb_queries;
267   size_t qd_size;
268 
269  /* Registered shaders' data */
270   FFVulkanShaderData *reg_shd;
271   int nb_reg_shd;
272 } FFVkExecPool;
273 
274  typedef struct FFVulkanContext {
275   const AVClass *class;
276   void *log_parent;
277 
278   FFVulkanFunctions vkfn;
279   FFVulkanExtensions extensions;
280   VkPhysicalDeviceProperties2 props;
281   VkPhysicalDeviceVulkan11Properties props_11;
282   VkPhysicalDeviceDriverProperties driver_props;
283   VkPhysicalDeviceMemoryProperties mprops;
284   VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops;
285   VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props;
286   VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props;
287   VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props;
288   VkPhysicalDevicePushDescriptorPropertiesKHR push_desc_props;
289   VkPhysicalDeviceOpticalFlowPropertiesNV optical_flow_props;
290   VkQueueFamilyQueryResultStatusPropertiesKHR *query_props;
291   VkQueueFamilyVideoPropertiesKHR *video_props;
292   VkQueueFamilyProperties2 *qf_props;
293   int tot_nb_qfs;
294   VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_props;
295   VkImageLayout *host_image_copy_layouts;
296 
297   VkCooperativeMatrixPropertiesKHR *coop_mat_props;
298   uint32_t coop_mat_props_nb;
299 
300   VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_feats;
301   VkPhysicalDeviceVulkan12Features feats_12;
302   VkPhysicalDeviceFeatures2 feats;
303 
304   AVBufferRef *device_ref;
305   AVHWDeviceContext *device;
306   AVVulkanDeviceContext *hwctx;
307 
308   AVBufferRef *input_frames_ref;
309   AVBufferRef *frames_ref;
310   AVHWFramesContext *frames;
311   AVVulkanFramesContext *hwfc;
312 
313   uint32_t qfs[64];
314   int nb_qfs;
315 
316  /* Properties */
317   int output_width;
318   int output_height;
319   enum AVPixelFormat output_format;
320   enum AVPixelFormat input_format;
321 } FFVulkanContext;
322 
323  static inline int ff_vk_count_images(AVVkFrame *f)
324 {
325  int cnt = 0;
326  while (cnt < FF_ARRAY_ELEMS(f->img) && f->img[cnt])
327  cnt++;
328 
329  return cnt;
330 }
331 
332  static inline const void *ff_vk_find_struct(const void *chain, VkStructureType stype)
333 {
334  const VkBaseInStructure *in = chain;
335  while (in) {
336  if (in->sType == stype)
337  return in;
338 
339  in = in->pNext;
340  }
341 
342  return NULL;
343 }
344 
345  static inline void ff_vk_link_struct(void *chain, const void *in)
346 {
347  VkBaseOutStructure *out = chain;
348  while (out->pNext)
349  out = out->pNext;
350 
351  out->pNext = (void *)in;
352 }
353 
354  #define FF_VK_STRUCT_EXT(CTX, BASE, STRUCT_P, EXT_FLAG, TYPE) \
355  do { \
356  if ((EXT_FLAG == FF_VK_EXT_NO_FLAG) || \
357  ((CTX)->extensions & EXT_FLAG)) { \
358  (STRUCT_P)->sType = TYPE; \
359  ff_vk_link_struct(BASE, STRUCT_P); \
360  } \
361  } while (0)
362 
363 /* Identity mapping - r = r, b = b, g = g, a = a */
364 extern const VkComponentMapping ff_comp_identity_map;
365 
366 /**
367  * Initializes the AVClass, in case this context is not used
368  * as the main user's context.
369  * May use either a frames context reference, or a device context reference.
370  */
371 int ff_vk_init(FFVulkanContext *s, void *log_parent,
372  AVBufferRef *device_ref, AVBufferRef *frames_ref);
373 
374 /**
375  * Converts Vulkan return values to strings
376  */
377 const char *ff_vk_ret2str(VkResult res);
378 
379 /**
380  * Map between usage and features.
381  */
382 VkImageUsageFlags ff_vk_map_feats_to_usage(VkFormatFeatureFlagBits2 feats);
383 VkFormatFeatureFlagBits2 ff_vk_map_usage_to_feats(VkImageUsageFlags usage);
384 
385 /**
386  * Returns 1 if pixfmt is a usable RGB format.
387  */
388 int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt);
389 
390 /**
391  * Since storage images may not be swizzled, we have to do this in the
392  * shader itself. This fills in a lookup table to do it.
393  */
394 void ff_vk_set_perm(enum AVPixelFormat pix_fmt, int lut[4], int inv);
395 
396 /**
397  * Get the aspect flag for a plane from an image.
398  */
399 VkImageAspectFlags ff_vk_aspect_flag(AVFrame *f, int p);
400 
401 /**
402  * Returns the format to use for images in shaders.
403  */
404  enum FFVkShaderRepFormat {
405  /* Native format with no conversion. May require casting. */
406   FF_VK_REP_NATIVE = 0,
407  /* Float conversion of the native format. */
408   FF_VK_REP_FLOAT,
409  /* Signed integer version of the native format */
410   FF_VK_REP_INT,
411  /* Unsigned integer version of the native format */
412   FF_VK_REP_UINT,
413 };
414 const char *ff_vk_shader_rep_fmt(enum AVPixelFormat pix_fmt,
415  enum FFVkShaderRepFormat rep_fmt);
416 
417 /**
418  * Loads props/mprops/driver_props
419  */
420 int ff_vk_load_props(FFVulkanContext *s);
421 
422 /**
423  * Chooses an appropriate QF.
424  */
425 AVVulkanDeviceQueueFamily *ff_vk_qf_find(FFVulkanContext *s,
426  VkQueueFlagBits dev_family,
427  VkVideoCodecOperationFlagBitsKHR vid_ops);
428 
429 /**
430  * Allocates/frees an execution pool.
431  * If used in a multi-threaded context, there must be at least as many contexts
432  * as there are threads.
433  * ff_vk_exec_pool_init_desc() MUST be called if ff_vk_exec_descriptor_set_add()
434  * has been called.
435  */
436 int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *qf,
437  FFVkExecPool *pool, int nb_contexts,
438  int nb_queries, VkQueryType query_type, int query_64bit,
439  const void *query_create_pnext);
440 void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool);
441 
442 /**
443  * Retrieve an execution pool. Threadsafe.
444  */
445 FFVkExecContext *ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool);
446 
447 /**
448  * Performs nb_queries queries and returns their results and statuses.
449  * 64_BIT and WITH_STATUS flags are ignored as 64_BIT must be specified via
450  * query_64bit in ff_vk_exec_pool_init() and WITH_STATUS is always enabled.
451  */
452 VkResult ff_vk_exec_get_query(FFVulkanContext *s, FFVkExecContext *e,
453  void **data, VkQueryResultFlagBits flags);
454 
455 /**
456  * Start/submit/wait an execution.
457  * ff_vk_exec_start() always waits on a submission, so using ff_vk_exec_wait()
458  * is not necessary (unless using it is just better).
459  */
460 int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e);
461 int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e);
462 void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e);
463 
464 /**
465  * Execution dependency management.
466  * Can attach buffers to executions that will only be unref'd once the
467  * buffer has finished executing.
468  * Adding a frame dep will *lock the frame*, until either the dependencies
469  * are discarded, the execution is submitted, or a failure happens.
470  * update_frame will update the frame's properties before it is unlocked,
471  * only if submission was successful.
472  */
473 int ff_vk_exec_add_dep_buf(FFVulkanContext *s, FFVkExecContext *e,
474  AVBufferRef **deps, int nb_deps, int ref);
475 int ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e,
476  VkSemaphore sem, uint64_t val,
477  VkPipelineStageFlagBits2 stage);
478 int ff_vk_exec_add_dep_bool_sem(FFVulkanContext *s, FFVkExecContext *e,
479  VkSemaphore *sem, int nb,
480  VkPipelineStageFlagBits2 stage,
481  int wait); /* Ownership transferred if !wait */
482 int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f,
483  VkPipelineStageFlagBits2 wait_stage,
484  VkPipelineStageFlagBits2 signal_stage);
485 int ff_vk_exec_add_dep_sw_frame(FFVulkanContext *s, FFVkExecContext *e,
486  AVFrame *f);
487 void ff_vk_exec_update_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f,
488  VkImageMemoryBarrier2 *bar, uint32_t *nb_img_bar);
489 int ff_vk_exec_mirror_sem_value(FFVulkanContext *s, FFVkExecContext *e,
490  VkSemaphore *dst, uint64_t *dst_val,
491  AVFrame *f);
492 void ff_vk_exec_discard_deps(FFVulkanContext *s, FFVkExecContext *e);
493 
494 /**
495  * Create a single imageview for a given plane.
496  */
497 int ff_vk_create_imageview(FFVulkanContext *s,
498  VkImageView *img_view, VkImageAspectFlags *aspect,
499  AVFrame *f, int plane, enum FFVkShaderRepFormat rep_fmt);
500 
501 /**
502  * Create an imageview and add it as a dependency to an execution.
503  */
504 int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e,
505  VkImageView views[AV_NUM_DATA_POINTERS],
506  AVFrame *f, enum FFVkShaderRepFormat rep_fmt);
507 
508 void ff_vk_frame_barrier(FFVulkanContext *s, FFVkExecContext *e,
509  AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar,
510  VkPipelineStageFlags src_stage,
511  VkPipelineStageFlags dst_stage,
512  VkAccessFlagBits new_access,
513  VkImageLayout new_layout,
514  uint32_t new_qf);
515 
516 /**
517  * Memory/buffer/image allocation helpers.
518  */
519 int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
520  VkMemoryPropertyFlagBits req_flags, void *alloc_extension,
521  VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem);
522 int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size,
523  void *pNext, void *alloc_pNext,
524  VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags);
525 
526 /**
527  * Buffer management code.
528  */
529 int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[],
530  int nb_buffers, int invalidate);
531 int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers,
532  int flush);
533 
534  static inline int ff_vk_map_buffer(FFVulkanContext *s, FFVkBuffer *buf, uint8_t **mem,
535  int invalidate)
536 {
537  return ff_vk_map_buffers(s, (FFVkBuffer *[]){ buf }, mem,
538  1, invalidate);
539 }
540 
541  static inline int ff_vk_unmap_buffer(FFVulkanContext *s, FFVkBuffer *buf, int flush)
542 {
543  return ff_vk_unmap_buffers(s, (FFVkBuffer *[]){ buf }, 1, flush);
544 }
545 
546 void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf);
547 
548 /** Initialize a pool and create AVBufferRefs containing FFVkBuffer.
549  * Threadsafe to use. Buffers are automatically mapped on creation if
550  * VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT is set in mem_props. Users should
551  * synchronize access themselvesd. Mainly meant for device-local buffers. */
552 int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool,
553  AVBufferRef **buf, VkBufferUsageFlags usage,
554  void *create_pNext, size_t size,
555  VkMemoryPropertyFlagBits mem_props);
556 
557 /** Maps a system RAM buffer into a Vulkan buffer.
558  * References the source buffer.
559  */
560 int ff_vk_host_map_buffer(FFVulkanContext *s, AVBufferRef **dst,
561  uint8_t *src_data, const AVBufferRef *src_buf,
562  VkBufferUsageFlags usage);
563 
564 /**
565  * Create a sampler.
566  */
567 int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler,
568  int unnorm_coords, VkFilter filt);
569 
570 /**
571  * Initialize a shader object, with a specific set of extensions, type+bind,
572  * local group size, and subgroup requirements.
573  */
574 int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name,
575  VkPipelineStageFlags stage,
576  const char *extensions[], int nb_extensions,
577  int lg_x, int lg_y, int lg_z,
578  uint32_t required_subgroup_size);
579 
580 /**
581  * Output the shader code as logging data, with a specific
582  * priority.
583  */
584 void ff_vk_shader_print(void *ctx, FFVulkanShader *shd, int prio);
585 
586 /**
587  * Link a shader into an executable.
588  */
589 int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd,
590  uint8_t *spirv, size_t spirv_len,
591  const char *entrypoint);
592 
593 /**
594  * Add/update push constants for execution.
595  */
596 int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size,
597  VkShaderStageFlagBits stage);
598 
599 /**
600  * Add descriptor to a shader. Must be called before shader init.
601  */
602 int ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd,
603  FFVulkanDescriptorSetBinding *desc, int nb,
604  int singular, int print_to_shader_only);
605 
606 /**
607  * Register a shader with an exec pool.
608  * Pool may be NULL if all descriptor sets are read-only.
609  */
610 int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool,
611  FFVulkanShader *shd);
612 
613 /**
614  * Bind a shader.
615  */
616 void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e,
617  FFVulkanShader *shd);
618 
619 /**
620  * Update push constant in a shader.
621  * Must be called before binding the shader.
622  */
623 void ff_vk_shader_update_push_const(FFVulkanContext *s, FFVkExecContext *e,
624  FFVulkanShader *shd,
625  VkShaderStageFlagBits stage,
626  int offset, size_t size, void *src);
627 
628 /**
629  * Update a descriptor in a buffer with a buffer.
630  * Must be called before binding the shader.
631  */
632 int ff_vk_shader_update_desc_buffer(FFVulkanContext *s, FFVkExecContext *e,
633  FFVulkanShader *shd,
634  int set, int bind, int elem,
635  FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len,
636  VkFormat fmt);
637 
638 /**
639  * Sets an image descriptor for specified shader and binding.
640  */
641 int ff_vk_shader_update_img(FFVulkanContext *s, FFVkExecContext *e,
642  FFVulkanShader *shd, int set, int bind, int offs,
643  VkImageView view, VkImageLayout layout,
644  VkSampler sampler);
645 
646 /**
647  * Update a descriptor in a buffer with an image array..
648  * Must be called before binding the shader.
649  */
650 void ff_vk_shader_update_img_array(FFVulkanContext *s, FFVkExecContext *e,
651  FFVulkanShader *shd, AVFrame *f,
652  VkImageView *views, int set, int binding,
653  VkImageLayout layout, VkSampler sampler);
654 
655 /**
656  * Free a shader.
657  */
658 void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd);
659 
660 /**
661  * Frees main context.
662  */
663 void ff_vk_uninit(FFVulkanContext *s);
664 
665 #endif /* AVUTIL_VULKAN_H */
FFVulkanShader::bind_point
VkPipelineBindPoint bind_point
Definition: vulkan.h:202
flags
const SwsFlags flags[]
Definition: swscale.c:61
ff_vk_ret2str
const char * ff_vk_ret2str(VkResult res)
Converts Vulkan return values to strings.
Definition: vulkan.c:35
ff_vk_exec_add_dep_bool_sem
int ff_vk_exec_add_dep_bool_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *sem, int nb, VkPipelineStageFlagBits2 stage, int wait)
Definition: vulkan.c:713
ff_vk_map_buffers
int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[], int nb_buffers, int invalidate)
Buffer management code.
Definition: vulkan.c:1123
ff_vk_unmap_buffers
int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers, int flush)
Definition: vulkan.c:1170
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
ff_vk_exec_discard_deps
void ff_vk_exec_discard_deps(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:591
ff_vk_map_usage_to_feats
VkFormatFeatureFlagBits2 ff_vk_map_usage_to_feats(VkImageUsageFlags usage)
FFVulkanContext::hwfc
AVVulkanFramesContext * hwfc
Definition: vulkan.h:311
ff_vk_uninit
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
Definition: vulkan.c:2964
ff_vk_exec_add_dep_frame
int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkPipelineStageFlagBits2 wait_stage, VkPipelineStageFlagBits2 signal_stage)
Definition: vulkan.c:779
FFVulkanContext::output_height
int output_height
Definition: vulkan.h:318
FFVulkanContext::props_11
VkPhysicalDeviceVulkan11Properties props_11
Definition: vulkan.h:281
FFVkExecContext::frame_deps_alloc_size
unsigned int frame_deps_alloc_size
Definition: vulkan.h:140
out
FILE * out
Definition: movenc.c:55
FFVulkanExtensions
uint64_t FFVulkanExtensions
Definition: vulkan_functions.h:29
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
ff_vk_load_props
int ff_vk_load_props(FFVulkanContext *s)
Loads props/mprops/driver_props.
Definition: vulkan.c:142
ff_vk_exec_pool_init
int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *qf, FFVkExecPool *pool, int nb_contexts, int nb_queries, VkQueryType query_type, int query_64bit, const void *query_create_pnext)
Allocates/frees an execution pool.
Definition: vulkan.c:356
ff_vk_exec_add_dep_sw_frame
int ff_vk_exec_add_dep_sw_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f)
Definition: vulkan.c:646
FFVulkanContext::device_ref
AVBufferRef * device_ref
Definition: vulkan.h:304
FFVkExecPool::contexts
FFVkExecContext * contexts
Definition: vulkan.h:253
FFVkExecPool::idx
atomic_uint_least64_t idx
Definition: vulkan.h:254
FFVulkanDescriptorSetData
Definition: vulkan.h:232
FFVulkanShader::nb_desc_pool_size
int nb_desc_pool_size
Definition: vulkan.h:229
FFVulkanShaderData
Definition: vulkan.h:238
FFVkExecContext::qf
int qf
Definition: vulkan.h:118
FFVkBuffer::access
VkAccessFlags2 access
Definition: vulkan.h:96
FFVulkanDescriptorSet::aligned_size
VkDeviceSize aligned_size
Definition: vulkan.h:179
FFVulkanShaderData::shd
FFVulkanShader * shd
Definition: vulkan.h:240
ff_vk_init
int ff_vk_init(FFVulkanContext *s, void *log_parent, AVBufferRef *device_ref, AVBufferRef *frames_ref)
Initializes the AVClass, in case this context is not used as the main user's context.
Definition: vulkan.c:2976
FFVkBuffer::stage
VkPipelineStageFlags2 stage
Definition: vulkan.h:95
FFVkBuffer::host_ref
AVBufferRef * host_ref
Definition: vulkan.h:108
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
pixdesc.h
FFVulkanDescriptorSetBinding::stages
VkShaderStageFlags stages
Definition: vulkan.h:82
ff_vk_map_buffer
static int ff_vk_map_buffer(FFVulkanContext *s, FFVkBuffer *buf, uint8_t **mem, int invalidate)
Definition: vulkan.h:534
FFVulkanShader::subgroup_info
VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info
Definition: vulkan.h:205
ff_vk_find_struct
static const void * ff_vk_find_struct(const void *chain, VkStructureType stype)
Definition: vulkan.h:332
FFVulkanShader::pipeline
VkPipeline pipeline
Definition: vulkan.h:209
FFVkExecContext::sem_sig_alloc
unsigned int sem_sig_alloc
Definition: vulkan.h:153
ff_vk_frame_barrier
void ff_vk_frame_barrier(FFVulkanContext *s, FFVkExecContext *e, AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar, VkPipelineStageFlags src_stage, VkPipelineStageFlags dst_stage, VkAccessFlagBits new_access, VkImageLayout new_layout, uint32_t new_qf)
Definition: vulkan.c:2013
FFVulkanShaderData::desc_bind
VkDescriptorBufferBindingInfoEXT * desc_bind
Definition: vulkan.h:245
FFVulkanShader::src
AVBPrint src
Definition: vulkan.h:195
FFVulkanShader::use_push
int use_push
Definition: vulkan.h:227
ff_vk_exec_add_dep_wait_sem
int ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
Definition: vulkan.c:696
data
const char data[16]
Definition: mxf.c:149
ff_vk_shader_link
int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd, uint8_t *spirv, size_t spirv_len, const char *entrypoint)
Link a shader into an executable.
Definition: vulkan.c:2353
FFVkBuffer::address
VkDeviceAddress address
Definition: vulkan.h:92
FFVkExecContext::sem_wait
VkSemaphoreSubmitInfo * sem_wait
Definition: vulkan.h:148
FF_VK_REP_NATIVE
@ FF_VK_REP_NATIVE
Definition: vulkan.h:406
FF_VK_REP_INT
@ FF_VK_REP_INT
Definition: vulkan.h:410
FFVulkanDescriptorSetBinding::buf_content
const char * buf_content
Definition: vulkan.h:79
ff_vk_shader_print
void ff_vk_shader_print(void *ctx, FFVulkanShader *shd, int prio)
Output the shader code as logging data, with a specific priority.
Definition: vulkan.c:2138
FFVkExecPool::query_pool
VkQueryPool query_pool
Definition: vulkan.h:260
FFVkExecPool::nb_reg_shd
int nb_reg_shd
Definition: vulkan.h:271
FFVulkanDescriptorSetData::desc_mem
uint8_t * desc_mem
Definition: vulkan.h:235
ff_vk_shader_add_descriptor_set
int ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, FFVulkanDescriptorSetBinding *desc, int nb, int singular, int print_to_shader_only)
Add descriptor to a shader.
Definition: vulkan.c:2428
FFVkExecContext::nb_sw_frame_deps
int nb_sw_frame_deps
Definition: vulkan.h:146
FFVulkanShaderData::desc_sets
VkDescriptorSet * desc_sets
Definition: vulkan.h:248
FFVulkanContext::tot_nb_qfs
int tot_nb_qfs
Definition: vulkan.h:293
FFVkShaderRepFormat
FFVkShaderRepFormat
Returns the format to use for images in shaders.
Definition: vulkan.h:404
FFVkBuffer::buf
VkBuffer buf
Definition: vulkan.h:88
ff_vk_shader_free
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
Definition: vulkan.c:2923
FFVkExecContext::frame_update_alloc_size
unsigned int frame_update_alloc_size
Definition: vulkan.h:173
FFVulkanShader::desc_layout
VkDescriptorSetLayout * desc_layout
Definition: vulkan.h:223
ff_vk_shader_register_exec
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
Definition: vulkan.c:2563
ff_vk_shader_rep_fmt
const char * ff_vk_shader_rep_fmt(enum AVPixelFormat pix_fmt, enum FFVkShaderRepFormat rep_fmt)
Definition: vulkan.c:1589
FFVulkanDescriptorSet::nb_bindings
int nb_bindings
Definition: vulkan.h:184
FFVulkanContext::feats
VkPhysicalDeviceFeatures2 feats
Definition: vulkan.h:302
ff_vk_exec_mirror_sem_value
int ff_vk_exec_mirror_sem_value(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *dst, uint64_t *dst_val, AVFrame *f)
Definition: vulkan.c:878
FFVulkanDescriptorSet::layout_size
VkDeviceSize layout_size
Definition: vulkan.h:178
AVVulkanFramesContext
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
Definition: hwcontext_vulkan.h:208
FFVkExecPool::query_64bit
int query_64bit
Definition: vulkan.h:264
FFVulkanContext::subgroup_props
VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props
Definition: vulkan.h:286
val
static double val(void *priv, double ch)
Definition: aeval.c:77
FFVulkanContext::frames_ref
AVBufferRef * frames_ref
Definition: vulkan.h:309
FFVulkanContext::atomic_float_feats
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_feats
Definition: vulkan.h:300
FFVkExecPool::query_statuses
int query_statuses
Definition: vulkan.h:263
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:63
FFVulkanDescriptorSet::binding
VkDescriptorSetLayoutBinding * binding
Definition: vulkan.h:182
FFVulkanDescriptorSetBinding::type
VkDescriptorType type
Definition: vulkan.h:76
ff_vk_exec_get_query
VkResult ff_vk_exec_get_query(FFVulkanContext *s, FFVkExecContext *e, void **data, VkQueryResultFlagBits flags)
Performs nb_queries queries and returns their results and statuses.
Definition: vulkan.c:519
FFVulkanDescriptorSetData::buf
FFVkBuffer buf
Definition: vulkan.h:234
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
FFVulkanDescriptorSetBinding::samplers
VkSampler samplers[4]
Definition: vulkan.h:84
FFVkExecContext::frame_deps
AVFrame ** frame_deps
Definition: vulkan.h:139
ff_vk_link_struct
static void ff_vk_link_struct(void *chain, const void *in)
Definition: vulkan.h:345
set
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)
Definition: swresample.c:59
ff_vk_host_map_buffer
int ff_vk_host_map_buffer(FFVulkanContext *s, AVBufferRef **dst, uint8_t *src_data, const AVBufferRef *src_buf, VkBufferUsageFlags usage)
Maps a system RAM buffer into a Vulkan buffer.
Definition: vulkan.c:1361
FFVkExecContext::queue_family_dst
uint32_t * queue_family_dst
Definition: vulkan.h:169
FFVulkanDescriptorSetBinding::elems
uint32_t elems
Definition: vulkan.h:81
FFVulkanContext::output_width
int output_width
Definition: vulkan.h:317
ff_vk_shader_update_desc_buffer
int ff_vk_shader_update_desc_buffer(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, int set, int bind, int elem, FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len, VkFormat fmt)
Update a descriptor in a buffer with a buffer.
Definition: vulkan.c:2813
FFVulkanShader::push_consts
VkPushConstantRange * push_consts
Definition: vulkan.h:215
s
#define s(width, name)
Definition: cbs_vp9.c:198
FFVulkanContext::log_parent
void * log_parent
Definition: vulkan.h:276
FFVulkanContext::driver_props
VkPhysicalDeviceDriverProperties driver_props
Definition: vulkan.h:282
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
FFVkExecContext::fence
VkFence fence
Definition: vulkan.h:125
ff_vk_free_buf
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
Definition: vulkan.c:1212
FF_VK_REP_FLOAT
@ FF_VK_REP_FLOAT
Definition: vulkan.h:408
FFVkExecContext::nb_buf_deps
int nb_buf_deps
Definition: vulkan.h:135
FFVulkanShader::stage
VkPipelineStageFlags stage
Definition: vulkan.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:49
ff_vk_create_buf
int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size, void *pNext, void *alloc_pNext, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags)
Definition: vulkan.c:1021
FFVulkanDescriptorSetBinding::mem_layout
const char * mem_layout
Definition: vulkan.h:77
FFVkExecContext::frame_update
uint8_t * frame_update
Definition: vulkan.h:172
FFVkExecContext::query_idx
int query_idx
Definition: vulkan.h:131
FFVkExecPool::query_status_stride
int query_status_stride
Definition: vulkan.h:265
FFVkExecContext::parent
const struct FFVkExecPool * parent
Definition: vulkan.h:113
ff_vk_shader_update_push_const
void ff_vk_shader_update_push_const(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, VkShaderStageFlagBits stage, int offset, size_t size, void *src)
Update push constant in a shader.
Definition: vulkan.c:2879
AVVulkanDeviceContext
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vulkan.h:59
FFVulkanShaderData::desc_set_buf
FFVulkanDescriptorSetData * desc_set_buf
Definition: vulkan.h:244
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
FFVkExecContext::sw_frame_deps_alloc_size
unsigned int sw_frame_deps_alloc_size
Definition: vulkan.h:145
FFVkExecContext::sem_sig_val_dst_alloc
unsigned int sem_sig_val_dst_alloc
Definition: vulkan.h:157
NULL
#define NULL
Definition: coverity.c:32
FFVulkanDescriptorSetBinding::buf_elems
uint32_t buf_elems
Definition: vulkan.h:83
ff_vk_create_imageviews
int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e, VkImageView views[AV_NUM_DATA_POINTERS], AVFrame *f, enum FFVkShaderRepFormat rep_fmt)
Create an imageview and add it as a dependency to an execution.
Definition: vulkan.c:1930
FFVkExecContext::access_dst_alloc
unsigned int access_dst_alloc
Definition: vulkan.h:164
FFVulkanDescriptorSet::singular
int singular
Definition: vulkan.h:187
FFVkExecContext::sem_sig_cnt
int sem_sig_cnt
Definition: vulkan.h:154
FFVulkanDescriptorSetBinding::dimensions
uint32_t dimensions
Definition: vulkan.h:80
FFVulkanContext::coop_matrix_props
VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props
Definition: vulkan.h:287
FFVulkanContext::qf_props
VkQueueFamilyProperties2 * qf_props
Definition: vulkan.h:292
hwcontext_vulkan.h
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:370
FFVkExecContext::qi
int qi
Definition: vulkan.h:119
FFVkExecContext::had_submission
int had_submission
Definition: vulkan.h:114
FFVkBuffer::size
size_t size
Definition: vulkan.h:91
FFVkExecPool::nb_queries
int nb_queries
Definition: vulkan.h:266
FFVkBuffer::mapped_mem
uint8_t * mapped_mem
Definition: vulkan.h:100
FFVulkanContext
Definition: vulkan.h:274
FFVulkanShader::nb_descriptor_sets
int nb_descriptor_sets
Definition: vulkan.h:220
FFVulkanShader::bound_buffer_indices
uint32_t * bound_buffer_indices
Definition: vulkan.h:224
ff_vk_init_sampler
int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler, int unnorm_coords, VkFilter filt)
Create a sampler.
Definition: vulkan.c:1480
FFVkExecContext::query_data
void * query_data
Definition: vulkan.h:130
ff_vk_shader_add_push_const
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
Definition: vulkan.c:1459
ff_vk_exec_wait
void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:552
FFVulkanContext::device
AVHWDeviceContext * device
Definition: vulkan.h:305
usage
const char * usage
Definition: floatimg_cmp.c:62
f
f
Definition: af_crystalizer.c:122
FFVkExecContext::layout_dst
VkImageLayout * layout_dst
Definition: vulkan.h:166
ff_vk_get_pooled_buffer
int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool, AVBufferRef **buf, VkBufferUsageFlags usage, void *create_pNext, size_t size, VkMemoryPropertyFlagBits mem_props)
Initialize a pool and create AVBufferRefs containing FFVkBuffer.
Definition: vulkan.c:1254
FFVkExecContext::queue_family_dst_alloc
unsigned int queue_family_dst_alloc
Definition: vulkan.h:170
FFVulkanDescriptorSetBinding
Definition: vulkan.h:74
ff_vk_exec_start
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
Definition: vulkan.c:559
FFVulkanShaderData::nb_descriptor_sets
int nb_descriptor_sets
Definition: vulkan.h:241
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
AVVkFrame
Definition: hwcontext_vulkan.h:298
FFVulkanContext::host_image_props
VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_props
Definition: vulkan.h:294
size
int size
Definition: twinvq_data.h:10344
FFVulkanShader::desc_pool_size
VkDescriptorPoolSize * desc_pool_size
Definition: vulkan.h:228
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:428
FFVkExecContext::nb_frame_deps
int nb_frame_deps
Definition: vulkan.h:141
FFVulkanShader
Definition: vulkan.h:190
ff_vk_create_imageview
int ff_vk_create_imageview(FFVulkanContext *s, VkImageView *img_view, VkImageAspectFlags *aspect, AVFrame *f, int plane, enum FFVkShaderRepFormat rep_fmt)
Create a single imageview for a given plane.
Definition: vulkan.c:1879
FFVulkanShader::pipeline_layout
VkPipelineLayout pipeline_layout
Definition: vulkan.h:212
FFVkExecContext::sem_sig_val_dst_cnt
int sem_sig_val_dst_cnt
Definition: vulkan.h:158
FFVulkanContext::output_format
enum AVPixelFormat output_format
Definition: vulkan.h:319
FFVkBuffer::flags
VkMemoryPropertyFlagBits flags
Definition: vulkan.h:90
ff_vk_aspect_flag
VkImageAspectFlags ff_vk_aspect_flag(AVFrame *f, int p)
Get the aspect flag for a plane from an image.
Definition: vulkan.c:1512
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
FFVkExecContext
Definition: vulkan.h:111
FFVulkanDescriptorSetBinding::name
const char * name
Definition: vulkan.h:75
ff_vk_exec_add_dep_buf
int ff_vk_exec_add_dep_buf(FFVulkanContext *s, FFVkExecContext *e, AVBufferRef **deps, int nb_deps, int ref)
Execution dependency management.
Definition: vulkan.c:619
ff_vk_exec_bind_shader
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd)
Bind a shader.
Definition: vulkan.c:2889
FFVulkanContext::input_frames_ref
AVBufferRef * input_frames_ref
Definition: vulkan.h:308
FFVkExecContext::sem_wait_cnt
int sem_wait_cnt
Definition: vulkan.h:150
layout
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
Definition: filter_design.txt:18
FFVkExecContext::queue
VkQueue queue
Definition: vulkan.h:117
FFVulkanContext::qfs
uint32_t qfs[64]
Definition: vulkan.h:313
ff_vk_shader_update_img
int ff_vk_shader_update_img(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, int set, int bind, int offs, VkImageView view, VkImageLayout layout, VkSampler sampler)
Sets an image descriptor for specified shader and binding.
Definition: vulkan.c:2735
ff_vk_exec_submit
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:904
bprint.h
FFVkExecPool::cmd_buf_pools
VkCommandPool * cmd_buf_pools
Definition: vulkan.h:256
FF_VK_REP_UINT
@ FF_VK_REP_UINT
Definition: vulkan.h:412
FFVulkanShaderData::desc_pool
VkDescriptorPool desc_pool
Definition: vulkan.h:249
VkFormat
enum VkFormat VkFormat
Definition: hwcontext_stub.c:25
FFVulkanShader::push_consts_num
int push_consts_num
Definition: vulkan.h:216
FFVkExecContext::layout_dst_alloc
unsigned int layout_dst_alloc
Definition: vulkan.h:167
ff_vk_exec_get
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
Definition: vulkan.c:547
ff_vk_mt_is_np_rgb
int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
Returns 1 if pixfmt is a usable RGB format.
Definition: vulkan.c:1529
FFVkExecPool::reg_shd
FFVulkanShaderData * reg_shd
Definition: vulkan.h:270
ff_vk_unmap_buffer
static int ff_vk_unmap_buffer(FFVulkanContext *s, FFVkBuffer *buf, int flush)
Definition: vulkan.h:541
FFVkBuffer::mem
VkDeviceMemory mem
Definition: vulkan.h:89
ff_vk_shader_init
int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name, VkPipelineStageFlags stage, const char *extensions[], int nb_extensions, int lg_x, int lg_y, int lg_z, uint32_t required_subgroup_size)
Initialize a shader object, with a specific set of extensions, type+bind, local group size,...
Definition: vulkan.c:2056
ff_vk_qf_find
AVVulkanDeviceQueueFamily * ff_vk_qf_find(FFVulkanContext *s, VkQueueFlagBits dev_family, VkVideoCodecOperationFlagBitsKHR vid_ops)
Chooses an appropriate QF.
Definition: vulkan.c:274
FFVulkanContext::hprops
VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops
Definition: vulkan.h:284
FFVulkanContext::props
VkPhysicalDeviceProperties2 props
Definition: vulkan.h:280
FFVkExecContext::frame_locked_alloc_size
unsigned int frame_locked_alloc_size
Definition: vulkan.h:161
len
int len
Definition: vorbis_enc_data.h:426
filt
static const int8_t filt[NUMTAPS *2]
Definition: af_earwax.c:40
FFVulkanContext::extensions
FFVulkanExtensions extensions
Definition: vulkan.h:279
FFVulkanContext::nb_qfs
int nb_qfs
Definition: vulkan.h:314
FFVulkanContext::mprops
VkPhysicalDeviceMemoryProperties mprops
Definition: vulkan.h:283
FFVulkanDescriptorSet::binding_offset
VkDeviceSize * binding_offset
Definition: vulkan.h:183
FFVkExecContext::sem_wait_alloc
unsigned int sem_wait_alloc
Definition: vulkan.h:149
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:118
ff_vk_shader_update_img_array
void ff_vk_shader_update_img_array(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, AVFrame *f, VkImageView *views, int set, int binding, VkImageLayout layout, VkSampler sampler)
Update a descriptor in a buffer with an image array.
Definition: vulkan.c:2800
FFVulkanContext::desc_buf_props
VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props
Definition: vulkan.h:285
ff_comp_identity_map
const VkComponentMapping ff_comp_identity_map
Definition: vulkan.c:27
FFVulkanShader::name
const char * name
Definition: vulkan.h:192
FFVulkanContext::vkfn
FFVulkanFunctions vkfn
Definition: vulkan.h:278
FFVkExecContext::opaque
void * opaque
Definition: vulkan.h:128
FFVkExecPool
Definition: vulkan.h:252
FFVkExecContext::frame_locked
uint8_t * frame_locked
Definition: vulkan.h:160
FFVkExecPool::query_data
void * query_data
Definition: vulkan.h:261
FFVkExecContext::sem_sig
VkSemaphoreSubmitInfo * sem_sig
Definition: vulkan.h:152
FFVkExecContext::buf
VkCommandBuffer buf
Definition: vulkan.h:122
ff_vk_alloc_mem
int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req, VkMemoryPropertyFlagBits req_flags, void *alloc_extension, VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem)
Memory/buffer/image allocation helpers.
Definition: vulkan.c:970
FFVulkanContext::input_format
enum AVPixelFormat input_format
Definition: vulkan.h:320
FFVulkanShader::desc_set
FFVulkanDescriptorSet * desc_set
Definition: vulkan.h:219
FFVulkanContext::coop_mat_props_nb
uint32_t coop_mat_props_nb
Definition: vulkan.h:298
vulkan_functions.h
ff_vk_exec_update_frame
void ff_vk_exec_update_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkImageMemoryBarrier2 *bar, uint32_t *nb_img_bar)
Definition: vulkan.c:859
FFVulkanContext::video_props
VkQueueFamilyVideoPropertiesKHR * video_props
Definition: vulkan.h:291
FFVulkanShader::object
VkShaderEXT object
Definition: vulkan.h:208
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
ff_vk_map_feats_to_usage
VkImageUsageFlags ff_vk_map_feats_to_usage(VkFormatFeatureFlagBits2 feats)
Map between usage and features.
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
FFVulkanDescriptorSet::usage
VkBufferUsageFlags usage
Definition: vulkan.h:180
ff_vk_exec_pool_free
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
Definition: vulkan.c:287
desc
const char * desc
Definition: libsvtav1.c:79
FFVulkanContext::hwctx
AVVulkanDeviceContext * hwctx
Definition: vulkan.h:306
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
FFVkExecPool::cmd_bufs
VkCommandBuffer * cmd_bufs
Definition: vulkan.h:257
FFVulkanContext::push_desc_props
VkPhysicalDevicePushDescriptorPropertiesKHR push_desc_props
Definition: vulkan.h:288
FFVulkanContext::feats_12
VkPhysicalDeviceVulkan12Features feats_12
Definition: vulkan.h:301
FFVkExecContext::sw_frame_deps
AVFrame ** sw_frame_deps
Definition: vulkan.h:144
ff_vk_count_images
static int ff_vk_count_images(AVVkFrame *f)
Definition: vulkan.h:323
FFVkBuffer::virtual_offset
size_t virtual_offset
Definition: vulkan.h:105
FFVkExecContext::buf_deps_alloc_size
unsigned int buf_deps_alloc_size
Definition: vulkan.h:136
FFVkExecContext::buf_deps
AVBufferRef ** buf_deps
Definition: vulkan.h:134
FFVkBuffer
Definition: vulkan.h:87
hwcontext.h
AVVulkanDeviceQueueFamily
Definition: hwcontext_vulkan.h:33
FFVkExecPool::qd_size
size_t qd_size
Definition: vulkan.h:267
FFVulkanContext::frames
AVHWFramesContext * frames
Definition: vulkan.h:310
FFVulkanDescriptorSet
Definition: vulkan.h:176
FFVulkanContext::optical_flow_props
VkPhysicalDeviceOpticalFlowPropertiesNV optical_flow_props
Definition: vulkan.h:289
ff_vk_set_perm
void ff_vk_set_perm(enum AVPixelFormat pix_fmt, int lut[4], int inv)
Since storage images may not be swizzled, we have to do this in the shader itself.
Definition: vulkan.c:1551
FFVkExecPool::query_results
int query_results
Definition: vulkan.h:262
FFVkExecContext::sem_sig_val_dst
uint64_t ** sem_sig_val_dst
Definition: vulkan.h:156
FFVulkanContext::query_props
VkQueueFamilyQueryResultStatusPropertiesKHR * query_props
Definition: vulkan.h:290
FFVulkanContext::host_image_copy_layouts
VkImageLayout * host_image_copy_layouts
Definition: vulkan.h:295
FFVulkanDescriptorSetBinding::mem_quali
const char * mem_quali
Definition: vulkan.h:78
FFVulkanFunctions
Definition: vulkan_functions.h:276
FFVkExecPool::pool_size
int pool_size
Definition: vulkan.h:258
FFVulkanContext::coop_mat_props
VkCooperativeMatrixPropertiesKHR * coop_mat_props
Definition: vulkan.h:297
FFVkExecContext::idx
uint32_t idx
Definition: vulkan.h:112
src
#define src
Definition: vp8dsp.c:248
atomic_uint_least64_t
intptr_t atomic_uint_least64_t
Definition: stdatomic.h:69
FFVulkanShader::lg_size
int lg_size[3]
Definition: vulkan.h:198
FFVkExecContext::access_dst
VkAccessFlagBits * access_dst
Definition: vulkan.h:163

Generated on Sat Oct 18 2025 19:23:37 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /