- Continuing sdlmain.cpp output code cleanup

- Move OpenGL output code from sdlmain.cpp to separate .cpp/.h
- Move sdl_opengl structure out of sdl structure, move some 'global' OpenGL related variables to it
- Generalize fallback to surface output in mode selection / sizing code (retFlags = 0 means we could not choose a mode and need to fallback), no weird goto anymore, log if even surface output routine returned zero
- OpenGL/D3D routines changed sdl.desktop.type individually. Now we set it to actual sdl.desktop.want_type value after fallbacks are processed (want_type is filled by OUTPUT_*_Select)
- Add OUTPUT_*_Initialize() routines to allow

- Small part of Direct3D related code moved out as well in preparation for next step (moving Direct3D output code out)

- TODO: Many supplementary OpenGL related code remains in sdlmain.cpp, needs to be assessed and moved out as well
This commit is contained in:
Alex/AT
2018-06-30 20:18:39 +03:00
parent 2392a20e54
commit 8f4ff8aa59
16 changed files with 845 additions and 649 deletions

View File

@@ -1,4 +1,6 @@
#include "dosbox.h"
#include "control.h"
#include "menu.h"
#include "mouse.h"
#include "render.h"
@@ -79,20 +81,6 @@ struct SDL_Block {
SCREEN_TYPES type;
SCREEN_TYPES want_type;
} desktop;
#if C_OPENGL
struct {
Bitu pitch;
void * framebuf;
GLuint buffer;
GLuint texture;
GLuint displaylist;
GLint max_texsize;
bool bilinear;
bool packed_pixel;
bool paletted_texture;
bool pixel_buffer_object;
} opengl;
#endif
struct {
SDL_Surface * surface;
#if (HAVE_DDRAW_H) && defined(WIN32)
@@ -165,10 +153,13 @@ extern Bitu userResizeWindowHeight;
extern Bitu currentWindowWidth;
extern Bitu currentWindowHeight;
void GFX_SetIcon(void);
void GFX_SDL_Overscan(void);
void GFX_DrawSDLMenu(DOSBoxMenu &menu, DOSBoxMenu::displaylist &dl);
void GFX_LogSDLState(void);
void GFX_SDL_Overscan(void);
void GFX_SetIcon(void);
void SDL_rect_cliptoscreen(SDL_Rect &r);
void UpdateWindowDimensions(void);
void UpdateWindowDimensions(Bitu width, Bitu height);
#if defined(C_SDL2)
SDL_Window* GFX_SetSDLWindowMode(Bit16u width, Bit16u height, SCREEN_TYPES screenType);