diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 11de3ef..193baba 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1790,7 +1790,7 @@ IDirectDrawImpl_CreateNewSurface(IDirect { Usage |= WINED3DUSAGE_OVERLAY; } - if(This->depthstencil) + if(This->depthstencil || (pDDSD->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)) { /* The depth stencil creation callback sets this flag. * Set the WineD3D usage to let it know that it's a depth diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 84a838f..88aaac8 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2740,6 +2740,38 @@ static HRESULT IWineD3DSurfaceImpl_BltOv /* Default: Fall back to the generic blt */ return WINED3DERR_INVALIDCALL; } +static HRESULT WINAPI IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, RECT *DestRect, IWineD3DSurface *SrcSurface, RECT *SrcRect, DWORD Flags, DDBLTFX *DDBltFx) +{ + IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice; + + /* We only support the BLT with DEPTH_FILL for now */ + if (Flags & DDBLT_DEPTHFILL) { + D3DRECT rect; + + if (DestRect) { + rect.x1 = DestRect->left; + rect.y1 = DestRect->top; + rect.x2 = DestRect->right; + rect.y2 = DestRect->bottom; + } + IWineD3DDevice_Clear( (IWineD3DDevice *) myDevice, + (DestRect == NULL ? 0 : 1), + &rect, + D3DCLEAR_ZBUFFER, + 0x00000000, + ((double) DDBltFx->u5.dwFillDepth) / MAXDWORD, + 0x00000000); + + return WINED3D_OK; + } + + if (SrcSurface) { + FIXME("(%p): Other depthstencil blts not supported yet\n", This); + return WINED3D_OK; + } + + return WINED3DERR_INVALIDCALL; +} static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, RECT *DestRect, IWineD3DSurface *SrcSurface, RECT *Src Rect, DWORD Flags, DDBLTFX *DDBltFx) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; @@ -2747,6 +2779,11 @@ static HRESULT WINAPI IWineD3DSurfaceImp TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx); TRACE("(%p): Usage is %s\n", This, debug_d3dusage(This->resource.usage)); + /* Characteristic but rare cases for DepthStencil surfaces */ + if(iface == This->resource.wineD3DDevice->stencilBufferTarget) { + return IWineD3DSurfaceImpl_BltZ(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx); + } + /* Special cases for RenderTargets */ if( (This->resource.usage & WINED3DUSAGE_RENDERTARGET) || ( Src && (Src->resource.usage & WINED3DUSAGE_RENDERTARGET) )) {