Skip to content

Commit

Permalink
Fixes #820 depth bug with 7900 XTX GPU
Browse files Browse the repository at this point in the history
Unbindinding INTZ depth stencil texture for the depth buffer fixed it, though accoridng to AMD's / former ATI's own documentation (https://developer.amd.com/wordpress/media/2012/10/Advanced-DX9-Capabilities-for-ATI-Radeon-Cards_v2.pdf) we shouldn't have to do this, since we have depth writes disabled (D3DRS_ZWRITEENABLE = FALSE):

> Note that an INTZ depth buffer may be used as a texture concurrently to the same INTZ
> surface being used for depth buffering, as long as depth writes are disabled.

, but apparently it stoped working on the 7900 XTX GPU, while it works fine with NVIDA GPUs still.

Maybe someone bored can fille a bug report with them, or maybe I misunderstood s.th. I dunno.

Many thanks to @Markxy for his patience when testing!
  • Loading branch information
dtugend committed Jan 13, 2023
1 parent 3745a55 commit 29679d6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions AfxHookSource/d3d9Hooks.cpp
Expand Up @@ -3193,8 +3193,17 @@ struct NewDirect3DDevice9

// Render:

// Unbind INTZ depth stencil, so we can use it as texture:
// not required // g_OldDirect3DDevice9->SetDepthStencilSurface(NULL);
// Unbind INTZ depth stencil texture for the depth buffer, so we can use it as texture:
//
// According to AMD's / former ATI's own documentation (https://developer.amd.com/wordpress/media/2012/10/Advanced-DX9-Capabilities-for-ATI-Radeon-Cards_v2.pdf)
// we shouldn't have to do this: "
// Note that an INTZ depth buffer may be used as a texture concurrently to the same INTZ
// surface being used for depth buffering, as long as depth writes are disabled.
// ", but it stoped working on the 7900 XTX GPU, while it works fine with NVIDA GPUs still.
//
// Maybe someone bored can fille a bug report with them, or maybe I misunederstood s.th. I dunno.
//
g_OldDirect3DDevice9->SetDepthStencilSurface(NULL);

// Bind depth as texture:
g_OldDirect3DDevice9->SetTexture(0, depthTexture);
Expand Down

0 comments on commit 29679d6

Please sign in to comment.