-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdl_glimp,tr_init: rewrite the original GL selection code, improve gf…
…xinfo This commit squashes multiple commits by illwieckz and slipher. See #478 Co-authored-by: Thomas “illwieckz” Debesse <[email protected]> Co-authored-by: slipher <[email protected]> == Squashed commits by illwieckz :: sdl_glimp: rewrite the original GL selection code - Detect best configuration possible. - Try custom configuration if exists. - If no custom configuration or if it fails, load the recommended configuration if possible (OpenGL 3.2 core) or the best one available. - Reuse window and context when possible. - Display meaningful popup telling user OpenGL version is too low or required extensions are missing when that happens. - Rely on more return codes for GLimp_SetMode(). - Test for negative SDL_Init return value, not just -1. :: sdl_glimp,tr_init: do not test all OpenGL versions unless r_glExtendedValidation is set When r_glExtendedValidation is enabled, the engine tests if OpenGL versions higher than 3.2 core are supported for logging and diagnostic purpose, but still requestes 3.2 core anyway. Some drivers may provide more than 3.2 when requesting 3.2, this is not our fault. :: sdl_glimp,tr_init: rewrite logging, improve gfxinfo - Move GL query for logging purpose from tr_init to sdl_glimp. - Do not split MODE log message. - Unify some log. - Add more debug log when building GL extension list. - Also increase the extensions_string length to not truncate the string, 4096 is not enough, there can be more than 6000 characters on an OpenGL 4.6 driver. - Also log missing extensions to make gfxinfo more useful. - Rewrite gfxinfo in more useful way. - List enabled and missing GL extensions. :: sdl_glimp: silence the GL error when querying if context is core on non-core implementation - Silence the error that may happen when querying if the OpenGL context uses core profile when core profile is not supported by the OpenGL implementation to begin with. For example this may happen on implementations not supporting higher than OpenGL 2.1, while forcing OpenGL 2.1 on implementations supporting higher versions including core profiles may not raise an error. :: sdl_glimp: make GLimp_StartDriverAndSetMode only return true on RSERR_OK - Only return true on OK, don't return true on unknown errors. :: sdl_glimp: catch errors from GLimp_DetectAvailableModes to prevent further segfault It may be possible to create a valid context that is unusable. For example the 3840×2160 resolution is too large for the Radeon 9700 and the Mesa r300 driver may print this error when the requested resolution is higher than what is supported by hardware: > r300: Implementation error: Render targets are too big in r300_set_framebuffer_state, refusing to bind framebuffer state! It will unfortunately return a valid but unusable context that will make the engine segfault when calling GL_SetDefaultState(). :: sdl_glimp: flag fullscreen window as borderless when borderless is enabled Flag fullscreen window as borderless when borderless is enabled otherwise the window will be bordered when leaving fullscreen while the borderless option would be enabled. :: sdl_glimp,tr_init: remove unused depthBits :: sdl_glimp: remove SDL_INIT_NOPARACHUTE In GLimp_StartDriverAndSetMod() the SDL_INIT_NOPARACHUTE flag was removed from SDL_Init( SDL_INIT_VIDEO ) as this flag is now ignored, see https://wiki.libsdl.org/SDL_Init == Squashed commits by slipher :: Better type safety in GL detection code :: Simplify GL_ValidateBestContext duplicate loop :: GLimp_SetMode - simplify error handling :: Rework GL initialization Have GLimp_ValidateBestContext() validate both the highest-numbered available context (if r_glExtendedValidation is enabled), and the highest context that we actually want to use (at most 3.2). This means most of the code in GLimp_ApplyPreferredOptions can be removed because it was duplicating the knowledge about version preferences and the code for instantiating them in GLimp_ValidateBestContext. :: Also cut down on other code duplication. :: Remove dead cvar r_stencilBits :: Fix glConfig.colorBits logging - show actual not requested - don't log it twice at notice level
- Loading branch information
Showing
7 changed files
with
1,026 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.