diff --git a/Xcode-iOS/Demos/src/accelerometer.c b/Xcode-iOS/Demos/src/accelerometer.c index 3ce812513..543a7b37f 100644 --- a/Xcode-iOS/Demos/src/accelerometer.c +++ b/Xcode-iOS/Demos/src/accelerometer.c @@ -170,7 +170,7 @@ main(int argc, char *argv[]) /* create main window and renderer */ window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI); - renderer = SDL_CreateRenderer(window, 0, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); SDL_GetWindowSize(window, &w, &h); SDL_RenderSetLogicalSize(renderer, w, h); diff --git a/Xcode-iOS/Demos/src/happy.c b/Xcode-iOS/Demos/src/happy.c index 42562007e..1bf183e15 100644 --- a/Xcode-iOS/Demos/src/happy.c +++ b/Xcode-iOS/Demos/src/happy.c @@ -145,7 +145,7 @@ main(int argc, char *argv[]) * (if SDL_WINDOW_RESIZABLE isn't specified). */ window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI); - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); SDL_GetWindowSize(window, &width, &height); SDL_RenderSetLogicalSize(renderer, width, height); diff --git a/Xcode-iOS/Demos/src/keyboard.c b/Xcode-iOS/Demos/src/keyboard.c index 2d0ae841c..2439aa59a 100644 --- a/Xcode-iOS/Demos/src/keyboard.c +++ b/Xcode-iOS/Demos/src/keyboard.c @@ -223,7 +223,7 @@ main(int argc, char *argv[]) /* create window */ window = SDL_CreateWindow("iOS keyboard test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); /* create renderer */ - renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC); + renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_PRESENTVSYNC); SDL_GetWindowSize(window, &width, &height); SDL_RenderSetLogicalSize(renderer, width, height); diff --git a/Xcode-iOS/Demos/src/mixer.c b/Xcode-iOS/Demos/src/mixer.c index 4c4ffbad0..2ea1b861a 100644 --- a/Xcode-iOS/Demos/src/mixer.c +++ b/Xcode-iOS/Demos/src/mixer.c @@ -283,7 +283,7 @@ main(int argc, char *argv[]) fatalError("could not initialize SDL"); } window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI); - renderer = SDL_CreateRenderer(window, 0, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); SDL_GetWindowSize(window, &width, &height); SDL_RenderSetLogicalSize(renderer, width, height); diff --git a/Xcode-iOS/Demos/src/rectangles.c b/Xcode-iOS/Demos/src/rectangles.c index 9102cf279..0f6cac957 100644 --- a/Xcode-iOS/Demos/src/rectangles.c +++ b/Xcode-iOS/Demos/src/rectangles.c @@ -61,7 +61,7 @@ main(int argc, char *argv[]) if (window == NULL) { fatalError("Could not initialize Window"); } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { fatalError("Could not create renderer"); } diff --git a/Xcode-iOS/Demos/src/touch.c b/Xcode-iOS/Demos/src/touch.c index 22a251be1..7c81390df 100644 --- a/Xcode-iOS/Demos/src/touch.c +++ b/Xcode-iOS/Demos/src/touch.c @@ -92,7 +92,7 @@ main(int argc, char *argv[]) /* create main window and renderer */ window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI); - renderer = SDL_CreateRenderer(window, 0, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); SDL_GetWindowSize(window, &w, &h); SDL_RenderSetLogicalSize(renderer, w, h); diff --git a/docs/README-migration.md b/docs/README-migration.md index 7ef3713e4..e654f8690 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -317,3 +317,18 @@ The following hints have been removed: The gesture API has been removed. There is no replacement planned. + +## SDL_render.h + +SDL_GetRenderDriverInfo() has been removed, since most of the information it reported were +estimates and could not be accurate before creating a renderer. Often times this function +was used to figure out the index of a driver, so one would call it in a for-loop, looking +for the driver named "opengl" or whatnot. SDL_GetRenderDriver() has been added for this +functionality, which returns only the name of the driver. + +Additionally, SDL_CreateRenderer()'s second argument is no longer an integer index, but a +`const char *` representing a renderer's name; if you were just using a for-loop to find +which index is the "opengl" or whatnot driver, you can just pass that string directly +here, now. Passing NULL is the same as passing -1 here in SDL2, to signify you want SDL +to decide for you. + diff --git a/docs/README-visualc.md b/docs/README-visualc.md index 8759843d8..4303fd518 100644 --- a/docs/README-visualc.md +++ b/docs/README-visualc.md @@ -89,7 +89,7 @@ Here's a sample SDL snippet to verify everything is setup in your IDE: SDL_Init(SDL_INIT_VIDEO); window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); - renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); + renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 1fac04152..c483d0c77 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -164,26 +164,35 @@ typedef struct SDL_Texture SDL_Texture; * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer - * \sa SDL_GetRenderDriverInfo + * \sa SDL_GetRenderDriver */ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); /** - * Get info about a specific 2D rendering driver for the current display. + * Use this function to get the name of a built in 2D rendering driver. * - * \param index the index of the driver to query information about - * \param info an SDL_RendererInfo structure to be filled with information on - * the rendering driver - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. + * The list of rendering drivers is given in the order that they are normally + * initialized by default; the drivers that seem more reasonable to choose + * first (as far as the SDL developers believe) are earlier in the list. + * + * The names of drivers are all simple, low-ASCII identifiers, like "opengl", + * "direct3d12" or "metal". These never have Unicode characters, and are not + * meant to be proper names. + * + * The returned value points to a static, read-only string; do not modify or + * free it! + * + * \param index the index of the rendering driver; the value ranges from 0 to + * SDL_GetNumRenderDrivers() - 1 + * \returns the name of the rendering driver at the requested index, or NULL + * if an invalid index was specified. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_CreateRenderer * \sa SDL_GetNumRenderDrivers */ -extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, - SDL_RendererInfo * info); +extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index); + /** * Create a window and default renderer. @@ -210,9 +219,16 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( /** * Create a 2D rendering context for a window. * + * If you want a specific renderer, you can specify its name here. A list + * of available renderers can be obtained by calling SDL_GetRenderDriver + * multiple times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If + * you don't need a specific renderer, specify NULL and SDL will attempt + * to chooes the best option for you, based on what is available on the + * user's system. + * * \param window the window where rendering is displayed - * \param index the index of the rendering driver to initialize, or -1 to - * initialize the first one supporting the requested flags + * \param name the name of the rendering driver to initialize, or NULL to + * initialize the first one supporting the requested flags * \param flags 0, or one or more SDL_RendererFlags OR'd together * \returns a valid rendering context or NULL if there was an error; call * SDL_GetError() for more information. @@ -222,10 +238,11 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( * \sa SDL_CreateSoftwareRenderer * \sa SDL_DestroyRenderer * \sa SDL_GetNumRenderDrivers + * \sa SDL_GetRenderDriver * \sa SDL_GetRendererInfo */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, - int index, Uint32 flags); + const char *name, Uint32 flags); /** * Create a 2D software rendering context for a surface. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 5d647a3cd..a3ebfd3df 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -432,7 +432,6 @@ SDL3_0.0.0 { SDL_hid_ble_scan; SDL_GetWindowWMInfo; SDL_GetNumRenderDrivers; - SDL_GetRenderDriverInfo; SDL_CreateWindowAndRenderer; SDL_CreateRenderer; SDL_CreateSoftwareRenderer; @@ -861,6 +860,7 @@ SDL3_0.0.0 { SDL_GetTicksNS; SDL_DelayNS; SDL_GetEventState; + SDL_GetRenderDriver; # extra symbols go here (don't modify this line) local: *; }; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index fd5039217..230abdb68 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -288,7 +288,6 @@ #define SDL_EnclosePoints SDL_EnclosePoints_REAL #define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL #define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL -#define SDL_GetRenderDriverInfo SDL_GetRenderDriverInfo_REAL #define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL #define SDL_CreateRenderer SDL_CreateRenderer_REAL #define SDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer_REAL @@ -885,3 +884,4 @@ #define SDL_GetTicksNS SDL_GetTicksNS_REAL #define SDL_DelayNS SDL_DelayNS_REAL #define SDL_GetEventState SDL_GetEventState_REAL +#define SDL_GetRenderDriver SDL_GetRenderDriver_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index ce9b5f51d..9f79080fb 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -315,9 +315,8 @@ SDL_DYNAPI_PROC(void,SDL_UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Re SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return) -SDL_DYNAPI_PROC(int,SDL_GetRenderDriverInfo,(int a, SDL_RendererInfo *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, int b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetRendererInfo,(SDL_Renderer *a, SDL_RendererInfo *b),(a,b),return) @@ -961,3 +960,4 @@ SDL_DYNAPI_PROC(void*,SDL_memset4,(void *a, Uint32 b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return) SDL_DYNAPI_PROC(void,SDL_DelayNS,(Uint64 a),(a),) SDL_DYNAPI_PROC(Uint8,SDL_GetEventState,(Uint32 a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index faa5c8c56..e1b0ee2cd 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -642,17 +642,18 @@ int SDL_GetNumRenderDrivers(void) #endif } -int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info) +const char *SDL_GetRenderDriver(int index) { #if !SDL_RENDER_DISABLED if (index < 0 || index >= SDL_GetNumRenderDrivers()) { - return SDL_SetError("index must be in the range of 0 - %d", + SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumRenderDrivers() - 1); + return NULL; } - *info = render_drivers[index]->info; - return 0; + return render_drivers[index]->info.name; #else - return SDL_SetError("SDL not built with rendering support"); + SDL_SetError("SDL not built with rendering support"); + return NULL; #endif } @@ -862,7 +863,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, return -1; } - *renderer = SDL_CreateRenderer(*window, -1, 0); + *renderer = SDL_CreateRenderer(*window, NULL, 0); if (!*renderer) { return -1; } @@ -926,13 +927,14 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind #endif /* !SDL_RENDER_DISABLED */ SDL_Renderer * -SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) +SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags) { #if !SDL_RENDER_DISABLED SDL_Renderer *renderer = NULL; - int n = SDL_GetNumRenderDrivers(); + const int n = SDL_GetNumRenderDrivers(); SDL_bool batching = SDL_TRUE; const char *hint; + int i; #if defined(__ANDROID__) Android_ActivityMutex_Lock_Running(); @@ -957,53 +959,39 @@ SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) } } - if (index < 0) { - hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER); - if (hint) { - for (index = 0; index < n; ++index) { - const SDL_RenderDriver *driver = render_drivers[index]; + if (!name) { + name = SDL_GetHint(SDL_HINT_RENDER_DRIVER); + } - if (SDL_strcasecmp(hint, driver->info.name) == 0) { - /* Create a new renderer instance */ - renderer = driver->CreateRenderer(window, flags); - if (renderer) { - batching = SDL_FALSE; - } + if (name) { + for (i = 0; i < n; i++) { + const SDL_RenderDriver *driver = render_drivers[i]; + if (SDL_strcasecmp(name, driver->info.name) == 0) { + /* Create a new renderer instance */ + renderer = driver->CreateRenderer(window, flags); + if (renderer) { + batching = SDL_FALSE; + } + break; + } + } + } else { + for (i = 0; i < n; i++) { + const SDL_RenderDriver *driver = render_drivers[i]; + if ((driver->info.flags & flags) == flags) { + /* Create a new renderer instance */ + renderer = driver->CreateRenderer(window, flags); + if (renderer) { + /* Yay, we got one! */ break; } } } + } - if (renderer == NULL) { - for (index = 0; index < n; ++index) { - const SDL_RenderDriver *driver = render_drivers[index]; - - if ((driver->info.flags & flags) == flags) { - /* Create a new renderer instance */ - renderer = driver->CreateRenderer(window, flags); - if (renderer) { - /* Yay, we got one! */ - break; - } - } - } - } - if (renderer == NULL) { - SDL_SetError("Couldn't find matching render driver"); - goto error; - } - } else { - if (index >= n) { - SDL_SetError("index must be -1 or in the range of 0 - %d", - n - 1); - goto error; - } - /* Create a new renderer instance */ - renderer = render_drivers[index]->CreateRenderer(window, flags); - batching = SDL_FALSE; - if (renderer == NULL) { - goto error; - } + if (renderer == NULL) { + SDL_SetError("Couldn't find matching render driver"); + goto error; } if ((flags & SDL_RENDERER_PRESENTVSYNC) != 0) { diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index cab0700c8..50cf8545b 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1196,16 +1196,13 @@ SDLTest_CommonInit(SDLTest_CommonState *state) } if (state->verbose & VERBOSE_RENDER) { - SDL_RendererInfo info; - n = SDL_GetNumRenderDrivers(); if (n == 0) { SDL_Log("No built-in render drivers\n"); } else { SDL_Log("Built-in render drivers:\n"); for (i = 0; i < n; ++i) { - SDL_GetRenderDriverInfo(i, &info); - SDLTest_PrintRenderer(&info); + SDL_Log(" %s\n", SDL_GetRenderDriver(i)); } } } @@ -1310,25 +1307,8 @@ SDLTest_CommonInit(SDLTest_CommonState *state) } if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) { - m = -1; - if (state->renderdriver) { - SDL_RendererInfo info; - n = SDL_GetNumRenderDrivers(); - for (j = 0; j < n; ++j) { - SDL_GetRenderDriverInfo(j, &info); - if (SDL_strcasecmp(info.name, state->renderdriver) == 0) { - m = j; - break; - } - } - if (m == -1) { - SDL_Log("Couldn't find render driver named %s", - state->renderdriver); - return SDL_FALSE; - } - } state->renderers[i] = SDL_CreateRenderer(state->windows[i], - m, state->render_flags); + state->renderdriver, state->render_flags); if (!state->renderers[i]) { SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 9e5f994fb..16472607e 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -213,13 +213,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U /* Check to see if there's a specific driver requested */ if (specific_accelerated_renderer) { - for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { - SDL_GetRenderDriverInfo(i, &info); - if (SDL_strcasecmp(info.name, hint) == 0) { - renderer = SDL_CreateRenderer(window, i, 0); - break; - } - } + renderer = SDL_CreateRenderer(window, hint, 0); if (renderer == NULL || (SDL_GetRendererInfo(renderer, &info) == -1)) { if (renderer) { SDL_DestroyRenderer(renderer); @@ -228,10 +222,11 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U } /* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */ } else { - for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { - SDL_GetRenderDriverInfo(i, &info); - if (SDL_strcmp(info.name, "software") != 0) { - renderer = SDL_CreateRenderer(window, i, 0); + const int total = SDL_GetNumRenderDrivers(); + for (i = 0; i < total; ++i) { + const char *name = SDL_GetRenderDriver(i); + if (name && (SDL_strcmp(info.name, "software") != 0)) { + renderer = SDL_CreateRenderer(window, name, 0); if (renderer && (SDL_GetRendererInfo(renderer, &info) == 0) && (info.flags & SDL_RENDERER_ACCELERATED)) { break; /* this will work. */ } diff --git a/test/checkkeys.c b/test/checkkeys.c index 0aa51efe9..6c739b1ed 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -273,7 +273,7 @@ int main(int argc, char *argv[]) quit(2); } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c index 02f102e3a..b361c1487 100644 --- a/test/checkkeysthreads.c +++ b/test/checkkeysthreads.c @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) /* On wayland, no window will actually show until something has actually been displayed. */ - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); SDL_RenderPresent(renderer); #if __IOS__ diff --git a/test/controllermap.c b/test/controllermap.c index 86a7c6783..b0aa86f88 100644 --- a/test/controllermap.c +++ b/test/controllermap.c @@ -730,7 +730,7 @@ int main(int argc, char *argv[]) return 2; } - screen = SDL_CreateRenderer(window, -1, 0); + screen = SDL_CreateRenderer(window, NULL, 0); if (screen == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); return 2; diff --git a/test/testaudiocapture.c b/test/testaudiocapture.c index b035fdce9..d0db38b13 100644 --- a/test/testaudiocapture.c +++ b/test/testaudiocapture.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) } window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0); - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderClear(renderer); SDL_RenderPresent(renderer); diff --git a/test/testautomation_render.c b/test/testautomation_render.c index 516af0675..c5a01fd34 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -45,7 +45,7 @@ void InitCreateRenderer(void *arg) return; } - renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); + renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED); SDLTest_AssertPass("SDL_CreateRenderer()"); SDLTest_AssertCheck(renderer != NULL, "Check SDL_CreateRenderer result"); if (renderer == NULL) { diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 0975813bc..421da8e89 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -892,7 +892,7 @@ int main(int argc, char *argv[]) return 2; } - screen = SDL_CreateRenderer(window, -1, 0); + screen = SDL_CreateRenderer(window, NULL, 0); if (screen == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); diff --git a/test/testhittesting.c b/test/testhittesting.c index 9c47a8581..a2646975a 100644 --- a/test/testhittesting.c +++ b/test/testhittesting.c @@ -76,7 +76,7 @@ int main(int argc, char **argv) /* !!! FIXME: check for errors. */ SDL_Init(SDL_INIT_VIDEO); window = SDL_CreateWindow("Drag the red boxes", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE); - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (SDL_SetWindowHitTest(window, hitTest, NULL) == -1) { SDL_Log("Enabling hit-testing failed!\n"); diff --git a/test/testjoystick.c b/test/testjoystick.c index d455eb975..8b2552ee1 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -291,7 +291,7 @@ int main(int argc, char *argv[]) return SDL_FALSE; } - screen = SDL_CreateRenderer(window, -1, 0); + screen = SDL_CreateRenderer(window, NULL, 0); if (screen == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); diff --git a/test/testmessage.c b/test/testmessage.c index bd67fdf14..3d3489b94 100644 --- a/test/testmessage.c +++ b/test/testmessage.c @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) /* On wayland, no window will actually show until something has actually been displayed. */ - SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0); + SDL_Renderer *renderer = SDL_CreateRenderer(window, NULL, 0); SDL_RenderPresent(renderer); success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, diff --git a/test/testmouse.c b/test/testmouse.c index 2f355ded9..121972a86 100644 --- a/test/testmouse.c +++ b/test/testmouse.c @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) return SDL_FALSE; } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); diff --git a/test/testnative.c b/test/testnative.c index 7553771fe..acb316b05 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) SDL_SetWindowTitle(window, "SDL Native Window Test"); /* Create the renderer */ - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); quit(5); diff --git a/test/testoffscreen.c b/test/testoffscreen.c index 833e36c17..fed770b0b 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) return SDL_FALSE; } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_Log("Couldn't create renderer: %s\n", diff --git a/test/testshape.c b/test/testshape.c index 77edf4f48..3f004bb70 100644 --- a/test/testshape.c +++ b/test/testshape.c @@ -113,7 +113,7 @@ int main(int argc, char **argv) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape."); exit(-4); } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_DestroyWindow(window); for (i = 0; i < num_pictures; i++) { diff --git a/test/teststreaming.c b/test/teststreaming.c index 95f00080a..65aa2d21e 100644 --- a/test/teststreaming.c +++ b/test/teststreaming.c @@ -164,7 +164,7 @@ int main(int argc, char **argv) quit(3); } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError()); quit(4); diff --git a/test/testyuv.c b/test/testyuv.c index 7ee67d5f2..063f25162 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -358,7 +358,7 @@ int main(int argc, char **argv) return 4; } - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, NULL, 0); if (renderer == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); return 4;