Skip to content

Commit

Permalink
Allow passing any non-zero value to enable alpha test or fog
Browse files Browse the repository at this point in the history
9on12 previously expected apps to pass an explicit TRUE (1) value for
enabling alphaTest or fog. This is technically to spec, but some apps
such as S.T.A.L.K.E.R. Shadow of Chernobyl would pass 0xFF instead with
the intent to enable.

Went ahead and applied this change to FogEnable too for consistency
since I wouldn't be surprised to hit that in the future.

Fixes #86
  • Loading branch information
vdwtanner committed Apr 3, 2024
1 parent 64e80b0 commit 2f7bbaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/9on12PixelStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ namespace D3D9on12
switch (dwState)
{
case D3DRS_ALPHATESTENABLE:
m_rasterStates.SetAlphaTestEnable(dwValue == TRUE);
m_rasterStates.SetAlphaTestEnable(dwValue != FALSE);
break;
case D3DRS_ALPHAFUNC:
m_rasterStates.SetAlphaFunc(static_cast<D3DCMPFUNC>(dwValue));
Expand All @@ -587,7 +587,7 @@ namespace D3D9on12
m_dirtyFlags.PSExtension = true;
break;
case D3DRS_FOGENABLE:
m_rasterStates.SetFogEnable(dwValue == TRUE);
m_rasterStates.SetFogEnable(dwValue != FALSE);
break;
case D3DRS_FOGCOLOR:
ConvertToRGB(dwValue, m_PSExtension.vFogColor);
Expand Down

0 comments on commit 2f7bbaa

Please sign in to comment.