[Commits] SDL: Fixed Android build with Vulkan support

libsdl.org revision control commits-owner at libsdl.org
Sun Aug 27 23:53:12 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/bb5404c6b2e0
changeset: 11380:bb5404c6b2e0
user:      Sam Lantinga <slouken at libsdl.org>
date:      Sun Aug 27 23:53:09 2017 -0700
description:
Fixed Android build with Vulkan support

diffstat:

 src/video/SDL_vulkan_internal.h       |  15 ++++++++++++++-
 src/video/android/SDL_androidvulkan.c |   4 ++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diffs (65 lines):

diff -r 308746c0fe9e -r bb5404c6b2e0 src/video/SDL_vulkan_internal.h
--- a/src/video/SDL_vulkan_internal.h	Sun Aug 27 23:39:55 2017 -0700
+++ b/src/video/SDL_vulkan_internal.h	Sun Aug 27 23:53:09 2017 -0700
@@ -25,11 +25,19 @@
 
 #include "SDL_stdinc.h"
 
+#if defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
+/* Vulkan isn't supported for the 'armeabi' NDK ABI, error in vk_platform.h */
+#undef SDL_VIDEO_VULKAN_SURFACE
+#define SDL_VIDEO_VULKAN_SURFACE 0
+#endif
+
 #if defined(SDL_LOADSO_DISABLED)
 #undef SDL_VIDEO_VULKAN_SURFACE
 #define SDL_VIDEO_VULKAN_SURFACE 0
 #endif
 
+#if SDL_VIDEO_VULKAN_SURFACE
+
 #if SDL_VIDEO_DRIVER_ANDROID
 #define VK_USE_PLATFORM_ANDROID_KHR
 #endif
@@ -58,7 +66,6 @@
 
 #include "SDL_vulkan.h"
 
-#if SDL_VIDEO_VULKAN_SURFACE
 
 extern const char *SDL_Vulkan_GetResultString(VkResult result);
 
@@ -72,6 +79,12 @@
                                                         const char **userNames,
                                                         unsigned nameCount,
                                                         const char *const *names);
+
+#else
+
+/* No SDL Vulkan support, just include the header for typedefs */
+#include "SDL_vulkan.h"
+
 #endif /* SDL_VIDEO_VULKAN_SURFACE */
 
 #endif /* SDL_vulkan_internal_h_ */
diff -r 308746c0fe9e -r bb5404c6b2e0 src/video/android/SDL_androidvulkan.c
--- a/src/video/android/SDL_androidvulkan.c	Sun Aug 27 23:39:55 2017 -0700
+++ b/src/video/android/SDL_androidvulkan.c	Sun Aug 27 23:53:09 2017 -0700
@@ -39,7 +39,7 @@
 int Android_Vulkan_LoadLibrary(_THIS, const char *path)
 {
     VkExtensionProperties *extensions = NULL;
-    Uint32 extensionCount = 0;
+    Uint32 i, extensionCount = 0;
     SDL_bool hasSurfaceExtension = SDL_FALSE;
     SDL_bool hasAndroidSurfaceExtension = SDL_FALSE;
     PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
@@ -72,7 +72,7 @@
         &extensionCount);
     if(!extensions)
         goto fail;
-    for(Uint32 i = 0; i < extensionCount; i++)
+    for(i = 0; i < extensionCount; i++)
     {
         if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
             hasSurfaceExtension = SDL_TRUE;


More information about the commits mailing list