Stefan Dösinger : ddraw: Map ZBIAS values to a smaller depth range.

Alexandre Julliard julliard at winehq.org
Tue May 10 13:33:39 CDT 2011


Module: wine
Branch: master
Commit: a1519e62f47f2dfa54ca526ee718fe8a936593f2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a1519e62f47f2dfa54ca526ee718fe8a936593f2

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun May  8 17:23:14 2011 +0200

ddraw: Map ZBIAS values to a smaller depth range.

---

 dlls/ddraw/device.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 001dff3..d31a629 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2249,6 +2249,8 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_End(IDirect3DDevice2 *iface, DWORD d
  *  DDERR_INVALIDPARAMS if Value == NULL
  *
  *****************************************************************************/
+static const float zbias_factor = -0.000005f;
+
 static HRESULT
 IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
                                      D3DRENDERSTATETYPE RenderStateType,
@@ -2383,7 +2385,7 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface,
             hr = IWineD3DDevice_GetRenderState(This->wineD3DDevice,
                                                WINED3DRS_DEPTHBIAS,
                                                &wined3d_value.d);
-            if (SUCCEEDED(hr)) *Value = -wined3d_value.f * 16.0f;
+            if (SUCCEEDED(hr)) *Value = wined3d_value.f / zbias_factor;
             break;
         }
 
@@ -2708,7 +2710,7 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface,
                 DWORD d;
                 float f;
             } wined3d_value;
-            wined3d_value.f = Value / -16.0;
+            wined3d_value.f = Value * zbias_factor;
             hr = IWineD3DDevice_SetRenderState(This->wineD3DDevice,
                                                WINED3DRS_DEPTHBIAS,
                                                wined3d_value.d);




More information about the wine-cvs mailing list