mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 23:05:49 +00:00
Change SDL_Vulkan_GetInstanceExtensions
This commit is contained in:
committed by
Ryan C. Gordon
parent
338974bb29
commit
d0d8b28df1
@@ -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_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_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(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),)
|
||||
|
||||
@@ -290,7 +290,7 @@ struct SDL_VideoDevice
|
||||
*/
|
||||
int (*Vulkan_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
|
||||
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);
|
||||
|
||||
/* * * */
|
||||
|
||||
@@ -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) {
|
||||
SDL_InvalidParamError("count");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
return _this->Vulkan_GetInstanceExtensions(_this, count, names);
|
||||
return _this->Vulkan_GetInstanceExtensions(_this, count);
|
||||
}
|
||||
|
||||
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
|
||||
|
||||
@@ -63,13 +63,6 @@ extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
|
||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
|
||||
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
|
||||
* using the DisplayKHR extension.
|
||||
* 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;
|
||||
}
|
||||
|
||||
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 */
|
||||
static const VkDisplayPlaneAlphaFlagBitsKHR alphaModes[4] = {
|
||||
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,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForAndroid[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
if(count) {
|
||||
*count = SDL_arraysize(extensionsForAndroid);
|
||||
}
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForAndroid),
|
||||
extensionsForAndroid);
|
||||
return extensionsForAndroid;
|
||||
}
|
||||
|
||||
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,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForCocoa[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
if(count) {
|
||||
*count = SDL_arraysize(extensionsForCocoa);
|
||||
}
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForCocoa),
|
||||
extensionsForCocoa);
|
||||
return extensionsForCocoa;
|
||||
}
|
||||
|
||||
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 */
|
||||
/* vkCreateInstance(). */
|
||||
/*********************************************************************/
|
||||
SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForKMSDRM[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForKMSDRM),
|
||||
extensionsForKMSDRM);
|
||||
if(count) { *count = SDL_arraysize(extensionsForKMSDRM); }
|
||||
return extensionsForKMSDRM;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
@@ -36,9 +36,8 @@
|
||||
|
||||
int KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
unsigned *count,
|
||||
const char **names);
|
||||
char const* const* KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count);
|
||||
SDL_bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
|
||||
@@ -169,21 +169,16 @@ void UIKit_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool UIKit_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* UIKit_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForUIKit[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
if(count) {
|
||||
*count = SDL_arraysize(extensionsForUIKit);
|
||||
}
|
||||
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForUIKit),
|
||||
extensionsForUIKit);
|
||||
return extensionsForUIKit;
|
||||
}
|
||||
|
||||
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,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* VIVANTE_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForVivante[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
if(count) {
|
||||
*count = SDL_arraysize(extensionsForVivante);
|
||||
}
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForVivante),
|
||||
extensionsForVivante);
|
||||
return extensionsForVivante;
|
||||
}
|
||||
|
||||
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,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForWayland[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForWayland),
|
||||
extensionsForWayland);
|
||||
return extensionsForWayland;
|
||||
}
|
||||
|
||||
SDL_bool Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
|
||||
@@ -36,9 +36,8 @@
|
||||
|
||||
int Wayland_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
void Wayland_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
SDL_bool Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
unsigned *count,
|
||||
const char **names);
|
||||
char const* const* Wayland_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count);
|
||||
SDL_bool Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
|
||||
@@ -112,20 +112,14 @@ void WIN_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool WIN_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* WIN_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForWin32[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
if (!_this->vulkan_config.loader_handle) {
|
||||
SDL_SetError("Vulkan is not loaded");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForWin32),
|
||||
extensionsForWin32);
|
||||
if(count) { *count = SDL_arraysize(extensionsForWin32); }
|
||||
return extensionsForWin32;
|
||||
}
|
||||
|
||||
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,
|
||||
unsigned *count,
|
||||
const char **names)
|
||||
char const* const* X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
{
|
||||
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) {
|
||||
static const char *const extensionsForXCB[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||
VK_KHR_XCB_SURFACE_EXTENSION_NAME,
|
||||
};
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB);
|
||||
if(count) {
|
||||
*count = SDL_arraysize(extensionsForXCB);
|
||||
}
|
||||
return extensionsForXCB;
|
||||
} else {
|
||||
static const char *const extensionsForXlib[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||
VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
|
||||
};
|
||||
return SDL_Vulkan_GetInstanceExtensions_Helper(
|
||||
count, names, SDL_arraysize(extensionsForXlib), extensionsForXlib);
|
||||
if(count) {
|
||||
*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);
|
||||
void X11_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
SDL_bool X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
unsigned *count,
|
||||
const char **names);
|
||||
char const* const* X11_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count);
|
||||
SDL_bool X11_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
|
||||
Reference in New Issue
Block a user