Commit a4d0e89f authored by bitplane's avatar bitplane

Use floating point z-buffer in D3D9 driver if possible.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2283 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e0ef6c74
...@@ -303,6 +303,11 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -303,6 +303,11 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
// check stencil buffer compatibility // check stencil buffer compatibility
if (StencilBuffer) if (StencilBuffer)
{
present.AutoDepthStencilFormat = D3DFMT_D24FS8;
if(FAILED(pID3D->CheckDeviceFormat(adapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
present.AutoDepthStencilFormat = D3DFMT_D24S8; present.AutoDepthStencilFormat = D3DFMT_D24S8;
if(FAILED(pID3D->CheckDeviceFormat(adapter, devtype, if(FAILED(pID3D->CheckDeviceFormat(adapter, devtype,
...@@ -324,6 +329,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -324,6 +329,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
} }
} }
}
else else
if(FAILED(pID3D->CheckDepthStencilMatch(adapter, devtype, if(FAILED(pID3D->CheckDepthStencilMatch(adapter, devtype,
present.BackBufferFormat, present.BackBufferFormat, present.AutoDepthStencilFormat))) present.BackBufferFormat, present.BackBufferFormat, present.AutoDepthStencilFormat)))
...@@ -334,6 +340,11 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -334,6 +340,11 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
// do not use else here to cope with flag change in previous block // do not use else here to cope with flag change in previous block
if (!StencilBuffer) if (!StencilBuffer)
{
present.AutoDepthStencilFormat = D3DFMT_D32F_LOCKABLE;
if(FAILED(pID3D->CheckDeviceFormat(adapter, devtype,
present.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, present.AutoDepthStencilFormat)))
{ {
present.AutoDepthStencilFormat = D3DFMT_D32; present.AutoDepthStencilFormat = D3DFMT_D32;
if(FAILED(pID3D->CheckDeviceFormat(adapter, devtype, if(FAILED(pID3D->CheckDeviceFormat(adapter, devtype,
...@@ -356,6 +367,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -356,6 +367,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
} }
} }
} }
}
// create device // create device
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment