Use at least 16bit for Depth-Buffer (fixes #37)

Seems like on Windows 0 bits is handled as "Let Windows/Driver decide",
so handle that case by setting a reasonable value of 16.
This commit is contained in:
Daniel Gibson 2016-04-24 16:06:57 +02:00
parent 40213b3e03
commit 8106aedd9f

View File

@ -95,11 +95,7 @@ BOOL CGfxLibrary::SetupPixelFormat_OGL( HDC hdc, BOOL bReport/*=FALSE*/)
// clamp depth/stencil values // clamp depth/stencil values
extern INDEX gap_iDepthBits; extern INDEX gap_iDepthBits;
extern INDEX gap_iStencilBits; extern INDEX gap_iStencilBits;
if( gap_iDepthBits <12) { if( gap_iDepthBits <22) gap_iDepthBits = 16; // this includes 0; 16 is a safe default
ASSERT(gap_iDepthBits >= 12 && "Using gap_iDepthBits=0, that's probably bad?!");
gap_iDepthBits = 0;
}
else if( gap_iDepthBits <22) gap_iDepthBits = 16;
else if( gap_iDepthBits <28) gap_iDepthBits = 24; else if( gap_iDepthBits <28) gap_iDepthBits = 24;
else gap_iDepthBits = 32; else gap_iDepthBits = 32;
if( gap_iStencilBits<3) gap_iStencilBits = 0; if( gap_iStencilBits<3) gap_iStencilBits = 0;