DDraw: Implement depth filling through blit. (re-resubmit) try2
Gregor Münch
greg87 at online.de
Fri Nov 24 10:19:42 CST 2006
Changelog: should apply now cleanly to git
This is modified version of this patch:
http://www.winehq.org/pipermail/wine-patches/2006-September/030815.html
With the help from Stefan Dösinger I altered 2 lines. Full credit
belongs to Elie Morisse
fixes: http://bugs.winehq.org/show_bug.cgi?id=4306
-------------- next part --------------
>From dff411a21dfd4531561ec3f4ecd0969976f55e66 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Gregor_M=FCnch?= <greg87 at online.de>
Date: Fri, 24 Nov 2006 16:57:30 +0100
Subject: [PATCH] modified: dlls/ddraw/ddraw.c
modified: dlls/wined3d/surface.c
---
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 de3c704..09a8df8 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1787,7 +1787,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 42e5d04..7e2ac74 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2738,12 +2738,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) {
+ WINED3DRECT 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 *SrcRect, DWORD Flags, DDBLTFX *DDBltFx) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
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) )) {
--
1.4.3.4
More information about the wine-patches
mailing list