Simplification and cleanup of windows opengl initialization.

Removed r_colorbits, use desktop color depth as default value. Nevertheless if there are issues when looking
for corresponding pixel format it is still posible to obtain pixel format with color depth that is different
from desktop color.
No changes to game modules, which means that game UI can still set r_colorbits but it has no effect.
This commit is contained in:
Artem Kharytoniuk 2017-03-20 10:28:21 +02:00
parent a16c11adf6
commit 1b78b53bea
9 changed files with 241 additions and 873 deletions

4
changelog.md Normal file
View File

@ -0,0 +1,4 @@
Removed cvars:
* r_colorbits (use desktop color depth by default)
* r_maskMinidriver
* r_allowSoftwareGL

View File

@ -178,12 +178,12 @@ typedef struct {
// <artem>
// Obsolete. Should be here for compatibility with other mods.
glDriverType_t driverType;
glDriverType_t UNUSED_driverType;
// </artem>
// <artem>
// Obsolete. Should be here for compatibility with other mods.
glHardwareType_t hardwareType;
glHardwareType_t UNUSED_hardwareType;
// </artem>
qboolean deviceSupportsGamma;
@ -198,7 +198,7 @@ typedef struct {
// <artem>
// Obsolete. Should be here for compatibility with other mods.
int displayFrequency;
int UNUSED_displayFrequency;
// </artem>
// synonymous with "does rendering consume the entire screen?", therefore

View File

@ -52,7 +52,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_VIDEO_HANDLES 16
extern glconfig_t glConfig;
extern int s_paintedtime;
extern int s_rawend;

View File

@ -35,14 +35,11 @@ typedef struct
HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library
qboolean allowdisplaydepthchange;
qboolean pixelFormatSet;
int desktopBitsPixel;
int desktopWidth, desktopHeight;
qboolean cdsFullscreen;
FILE *log_fp;
} glwstate_t;

File diff suppressed because it is too large Load Diff

View File

@ -3192,25 +3192,10 @@ void QGL_Shutdown( void )
*/
qboolean QGL_Init( const char *dllname )
{
char systemDir[1024];
char libName[1024];
GetSystemDirectory( systemDir, sizeof( systemDir ) );
assert( glw_state.hinstOpenGL == 0 );
ri.Printf( PRINT_ALL, "...initializing QGL\n" );
if ( dllname[0] != '!' )
{
Com_sprintf( libName, sizeof( libName ), "%s\\%s", systemDir, dllname );
}
else
{
Q_strncpyz( libName, dllname, sizeof( libName ) );
}
ri.Printf( PRINT_ALL, "...calling LoadLibrary( '%s.dll' ): ", libName );
ri.Printf( PRINT_ALL, "...calling LoadLibrary('%s'): ", dllname );
if ( ( glw_state.hinstOpenGL = LoadLibrary( dllname ) ) == 0 )
{

View File

@ -38,45 +38,6 @@ extern cvar_t *r_fullscreen;
LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static qboolean s_alttab_disabled;
static void WIN_DisableAltTab( void )
{
if ( s_alttab_disabled )
return;
if ( !Q_stricmp( Cvar_VariableString( "arch" ), "winnt" ) )
{
RegisterHotKey( 0, 0, MOD_ALT, VK_TAB );
}
else
{
BOOL old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0 );
}
s_alttab_disabled = qtrue;
}
static void WIN_EnableAltTab( void )
{
if ( s_alttab_disabled )
{
if ( !Q_stricmp( Cvar_VariableString( "arch" ), "winnt" ) )
{
UnregisterHotKey( 0, 0 );
}
else
{
BOOL old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, &old, 0 );
}
s_alttab_disabled = qfalse;
}
}
/*
==================
VID_AppActivate
@ -287,15 +248,6 @@ LONG WINAPI MainWndProc (
vid_ypos = Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE);
r_fullscreen = Cvar_Get ("r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH );
if ( r_fullscreen->integer )
{
WIN_DisableAltTab();
}
else
{
WIN_EnableAltTab();
}
break;
#if 0
case WM_DISPLAYCHANGE:
@ -314,10 +266,6 @@ LONG WINAPI MainWndProc (
case WM_DESTROY:
// let sound and input know about this?
g_wv.hWnd = NULL;
if ( r_fullscreen->integer )
{
WIN_EnableAltTab();
}
break;
case WM_CLOSE:

View File

@ -86,7 +86,6 @@ cvar_t *r_logFile;
cvar_t *r_stencilbits;
cvar_t *r_depthbits;
cvar_t *r_colorbits;
cvar_t *r_stereo;
cvar_t *r_primitives;
cvar_t *r_texturebits;
@ -189,8 +188,6 @@ static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qboolean sh
*/
static void InitOpenGL( void )
{
char renderer_buffer[1024];
//
// initialize OS specific portions of the renderer
//
@ -198,21 +195,16 @@ static void InitOpenGL( void )
// - r_fullscreen
// - r_glDriver
// - r_mode
// - r_(color|depth|stencil)bits
// - r_(depth|stencil)bits
// - r_ignorehwgamma
// - r_gamma
//
if ( glConfig.vidWidth == 0 )
{
GLint temp;
GLimp_Init();
strcpy( renderer_buffer, glConfig.renderer_string );
Q_strlwr( renderer_buffer );
// OpenGL driver constants
GLint temp;
qglGetIntegerv( GL_MAX_TEXTURE_SIZE, &temp );
glConfig.maxTextureSize = temp;
@ -859,7 +851,6 @@ void R_Register( void )
AssertCvarRange( r_picmip, 0, 16, qtrue );
r_detailTextures = ri.Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_colorbits = ri.Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_stereo = ri.Cvar_Get( "r_stereo", "0", CVAR_ARCHIVE | CVAR_LATCH );
#ifdef __linux__
r_stencilbits = ri.Cvar_Get( "r_stencilbits", "0", CVAR_ARCHIVE | CVAR_LATCH );

View File

@ -987,7 +987,6 @@ extern cvar_t *r_znear; // near Z clip plane
extern cvar_t *r_stencilbits; // number of desired stencil bits
extern cvar_t *r_depthbits; // number of desired depth bits
extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen
extern cvar_t *r_stereo; // desired pixelformat stereo flag
extern cvar_t *r_texturebits; // number of desired texture bits
// 0 = use framebuffer depth