diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 3a9385d85..486cc57f8 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3822,7 +3822,7 @@ static void CL_InitGLimp_Cvars( void ) // shared with renderer: cl_stencilbits = Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH ); Cvar_CheckRange( cl_stencilbits, "0", "8", CV_INTEGER ); - Cvar_SetDescription( cl_stencilbits, "Stencil buffer size, value decreases Z-buffer depth." ); + Cvar_SetDescription( cl_stencilbits, "Stencil buffer size, required to be 8 for stencil shadows." ); cl_depthbits = Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE_ND | CVAR_LATCH ); Cvar_CheckRange( cl_depthbits, "0", "32", CV_INTEGER ); Cvar_SetDescription( cl_depthbits, "Sets precision of Z-buffer." ); diff --git a/code/qcommon/cmd.c b/code/qcommon/cmd.c index f111ee1f1..c5a04222b 100644 --- a/code/qcommon/cmd.c +++ b/code/qcommon/cmd.c @@ -255,6 +255,8 @@ void Cbuf_Execute( void ) { char line[MAX_CMD_LINE], *text; int i, n, quotes; + qboolean in_star_comment; + qboolean in_slash_comment; if ( cmd_wait > 0 ) { // delay command buffer execution @@ -265,8 +267,8 @@ void Cbuf_Execute( void ) // This will keep // style comments all on one line by not breaking on // a semicolon. It will keep /* ... */ style comments all on one line by not // breaking it for semicolon or newline. - qboolean in_star_comment = qfalse; - qboolean in_slash_comment = qfalse; + in_star_comment = qfalse; + in_slash_comment = qfalse; while ( cmd_text.cursize > 0 ) { diff --git a/code/renderer/tr_arb.c b/code/renderer/tr_arb.c index 469ff2aad..9ebf36c8b 100644 --- a/code/renderer/tr_arb.c +++ b/code/renderer/tr_arb.c @@ -1110,7 +1110,7 @@ void FBO_Clean( frameBuffer_t *fb ) fb->depthStencil = 0; } #else - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0 ); else qglFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0 ); @@ -1165,7 +1165,7 @@ static GLuint FBO_CreateDepthTextureOrBuffer( GLsizei width, GLsizei height ) GLuint buffer; qglGenRenderbuffers( 1, &buffer ); qglBindRenderbuffer( GL_RENDERBUFFER, buffer ); - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT32, width, height ); else qglRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height ); @@ -1176,7 +1176,7 @@ static GLuint FBO_CreateDepthTextureOrBuffer( GLsizei width, GLsizei height ) GL_BindTexture( 0, tex ); qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL ); else qglTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, width, height, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL ); @@ -1336,12 +1336,12 @@ static qboolean FBO_Create( frameBuffer_t *fb, GLsizei width, GLsizei height, qb fb->depthStencil = FBO_CreateDepthTextureOrBuffer( width, height ); #endif #ifdef DEPTH_RENDER_BUFFER - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fb->depthStencil ); else qglFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->depthStencil ); #else - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, fb->depthStencil, 0 ); else qglFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, fb->depthStencil, 0 ); @@ -1413,7 +1413,7 @@ static qboolean FBO_CreateMS( frameBuffer_t *fb, int width, int height ) qglGenRenderbuffers( 1, &fb->depthStencil ); qglBindRenderbuffer( GL_RENDERBUFFER, fb->depthStencil ); - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglRenderbufferStorageMultisample( GL_RENDERBUFFER, nSamples, GL_DEPTH_COMPONENT32, width, height ); else qglRenderbufferStorageMultisample( GL_RENDERBUFFER, nSamples, GL_DEPTH24_STENCIL8, width, height ); @@ -1424,7 +1424,7 @@ static qboolean FBO_CreateMS( frameBuffer_t *fb, int width, int height ) return qfalse; } - if ( r_stencilbits->integer == 0 ) + if ( glConfig.stencilBits == 0 ) qglFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fb->depthStencil ); else qglFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->depthStencil ); diff --git a/code/renderer/tr_common.h b/code/renderer/tr_common.h index 63479ca3d..a7a327219 100644 --- a/code/renderer/tr_common.h +++ b/code/renderer/tr_common.h @@ -70,7 +70,7 @@ extern int gl_version; // // cvars // -extern cvar_t *r_stencilbits; // number of desired stencil bits +//extern cvar_t *r_stencilbits; // number of desired stencil bits extern cvar_t *r_texturebits; // number of desired texture bits // 0 = use framebuffer depth // 16 = use 16-bit textures diff --git a/code/renderer/tr_image.c b/code/renderer/tr_image.c index e7b776fb2..267696a49 100644 --- a/code/renderer/tr_image.c +++ b/code/renderer/tr_image.c @@ -46,11 +46,11 @@ return a hash value for the filename */ void R_GammaCorrect( byte *buffer, int bufSize ) { int i; -#ifdef USE_FBO +#ifdef USE_FBO if ( fboEnabled ) { return; } -#endif +#endif if ( !gls.deviceSupportsGamma ) { return; } @@ -304,11 +304,11 @@ static void R_LightScaleTexture( byte *in, int inwidth, int inheight, qboolean o if ( only_gamma ) { -#ifdef USE_FBO +#ifdef USE_FBO if ( !glConfig.deviceSupportsGamma && !fboEnabled ) -#else - if ( !glConfig.deviceSupportsGamma ) -#endif +#else + if ( !glConfig.deviceSupportsGamma ) +#endif { int i, c; byte *p; @@ -333,10 +333,10 @@ static void R_LightScaleTexture( byte *in, int inwidth, int inheight, qboolean o c = inwidth*inheight; -#ifdef USE_FBO - if ( glConfig.deviceSupportsGamma || fboEnabled ) -#else - if ( glConfig.deviceSupportsGamma ) +#ifdef USE_FBO + if ( glConfig.deviceSupportsGamma || fboEnabled ) +#else + if ( glConfig.deviceSupportsGamma ) #endif { for (i=0 ; iinteger ); // never overbright in windowed mode -#ifdef USE_FBO +#ifdef USE_FBO if ( !glConfig.isFullscreen && r_overBrightBits->integer >= 0 && !fboEnabled ) { -#else +#else if ( !glConfig.isFullscreen && r_overBrightBits->integer >= 0 ) { -#endif +#endif tr.overbrightBits = 0; applyGamma = qfalse; } else { @@ -1442,11 +1442,11 @@ void R_SetColorMappings( void ) { } if ( gls.deviceSupportsGamma ) { -#ifdef USE_FBO +#ifdef USE_FBO if ( fboEnabled ) ri.GLimp_SetGamma( s_gammatable_linear, s_gammatable_linear, s_gammatable_linear ); else -#endif +#endif { if ( applyGamma ) { ri.GLimp_SetGamma( s_gammatable, s_gammatable, s_gammatable ); diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c index e72977965..1bc6dd546 100644 --- a/code/renderer/tr_init.c +++ b/code/renderer/tr_init.c @@ -124,7 +124,7 @@ cvar_t *r_ext_max_anisotropy; cvar_t *r_ignoreGLErrors; -cvar_t *r_stencilbits; +//cvar_t *r_stencilbits; cvar_t *r_texturebits; #ifdef USE_FBO @@ -1759,8 +1759,7 @@ static void R_Register( void ) ri.Cvar_CheckRange( r_ext_max_anisotropy, "1", NULL, CV_INTEGER ); ri.Cvar_SetDescription( r_ext_max_anisotropy, "Sets maximum anisotropic level for your graphics driver. Requires \\r_ext_texture_filter_anisotropic." ); - r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH ); - ri.Cvar_SetDescription( r_stencilbits, "Stencil buffer size, value decreases Z-buffer depth." ); + //r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH ); r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE_ND | CVAR_LATCH ); ri.Cvar_CheckRange( r_ignorehwgamma, "0", "1", CV_INTEGER ); ri.Cvar_SetDescription( r_ignorehwgamma, "Overrides hardware gamma capabilities." ); diff --git a/code/renderer2/tr_init.c b/code/renderer2/tr_init.c index 4579f3bf4..f04a8a9ed 100644 --- a/code/renderer2/tr_init.c +++ b/code/renderer2/tr_init.c @@ -157,7 +157,7 @@ cvar_t *r_ignoreDstAlpha; cvar_t *r_ignoreGLErrors; cvar_t *r_logFile; -cvar_t *r_stencilbits; +//cvar_t *r_stencilbits; cvar_t *r_texturebits; cvar_t *r_ext_multisample; @@ -1140,8 +1140,7 @@ static void R_Register( void ) ri.Cvar_SetDescription( r_detailTextures, "Enables usage of shader stages flagged as detail." ); r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH ); ri.Cvar_SetDescription( r_texturebits, "Number of texture bits per texture." ); - r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE | CVAR_LATCH ); - ri.Cvar_SetDescription( r_stencilbits, "Stencil buffer size, value decreases Z-buffer depth." ); +// r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE | CVAR_LATCH ); r_ext_multisample = ri.Cvar_Get( "r_ext_multisample", "0", CVAR_ARCHIVE | CVAR_LATCH ); ri.Cvar_CheckRange( r_ext_multisample, "0", "8", CV_INTEGER ); ri.Cvar_SetDescription( r_ext_multisample, "For anti-aliasing geometry edges." ); diff --git a/code/renderervk/tr_common.h b/code/renderervk/tr_common.h index cb2157ae4..fb44f19f0 100644 --- a/code/renderervk/tr_common.h +++ b/code/renderervk/tr_common.h @@ -71,7 +71,7 @@ extern int maxAnisotropy; // // cvars // -extern cvar_t *r_stencilbits; // number of desired stencil bits +//extern cvar_t *r_stencilbits; // number of desired stencil bits extern cvar_t *r_texturebits; // number of desired texture bits // 0 = use framebuffer depth // 16 = use 16-bit textures diff --git a/code/renderervk/tr_init.c b/code/renderervk/tr_init.c index f5a1dfae7..874628121 100644 --- a/code/renderervk/tr_init.c +++ b/code/renderervk/tr_init.c @@ -121,7 +121,7 @@ cvar_t *r_ext_max_anisotropy; cvar_t *r_ignoreGLErrors; -cvar_t *r_stencilbits; +//cvar_t *r_stencilbits; cvar_t *r_texturebits; cvar_t *r_ext_multisample; cvar_t *r_ext_alpha_to_coverage; @@ -1762,10 +1762,7 @@ static void R_Register( void ) ri.Cvar_CheckRange( r_ext_max_anisotropy, "1", NULL, CV_INTEGER ); ri.Cvar_SetDescription( r_ext_max_anisotropy, "Sets maximum anisotropic level for your graphics driver. Requires \\r_ext_texture_filter_anisotropic." ); - r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH ); - ri.Cvar_CheckRange( r_stencilbits, "0", "8", CV_INTEGER ); - ri.Cvar_SetDescription( r_stencilbits, "Stencil buffer size, value decreases Z-buffer depth." ); - + //r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND | CVAR_LATCH ); r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE_ND | CVAR_LATCH ); ri.Cvar_CheckRange( r_ignorehwgamma, "0", "1", CV_INTEGER ); ri.Cvar_SetDescription( r_ignorehwgamma, "Overrides hardware gamma capabilities." ); diff --git a/code/renderervk/vk.c b/code/renderervk/vk.c index cdc478ff3..31ca3b0fe 100644 --- a/code/renderervk/vk.c +++ b/code/renderervk/vk.c @@ -677,10 +677,10 @@ static void vk_create_render_passes( void ) attachments[1].format = depth_format; attachments[1].samples = vkSamples; attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; // Need empty depth buffer before use - attachments[1].stencilLoadOp = r_stencilbits->integer ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE; + attachments[1].stencilLoadOp = glConfig.stencilBits ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE; if ( r_bloom->integer ) { attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE; // keep it for post-bloom pass - attachments[1].stencilStoreOp = r_stencilbits->integer ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE; + attachments[1].stencilStoreOp = glConfig.stencilBits ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE; } else { attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; @@ -1247,15 +1247,14 @@ static VkFormat get_depth_format( VkPhysicalDevice physical_device ) { VkFormat formats[2]; int i; - if (r_stencilbits->integer > 0) { + if ( glConfig.stencilBits > 0 ) { formats[0] = glConfig.depthBits == 16 ? VK_FORMAT_D16_UNORM_S8_UINT : VK_FORMAT_D24_UNORM_S8_UINT; formats[1] = VK_FORMAT_D32_SFLOAT_S8_UINT; - glConfig.stencilBits = 8; } else { formats[0] = glConfig.depthBits == 16 ? VK_FORMAT_D16_UNORM : VK_FORMAT_X8_D24_UNORM_PACK32; formats[1] = VK_FORMAT_D32_SFLOAT; - glConfig.stencilBits = 0; } + for ( i = 0; i < ARRAY_LEN( formats ); i++ ) { qvkGetPhysicalDeviceFormatProperties( physical_device, formats[i], &props ); if ( ( props.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT ) != 0 ) { @@ -3228,7 +3227,7 @@ static void create_depth_attachment( uint32_t width, uint32_t height, VkSampleCo create_desc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; image_aspect_flags = VK_IMAGE_ASPECT_DEPTH_BIT; - if ( r_stencilbits->integer ) + if ( glConfig.stencilBits > 0 ) image_aspect_flags |= VK_IMAGE_ASPECT_STENCIL_BIT; VK_CHECK( qvkCreateImage( vk.device, &create_desc, NULL, image ) ); @@ -6383,7 +6382,7 @@ void vk_clear_depth( qboolean clear_stencil ) { attachment.clearValue.depthStencil.depth = 1.0f; #endif attachment.clearValue.depthStencil.stencil = 0; - if ( clear_stencil && r_stencilbits->integer ) { + if ( clear_stencil && glConfig.stencilBits > 0 ) { attachment.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; } else { attachment.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; diff --git a/code/renderervk/vk.h b/code/renderervk/vk.h index 780772edd..bc7a9cca1 100644 --- a/code/renderervk/vk.h +++ b/code/renderervk/vk.h @@ -14,7 +14,7 @@ #define VERTEX_BUFFER_SIZE (4 * 1024 * 1024) #define IMAGE_CHUNK_SIZE (32 * 1024 * 1024) -#define MAX_IMAGE_CHUNKS 48 +#define MAX_IMAGE_CHUNKS 56 #define NUM_COMMAND_BUFFERS 2 // number of command buffers / render semaphores / framebuffer sets diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 1dbe36768..e9324a8dd 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -348,17 +348,11 @@ static int GLW_SetMode( int mode, const char *modeFS, qboolean fullscreen, qbool { // reduce depthBits if (testDepthBits == 24) testDepthBits = 16; - else if (testDepthBits == 16) - testDepthBits = 8; } if ((i % 4) == 1) { // reduce stencilBits - if (testStencilBits == 24) - testStencilBits = 16; - else if (testStencilBits == 16) - testStencilBits = 8; - else + if (testStencilBits == 8) testStencilBits = 0; } diff --git a/code/unix/linux_glimp.c b/code/unix/linux_glimp.c index 012f3f6f9..6de9fbbea 100644 --- a/code/unix/linux_glimp.c +++ b/code/unix/linux_glimp.c @@ -1296,21 +1296,23 @@ static rserr_t GLW_StartDriverAndSetMode( int mode, const char *modeFS, qboolean static XVisualInfo *GL_SelectVisual( int colorbits, int depthbits, int stencilbits, glconfig_t *config ) { // these match in the array - #define ATTR_RED_IDX 2 - #define ATTR_GREEN_IDX 4 - #define ATTR_BLUE_IDX 6 - #define ATTR_DEPTH_IDX 9 - #define ATTR_STENCIL_IDX 11 + #define ATTR_RED_IDX 3 + #define ATTR_GREEN_IDX 5 + #define ATTR_BLUE_IDX 7 + #define ATTR_ALPHA_IDX 9 + #define ATTR_DEPTH_IDX 11 + #define ATTR_STENCIL_IDX 13 static int attrib[] = { - GLX_RGBA, // 0 - GLX_RED_SIZE, 4, // 1, 2 - GLX_GREEN_SIZE, 4, // 3, 4 - GLX_BLUE_SIZE, 4, // 5, 6 - GLX_DOUBLEBUFFER, // 7 - GLX_DEPTH_SIZE, 1, // 8, 9 - GLX_STENCIL_SIZE, 1, // 10, 11 + GLX_RGBA, // 0 + GLX_DOUBLEBUFFER, // 1 + GLX_RED_SIZE, 8, // 2, 3 + GLX_GREEN_SIZE, 8, // 4, 5 + GLX_BLUE_SIZE, 8, // 6, 7 + GLX_ALPHA_SIZE, 8, // 8, 9 + GLX_DEPTH_SIZE, 24, // 10, 11 + GLX_STENCIL_SIZE, 8, // 12, 13 None }; @@ -1335,13 +1337,9 @@ static XVisualInfo *GL_SelectVisual( int colorbits, int depthbits, int stencilbi case 1 : if ( depthbits == 24 ) depthbits = 16; - else if ( depthbits == 16 ) - depthbits = 8; case 3 : - if ( stencilbits == 24 ) - stencilbits = 16; - else if ( stencilbits == 16 ) - stencilbits = 8; + if ( stencilbits == 8 ) + stencilbits = 0; } } @@ -1359,17 +1357,11 @@ static XVisualInfo *GL_SelectVisual( int colorbits, int depthbits, int stencilbi { // reduce depthbits if ( tdepthbits == 24 ) tdepthbits = 16; - else if ( tdepthbits == 16 ) - tdepthbits = 8; } if ((i % 4) == 1) { // reduce stencilbits - if ( tstencilbits == 24 ) - tstencilbits = 16; - else if ( tstencilbits == 16 ) - tstencilbits = 8; - else + if ( tstencilbits == 8 ) tstencilbits = 0; } @@ -1378,6 +1370,7 @@ static XVisualInfo *GL_SelectVisual( int colorbits, int depthbits, int stencilbi attrib[ATTR_RED_IDX] = 8; attrib[ATTR_GREEN_IDX] = 8; attrib[ATTR_BLUE_IDX] = 8; + attrib[ATTR_ALPHA_IDX] = 8; } else { @@ -1385,6 +1378,7 @@ static XVisualInfo *GL_SelectVisual( int colorbits, int depthbits, int stencilbi attrib[ATTR_RED_IDX] = 4; attrib[ATTR_GREEN_IDX] = 4; attrib[ATTR_BLUE_IDX] = 4; + attrib[ATTR_ALPHA_IDX] = 0; // prefer smallest available alpha } attrib[ATTR_DEPTH_IDX] = tdepthbits; // default to 24 depth diff --git a/code/win32/win_glimp.c b/code/win32/win_glimp.c index 9de15120f..4c25c06c9 100644 --- a/code/win32/win_glimp.c +++ b/code/win32/win_glimp.c @@ -151,7 +151,7 @@ static int GLW_ChoosePFD( HDC hDC, PIXELFORMATDESCRIPTOR *pPFD ) pfds = Z_Malloc( ( maxPFD + 1 ) * sizeof( PIXELFORMATDESCRIPTOR ) ); - Com_Printf( "...%d PFDs found\n", maxPFD - 1 ); + Com_Printf( "...%d PFDs found\n", maxPFD ); // grab information for ( i = 1; i <= maxPFD; i++ ) @@ -392,8 +392,6 @@ static void GLW_CreatePFD( PIXELFORMATDESCRIPTOR *pPFD, int colorbits, int depth */ static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD ) { - int pixelformat; - // // don't putz around with pixelformat if it's already set (e.g. this is a soft // reset of the graphics system) @@ -405,7 +403,8 @@ static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD ) // using a minidriver then we need to bypass the GDI functions, // otherwise use the GDI functions. // - if ( ( pixelformat = GLW_ChoosePFD( glw_state.hDC, pPFD ) ) == 0 ) + int pixelformat = GLW_ChoosePFD( glw_state.hDC, pPFD ); + if ( pixelformat == 0 ) { Com_Printf( "...GLW_ChoosePFD failed\n" ); return TRY_PFD_FAIL_SOFT; @@ -498,8 +497,7 @@ static qboolean GLW_InitOpenGLDriver( int colorbits ) // do not allow stencil if Z-buffer depth likely won't contain it // stencilbits = cl_stencilbits->integer; - if ( depthbits < 24 ) - { + if ( depthbits < 16 ) { // was < 24 before, some win9X drivers have 16/8 depth/stencil buffers stencilbits = 0; } @@ -571,7 +569,7 @@ static qboolean GLW_InitOpenGLDriver( int colorbits ) ** store PFD specifics */ - glw_state.config->colorBits = ( int ) pfd.cColorBits; + glw_state.config->colorBits = ( int ) pfd.cRedBits + ( int ) pfd.cGreenBits + ( int ) pfd.cBlueBits; glw_state.config->depthBits = ( int ) pfd.cDepthBits; glw_state.config->stencilBits = ( int ) pfd.cStencilBits; @@ -1213,7 +1211,7 @@ static rserr_t GLW_SetMode( int mode, const char *modeFS, int colorbits, qboolea // NOTE: this is overridden later on standalone 3Dfx drivers glw_state.config->isFullscreen = cdsFullscreen; - glw_state.config->colorBits = dm.dmBitsPerPel; + //glw_state.config->colorBits = dm.dmBitsPerPel; return RSERR_OK; }