Removed some uneeded 'unsigned': renderer.num_texture_format and SDL_Vulkan_GetInstanceExtensions() prototype

This commit is contained in:
Sylvain 2024-03-05 21:11:32 +01:00 committed by Sam Lantinga
parent 1e0bac288b
commit cea717e5d3
9 changed files with 21 additions and 21 deletions

View File

@ -79,7 +79,7 @@ typedef struct SDL_RendererInfo
{ {
const char *name; /**< The name of the renderer */ const char *name; /**< The name of the renderer */
Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 flags; /**< Supported ::SDL_RendererFlags */
Uint32 num_texture_formats; /**< The number of available texture formats */ int num_texture_formats; /**< The number of available texture formats */
Uint32 texture_formats[16]; /**< The available texture formats */ Uint32 texture_formats[16]; /**< The available texture formats */
int max_texture_width; /**< The maximum texture width */ int max_texture_width; /**< The maximum texture width */
int max_texture_height; /**< The maximum texture height */ int max_texture_height; /**< The maximum texture height */

View File

@ -141,7 +141,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
* This should be called after either calling SDL_Vulkan_LoadLibrary() or * This should be called after either calling SDL_Vulkan_LoadLibrary() or
* creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag. * creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag.
* *
* On return, the variable pointed to by `pCount` will be set to the number of * On return, the variable pointed to by `count` will be set to the number of
* elements returned, suitable for using with * elements returned, suitable for using with
* VkInstanceCreateInfo::enabledExtensionCount, and the returned array can be * VkInstanceCreateInfo::enabledExtensionCount, and the returned array can be
* used with VkInstanceCreateInfo::ppEnabledExtensionNames, for calling * used with VkInstanceCreateInfo::ppEnabledExtensionNames, for calling
@ -149,7 +149,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
* *
* You should not free the returned array; it is owned by SDL. * You should not free the returned array; it is owned by SDL.
* *
* \param pCount A pointer to Uint32 that will be filled with the number of * \param count A pointer to an int that will be filled with the number of
* extensions returned. * extensions returned.
* \returns An array of extension name strings on success, NULL on error. * \returns An array of extension name strings on success, NULL on error.
* *
@ -157,7 +157,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
* *
* \sa SDL_Vulkan_CreateSurface * \sa SDL_Vulkan_CreateSurface
*/ */
extern DECLSPEC char const* const* SDLCALL SDL_Vulkan_GetInstanceExtensions(Uint32 *pCount); extern DECLSPEC char const* const* SDLCALL SDL_Vulkan_GetInstanceExtensions(int *count);
/** /**
* Create a Vulkan rendering surface for a window. * Create a Vulkan rendering surface for a window.

View File

@ -688,7 +688,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, const struct VkAllocationCallbacks *c, VkSurfaceKHR *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, const struct VkAllocationCallbacks *c, VkSurfaceKHR *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(char const* const*,SDL_Vulkan_GetInstanceExtensions,(Uint32 *a),(a),return) SDL_DYNAPI_PROC(char const* const*,SDL_Vulkan_GetInstanceExtensions,(int *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),(),)

View File

@ -1187,7 +1187,7 @@ static SDL_bool IsSupportedBlendMode(SDL_Renderer *renderer, SDL_BlendMode blend
static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, Uint32 format) static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, Uint32 format)
{ {
Uint32 i; int i;
for (i = 0; i < renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (renderer->info.texture_formats[i] == format) { if (renderer->info.texture_formats[i] == format) {
@ -1199,7 +1199,7 @@ static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, Uint32 format)
static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format) static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format)
{ {
Uint32 i; int i;
if (SDL_ISPIXELFORMAT_FOURCC(format)) { if (SDL_ISPIXELFORMAT_FOURCC(format)) {
/* Look for an exact match */ /* Look for an exact match */
@ -1438,14 +1438,14 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
/* No alpha, but a colorkey => promote to alpha */ /* No alpha, but a colorkey => promote to alpha */
if (!fmt->Amask && SDL_SurfaceHasColorKey(surface)) { if (!fmt->Amask && SDL_SurfaceHasColorKey(surface)) {
if (fmt->format == SDL_PIXELFORMAT_XRGB8888) { if (fmt->format == SDL_PIXELFORMAT_XRGB8888) {
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ARGB8888) { if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ARGB8888) {
format = SDL_PIXELFORMAT_ARGB8888; format = SDL_PIXELFORMAT_ARGB8888;
break; break;
} }
} }
} else if (fmt->format == SDL_PIXELFORMAT_XBGR8888) { } else if (fmt->format == SDL_PIXELFORMAT_XBGR8888) {
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ABGR8888) { if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ABGR8888) {
format = SDL_PIXELFORMAT_ABGR8888; format = SDL_PIXELFORMAT_ABGR8888;
break; break;
@ -1454,7 +1454,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
} }
} else { } else {
/* Exact match would be fine */ /* Exact match would be fine */
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (renderer->info.texture_formats[i] == fmt->format) { if (renderer->info.texture_formats[i] == fmt->format) {
format = fmt->format; format = fmt->format;
break; break;
@ -1464,7 +1464,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
/* Look for 10-bit pixel formats if needed */ /* Look for 10-bit pixel formats if needed */
if (format == SDL_PIXELFORMAT_UNKNOWN && SDL_ISPIXELFORMAT_10BIT(fmt->format)) { if (format == SDL_PIXELFORMAT_UNKNOWN && SDL_ISPIXELFORMAT_10BIT(fmt->format)) {
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (SDL_ISPIXELFORMAT_10BIT(renderer->info.texture_formats[i])) { if (SDL_ISPIXELFORMAT_10BIT(renderer->info.texture_formats[i])) {
format = renderer->info.texture_formats[i]; format = renderer->info.texture_formats[i];
break; break;
@ -1475,7 +1475,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
/* Look for floating point pixel formats if needed */ /* Look for floating point pixel formats if needed */
if (format == SDL_PIXELFORMAT_UNKNOWN && if (format == SDL_PIXELFORMAT_UNKNOWN &&
(SDL_ISPIXELFORMAT_10BIT(fmt->format) || SDL_ISPIXELFORMAT_FLOAT(fmt->format))) { (SDL_ISPIXELFORMAT_10BIT(fmt->format) || SDL_ISPIXELFORMAT_FLOAT(fmt->format))) {
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (SDL_ISPIXELFORMAT_FLOAT(renderer->info.texture_formats[i])) { if (SDL_ISPIXELFORMAT_FLOAT(renderer->info.texture_formats[i])) {
format = renderer->info.texture_formats[i]; format = renderer->info.texture_formats[i];
break; break;
@ -1486,7 +1486,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
/* Fallback, choose a valid pixel format */ /* Fallback, choose a valid pixel format */
if (format == SDL_PIXELFORMAT_UNKNOWN) { if (format == SDL_PIXELFORMAT_UNKNOWN) {
format = renderer->info.texture_formats[0]; format = renderer->info.texture_formats[0];
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) && if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) { SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
format = renderer->info.texture_formats[i]; format = renderer->info.texture_formats[i];

View File

@ -1708,7 +1708,7 @@ static VkResult VULKAN_CreateDeviceResources(SDL_Renderer *renderer, SDL_Propert
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;
char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount); char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions((int *)&instanceCreateInfo.enabledExtensionCount);
const char **instanceExtensionsCopy = SDL_calloc(instanceCreateInfo.enabledExtensionCount + 2, sizeof(const char *)); const char **instanceExtensionsCopy = SDL_calloc(instanceCreateInfo.enabledExtensionCount + 2, sizeof(const char *));
for (uint32_t i = 0; i < instanceCreateInfo.enabledExtensionCount; i++) { for (uint32_t i = 0; i < instanceCreateInfo.enabledExtensionCount; i++) {

View File

@ -1048,8 +1048,8 @@ static void SDLTest_PrintRenderer(SDL_RendererInfo *info)
SDL_snprintfcat(text, sizeof(text), ")"); SDL_snprintfcat(text, sizeof(text), ")");
SDL_Log("%s\n", text); SDL_Log("%s\n", text);
(void)SDL_snprintf(text, sizeof(text), " Texture formats (%" SDL_PRIu32 "): ", info->num_texture_formats); (void)SDL_snprintf(text, sizeof(text), " Texture formats (%d): ", info->num_texture_formats);
for (i = 0; i < (int)info->num_texture_formats; ++i) { for (i = 0; i < info->num_texture_formats; ++i) {
if (i > 0) { if (i > 0) {
SDL_snprintfcat(text, sizeof(text), ", "); SDL_snprintfcat(text, sizeof(text), ", ");
} }

View File

@ -313,7 +313,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
/* Find the first format with or without an alpha channel */ /* Find the first format with or without an alpha channel */
*format = info.texture_formats[0]; *format = info.texture_formats[0];
for (i = 0; i < (int)info.num_texture_formats; ++i) { for (i = 0; i < info.num_texture_formats; ++i) {
if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) && if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) &&
transparent == SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) { transparent == SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) {
*format = info.texture_formats[i]; *format = info.texture_formats[i];
@ -5217,9 +5217,9 @@ void SDL_Vulkan_UnloadLibrary(void)
} }
} }
char const* const* SDL_Vulkan_GetInstanceExtensions(Uint32 *count) char const* const* SDL_Vulkan_GetInstanceExtensions(int *count)
{ {
return _this->Vulkan_GetInstanceExtensions(_this, count); return _this->Vulkan_GetInstanceExtensions(_this, (Uint32 *)count);
} }
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,

View File

@ -206,7 +206,7 @@ static int createInstance(VulkanVideoContext *context)
VkApplicationInfo appInfo = { 0 }; VkApplicationInfo appInfo = { 0 };
VkInstanceCreateInfo instanceCreateInfo = { 0 }; VkInstanceCreateInfo instanceCreateInfo = { 0 };
VkResult result; VkResult result;
char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount); char const *const *instanceExtensions = SDL_Vulkan_GetInstanceExtensions((int *)&instanceCreateInfo.enabledExtensionCount);
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.apiVersion = VK_API_VERSION_1_3; appInfo.apiVersion = VK_API_VERSION_1_3;

View File

@ -229,7 +229,7 @@ static void createInstance(void)
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instanceCreateInfo.pApplicationInfo = &appInfo; instanceCreateInfo.pApplicationInfo = &appInfo;
instanceCreateInfo.ppEnabledExtensionNames = SDL_Vulkan_GetInstanceExtensions(&instanceCreateInfo.enabledExtensionCount); instanceCreateInfo.ppEnabledExtensionNames = SDL_Vulkan_GetInstanceExtensions((int *)&instanceCreateInfo.enabledExtensionCount);
result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext->instance); result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext->instance);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
vulkanContext->instance = VK_NULL_HANDLE; vulkanContext->instance = VK_NULL_HANDLE;