R_Clear: clear stencil buffer together with depth buffer if we have one.

mh suggest that not doing this may cause performance
issues: http://forums.inside3d.com/viewtopic.php?t=2408
It's also mentioned in a "Depth In-Depth" document from AMD.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1203 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
ewasylishen 2015-04-16 23:57:45 +00:00
parent 4aad7272bc
commit fce5c733c0
3 changed files with 10 additions and 0 deletions

View file

@ -489,6 +489,9 @@ void R_Clear (void)
unsigned int clearbits;
clearbits = GL_DEPTH_BUFFER_BIT;
// from mh -- if we get a stencil buffer, we should clear it, even though we don't use it
if (gl_stencilbits)
clearbits |= GL_STENCIL_BUFFER_BIT;
if (gl_clear.value)
clearbits |= GL_COLOR_BUFFER_BIT;
glClear (clearbits);

View file

@ -104,6 +104,7 @@ qboolean gl_glsl_able = false; //ericw
GLint gl_max_texture_units = 0; //ericw
qboolean gl_glsl_gamma_able = false; //ericw
qboolean gl_glsl_alias_able = false; //ericw
int gl_stencilbits;
PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz
PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz
@ -651,6 +652,10 @@ static qboolean VID_SetMode (int width, int height, int bpp, qboolean fullscreen
if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &fsaa_obtained) == -1)
fsaa_obtained = 0;
// read stencil bits
if (SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &gl_stencilbits) == -1)
gl_stencilbits = 0;
modestate = VID_GetFullscreen() ? MS_FULLSCREEN : MS_WINDOWED;
CDAudio_Resume ();

View file

@ -148,6 +148,8 @@ extern cvar_t gl_playermip;
extern cvar_t gl_subdivide_size;
extern float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
extern int gl_stencilbits;
// Multitexture
extern qboolean mtexenabled;
extern qboolean gl_mtexable;