Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend D3D11 Depth Test Overlay #100

Conversation

Zorro666
Copy link
Owner

@Zorro666 Zorro666 commented Nov 6, 2023

Description

D3D11 Replay support for Issue #2858

This is a PR in a sequence of PRs which all together complete the implementation of the feature.
Future PRs will cover replay support for D3D12, Vulkan and extending the automated overlay tests GL_Overlay_Test, D3D11_Overlay_Test, D3D12_Overlay_Test, VK_Overlay_Test.

The feature enables supporting shader exported depth for the Depth Test overlay by replaying the draw using the pixel shader from the capture instead of a replacement shader. Depth test passing pixels are identified by using the stencil buffer to generate a stencil mask.

If the depth buffer used for the draw does not have a stencil buffer then a new depth buffer is created with a depth+stencil format and a fullscreen pass is used to copy depth from the original depth buffer to the newly created depth+stencil buffer.

Changes to existing implementation

  • Don't write depth or stencil during the reply of failing pixels
  • No need to restore depth-stencil after replay of failing pixels

Tested on Windows using changes to D3D11_Overlay_Test

The change makes the pixel shader write out depth 0.0 for a small rectangle just bottom-left of the centre

Before (using v1.29) : the rectangle of output depth 0.0 is shown as failing the depth test

Depth Buffer format D24_S8
image
Depth Buffer format D32_S8
image
Depth Buffer format D16 MSAA
image
Depth Buffer format D32 MSAA
image

After : the rectangle of output depth 0.0 is shown as passing the depth test

Depth Buffer format D24_S8
image
Depth Buffer format D32_S8
image
Depth Buffer format D16 MSAA
image
Depth Buffer format D32 MSAA
image

@Zorro666 Zorro666 force-pushed the support-shader-exported-depth-in-depth-test-overlay-d3d11 branch from ffa61c3 to f6e534f Compare November 6, 2023 15:58
Support shader exported depth by replaying using the capture pixel shader to determine passing pixels

Don't write depth or stencil during the reply of failing pixels
No need to restore depth-stencil after replay of failing pixels
@Zorro666 Zorro666 force-pushed the support-shader-exported-depth-in-depth-test-overlay-d3d11 branch from f6e534f to b8a0443 Compare November 7, 2023 17:17
@Zorro666
Copy link
Owner Author

Zorro666 commented Nov 7, 2023

baldurk#3118

@Zorro666 Zorro666 closed this Nov 7, 2023
@Zorro666 Zorro666 deleted the support-shader-exported-depth-in-depth-test-overlay-d3d11 branch November 9, 2023 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant