mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 05:59:11 +00:00
Change SDL_Vulkan_GetInstanceExtensions
This commit is contained in:
parent
338974bb29
commit
d0d8b28df1
18 changed files with 54 additions and 149 deletions
|
@ -160,8 +160,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
|
||||||
*
|
*
|
||||||
* \sa SDL_Vulkan_CreateSurface
|
* \sa SDL_Vulkan_CreateSurface
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(unsigned int *pCount,
|
extern DECLSPEC char const* const* SDLCALL SDL_Vulkan_GetInstanceExtensions(Uint32 *pCount);
|
||||||
const char **pNames);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Vulkan rendering surface for a window.
|
* Create a Vulkan rendering surface for a window.
|
||||||
|
|
|
@ -719,7 +719,7 @@ SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return)
|
SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(unsigned int *a, const char **b),(a,b),return)
|
SDL_DYNAPI_PROC(char const* const*,SDL_Vulkan_GetInstanceExtensions,(Uint32 *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),)
|
SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),)
|
||||||
|
|
|
@ -290,7 +290,7 @@ struct SDL_VideoDevice
|
||||||
*/
|
*/
|
||||||
int (*Vulkan_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
|
int (*Vulkan_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
|
||||||
void (*Vulkan_UnloadLibrary)(SDL_VideoDevice *_this);
|
void (*Vulkan_UnloadLibrary)(SDL_VideoDevice *_this);
|
||||||
SDL_bool (*Vulkan_GetInstanceExtensions)(SDL_VideoDevice *_this, unsigned *count, const char **names);
|
char const* const* (*Vulkan_GetInstanceExtensions)(SDL_VideoDevice *_this, Uint32 *count);
|
||||||
SDL_bool (*Vulkan_CreateSurface)(SDL_VideoDevice *_this, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
|
SDL_bool (*Vulkan_CreateSurface)(SDL_VideoDevice *_this, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
|
||||||
|
|
||||||
/* * * */
|
/* * * */
|
||||||
|
|
|
@ -5140,14 +5140,9 @@ void SDL_Vulkan_UnloadLibrary(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool SDL_Vulkan_GetInstanceExtensions(unsigned *count, const char **names)
|
char const* const* SDL_Vulkan_GetInstanceExtensions(Uint32 *count)
|
||||||
{
|
{
|
||||||
if (count == NULL) {
|
return _this->Vulkan_GetInstanceExtensions(_this, count);
|
||||||
SDL_InvalidParamError("count");
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _this->Vulkan_GetInstanceExtensions(_this, count, names);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
|
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
|
||||||
|
|
|
@ -63,13 +63,6 @@ extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
|
||||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
|
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
|
||||||
Uint32 *extensionCount); /* free returned list with SDL_free */
|
Uint32 *extensionCount); /* free returned list with SDL_free */
|
||||||
|
|
||||||
/* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of
|
|
||||||
* names passed in nameCount and names. */
|
|
||||||
extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
|
|
||||||
const char **userNames,
|
|
||||||
unsigned nameCount,
|
|
||||||
const char *const *names);
|
|
||||||
|
|
||||||
/* Create a surface directly from a display connected to a physical device
|
/* Create a surface directly from a display connected to a physical device
|
||||||
* using the DisplayKHR extension.
|
* using the DisplayKHR extension.
|
||||||
* This needs to be passed an instance that was created with the VK_KHR_DISPLAY_EXTENSION_NAME
|
* This needs to be passed an instance that was created with the VK_KHR_DISPLAY_EXTENSION_NAME
|
||||||
|
|
|
@ -167,27 +167,6 @@ VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
|
|
||||||
const char **userNames,
|
|
||||||
unsigned nameCount,
|
|
||||||
const char *const *names)
|
|
||||||
{
|
|
||||||
if (userNames) {
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (*userCount < nameCount) {
|
|
||||||
SDL_SetError("Output array for SDL_Vulkan_GetInstanceExtensions needs to be at least %d big", nameCount);
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < nameCount; i++) {
|
|
||||||
userNames[i] = names[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*userCount = nameCount;
|
|
||||||
return SDL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Alpha modes, in order of preference */
|
/* Alpha modes, in order of preference */
|
||||||
static const VkDisplayPlaneAlphaFlagBitsKHR alphaModes[4] = {
|
static const VkDisplayPlaneAlphaFlagBitsKHR alphaModes[4] = {
|
||||||
VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR,
|
VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR,
|
||||||
|
|
|
@ -111,20 +111,16 @@ void Android_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForAndroid[] = {
|
static const char *const extensionsForAndroid[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
if(count) {
|
||||||
SDL_SetError("Vulkan is not loaded");
|
*count = SDL_arraysize(extensionsForAndroid);
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
return extensionsForAndroid;
|
||||||
count, names, SDL_arraysize(extensionsForAndroid),
|
|
||||||
extensionsForAndroid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
|
|
|
@ -163,20 +163,16 @@ void Cocoa_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForCocoa[] = {
|
static const char *const extensionsForCocoa[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
if(count) {
|
||||||
SDL_SetError("Vulkan is not loaded");
|
*count = SDL_arraysize(extensionsForCocoa);
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
return extensionsForCocoa;
|
||||||
count, names, SDL_arraysize(extensionsForCocoa),
|
|
||||||
extensionsForCocoa);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool Cocoa_Vulkan_CreateSurfaceViaMetalView(SDL_VideoDevice *_this,
|
static SDL_bool Cocoa_Vulkan_CreateSurfaceViaMetalView(SDL_VideoDevice *_this,
|
||||||
|
|
|
@ -142,20 +142,14 @@ void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
/* members of the VkInstanceCreateInfo struct passed to */
|
/* members of the VkInstanceCreateInfo struct passed to */
|
||||||
/* vkCreateInstance(). */
|
/* vkCreateInstance(). */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForKMSDRM[] = {
|
static const char *const extensionsForKMSDRM[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
if(count) { *count = SDL_arraysize(extensionsForKMSDRM); }
|
||||||
SDL_SetError("Vulkan is not loaded");
|
return extensionsForKMSDRM;
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
|
||||||
count, names, SDL_arraysize(extensionsForKMSDRM),
|
|
||||||
extensionsForKMSDRM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
@ -36,9 +36,8 @@
|
||||||
|
|
||||||
int KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
int KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||||
void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||||
SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count);
|
||||||
const char **names);
|
|
||||||
SDL_bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
VkInstance instance,
|
VkInstance instance,
|
||||||
|
|
|
@ -169,21 +169,16 @@ void UIKit_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool UIKit_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* UIKit_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForUIKit[] = {
|
static const char *const extensionsForUIKit[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
if(count) {
|
||||||
SDL_SetError("Vulkan is not loaded");
|
*count = SDL_arraysize(extensionsForUIKit);
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
|
return extensionsForUIKit;
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
|
||||||
count, names, SDL_arraysize(extensionsForUIKit),
|
|
||||||
extensionsForUIKit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool UIKit_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool UIKit_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
|
|
|
@ -118,20 +118,16 @@ void VIVANTE_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool VIVANTE_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* VIVANTE_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForVivante[] = {
|
static const char *const extensionsForVivante[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
if(count) {
|
||||||
SDL_SetError("Vulkan is not loaded");
|
*count = SDL_arraysize(extensionsForVivante);
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
return extensionsForVivante;
|
||||||
count, names, SDL_arraysize(extensionsForVivante),
|
|
||||||
extensionsForVivante);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool VIVANTE_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool VIVANTE_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
|
|
|
@ -118,20 +118,13 @@ void Wayland_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForWayland[] = {
|
static const char *const extensionsForWayland[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
return extensionsForWayland;
|
||||||
SDL_SetError("Vulkan is not loaded");
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
|
||||||
count, names, SDL_arraysize(extensionsForWayland),
|
|
||||||
extensionsForWayland);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
|
|
|
@ -36,9 +36,8 @@
|
||||||
|
|
||||||
int Wayland_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
int Wayland_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||||
void Wayland_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
void Wayland_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||||
SDL_bool Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count);
|
||||||
const char **names);
|
|
||||||
SDL_bool Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
VkInstance instance,
|
VkInstance instance,
|
||||||
|
|
|
@ -112,20 +112,14 @@ void WIN_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool WIN_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* WIN_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
static const char *const extensionsForWin32[] = {
|
static const char *const extensionsForWin32[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME
|
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME
|
||||||
};
|
};
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
if(count) { *count = SDL_arraysize(extensionsForWin32); }
|
||||||
SDL_SetError("Vulkan is not loaded");
|
return extensionsForWin32;
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
|
||||||
count, names, SDL_arraysize(extensionsForWin32),
|
|
||||||
extensionsForWin32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool WIN_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool WIN_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
|
|
|
@ -142,29 +142,28 @@ void X11_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count)
|
||||||
const char **names)
|
|
||||||
{
|
{
|
||||||
SDL_VideoData *videoData = _this->driverdata;
|
SDL_VideoData *videoData = _this->driverdata;
|
||||||
if (!_this->vulkan_config.loader_handle) {
|
|
||||||
SDL_SetError("Vulkan is not loaded");
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
if (videoData->vulkan_xlib_xcb_library) {
|
if (videoData->vulkan_xlib_xcb_library) {
|
||||||
static const char *const extensionsForXCB[] = {
|
static const char *const extensionsForXCB[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||||
VK_KHR_XCB_SURFACE_EXTENSION_NAME,
|
VK_KHR_XCB_SURFACE_EXTENSION_NAME,
|
||||||
};
|
};
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
if(count) {
|
||||||
count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB);
|
*count = SDL_arraysize(extensionsForXCB);
|
||||||
|
}
|
||||||
|
return extensionsForXCB;
|
||||||
} else {
|
} else {
|
||||||
static const char *const extensionsForXlib[] = {
|
static const char *const extensionsForXlib[] = {
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||||
VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
|
VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
|
||||||
};
|
};
|
||||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
if(count) {
|
||||||
count, names, SDL_arraysize(extensionsForXlib), extensionsForXlib);
|
*count = SDL_arraysize(extensionsForXlib);
|
||||||
|
}
|
||||||
|
return extensionsForXlib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,8 @@ typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy);
|
||||||
|
|
||||||
int X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
int X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||||
void X11_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
void X11_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||||
SDL_bool X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
char const* const* X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||||
unsigned *count,
|
Uint32 *count);
|
||||||
const char **names);
|
|
||||||
SDL_bool X11_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
SDL_bool X11_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
VkInstance instance,
|
VkInstance instance,
|
||||||
|
|
|
@ -222,36 +222,15 @@ static void createInstance(void)
|
||||||
{
|
{
|
||||||
VkApplicationInfo appInfo = { 0 };
|
VkApplicationInfo appInfo = { 0 };
|
||||||
VkInstanceCreateInfo instanceCreateInfo = { 0 };
|
VkInstanceCreateInfo instanceCreateInfo = { 0 };
|
||||||
const char **extensions = NULL;
|
|
||||||
unsigned extensionCount = 0;
|
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||||
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
instanceCreateInfo.pApplicationInfo = &appInfo;
|
instanceCreateInfo.pApplicationInfo = &appInfo;
|
||||||
if (!SDL_Vulkan_GetInstanceExtensions(&extensionCount, NULL)) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
instanceCreateInfo.ppEnabledExtensionNames = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount);
|
||||||
"SDL_Vulkan_GetInstanceExtensions(): %s\n",
|
|
||||||
SDL_GetError());
|
|
||||||
quit(2);
|
|
||||||
}
|
|
||||||
extensions = (const char **)SDL_malloc(sizeof(const char *) * extensionCount);
|
|
||||||
if (extensions == NULL) {
|
|
||||||
SDL_OutOfMemory();
|
|
||||||
quit(2);
|
|
||||||
}
|
|
||||||
if (!SDL_Vulkan_GetInstanceExtensions(&extensionCount, extensions)) {
|
|
||||||
SDL_free((void *)extensions);
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"SDL_Vulkan_GetInstanceExtensions(): %s\n",
|
|
||||||
SDL_GetError());
|
|
||||||
quit(2);
|
|
||||||
}
|
|
||||||
instanceCreateInfo.enabledExtensionCount = extensionCount;
|
|
||||||
instanceCreateInfo.ppEnabledExtensionNames = extensions;
|
|
||||||
result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext->instance);
|
result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext->instance);
|
||||||
SDL_free((void *)extensions);
|
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
vulkanContext->instance = VK_NULL_HANDLE;
|
vulkanContext->instance = VK_NULL_HANDLE;
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue