[vlc-devel] [PATCH v3 04/16] vulkan: platform: forward VkInstance to CreateSurface

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


---
 modules/video_output/vulkan/platform.h         | 2 +-
 modules/video_output/vulkan/platform_android.c | 4 +---
 modules/video_output/vulkan/platform_win32.c   | 4 +---
 modules/video_output/vulkan/platform_xcb.c     | 3 +--
 modules/video_output/vulkan/surface.c          | 2 +-
 5 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/modules/video_output/vulkan/platform.h b/modules/video_output/vulkan/platform.h
index fb7a9923ff..ddd314a789 100644
--- a/modules/video_output/vulkan/platform.h
+++ b/modules/video_output/vulkan/platform.h
@@ -31,6 +31,6 @@ void vlc_vk_ClosePlatform(vlc_vk_t *);
 extern const char * const vlc_vk_PlatformExt;
 
 // Create a vulkan surface to vk->surface
-int vlc_vk_CreateSurface(vlc_vk_t *);
+int vlc_vk_CreateSurface(vlc_vk_t *, VkInstance);
 
 #endif // VLC_VULKAN_PLATFORM_H
diff --git a/modules/video_output/vulkan/platform_android.c b/modules/video_output/vulkan/platform_android.c
index adb66114ca..aebe6416c3 100644
--- a/modules/video_output/vulkan/platform_android.c
+++ b/modules/video_output/vulkan/platform_android.c
@@ -39,10 +39,8 @@ void vlc_vk_ClosePlatform(vlc_vk_t *vk)
 
 const char * const vlc_vk_PlatformExt = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
 
-int vlc_vk_CreateSurface(vlc_vk_t *vk)
+int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
 {
-    VkInstance vkinst = vk->instance->instance;
-
     ANativeWindow *anw =
         AWindowHandler_getANativeWindow(vk->window->handle.anativewindow,
                                         AWindow_Video);
diff --git a/modules/video_output/vulkan/platform_win32.c b/modules/video_output/vulkan/platform_win32.c
index 5f03c41c52..1b79965db8 100644
--- a/modules/video_output/vulkan/platform_win32.c
+++ b/modules/video_output/vulkan/platform_win32.c
@@ -41,10 +41,8 @@ void vlc_vk_ClosePlatform(vlc_vk_t *vk)
 
 const char * const vlc_vk_PlatformExt = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
 
-int vlc_vk_CreateSurface(vlc_vk_t *vk)
+int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
 {
-    VkInstance vkinst = vk->instance->instance;
-
     // Get current win32 HINSTANCE
     HINSTANCE hInst = GetModuleHandle(NULL);
 
diff --git a/modules/video_output/vulkan/platform_xcb.c b/modules/video_output/vulkan/platform_xcb.c
index 897e8b29e1..cb9bf21a08 100644
--- a/modules/video_output/vulkan/platform_xcb.c
+++ b/modules/video_output/vulkan/platform_xcb.c
@@ -49,9 +49,8 @@ void vlc_vk_ClosePlatform(vlc_vk_t *vk)
 
 const char * const vlc_vk_PlatformExt = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
 
-int vlc_vk_CreateSurface(vlc_vk_t *vk)
+int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
 {
-    VkInstance vkinst = vk->instance->instance;
     xcb_connection_t *conn = vk->platform_sys;
 
     VkXcbSurfaceCreateInfoKHR xinfo = {
diff --git a/modules/video_output/vulkan/surface.c b/modules/video_output/vulkan/surface.c
index 7345bdb2a5..880d9b8686 100644
--- a/modules/video_output/vulkan/surface.c
+++ b/modules/video_output/vulkan/surface.c
@@ -61,7 +61,7 @@ static int Open (vlc_object_t *obj)
         goto error;
 
     // Create the platform-specific surface object
-    if (vlc_vk_CreateSurface(vk) != VLC_SUCCESS)
+    if (vlc_vk_CreateSurface(vk, vk->instance->instance) != VLC_SUCCESS)
         goto error;
 
     // Create vulkan device
-- 
2.31.1



More information about the vlc-devel mailing list