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
D3D: Use a 32-bit floating point depth buffer. #3495
Conversation
This is some pretty deep stuff. |
@aserna3 1 minute and 10 seconds, that's some quick punning. |
hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &buf); | ||
CHECK(hr==S_OK, "create EFB depth texture (size: %dx%d; hr=%#x)", m_target_width, m_target_height, hr); | ||
m_efb.depth_tex = new D3DTexture2D(buf, (D3D11_BIND_FLAG)(D3D11_BIND_DEPTH_STENCIL|D3D11_BIND_SHADER_RESOURCE), DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN, (sample_desc.Count > 1)); | ||
m_efb.depth_tex = new D3DTexture2D(buf, (D3D11_BIND_FLAG)(D3D11_BIND_DEPTH_STENCIL|D3D11_BIND_SHADER_RESOURCE), DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, DXGI_FORMAT_UNKNOWN, (sample_desc.Count > 1)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -127,10 +127,10 @@ FramebufferManager::FramebufferManager() | |||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.color_staging_buf, "EFB color staging texture (used for Renderer::AccessEFB)"); | |||
|
|||
// EFB depth buffer - primary depth buffer | |||
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R24G8_TYPELESS, m_target_width, m_target_height, m_efb.slices, 1, D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DEFAULT, 0, sample_desc.Count, sample_desc.Quality); | |||
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32G8X24_TYPELESS, m_target_width, m_target_height, m_efb.slices, 1, D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DEFAULT, 0, sample_desc.Count, sample_desc.Quality); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
I guess this raises some overflows in efb access or efb copys, eg the cas to u32 in https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoBackends/D3D/Render.cpp#L438 may underflow easily. Same in https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/TextureConversionShader.cpp#L496 |
@degasus But it's clamped for that reason right? |
on efb access, it's clamped after the u32 cast, and I don't see the clamp in the efb copy code. |
@dolphin-emu-bot rebuild |
FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:
automated-fifoci-reporter |
Sounds fine to me. |
D3D: Use a 32-bit floating point depth buffer.
This was previously reverted because of a regression on the DefJam FIFO in PR #2415, due to recent changes this seems to no longer be the case.
The advantage of using a 32-bit depth buffer is that it fixes round-trip errors as shown by the z poke hw test. Together with the commit that fixes the depth range for Z pokes, D3D has no more roundtrip errors.