[vlc-devel] [PATCH v3 02/16] vulkan: move platform ext string to vlc_vk_t

Alexandre Janniaux ajanni at videolabs.io
Wed Apr 21 08:04:36 UTC 2021


The platform string will be used by vulkan implementation not following
the surface.c implementation so as to remove it later.
---
 modules/video_output/vulkan/instance.c | 1 +
 modules/video_output/vulkan/instance.h | 1 +
 modules/video_output/vulkan/surface.c  | 4 +++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/vulkan/instance.c b/modules/video_output/vulkan/instance.c
index 3cafa5a571..1c2361b2ed 100644
--- a/modules/video_output/vulkan/instance.c
+++ b/modules/video_output/vulkan/instance.c
@@ -50,6 +50,7 @@ vlc_vk_t *vlc_vk_Create(struct vout_window_t *wnd, const char *name)
     vk->ctx = NULL;
     vk->instance = NULL;
     vk->surface = (VkSurfaceKHR) NULL;
+    vk->platform_ext = NULL;
 
     vk->window = wnd;
     vk->module = module_need(vk, "vulkan", name, true);
diff --git a/modules/video_output/vulkan/instance.h b/modules/video_output/vulkan/instance.h
index 30f0962c86..f9d38bc9c6 100644
--- a/modules/video_output/vulkan/instance.h
+++ b/modules/video_output/vulkan/instance.h
@@ -39,6 +39,7 @@ typedef struct vlc_vk_t
     module_t *module;
     vlc_atomic_rc_t ref_count;
     void *platform_sys;
+    const char *platform_ext;
 
     // these should be initialized by the surface module (i.e. surface.c)
     struct pl_context *ctx;
diff --git a/modules/video_output/vulkan/surface.c b/modules/video_output/vulkan/surface.c
index 64fd5d8bde..7345bdb2a5 100644
--- a/modules/video_output/vulkan/surface.c
+++ b/modules/video_output/vulkan/surface.c
@@ -42,6 +42,8 @@ static int Open (vlc_object_t *obj)
     if (vlc_vk_InitPlatform(vk) != VLC_SUCCESS)
         goto error;
 
+    vk->platform_ext = vlc_vk_PlatformExt;
+
     // Initialize Vulkan instance
     vk->ctx = vlc_placebo_Create(VLC_OBJECT(vk));
     if (!vk->ctx)
@@ -51,7 +53,7 @@ static int Open (vlc_object_t *obj)
         .debug = var_InheritBool(vk, "vk-debug"),
         .extensions = (const char *[]) {
             VK_KHR_SURFACE_EXTENSION_NAME,
-            vlc_vk_PlatformExt,
+            vk->platform_ext,
         },
         .num_extensions = 2,
     });
-- 
2.31.1



More information about the vlc-devel mailing list