Fixed code style for new Vulkan API functions
parent
ea91908e95
commit
0cebef607b
|
@ -1398,21 +1398,17 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flags & SDL_WINDOW_VULKAN)
|
if (flags & SDL_WINDOW_VULKAN) {
|
||||||
{
|
if (!_this->Vulkan_CreateSurface) {
|
||||||
if(!_this->Vulkan_CreateSurface)
|
|
||||||
{
|
|
||||||
SDL_SetError("Vulkan support is either not configured in SDL "
|
SDL_SetError("Vulkan support is either not configured in SDL "
|
||||||
"or not available in video driver");
|
"or not available in video driver");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(flags & SDL_WINDOW_OPENGL)
|
if (flags & SDL_WINDOW_OPENGL) {
|
||||||
{
|
|
||||||
SDL_SetError("Vulkan and OpenGL not supported on same window");
|
SDL_SetError("Vulkan and OpenGL not supported on same window");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(SDL_Vulkan_LoadLibrary(NULL) < 0)
|
if (SDL_Vulkan_LoadLibrary(NULL) < 0) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1927,20 +1923,16 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we don't exceed any window size limits */
|
/* Make sure we don't exceed any window size limits */
|
||||||
if (window->min_w && w < window->min_w)
|
if (window->min_w && w < window->min_w) {
|
||||||
{
|
|
||||||
w = window->min_w;
|
w = window->min_w;
|
||||||
}
|
}
|
||||||
if (window->max_w && w > window->max_w)
|
if (window->max_w && w > window->max_w) {
|
||||||
{
|
|
||||||
w = window->max_w;
|
w = window->max_w;
|
||||||
}
|
}
|
||||||
if (window->min_h && h < window->min_h)
|
if (window->min_h && h < window->min_h) {
|
||||||
{
|
|
||||||
h = window->min_h;
|
h = window->min_h;
|
||||||
}
|
}
|
||||||
if (window->max_h && h > window->max_h)
|
if (window->max_h && h > window->max_h) {
|
||||||
{
|
|
||||||
h = window->max_h;
|
h = window->max_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3978,34 +3970,27 @@ void SDL_OnApplicationDidBecomeActive(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window."
|
#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window"
|
||||||
|
|
||||||
int SDL_Vulkan_LoadLibrary(const char *path)
|
int SDL_Vulkan_LoadLibrary(const char *path)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
if(!_this)
|
if (!_this) {
|
||||||
{
|
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(_this->vulkan_config.loader_loaded)
|
if (_this->vulkan_config.loader_loaded) {
|
||||||
{
|
if (path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0) {
|
||||||
if(path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0)
|
|
||||||
{
|
|
||||||
return SDL_SetError("Vulkan loader library already loaded");
|
return SDL_SetError("Vulkan loader library already loaded");
|
||||||
}
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
} else {
|
||||||
else
|
if (!_this->Vulkan_LoadLibrary) {
|
||||||
{
|
|
||||||
if(!_this->Vulkan_LoadLibrary)
|
|
||||||
{
|
|
||||||
return SDL_SetError("No Vulkan support in video driver");
|
return SDL_SetError("No Vulkan support in video driver");
|
||||||
}
|
}
|
||||||
retval = _this->Vulkan_LoadLibrary(_this, path);
|
retval = _this->Vulkan_LoadLibrary(_this, path);
|
||||||
}
|
}
|
||||||
if(retval == 0)
|
if (retval == 0) {
|
||||||
{
|
|
||||||
_this->vulkan_config.loader_loaded++;
|
_this->vulkan_config.loader_loaded++;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -4013,13 +3998,11 @@ int SDL_Vulkan_LoadLibrary(const char *path)
|
||||||
|
|
||||||
void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
|
void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
|
||||||
{
|
{
|
||||||
if(!_this)
|
if (!_this) {
|
||||||
{
|
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(!_this->vulkan_config.loader_loaded)
|
if (!_this->vulkan_config.loader_loaded) {
|
||||||
{
|
|
||||||
SDL_SetError("No Vulkan loader has been loaded");
|
SDL_SetError("No Vulkan loader has been loaded");
|
||||||
}
|
}
|
||||||
return _this->vulkan_config.vkGetInstanceProcAddr;
|
return _this->vulkan_config.vkGetInstanceProcAddr;
|
||||||
|
@ -4027,19 +4010,15 @@ void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
|
||||||
|
|
||||||
void SDL_Vulkan_UnloadLibrary(void)
|
void SDL_Vulkan_UnloadLibrary(void)
|
||||||
{
|
{
|
||||||
if(!_this)
|
if (!_this) {
|
||||||
{
|
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_this->vulkan_config.loader_loaded > 0)
|
if (_this->vulkan_config.loader_loaded > 0) {
|
||||||
{
|
if (--_this->vulkan_config.loader_loaded > 0) {
|
||||||
if(--_this->vulkan_config.loader_loaded > 0)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_this->Vulkan_UnloadLibrary)
|
if (_this->Vulkan_UnloadLibrary) {
|
||||||
{
|
|
||||||
_this->Vulkan_UnloadLibrary(_this);
|
_this->Vulkan_UnloadLibrary(_this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4049,15 +4028,13 @@ SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, c
|
||||||
{
|
{
|
||||||
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
||||||
|
|
||||||
if(!(window->flags & SDL_WINDOW_VULKAN))
|
if (!(window->flags & SDL_WINDOW_VULKAN)) {
|
||||||
{
|
|
||||||
SDL_SetError(NOT_A_VULKAN_WINDOW);
|
SDL_SetError(NOT_A_VULKAN_WINDOW);
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!count)
|
if (!count) {
|
||||||
{
|
SDL_InvalidParamError("count");
|
||||||
SDL_SetError("invalid count");
|
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4070,21 +4047,18 @@ SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
|
||||||
{
|
{
|
||||||
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
||||||
|
|
||||||
if(!(window->flags & SDL_WINDOW_VULKAN))
|
if (!(window->flags & SDL_WINDOW_VULKAN)) {
|
||||||
{
|
|
||||||
SDL_SetError(NOT_A_VULKAN_WINDOW);
|
SDL_SetError(NOT_A_VULKAN_WINDOW);
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!instance)
|
if (!instance) {
|
||||||
{
|
SDL_InvalidParamError("instance");
|
||||||
SDL_SetError("invalid instance");
|
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!surface)
|
if (!surface) {
|
||||||
{
|
SDL_InvalidParamError("surface");
|
||||||
SDL_SetError("invalid surface");
|
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue