Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix renderer creation for HW display engine (OpenRCT2#22445)
SDL requires a renderer to be created in an empty window, i.e. one without any other renderer nor surface. Leaving the window with earlier surface from another engine (e.g. when switching from SW to SW+HWD) caused no renderer to be created (_sdlRenderer set to nullptr) and setting up a bomb to explode next time we try to render a frame. I think this can also get triggered when resizing/switching the focus of a window. While SDL already has internal checks for window surface presence in `SDL_DestroyWindowSurface` _in the SDL version I checked_, I have no certainty if this is correct for all of them. I added check for window surface presence to better express the code intent as well. `SDL_DestroyWindowSurface` was introduced in SDL 2.28 This should take care of most of the `BlitPixel`, `DrawRLESpriteMinify` issues reported by backtrace.
- Loading branch information