Commit 7f1250e5 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Handle creation of a depth/stencil buffer when creating a device.

Implement IDirect3D8DeviceImpl_GetDepthStencilBuffer.
parent 7d77d77d
......@@ -239,6 +239,7 @@ struct IDirect3DDevice8Impl
/* IDirect3DDevice8 fields */
IDirect3D8Impl *direct3d8;
IDirect3DSurface8Impl *backBuffer;
IDirect3DSurface8Impl *depthStencilBuffer;
D3DPRESENT_PARAMETERS PresentParms;
D3DDEVICE_CREATION_PARAMETERS CreateParms;
......
......@@ -828,12 +828,22 @@ SHORT bytesPerPixel(D3DFORMAT fmt) {
SHORT retVal;
switch (fmt) {
/* color buffer */
case D3DFMT_A4R4G4B4: retVal = 2; break;
case D3DFMT_A8R8G8B8: retVal = 4; break;
case D3DFMT_X8R8G8B8: retVal = 4; break;
case D3DFMT_R8G8B8: retVal = 3; break;
case D3DFMT_R5G6B5: retVal = 2; break;
case D3DFMT_A1R5G5B5: retVal = 2; break;
/* depth/stencil buffer */
case D3DFMT_D16_LOCKABLE: retVal = 2; break;
case D3DFMT_D32: retVal = 4; break;
case D3DFMT_D15S1: retVal = 2; break;
case D3DFMT_D24S8: retVal = 4; break;
case D3DFMT_D16: retVal = 2; break;
case D3DFMT_D24X8: retVal = 4; break;
case D3DFMT_D24X4S4: retVal = 4; break;
/* unknown */
case D3DFMT_UNKNOWN:
/* Guess at the highest value of the above */
TRACE("D3DFMT_UNKNOWN - Guessing at 4 bytes/pixel %d\n", fmt);
......@@ -1587,10 +1597,12 @@ HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE8 i
ICOM_THIS(IDirect3DDevice8Impl,iface);
/* Note inc ref on returned surface *
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppBackBuffer); */
TRACE("(%p)->(%p)\n", This, ppZStencilSurface);
/* Note inc ref on returned surface */
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->depthStencilBuffer);
*ppZStencilSurface = (LPDIRECT3DSURFACE8)This->depthStencilBuffer;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......
......@@ -530,6 +530,13 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
pPresentationParameters->BackBufferFormat,
(LPDIRECT3DSURFACE8*) &object->backBuffer);
if (pPresentationParameters->EnableAutoDepthStencil)
IDirect3DDevice8Impl_CreateImageSurface((LPDIRECT3DDEVICE8) object,
pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight,
pPresentationParameters->AutoDepthStencilFormat,
(LPDIRECT3DSURFACE8*) &object->depthStencilBuffer);
/* Now override the surface's Flip method (if in double buffering) ?COPIED from DDRAW!?
((x11_ds_private *) surface->private)->opengl_flip = TRUE;
{
......
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