mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avutil/vulkan: load win32 external memory functions
This commit is contained in:
parent
bfbd5954e5
commit
fedf4ff85c
@ -19,6 +19,9 @@
|
||||
#ifndef AVUTIL_HWCONTEXT_VULKAN_H
|
||||
#define AVUTIL_HWCONTEXT_VULKAN_H
|
||||
|
||||
#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "pixfmt.h"
|
||||
|
@ -27,6 +27,10 @@ typedef enum FFVulkanExtensions {
|
||||
FF_VK_EXT_EXTERNAL_FD_SEM = 1ULL << 3, /* VK_KHR_external_semaphore_fd */
|
||||
FF_VK_EXT_EXTERNAL_HOST_MEMORY = 1ULL << 4, /* VK_EXT_external_memory_host */
|
||||
FF_VK_EXT_DEBUG_UTILS = 1ULL << 5, /* VK_EXT_debug_utils */
|
||||
#ifdef _WIN32
|
||||
FF_VK_EXT_EXTERNAL_WIN32_MEMORY = 1ULL << 6, /* VK_KHR_external_memory_win32 */
|
||||
FF_VK_EXT_EXTERNAL_WIN32_SEM = 1ULL << 7, /* VK_KHR_external_semaphore_win32 */
|
||||
#endif
|
||||
|
||||
FF_VK_EXT_NO_FLAG = 1ULL << 63,
|
||||
} FFVulkanExtensions;
|
||||
@ -151,6 +155,11 @@ typedef enum FFVulkanExtensions {
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateShaderModule) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyShaderModule)
|
||||
|
||||
/* Macro containing every win32 specific function that we utilize in our codebase */
|
||||
#define FN_LIST_WIN32(MACRO) \
|
||||
MACRO(1, 1, FF_VK_EXT_EXTERNAL_WIN32_SEM, GetSemaphoreWin32HandleKHR) \
|
||||
MACRO(1, 1, FF_VK_EXT_EXTERNAL_WIN32_MEMORY, GetMemoryWin32HandleKHR)
|
||||
|
||||
/* Macro to turn a function name into a definition */
|
||||
#define PFN_DEF(req_inst, req_dev, ext_flag, name) \
|
||||
PFN_vk##name name;
|
||||
@ -158,6 +167,9 @@ typedef enum FFVulkanExtensions {
|
||||
/* Structure with the definition of all listed functions */
|
||||
typedef struct FFVulkanFunctions {
|
||||
FN_LIST(PFN_DEF)
|
||||
#ifdef _WIN32
|
||||
FN_LIST_WIN32(PFN_DEF)
|
||||
#endif
|
||||
} FFVulkanFunctions;
|
||||
|
||||
#endif /* AVUTIL_VULKAN_FUNCTIONS_H */
|
||||
|
@ -43,7 +43,11 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions,
|
||||
{ VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY },
|
||||
{ VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_SEM },
|
||||
{ VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_HOST_MEMORY },
|
||||
{ VK_EXT_DEBUG_UTILS_EXTENSION_NAME, FF_VK_EXT_DEBUG_UTILS }
|
||||
{ VK_EXT_DEBUG_UTILS_EXTENSION_NAME, FF_VK_EXT_DEBUG_UTILS },
|
||||
#ifdef _WIN32
|
||||
{ VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_MEMORY },
|
||||
{ VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_SEM },
|
||||
#endif
|
||||
};
|
||||
|
||||
FFVulkanExtensions mask = 0x0;
|
||||
@ -88,6 +92,9 @@ static inline int ff_vk_load_functions(AVHWDeviceContext *ctx,
|
||||
const char *names[3];
|
||||
} vk_load_info[] = {
|
||||
FN_LIST(PFN_LOAD_INFO)
|
||||
#ifdef _WIN32
|
||||
FN_LIST_WIN32(PFN_LOAD_INFO)
|
||||
#endif
|
||||
};
|
||||
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(vk_load_info); i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user