From 56db6e3de0a74783587a59e99e69c1b4422cb110 Mon Sep 17 00:00:00 2001 From: chrisf Date: Mon, 1 Oct 2007 22:04:25 +0000 Subject: [PATCH] git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1720 993157c7-ee19-0410-b2c4-bb4e9862e678 --- BluntDx/GraphicsDevice.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BluntDx/GraphicsDevice.h b/BluntDx/GraphicsDevice.h index 488debfc82..153de77294 100644 --- a/BluntDx/GraphicsDevice.h +++ b/BluntDx/GraphicsDevice.h @@ -108,7 +108,7 @@ namespace BluntDirectX { namespace Direct3D return gcnew GraphicsDevice( dev, true ); } - static GraphicsDevice^ Create(Control^ host, int width, int height, bool windowed, bool vsync) + static GraphicsDevice^ Create(Control^ host, int width, int height, bool windowed, bool vsync, Surfaces surfs) { IDirect3D9* d3d = Direct3DCreate9( D3D_SDK_VERSION ); D3DPRESENT_PARAMETERS pp; @@ -119,7 +119,11 @@ namespace BluntDirectX { namespace Direct3D pp.BackBufferHeight = height; pp.BackBufferFormat = D3DFMT_X8R8G8B8; - pp.EnableAutoDepthStencil = false; + bool needZ = 0 != (int)(surfs & Surfaces::Depth); + + pp.EnableAutoDepthStencil = needZ; + if (needZ) + pp.AutoDepthStencilFormat = D3DFMT_D24X8; pp.SwapEffect = D3DSWAPEFFECT_DISCARD; pp.Windowed = windowed; @@ -151,6 +155,11 @@ namespace BluntDirectX { namespace Direct3D throw gcnew ApplicationException("D3D not available."); } + static GraphicsDevice^ Create(Control^ host, int width, int height, bool windowed, bool vsync) + { + return Create(host, width, height, windowed, vsync, Surfaces::Color); + } + void EnableScissor( int left, int top, int width, int height ) { RECT r = { left, top, left + width, top + height };