Skip to content

Commit 9a46c08

Browse files
committed
Use smallest epsilon number for DepthBias
1 parent d5cc314 commit 9a46c08

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Dllmain/BuildNo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD_NUMBER 8084
1+
#define BUILD_NUMBER 8085

External/d3d8to9

ddraw/IDirect3DTypes.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,15 @@ DWORD GetDepthBias(DWORD ZBias, DWORD DepthBitCount)
306306
{
307307
case 32:
308308
case 24:
309-
DepthEpsilon = -10.0f / (1 << 16);
309+
// Bit shifting by 24 is too small for float precision. A shift of 20 seems to work best.
310+
DepthEpsilon = -1.0f / ((1 << 20) - 1);
310311
break;
311312
default:
312313
case 16:
313-
DepthEpsilon = -20.0f / (1 << 16);
314+
DepthEpsilon = -1.0f / ((1 << 16) - 1);
314315
break;
315316
case 15:
316-
DepthEpsilon = -25.0f / (1 << 16);
317+
DepthEpsilon = -1.0f / ((1 << 15) - 1);
317318
break;
318319
}
319320
float DepthBias = min(ZBias, 16UL) * DepthEpsilon;

0 commit comments

Comments
 (0)