|
|
@ -158,8 +158,8 @@ void *SW_LockBuffer( void ) |
|
|
|
void *pixels; |
|
|
|
void *pixels; |
|
|
|
int stride; |
|
|
|
int stride; |
|
|
|
|
|
|
|
|
|
|
|
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) ) |
|
|
|
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) < 0 ) |
|
|
|
Sys_Error("%s", SDL_GetError()); |
|
|
|
Sys_Error( "%s: %s", __func__, SDL_GetError( )); |
|
|
|
return pixels; |
|
|
|
return pixels; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -272,7 +272,7 @@ static void R_InitVideoModes( void ) |
|
|
|
int j; |
|
|
|
int j; |
|
|
|
SDL_DisplayMode mode; |
|
|
|
SDL_DisplayMode mode; |
|
|
|
|
|
|
|
|
|
|
|
if( SDL_GetDisplayMode( displayIndex, i, &mode ) ) |
|
|
|
if( SDL_GetDisplayMode( displayIndex, i, &mode ) < 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Msg( "SDL_GetDisplayMode: %s\n", SDL_GetError() ); |
|
|
|
Msg( "SDL_GetDisplayMode: %s\n", SDL_GetError() ); |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -419,12 +419,16 @@ static qboolean WIN_SetWindowIcon( HICON ico ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_SysWMinfo wminfo; |
|
|
|
SDL_SysWMinfo wminfo; |
|
|
|
|
|
|
|
|
|
|
|
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo )) |
|
|
|
SDL_VERSION( &wminfo.version ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico ); |
|
|
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico ); |
|
|
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico ); |
|
|
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico ); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Con_Reportf( S_ERROR "%s: %s", __func__, SDL_GetError( )); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -492,8 +496,8 @@ void GL_UpdateSwapInterval( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ClearBits( gl_vsync.flags, FCVAR_CHANGED ); |
|
|
|
ClearBits( gl_vsync.flags, FCVAR_CHANGED ); |
|
|
|
|
|
|
|
|
|
|
|
if( SDL_GL_SetSwapInterval( gl_vsync.value ) ) |
|
|
|
if( SDL_GL_SetSwapInterval( gl_vsync.value ) < 0 ) |
|
|
|
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) ); |
|
|
|
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( )); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
|
|
|
} |
|
|
|
} |
|
|
@ -542,7 +546,7 @@ GL_UpdateContext |
|
|
|
static qboolean GL_UpdateContext( void ) |
|
|
|
static qboolean GL_UpdateContext( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context )) |
|
|
|
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ) < 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError()); |
|
|
|
Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError()); |
|
|
|
return GL_DeleteContext(); |
|
|
|
return GL_DeleteContext(); |
|
|
@ -599,7 +603,7 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi |
|
|
|
want.w = width; |
|
|
|
want.w = width; |
|
|
|
want.h = height; |
|
|
|
want.h = height; |
|
|
|
|
|
|
|
|
|
|
|
if( SDL_GetClosestDisplayMode( 0, &want, &got ) < 0 ) |
|
|
|
if( SDL_GetClosestDisplayMode( 0, &want, &got ) == NULL ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Printf( S_ERROR "%s: SDL_GetClosestDisplayMode: %s", __func__, SDL_GetError( )); |
|
|
|
Con_Printf( S_ERROR "%s: SDL_GetClosestDisplayMode: %s", __func__, SDL_GetError( )); |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -1047,7 +1051,7 @@ qboolean R_Init_Video( const int type ) |
|
|
|
// refdll can request some attributes
|
|
|
|
// refdll can request some attributes
|
|
|
|
GL_SetupAttributes( ); |
|
|
|
GL_SetupAttributes( ); |
|
|
|
|
|
|
|
|
|
|
|
if( SDL_GL_LoadLibrary( EGL_LIB ) ) |
|
|
|
if( SDL_GL_LoadLibrary( EGL_LIB ) < 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError()); |
|
|
|
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError()); |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -1086,7 +1090,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
SDL_DisplayMode displayMode; |
|
|
|
SDL_DisplayMode displayMode; |
|
|
|
|
|
|
|
|
|
|
|
SDL_GetCurrentDisplayMode( 0, &displayMode ); |
|
|
|
if( SDL_GetCurrentDisplayMode( 0, &displayMode ) < 0 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_ERROR "SDL_GetCurrentDisplayMode: %s", SDL_GetError( )); |
|
|
|
|
|
|
|
return rserr_invalid_mode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// check our desktop attributes
|
|
|
|
// check our desktop attributes
|
|
|
|
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format ); |
|
|
|
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format ); |
|
|
@ -1115,8 +1123,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod |
|
|
|
VID_RestoreScreenResolution(); |
|
|
|
VID_RestoreScreenResolution(); |
|
|
|
|
|
|
|
|
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
if( SDL_SetWindowFullscreen( host.hWnd, 0 )) |
|
|
|
if( SDL_SetWindowFullscreen( host.hWnd, 0 ) < 0 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_ERROR "SDL_SetWindowFullscreen: %s", SDL_GetError( )); |
|
|
|
return rserr_invalid_fullscreen; |
|
|
|
return rserr_invalid_fullscreen; |
|
|
|
|
|
|
|
} |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 5 ) |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 5 ) |
|
|
|
SDL_SetWindowResizable( host.hWnd, SDL_TRUE ); |
|
|
|
SDL_SetWindowResizable( host.hWnd, SDL_TRUE ); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|