[vlc-devel] [PATCH 07/17] vulkan: platform_win32: rework as vulkan platform
Romain Vimont
rom1v at videolabs.io
Wed Apr 14 09:26:24 UTC 2021
On Mon, Apr 12, 2021 at 03:32:23PM +0200, Alexandre Janniaux wrote:
> Instead of recompiling surface.c while implementing its public
> functions, and so as to remove surface.c.
> ---
> modules/video_output/vulkan/Makefile.am | 2 +-
> modules/video_output/vulkan/platform_win32.c | 29 ++++++++++++++++----
> 2 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/modules/video_output/vulkan/Makefile.am b/modules/video_output/vulkan/Makefile.am
> index 5ab6eb6ee6..c6906bd422 100644
> --- a/modules/video_output/vulkan/Makefile.am
> +++ b/modules/video_output/vulkan/Makefile.am
> @@ -17,7 +17,7 @@ libvk_plugin_la_SOURCES = $(VULKAN_COMMONSOURCES) video_output/vulkan/display.c
> libvk_plugin_la_CFLAGS = $(AM_CFLAGS) $(VULKAN_COMMONCFLAGS)
> libvk_plugin_la_LIBADD = $(VULKAN_COMMONLIBS)
>
> -libvk_win32_plugin_la_SOURCES = $(VULKAN_COMMONSOURCES) video_output/vulkan/surface.c \
> +libvk_win32_plugin_la_SOURCES = $(VULKAN_COMMONSOURCES) \
> video_output/vulkan/platform_win32.c
> libvk_win32_plugin_la_CFLAGS = $(AM_CFLAGS) $(VULKAN_COMMONCFLAGS) \
> -DVK_USE_PLATFORM_WIN32_KHR -DPLATFORM_NAME=Win32
> diff --git a/modules/video_output/vulkan/platform_win32.c b/modules/video_output/vulkan/platform_win32.c
> index 1b79965db8..c905feb345 100644
> --- a/modules/video_output/vulkan/platform_win32.c
> +++ b/modules/video_output/vulkan/platform_win32.c
> @@ -24,24 +24,33 @@
> # include "config.h"
> #endif
>
> +#include <vlc_common.h>
> +#include <vlc_plugin.h>
> #include "platform.h"
>
> -int vlc_vk_InitPlatform(vlc_vk_t *vk)
> +static void ClosePlatform(vlc_vk_t *vk);
> +static int CreateSurface(vlc_vk_t *vk);
> +static const struct vlc_vk_operations platform_ops =
Unused, missing assignment in InitPlatform?
> +{
> + .close = ClosePlatform,
> + .create_surface = CreateSurface,
> +};
> +
> +static int InitPlatform(vlc_vk_t *vk)
> {
> if (vk->window->type != VOUT_WINDOW_TYPE_HWND)
> return VLC_EGENERIC;
>
> + vk->platform_ext = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
> return VLC_SUCCESS;
> }
>
> -void vlc_vk_ClosePlatform(vlc_vk_t *vk)
> +static void ClosePlatform(vlc_vk_t *vk)
> {
> VLC_UNUSED(vk);
> }
>
> -const char * const vlc_vk_PlatformExt = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
> -
> -int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
> +static int CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
> {
> // Get current win32 HINSTANCE
> HINSTANCE hInst = GetModuleHandle(NULL);
> @@ -60,3 +69,13 @@ int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
>
> return VLC_SUCCESS;
> }
> +
> +vlc_module_begin()
> + set_shortname("Vulkan Win32")
> + set_description(N_("Win32 platform support for Vulkan"))
> + set_category(CAT_VIDEO)
> + set_subcategory(SUBCAT_VIDEO_VOUT)
> + set_capability("vulkan platform", 50)
> + set_callback(InitPlatform)
> + add_shortcut("vk_win32")
> +vlc_module_end()
> --
> 2.31.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list