Skip to content

Commit

Permalink
Be clear that disabling Vulkan surface support disables the entire SD…
Browse files Browse the repository at this point in the history
…L Vulkan integration
  • Loading branch information
slouken committed Aug 28, 2017
1 parent 5cd1a95 commit ce2b164
Show file tree
Hide file tree
Showing 35 changed files with 54 additions and 59 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -325,7 +325,7 @@ set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
dep_option(VIDEO_VULKAN "Enable Vulkan surface creation" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS})
dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF)

Expand Down Expand Up @@ -1518,7 +1518,7 @@ elseif(HAIKU)
endif()

if(VIDEO_VULKAN AND (NOT APPLE OR QUARTZCORE))
set(SDL_VIDEO_VULKAN_SURFACE 1)
set(SDL_VIDEO_VULKAN 1)
endif()

# Dummies
Expand Down
2 changes: 1 addition & 1 deletion configure
Expand Up @@ -21957,7 +21957,7 @@ $as_echo "$as_me: WARNING: Sorry, Vulkan does not work on this configuration." >
fi
if test x$enable_video_vulkan = xyes; then

$as_echo "#define SDL_VIDEO_VULKAN_SURFACE 1" >>confdefs.h
$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h

SUMMARY_video="${SUMMARY_video} vulkan"
fi
Expand Down
4 changes: 2 additions & 2 deletions configure.in
Expand Up @@ -2403,7 +2403,7 @@ CheckEmscriptenGLES()

dnl Check to see if Vulkan surface support is desired
AC_ARG_ENABLE(video-vulkan,
AC_HELP_STRING([--enable-video-vulkan], [include Vulkan surface support [[default=yes]]]),
AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
, enable_video_vulkan=yes)

