Fixed Android build with Vulkan support
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/src/video/SDL_vulkan_internal.h b/src/video/SDL_vulkan_internal.h
index b42da01..de44bd1 100644
--- a/src/video/SDL_vulkan_internal.h
+++ b/src/video/SDL_vulkan_internal.h
@@ -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 @@ extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
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 --git a/src/video/android/SDL_androidvulkan.c b/src/video/android/SDL_androidvulkan.c
index d7cf5c5..cbb677a 100644
--- a/src/video/android/SDL_androidvulkan.c
+++ b/src/video/android/SDL_androidvulkan.c
@@ -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 @@ int Android_Vulkan_LoadLibrary(_THIS, const char *path)
&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;