DDraw: Implement depth filling through blit. ( Resubmit )
Elie Morisse
lachienne at wanadoo.fr
Fri Sep 22 10:12:57 CDT 2006
Resubmit of my previous patch. Be aware that it is completing an older Stefan Dosinger patch which hasn't been accepted, but can be applied independently ( it'll be quite useless nevertheless.. )
-------------- next part --------------
>From 7dc1f6357906bea72f65d5b404a2ce8a65ed4305 Mon Sep 17 00:00:00 2001
From: Elie Morisse <lachienne at wanadoo.fr>
Date: Fri, 22 Sep 2006 18:51:16 +0400
Subject: [PATCH] ddraw: Implement depth filling through blit.
---
dlls/ddraw/ddraw.c | 2 +-
dlls/wined3d/surface.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 333fcde..91b8641 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1806,7 +1806,7 @@ IDirectDrawImpl_CreateNewSurface(IDirect
DDSCAPS_VISIBLE |
DDSCAPS_LOCALVIDMEM;
}
- 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 908211e..05173bf 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2770,12 +2770,50 @@ static HRESULT IWineD3DSurfaceImpl_BltOv
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) / 4294967295.0,
+ 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 *SrcRect, DWORD Flags, DDBLTFX *DDBltFx) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
TRACE("(%p)->(%p,%p,%p,%lx,%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) )) {
--
1.4.2.1
More information about the wine-patches
mailing list