dnl Find Vulkan Header
Expand Down Expand Up @@ -2435,7 +2435,7 @@ CheckVulkan()
fi
fi
if test x$enable_video_vulkan = xyes; then
AC_DEFINE(SDL_VIDEO_VULKAN_SURFACE, 1, [ ])
AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
SUMMARY_video="${SUMMARY_video} vulkan"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion docs/README-windows.md
Expand Up @@ -42,4 +42,4 @@ Known Bugs:
Vulkan Surface Support
==============

Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN_SURFACE` to 0 in `SDL_config_windows`. When it is on you must install a [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to build libSDL.
Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application.
4 changes: 2 additions & 2 deletions include/SDL_config.h.cmake
Expand Up @@ -354,8 +354,8 @@
#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@

/* Enable Vulkan surface support */
#cmakedefine SDL_VIDEO_VULKAN_SURFACE @SDL_VIDEO_VULKAN_SURFACE@
/* Enable Vulkan support */
#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@

/* Enable system power support */
#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_config.h.in
Expand Up @@ -351,8 +351,8 @@
#undef SDL_VIDEO_OPENGL_OSMESA
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC

/* Enable Vulkan surface support */
#undef SDL_VIDEO_VULKAN_SURFACE
/* Enable Vulkan support */
#undef SDL_VIDEO_VULKAN

/* Enable system power support */
#undef SDL_POWER_LINUX
Expand Down
8 changes: 4 additions & 4 deletions include/SDL_config_android.h
Expand Up @@ -140,12 +140,12 @@
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES2 1

/* Enable Vulkan surface support */
/* Enable Vulkan support */
/* Android does not support Vulkan in native code using the "armeabi" ABI. */
#if !defined(__ARM_EABI__) || defined(__ARM_ARCH_7A__)
#define SDL_VIDEO_VULKAN_SURFACE 1
#if defined(__ARM_ARCH) && __ARM_ARCH < 7
#define SDL_VIDEO_VULKAN 0
#else
#define SDL_VIDEO_VULKAN_SURFACE 0
#define SDL_VIDEO_VULKAN 1
#endif

/* Enable system power support */
Expand Down
6 changes: 3 additions & 3 deletions include/SDL_config_iphoneos.h
Expand Up @@ -139,11 +139,11 @@
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES2 1

/* Enable Vulkan surface support */
/* Enable Vulkan support */
#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal
#define SDL_VIDEO_VULKAN_SURFACE 1
#define SDL_VIDEO_VULKAN 1
#else
#define SDL_VIDEO_VULKAN_SURFACE 0
#define SDL_VIDEO_VULKAN 0
#endif

/* Enable system power support */
Expand Down
8 changes: 4 additions & 4 deletions include/SDL_config_macosx.h
Expand Up @@ -174,12 +174,12 @@
#define SDL_VIDEO_OPENGL_GLX 1
#endif

/* enable Vulkan surface support */
/* Enable Vulkan support */
/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures */
#if TARGET_CPU_X86_64
/* Metal/MoltenVK/Vulkan not supported on 32-bit architectures. */
#define SDL_VIDEO_VULKAN_SURFACE 1
#define SDL_VIDEO_VULKAN 1
#else
#define SDL_VIDEO_VULKAN_SURFACE 0
#define SDL_VIDEO_VULKAN 0
#endif

/* Enable system power support */
Expand Down
3 changes: 2 additions & 1 deletion include/SDL_config_windows.h
Expand Up @@ -208,7 +208,8 @@ typedef unsigned int uintptr_t;
#define SDL_VIDEO_OPENGL_EGL 1
#endif

#define SDL_VIDEO_VULKAN_SURFACE 1
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1

/* Enable system power support */
#define SDL_POWER_WINDOWS 1
Expand Down
14 changes: 4 additions & 10 deletions src/video/SDL_vulkan_internal.h
Expand Up @@ -25,18 +25,12 @@

#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
#undef SDL_VIDEO_VULKAN
#define SDL_VIDEO_VULKAN 0
#endif

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN

#if SDL_VIDEO_DRIVER_ANDROID
#define VK_USE_PLATFORM_ANDROID_KHR
Expand Down Expand Up @@ -85,7 +79,7 @@ extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
/* No SDL Vulkan support, just include the header for typedefs */
#include "SDL_vulkan.h"

#endif /* SDL_VIDEO_VULKAN_SURFACE */
#endif /* SDL_VIDEO_VULKAN */

#endif /* SDL_vulkan_internal_h_ */

Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_vulkan_utils.c
Expand Up @@ -23,7 +23,7 @@
#include "SDL_vulkan_internal.h"
#include "SDL_error.h"

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN

/* Based on the headers found in
* https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers
Expand Down
2 changes: 1 addition & 1 deletion src/video/android/SDL_androidvideo.c
Expand Up @@ -133,7 +133,7 @@ Android_CreateDevice(int devindex)
device->GL_SwapWindow = Android_GLES_SwapWindow;
device->GL_DeleteContext = Android_GLES_DeleteContext;

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions;
Expand Down
2 changes: 1 addition & 1 deletion src/video/android/SDL_androidvulkan.c
Expand Up @@ -26,7 +26,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_ANDROID
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID

#include "SDL_androidvideo.h"
#include "SDL_androidwindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/video/android/SDL_androidvulkan.h
Expand Up @@ -32,7 +32,7 @@
#include "../SDL_vulkan_internal.h"
#include "../SDL_sysvideo.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_ANDROID
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID

int Android_Vulkan_LoadLibrary(_THIS, const char *path);
void Android_Vulkan_UnloadLibrary(_THIS);
Expand Down
2 changes: 1 addition & 1 deletion src/video/cocoa/SDL_cocoavideo.m
Expand Up @@ -123,7 +123,7 @@
device->GL_DeleteContext = Cocoa_GL_DeleteContext;
#endif

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions;
Expand Down
2 changes: 1 addition & 1 deletion src/video/cocoa/SDL_cocoavulkan.h
Expand Up @@ -33,7 +33,7 @@
#include "../SDL_vulkan_internal.h"
#include "../SDL_sysvideo.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_COCOA
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA

int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path);
void Cocoa_Vulkan_UnloadLibrary(_THIS);
Expand Down
2 changes: 1 addition & 1 deletion src/video/cocoa/SDL_cocoavulkan.m
Expand Up @@ -26,7 +26,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_COCOA
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA

#include "SDL_cocoavideo.h"
#include "SDL_cocoawindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/video/mir/SDL_mirvideo.c
Expand Up @@ -233,7 +233,7 @@ MIR_CreateDevice(int device_index)

device->ShowMessageBox = NULL;

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions;
Expand Down
2 changes: 1 addition & 1 deletion src/video/mir/SDL_mirvulkan.c
Expand Up @@ -26,7 +26,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_MIR
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR

#include "SDL_mirvideo.h"
#include "SDL_mirwindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/video/mir/SDL_mirvulkan.h
Expand Up @@ -32,7 +32,7 @@
#include "../SDL_vulkan_internal.h"
#include "../SDL_sysvideo.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_MIR
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR

int MIR_Vulkan_LoadLibrary(_THIS, const char *path);
void MIR_Vulkan_UnloadLibrary(_THIS);
Expand Down
2 changes: 1 addition & 1 deletion src/video/uikit/SDL_uikitmetalview.m
Expand Up @@ -28,7 +28,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_UIKIT
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT

#import "../SDL_sysvideo.h"
#import "SDL_uikitwindow.h"
Expand Down
8 changes: 4 additions & 4 deletions src/video/uikit/SDL_uikitvideo.m
Expand Up @@ -102,13 +102,13 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds;

#if SDL_IPHONE_KEYBOARD
#if SDL_IPHONE_KEYBOARD
device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport;
device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard;
device->HideScreenKeyboard = UIKit_HideScreenKeyboard;
device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown;
device->SetTextInputRect = UIKit_SetTextInputRect;
#endif
#endif

device->SetClipboardText = UIKit_SetClipboardText;
device->GetClipboardText = UIKit_GetClipboardText;
Expand All @@ -124,14 +124,14 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
device->free = UIKit_DeleteDevice;

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions
= UIKit_Vulkan_GetInstanceExtensions;
device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface;
device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize;
#endif
#endif

device->gl_config.accelerated = 1;

Expand Down
2 changes: 1 addition & 1 deletion src/video/uikit/SDL_uikitvulkan.h
Expand Up @@ -32,7 +32,7 @@
#include "../SDL_vulkan_internal.h"
#include "../SDL_sysvideo.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_UIKIT
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT

int UIKit_Vulkan_LoadLibrary(_THIS, const char *path);
void UIKit_Vulkan_UnloadLibrary(_THIS);
Expand Down
2 changes: 1 addition & 1 deletion src/video/uikit/SDL_uikitvulkan.m
Expand Up @@ -26,7 +26,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_UIKIT
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT

#include "SDL_uikitvideo.h"
#include "SDL_uikitwindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/video/wayland/SDL_waylandvideo.c
Expand Up @@ -182,7 +182,7 @@ Wayland_CreateDevice(int devindex)
device->GetClipboardText = Wayland_GetClipboardText;
device->HasClipboardText = Wayland_HasClipboardText;

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions;
Expand Down
2 changes: 1 addition & 1 deletion src/video/wayland/SDL_waylandvulkan.c
Expand Up @@ -26,7 +26,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_WAYLAND
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND

#include "SDL_waylandvideo.h"
#include "SDL_waylandwindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/video/wayland/SDL_waylandvulkan.h
Expand Up @@ -32,7 +32,7 @@
#include "../SDL_vulkan_internal.h"
#include "../SDL_sysvideo.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_WAYLAND
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND

int Wayland_Vulkan_LoadLibrary(_THIS, const char *path);
void Wayland_Vulkan_UnloadLibrary(_THIS);
Expand Down
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowsvideo.c
Expand Up @@ -191,7 +191,7 @@ WIN_CreateDevice(int devindex)
device->GL_SwapWindow = WIN_GLES_SwapWindow;
device->GL_DeleteContext = WIN_GLES_DeleteContext;
#endif
#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions;
Expand Down
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowsvulkan.c
Expand Up @@ -26,7 +26,7 @@

#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_WINDOWS
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS

#include "SDL_windowsvideo.h"
#include "SDL_windowswindow.h"
Expand Down
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowsvulkan.h
Expand Up @@ -32,7 +32,7 @@
#include "../SDL_vulkan_internal.h"
#include "../SDL_sysvideo.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_WINDOWS
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS

int WIN_Vulkan_LoadLibrary(_THIS, const char *path);
void WIN_Vulkan_UnloadLibrary(_THIS);
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11video.c
Expand Up @@ -296,7 +296,7 @@ X11_CreateDevice(int devindex)

device->free = X11_DeleteDevice;

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions;
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11video.h
Expand Up @@ -141,7 +141,7 @@ typedef struct SDL_VideoData
KeyCode filter_code;
Time filter_time;

#if SDL_VIDEO_VULKAN_SURFACE
#if SDL_VIDEO_VULKAN
/* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */
void *vulkan_xlib_xcb_library;
PFN_XGetXCBConnection vulkan_XGetXCBConnection;
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11vulkan.c
Expand Up @@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"

#if SDL_VIDEO_VULKAN_SURFACE && SDL_VIDEO_DRIVER_X11
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11

#include "SDL_x11video.h"
#include "SDL_assert.h"
Expand Down

0 comments on commit ce2b164

Please sign in to comment.