Set correct number of depth bits and stencil bits for frame buffer format info.

This commit is contained in:
aignacio_sf 2006-10-13 20:17:53 +00:00
parent cc0853e021
commit ba5ff66beb
1 changed files with 37 additions and 5 deletions

View File

@ -710,12 +710,44 @@ create_screen_buffers_and_device(DXScreenData &display, bool force_16bpp_zbuffer
PRINT_REFCNT(wdxdisplay8, _wcontext._d3d_device);
if (presentation_params->EnableAutoDepthStencil) {
_fb_properties.set_depth_bits(1);
if (IS_STENCIL_FORMAT(presentation_params->AutoDepthStencilFormat)) {
_fb_properties.set_stencil_bits(1);
} else {
_fb_properties.set_stencil_bits(0);
int depth_bits;
int stencil_bits;
depth_bits = 1;
stencil_bits = 0;
switch (presentation_params->AutoDepthStencilFormat)
{
case D3DFMT_D16_LOCKABLE:
depth_bits = 16;
break;
case D3DFMT_D32:
depth_bits = 32;
break;
case D3DFMT_D15S1:
depth_bits = 15;
stencil_bits = 1;
break;
case D3DFMT_D24S8:
depth_bits = 24;
stencil_bits = 8;
break;
case D3DFMT_D24X8:
depth_bits = 24;
break;
case D3DFMT_D24X4S4:
depth_bits = 24;
stencil_bits = 4;
break;
case D3DFMT_D16:
depth_bits = 16;
break;
default:
wdxdisplay8_cat.error() << "unknown depth stencil format " << presentation_params->AutoDepthStencilFormat;
break;
}
_fb_properties.set_stencil_bits(stencil_bits);
_fb_properties.set_depth_bits(depth_bits);
} else {
_fb_properties.set_depth_bits(0);
_fb_properties.set_stencil_bits(0);