Fixed code style for new Vulkan API functions
authorSam Lantinga <slouken@libsdl.org>
Sun, 27 Aug 2017 23:39:55 -0700
changeset 11379308746c0fe9e
parent 11378 dc769c104554
child 11380 bb5404c6b2e0
Fixed code style for new Vulkan API functions
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Sun Aug 27 23:39:38 2017 -0700
     1.2 +++ b/src/video/SDL_video.c	Sun Aug 27 23:39:55 2017 -0700
     1.3 @@ -1398,21 +1398,17 @@
     1.4          }
     1.5      }
     1.6  
     1.7 -    if(flags & SDL_WINDOW_VULKAN)
     1.8 -    {
     1.9 -        if(!_this->Vulkan_CreateSurface)
    1.10 -        {
    1.11 +    if (flags & SDL_WINDOW_VULKAN) {
    1.12 +        if (!_this->Vulkan_CreateSurface) {
    1.13              SDL_SetError("Vulkan support is either not configured in SDL "
    1.14              		     "or not available in video driver");
    1.15              return NULL;
    1.16          }
    1.17 -        if(flags & SDL_WINDOW_OPENGL)
    1.18 -        {
    1.19 +        if (flags & SDL_WINDOW_OPENGL) {
    1.20              SDL_SetError("Vulkan and OpenGL not supported on same window");
    1.21              return NULL;
    1.22          }
    1.23 -        if(SDL_Vulkan_LoadLibrary(NULL) < 0)
    1.24 -        {
    1.25 +        if (SDL_Vulkan_LoadLibrary(NULL) < 0) {
    1.26              return NULL;
    1.27          }
    1.28      }
    1.29 @@ -1927,20 +1923,16 @@
    1.30      }
    1.31  
    1.32      /* Make sure we don't exceed any window size limits */
    1.33 -    if (window->min_w && w < window->min_w)
    1.34 -    {
    1.35 +    if (window->min_w && w < window->min_w) {
    1.36          w = window->min_w;
    1.37      }
    1.38 -    if (window->max_w && w > window->max_w)
    1.39 -    {
    1.40 +    if (window->max_w && w > window->max_w) {
    1.41          w = window->max_w;
    1.42      }
    1.43 -    if (window->min_h && h < window->min_h)
    1.44 -    {
    1.45 +    if (window->min_h && h < window->min_h) {
    1.46          h = window->min_h;
    1.47      }
    1.48 -    if (window->max_h && h > window->max_h)
    1.49 -    {
    1.50 +    if (window->max_h && h > window->max_h) {
    1.51          h = window->max_h;
    1.52      }
    1.53  
    1.54 @@ -3978,34 +3970,27 @@
    1.55      }
    1.56  }
    1.57  
    1.58 -#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window."
    1.59 +#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window"
    1.60  
    1.61  int SDL_Vulkan_LoadLibrary(const char *path)
    1.62  {
    1.63      int retval;
    1.64 -    if(!_this)
    1.65 -    {
    1.66 +    if (!_this) {
    1.67          SDL_UninitializedVideo();
    1.68          return -1;
    1.69      }
    1.70 -    if(_this->vulkan_config.loader_loaded)
    1.71 -    {
    1.72 -        if(path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0)
    1.73 -        {
    1.74 +    if (_this->vulkan_config.loader_loaded) {
    1.75 +        if (path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0) {
    1.76              return SDL_SetError("Vulkan loader library already loaded");
    1.77          }
    1.78          retval = 0;
    1.79 -    }
    1.80 -    else
    1.81 -    {
    1.82 -        if(!_this->Vulkan_LoadLibrary)
    1.83 -        {
    1.84 +    } else {
    1.85 +        if (!_this->Vulkan_LoadLibrary) {
    1.86              return SDL_SetError("No Vulkan support in video driver");
    1.87          }
    1.88          retval = _this->Vulkan_LoadLibrary(_this, path);
    1.89      }
    1.90 -    if(retval == 0)
    1.91 -    {
    1.92 +    if (retval == 0) {
    1.93          _this->vulkan_config.loader_loaded++;
    1.94      }
    1.95      return retval;
    1.96 @@ -4013,13 +3998,11 @@
    1.97  
    1.98  void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
    1.99  {
   1.100 -    if(!_this)
   1.101 -    {
   1.102 +    if (!_this) {
   1.103          SDL_UninitializedVideo();
   1.104          return NULL;
   1.105      }
   1.106 -    if(!_this->vulkan_config.loader_loaded)
   1.107 -    {
   1.108 +    if (!_this->vulkan_config.loader_loaded) {
   1.109          SDL_SetError("No Vulkan loader has been loaded");
   1.110      }
   1.111      return _this->vulkan_config.vkGetInstanceProcAddr;
   1.112 @@ -4027,19 +4010,15 @@
   1.113  
   1.114  void SDL_Vulkan_UnloadLibrary(void)
   1.115  {
   1.116 -    if(!_this)
   1.117 -    {
   1.118 +    if (!_this) {
   1.119          SDL_UninitializedVideo();
   1.120          return;
   1.121      }
   1.122 -    if(_this->vulkan_config.loader_loaded > 0)
   1.123 -    {
   1.124 -        if(--_this->vulkan_config.loader_loaded > 0)
   1.125 -        {
   1.126 +    if (_this->vulkan_config.loader_loaded > 0) {
   1.127 +        if (--_this->vulkan_config.loader_loaded > 0) {
   1.128              return;
   1.129          }
   1.130 -        if(_this->Vulkan_UnloadLibrary)
   1.131 -        {
   1.132 +        if (_this->Vulkan_UnloadLibrary) {
   1.133              _this->Vulkan_UnloadLibrary(_this);
   1.134          }
   1.135      }
   1.136 @@ -4049,15 +4028,13 @@
   1.137  {
   1.138      CHECK_WINDOW_MAGIC(window, SDL_FALSE);
   1.139  
   1.140 -    if(!(window->flags & SDL_WINDOW_VULKAN))
   1.141 -    {
   1.142 +    if (!(window->flags & SDL_WINDOW_VULKAN)) {
   1.143          SDL_SetError(NOT_A_VULKAN_WINDOW);
   1.144          return SDL_FALSE;
   1.145      }
   1.146  
   1.147 -    if(!count)
   1.148 -    {
   1.149 -        SDL_SetError("invalid count");
   1.150 +    if (!count) {
   1.151 +        SDL_InvalidParamError("count");
   1.152          return SDL_FALSE;
   1.153      }
   1.154  
   1.155 @@ -4070,21 +4047,18 @@
   1.156  {
   1.157      CHECK_WINDOW_MAGIC(window, SDL_FALSE);
   1.158  
   1.159 -    if(!(window->flags & SDL_WINDOW_VULKAN))
   1.160 -    {
   1.161 +    if (!(window->flags & SDL_WINDOW_VULKAN)) {
   1.162          SDL_SetError(NOT_A_VULKAN_WINDOW);
   1.163          return SDL_FALSE;
   1.164      }
   1.165  
   1.166 -    if(!instance)
   1.167 -    {
   1.168 -        SDL_SetError("invalid instance");
   1.169 +    if (!instance) {
   1.170 +        SDL_InvalidParamError("instance");
   1.171          return SDL_FALSE;
   1.172      }
   1.173  
   1.174 -    if(!surface)
   1.175 -    {
   1.176 -        SDL_SetError("invalid surface");
   1.177 +    if (!surface) {
   1.178 +        SDL_InvalidParamError("surface");
   1.179          return SDL_FALSE;
   1.180      }
   1.181